Refactor Docker files: docker-compose.yml, environment variables, add interpolation vars for Dawarich version and other values commonly modified by Dawarich instance admins.

This commit is contained in:
Jivan Pal 2025-07-08 16:52:07 +01:00
parent b25647879f
commit 405a455d6d
3 changed files with 33 additions and 36 deletions

View file

@ -1,6 +1,8 @@
DATABASE_HOST=localhost DAWARICH_VERSION=latest
DATABASE_USERNAME=postgres
DATABASE_PASSWORD=password DAWARICH_DATABASE_USER=postgres
DATABASE_NAME=dawarich_development DAWARICH_DATABASE_PASSWORD=password
DATABASE_PORT=5432 DAWARICH_DATABASE_NAME=dawarich_development
REDIS_URL=redis://localhost:6379
DAWARICH_HOSTS=your-domain.example.com,localhost
DAWARICH_PROTOCOL=http

View file

@ -0,0 +1,17 @@
RAILS_ENV=development
REDIS_URL=redis://dawarich_redis:6379
DATABASE_HOST=dawarich_db
DATABASE_USERNAME=${DAWARICH_DATABASE_USER}
DATABASE_PASSWORD=${DAWARICH_DATABASE_PASSWORD}
DATABASE_NAME=${DAWARICH_DATABASE_SCHEMA}
APPLICATION_HOSTS=${DAWARICH_HOSTS}
APPLICATION_PROTOCOL=${DAWARICH_PROTOCOL}
PROMETHEUS_EXPORTER_ENABLED=false
PROMETHEUS_EXPORTER_PORT=9394
SELF_HOSTED=true
STORE_GEODATA=true

View file

@ -27,19 +27,19 @@ services:
networks: networks:
- dawarich - dawarich
environment: environment:
POSTGRES_USER: postgres POSTGRES_USER: ${DAWARICH_DATABASE_USER}
POSTGRES_PASSWORD: password POSTGRES_PASSWORD: ${DAWARICH_DATABASE_PASSWORD}
POSTGRES_DB: dawarich_development POSTGRES_DB: ${DAWARICH_DATABASE_NAME}
restart: always restart: always
healthcheck: healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres -d dawarich_development" ] test: [ "CMD-SHELL", "pg_isready -U ${DAWARICH_DATABASE_USER} -d ${DAWARICH_DATABASE_NAME}" ]
interval: 10s interval: 10s
retries: 5 retries: 5
start_period: 30s start_period: 30s
timeout: 10s timeout: 10s
# command: postgres -c config_file=/etc/postgresql/postgresql.conf # Use custom config, uncomment if you want to use a custom config # command: postgres -c config_file=/etc/postgresql/postgresql.conf # Use custom config, uncomment if you want to use a custom config
dawarich_app: dawarich_app:
image: freikin/dawarich:latest image: freikin/dawarich:${DAWARICH_VERSION}
container_name: dawarich_app container_name: dawarich_app
volumes: volumes:
- dawarich_public:/var/app/public - dawarich_public:/var/app/public
@ -56,22 +56,11 @@ services:
entrypoint: web-entrypoint.sh entrypoint: web-entrypoint.sh
command: ['bin/rails', 'server', '-p', '3000', '-b', '::'] command: ['bin/rails', 'server', '-p', '3000', '-b', '::']
restart: on-failure restart: on-failure
env_file: '.env.dawarich-common'
environment: environment:
RAILS_ENV: development
REDIS_URL: redis://dawarich_redis:6379
DATABASE_HOST: dawarich_db
DATABASE_USERNAME: postgres
DATABASE_PASSWORD: password
DATABASE_NAME: dawarich_development
MIN_MINUTES_SPENT_IN_CITY: 60 MIN_MINUTES_SPENT_IN_CITY: 60
APPLICATION_HOSTS: localhost
TIME_ZONE: Europe/London TIME_ZONE: Europe/London
APPLICATION_PROTOCOL: http
PROMETHEUS_EXPORTER_ENABLED: "false"
PROMETHEUS_EXPORTER_HOST: 0.0.0.0 PROMETHEUS_EXPORTER_HOST: 0.0.0.0
PROMETHEUS_EXPORTER_PORT: 9394
SELF_HOSTED: "true"
STORE_GEODATA: "true"
logging: logging:
driver: "json-file" driver: "json-file"
options: options:
@ -96,7 +85,7 @@ services:
cpus: '0.50' # Limit CPU usage to 50% of one core cpus: '0.50' # Limit CPU usage to 50% of one core
memory: '4G' # Limit memory usage to 4GB memory: '4G' # Limit memory usage to 4GB
dawarich_sidekiq: dawarich_sidekiq:
image: freikin/dawarich:latest image: freikin/dawarich:${DAWARICH_VERSION}
container_name: dawarich_sidekiq container_name: dawarich_sidekiq
volumes: volumes:
- dawarich_public:/var/app/public - dawarich_public:/var/app/public
@ -109,21 +98,10 @@ services:
entrypoint: sidekiq-entrypoint.sh entrypoint: sidekiq-entrypoint.sh
command: ['sidekiq'] command: ['sidekiq']
restart: on-failure restart: on-failure
env_file: '.env.dawarich-common'
environment: environment:
RAILS_ENV: development
REDIS_URL: redis://dawarich_redis:6379
DATABASE_HOST: dawarich_db
DATABASE_USERNAME: postgres
DATABASE_PASSWORD: password
DATABASE_NAME: dawarich_development
APPLICATION_HOSTS: localhost
BACKGROUND_PROCESSING_CONCURRENCY: 10 BACKGROUND_PROCESSING_CONCURRENCY: 10
APPLICATION_PROTOCOL: http
PROMETHEUS_EXPORTER_ENABLED: "false"
PROMETHEUS_EXPORTER_HOST: dawarich_app PROMETHEUS_EXPORTER_HOST: dawarich_app
PROMETHEUS_EXPORTER_PORT: 9394
SELF_HOSTED: "true"
STORE_GEODATA: "true"
logging: logging:
driver: "json-file" driver: "json-file"
options: options: