services: db: image: postgres:17.6-bookworm environment: POSTGRES_DB: messenger POSTGRES_USER: messenger POSTGRES_PASSWORD_FILE: /run/secrets/db_password secrets: - db_password volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: [CMD-SHELL, 'pg_isready -U messenger -d messenger'] interval: 2s timeout: 3s retries: 30 cache: image: redis:7.4.6-bookworm command: [redis-server, --save, "", --appendonly, "no", --maxmemory, 64mb, --maxmemory-policy, allkeys-lru] healthcheck: test: [CMD, redis-cli, ping] interval: 2s timeout: 3s retries: 30 api: build: . environment: CACHE_URL: redis://cache:6379/0 DATABASE_URL_FILE: /run/secrets/database_url SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600} secrets: - database_url ports: - '127.0.0.1:8080:8080' depends_on: db: condition: service_healthy healthcheck: test: [CMD, python, -c, 'import urllib.request; urllib.request.urlopen("http://127.0.0.1:8080/health/ready", timeout=3)'] interval: 2s timeout: 4s retries: 30 secrets: db_password: file: ./secrets/db_password database_url: file: ./secrets/database_url volumes: postgres_data: