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
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.ymlversion: '3'services:app:build:context: .env_file: .envports:- '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:
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 upStarting geopoiesis_app_1 ... doneAttaching to geopoiesis_app_1app_1 | time="2018-06-17T09:22:55Z" level=info msg="Worker starting" worker=5b7726bdc4ed-01CG6GVX1SHSHP32ZXWH2Z53GAapp_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.