Running the app

In this article we are going to build on the previous section and get Geopoiesis working on your machine using Docker. Please create a folder called geopoiesis on your disk, and add to it the licence.json file, config.hcl file and a Dockerfile. On top of that, we suggest that you use Docker Compose to make managing your entire setup locally easier. In order to do that, you will need a docker-compose.yml file, just like the one below.

docker-compose.yml
version: '3'
services:
app:
build:
context: .
env_file: .env
ports:
- '1983:1983'
volumes:
- ./config.hcl:/config.hcl

Note that in the above example we mount config.hcl as a volume inside the Docker container. Technically it's not necessary, because our Dockerfile already copies that file to the image. However, during the testing phase we don't want to rebuild the image every time configuration changes.

Throughout the app setup phase, we accumulated a whole bunch of environment variables. There are many ways to pass them it to the running binary, but in the example above we use an env_file called .env. Here is a file that will work with our minimal installation - make sure you supply your own values:

.env
AWS_ACCESS_KEY_ID=
AWS_REGION=
AWS_SECRET_ACCESS_KEY=
AWS_KMS_KEY_ID=
AWS_S3_BUCKET=
GITHUB_ACCESS_TOKEN=
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_WEBHOOK_SECRET=

If you're checking in the above work, please make sure to add the above .env file to your .gitignore. Otherwise your will leak sensitive credentials.

Once you have everything ready, running docker-compose build and docker-compose up should make your app start on port 1983 of your local machine:

$ docker-compose build
...
$ docker-compose up
Starting geopoiesis_app_1 ... done
Attaching to geopoiesis_app_1
app_1 | time="2018-06-17T09:22:55Z" level=info msg="Worker starting" worker=5b7726bdc4ed-01CG6GVX1SHSHP32ZXWH2Z53GA
app_1 | time="2018-06-17T09:22:55Z" level=info msg="Garbage collector starting"
app_1 | time="2018-06-17T09:22:55Z" level=info msg="Reporter starting"
app_1 | time="2018-06-17T09:22:55Z" level=info msg="Server starting on :1983"

By navigating to localhost:1983, you should see the following screen:

It may not be terribly impressive, but it means you have Geopoiesis running on your local machine and are ready to start playing with it.