-
Notifications
You must be signed in to change notification settings - Fork 2
HOWTO Run the server using Docker
The recommended way for now is to use Docker. You need to install Docker on your machine, then run the TreeMap app on a specific port like 8002, then configure a CDN, like Cloudflare (which has a free plan) to proxy requests to that server and port.
The image includes a statically compiled frontend, the backend binary, supervisor to run the backend and cron, and a crontab to pull updates from OSM upon every hour. The build file is here.
To start the server, use a script like this:
#!/bin/sh
mkdir -p var
docker run --detach -p 8002:8000 --volume $PWD/var:/app/var --restart unless-stopped --name treemap ghcr.io/umonkey/treemap:latest
To update the image (software version) and restart the server, use a script like this:
#!/bin/sh
IMAGE="ghcr.io/umonkey/treemap:latest"
mkdir -p var
docker pull $IMAGE
docker stop treemap
docker rm treemap
docker run --detach -p 8002:8000 --volume $PWD/var:/app/var --restart unless-stopped --name treemap $IMAGE
This will make the app available at localhost:8002, with the SQLite database stored in ./var
. The application can be configured using environment variables, see the configuration page for details.
Note that the app is not yet ready for production, as it lacks user authentication and a lot more.
The server is configured using environment variables. With Docker, those variables can be passed using the -e
command line switch, for example:
docker run --detach -p 8002:8000 -e AWS_ACCESS_KEY_ID=secret ...
However, with multiple config options, the command line becomes very long, hard to maintain and reproduce. It is more convenient to put all variables in a text file and use the --env-file
switch. The file looks like this:
AWS_ACCESS_KEY_ID=foo
AWS_SECRET_ACCESS_KEY=bar
The command line looks like this:
docker run --detach -p 8002:8000 --env-file env.txt ...