diff --git a/README.md b/README.md index 07426aa..9ff85de 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,11 @@ bring your own Postgres server. You also have to provide a config file. docker run -v /path/to/config.toml:/config.toml -p 8080:8080 thcyron/tracklog +Alternately, use docker-compose to run: + + docker-compose up -d + docker exec -it tracklog /bin/tracklog-control -config /config.toml user add + ## Installation First, make sure you have Go and Node.js installed. diff --git a/config.toml.example b/config.toml.example index 9b59ce1..e35bb8f 100644 --- a/config.toml.example +++ b/config.toml.example @@ -7,4 +7,4 @@ mapbox_access_token = "" [db] driver = "postgres" -dsn = "dbname=tracklog sslmode=disable" +dsn = "postgres://postgres:password@postgres/tracklog?sslmode=disable" diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d89b625 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,26 @@ +version: '3' + +services: + tracklog: + build: . + image: thcyron/tracklog:latest + container_name: tracklog + entrypoint: /bin/tracklog-server -config /config.toml + restart: always + depends_on: + - postgres + ports: + - 8080:8080 + volumes: + - ./config.toml.example:/config.toml + + postgres: + image: postgres:12-alpine + container_name: postgres + restart: always + environment: + - POSTGRES_DB=tracklog + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=password + volumes: + - ./pkg/db/postgres.sql:/docker-entrypoint-initdb.d/init.sql