fix: complete Dawarich architecture with Redis and Sidekiq services

- Add Redis service for caching and background job processing
- Add Sidekiq worker service for background tasks
- Update to tagged version 0.28.1 for stability
- Fix Redis URL format to resolve parsing errors
- Remove incorrect volume mounts and SQLite paths
- Add proper service dependencies and health checks
- Use vault variable for SECRET_KEY_BASE security

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-06-19 16:04:46 -06:00
parent ef5309363c
commit 5f76f69d8b

View File

@ -1,4 +1,19 @@
services:
dawarich_redis:
image: redis:7.4-alpine
container_name: dawarich_redis
labels:
glance.parent: dawarich
glance.name: Redis
volumes:
- dawarich_redis_data:/data
restart: always
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
retries: 5
start_period: 30s
timeout: 10s
dawarich_db:
image: postgis/postgis:17-3.5-alpine
shm_size: 1G
@ -19,8 +34,9 @@ services:
retries: 5
start_period: 30s
timeout: 10s
dawarich_app:
image: freikin/dawarich:latest
image: freikin/dawarich:0.28.1
container_name: dawarich_app
labels:
glance.name: Dawarich
@ -32,7 +48,6 @@ services:
- dawarich_public:/var/app/public
- dawarich_watched:/var/app/tmp/imports/watched
- dawarich_storage:/var/app/storage
- dawarich_db_data:/dawarich_db_data
stdin_open: true
tty: true
entrypoint: web-entrypoint.sh
@ -40,13 +55,12 @@ services:
restart: on-failure
environment:
RAILS_ENV: production
QUEUE_DATABASE_PATH: /dawarich_db_data/dawarich_production_queue.sqlite3
CACHE_DATABASE_PATH: /dawarich_db_data/dawarich_production_cache.sqlite3
DATABASE_HOST: dawarich_db
DATABASE_PORT: 5432
DATABASE_USERNAME: postgres
DATABASE_PASSWORD: {{ vault_dawarich.postgres_password }}
DATABASE_NAME: dawarich_production
REDIS_URL: redis://dawarich_redis:6379
MIN_MINUTES_SPENT_IN_CITY: 60
APPLICATION_HOSTS: {{ subdomains.loclog }},localhost,::1,127.0.0.1
TIME_ZONE: America/Denver
@ -55,7 +69,7 @@ services:
PROMETHEUS_EXPORTER_ENABLED: false
PROMETHEUS_EXPORTER_HOST: 0.0.0.0
PROMETHEUS_EXPORTER_PORT: 9394
SECRET_KEY_BASE: 1234567890
SECRET_KEY_BASE: {{ vault_dawarich.secret_key_base }}
RAILS_LOG_TO_STDOUT: "true"
logging:
driver: "json-file"
@ -72,13 +86,69 @@ services:
dawarich_db:
condition: service_healthy
restart: true
dawarich_redis:
condition: service_healthy
restart: true
deploy:
resources:
limits:
cpus: '0.50' # Limit CPU usage to 50% of one core
memory: '2G' # Limit memory usage to 2GB
cpus: '0.50'
memory: '2G'
dawarich_sidekiq:
image: freikin/dawarich:0.28.1
container_name: dawarich_sidekiq
labels:
glance.parent: dawarich
glance.name: Sidekiq
volumes:
- dawarich_public:/var/app/public
- dawarich_watched:/var/app/tmp/imports/watched
- dawarich_storage:/var/app/storage
stdin_open: true
tty: true
entrypoint: sidekiq-entrypoint.sh
command: ['sidekiq']
restart: on-failure
environment:
RAILS_ENV: production
DATABASE_HOST: dawarich_db
DATABASE_PORT: 5432
DATABASE_USERNAME: postgres
DATABASE_PASSWORD: {{ vault_dawarich.postgres_password }}
DATABASE_NAME: dawarich_production
REDIS_URL: redis://dawarich_redis:6379
MIN_MINUTES_SPENT_IN_CITY: 60
APPLICATION_HOSTS: {{ subdomains.loclog }},localhost,::1,127.0.0.1
TIME_ZONE: America/Denver
APPLICATION_PROTOCOL: http
DISTANCE_UNIT: mi
PROMETHEUS_EXPORTER_ENABLED: false
SECRET_KEY_BASE: {{ vault_dawarich.secret_key_base }}
RAILS_LOG_TO_STDOUT: "true"
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "5"
healthcheck:
test: ["CMD-SHELL", "ps aux | grep '[s]idekiq' || exit 1"]
interval: 10s
retries: 30
start_period: 30s
timeout: 10s
depends_on:
dawarich_app:
condition: service_healthy
restart: true
dawarich_db:
condition: service_healthy
restart: true
dawarich_redis:
condition: service_healthy
restart: true
volumes:
dawarich_db_data:
dawarich_redis_data:
dawarich_public:
dawarich_watched:
dawarich_storage: