Files
shields/doc/self-hosting.md
Paul Melnikow 16045fdff8 Update documentation (#1129)
I wrote a new readme and contributing guidelines, and took a rough pass through the rest of the documentation.
2017-10-14 11:43:52 -04:00

2.1 KiB

Hosting your own Shields server

Installation

You will need version 6 of Node.js, which you can install using a package manager.

On Ubuntu / Debian:

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -; sudo apt-get install -y nodejs
git clone https://github.com/badges/shields.git
cd shields
npm install  # You may need sudo for this.

Build the index

Build the "real" index page:

make website

Start the server

sudo node server

The server uses port 80 by default, which requires sudo permissions.

There are two ways to provide an alternate port:

PORT=8080 node server
node server 8080

The root gets redirected to https://shields.io.

For testing purposes, you can go to http://localhost/try.html.

Heroku

Once you have installed the Heroku Toolbelt:

heroku login
heroku create your-app-name
heroku config:set BUILDPACK_URL=https://github.com/mojodna/heroku-buildpack-multi.git#build-env
cp /path/to/Verdana.ttf .
make deploy
heroku open

Docker

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
Successfully built 4471b442c220

Optionally, create a file called shields.env that contains the needed configuration. See shields.example.env for an example.

Then run the container:

$ docker run --rm -p 8080:80 --env-file shields.env --name shields shields

> gh-badges@1.1.2 start /usr/src/app
> node server.js

http://[::1]:80/try.html

Assuming Docker is running locally, you should be able to get to the application at http://localhost:8080/try.html.

If you run Docker in a virtual machine (such as boot2docker or Docker Machine) then you will need to replace localhost with the IP address of that virtual machine.