Hosting your own Shields server
-Installation
+This document describes how to host your own shields server either from source or using a docker image. See the docs on releases for info on how we version the server and how to choose a release.
+Installing from Source
You will need Node 12 or later, which you can install using a package manager.
On Ubuntu / Debian:
@@ -37,12 +38,13 @@git clone https://github.com/badges/shields.git
cd shields
+git checkout $(git tag | grep server | tail -n 1) # checkout the latest tag
npm ci # You may need sudo for this.
-Build the frontend
+Build the frontend
npm run build
-Start the server
+Start the server
sudo node server
The server uses port 80 by default, which requires sudo permissions.
The root gets redirected to https://shields.io.
For testing purposes, you can go to http://localhost/.
Heroku
+Deploying to Heroku
Once you have installed the Heroku CLI
heroku login
heroku create your-app-name
git push heroku master
heroku open
+Deploying to Zeit Vercel
+To deploy using Zeit Vercel:
+npm run build # Not sure why, but this needs to be run before deploying.
+vercel
+
Docker
-You can build and run the server locally using Docker. First build an image:
+DockerHub
+We publish images to DockerHub at https://registry.hub.docker.com/r/shieldsio/shields
+The next tag is the latest build from master, or tagged releases are available
+https://registry.hub.docker.com/r/shieldsio/shields/tags
$ docker pull shieldsio/shields:next
+$ docker run shieldsio/shields:next
+
+Building Docker Image Locally
+Alternatively, you can build and run the server locally using Docker. First build an image:
$ docker build -t shields .
Sending build context to Docker daemon 3.923 MB
…
@@ -99,11 +114,6 @@ for the legacy raster URLs instead of 404's.
If anyone has set this up, more documentation on how to do this would be
welcome! It would also be nice to ship a Docker image that includes a
preconfigured raster server.
-Zeit Now
-To deploy using Zeit Now:
-npm run build # Not sure why, but this needs to be run before deploying.
-now
-
Persistence
To enable Redis-backed GitHub token persistence, point REDIS_URL to your
Redis installation.
@@ -148,14 +158,14 @@ Set the REDIRECT_URI environment variable:
sudo node server
-Prometheus
+Prometheus
Shields uses prom-client to provide default metrics. These metrics are disabled by default.
You can enable them by METRICS_PROMETHEUS_ENABLED and METRICS_PROMETHEUS_ENDPOINT_ENABLED environment variables.
METRICS_PROMETHEUS_ENABLED=true METRICS_PROMETHEUS_ENDPOINT_ENABLED=true npm start
Metrics are available at /metrics resource.
Cloudflare
-Shields uses Cloudflare as a downstream CDN. If your installation does the same, +
Cloudflare
+Shields.io uses Cloudflare as a downstream CDN. If your installation does the same,
you can configure your server to only accept requests coming from Cloudflare's IPs.
Set public.requireCloudflare: true.