Setting up bors with docker-compose

This tutorial assumes you’ve used Docker and Docker-Compose before. If you haven’t, you should probably use Heroku instead, like the README says.

The example docker-compose file

I called this file docker-compose.yml, and put it in a directory called bors. The name of the directory matters, since docker-compose uses it as the “project name”, but if you want to call it something else, you can.

version: "2"
services:
  web:
    image: borsng/bors-ng
    restart: always
    ports:
      - "80:8000"
    environment:
      # You shouldn't have to change these
      PORT: 8000
      DATABASE_USE_SSL: "false"
      DATABASE_AUTO_MIGRATE: "true"
      ALLOW_PRIVATE_REPOS: "true"
      # Replace this with the hostname of your bors instance
      # For example, the public instance is app.bors.tech
      # and cockroachdb runs bors.crdb.io
      PUBLIC_HOST: ec2-35-165-77-94.us-west-2.compute.amazonaws.com
      # Replace this with a random number
      # If you have a bors source checkout, you can run `mix phx.gen.secret` to get one
      SECRET_KEY_BASE: [censored]
      # Get these from the GitHub App setup screen under "OAuth credentials"
      GITHUB_CLIENT_ID:  Iv1.8777d55dcb1196be
      GITHUB_CLIENT_SECRET: [censored]
      # Get this from the GitHub App setup screen under "About"
      GITHUB_INTEGRATION_ID: 15974
      # Get this by taking the private key and base64-encoding it
      # For example, `openssl base64 -A -e < bors-merge-queue.2018-08-10.private-key.pem`
      # the result will be long, and will end in one or two equal signs
      GITHUB_INTEGRATION_PEM: [censored]
      # Replace this with a random number
      # You will also provide this same number to GitHub when you set up the app
      GITHUB_WEBHOOK_SECRET: [censored]
      # Make sure the [censored] password here matches the POSTGRES_PASSWORD
      DATABASE_URL: postgres://postgres:[censored]@postgres:5432/bors
  postgres:
    image: postgres:10.5
    restart: always
    volumes:
      - datadb:/var/lib/postgresql/data
    environment:
      # Make sure the [censored] password here matches the one in the DATABASE_URL
      POSTGRES_PASSWORD: [censored]
volumes:
  datadb:
networks:
  default:
    driver: bridge

The environment variables should be replaced with stuff specific to your setup.

How to administer it

You can start everything with this command (it should restart all the containers when your computer reboots automatically, as long as you start them the first time):

docker-compose up -d

You can get logs from bors with this command:

docker-compose logs web

You can get an Elixir shell with this command:

docker-compose exec web /app/bors/bin/bors remote_console

You can update to a newer bors instance with these commands:

docker pull borsng/bors-ng && docker-compose up --force-recreate -d
1 Like