name: mtusi-lab2 services: api: build: . ports: ["127.0.0.1:${APP_PORT:-8080}:8080"] environment: APP_HOST: 0.0.0.0 APP_PORT: 8080 APP_ENV: lab SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600} DATABASE_URL_FILE: /run/secrets/database_url CACHE_URL_FILE: /run/secrets/cache_url CURSOR_KEY_FILE: /run/secrets/cursor_key secrets: [database_url, cache_url, cursor_key] depends_on: postgres: {condition: service_healthy} redis: {condition: service_healthy} restart: unless-stopped postgres: image: postgres:17.6-bookworm environment: POSTGRES_USER: messenger POSTGRES_DB: messenger POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password secrets: [postgres_password] volumes: ["postgres-data:/var/lib/postgresql/data"] healthcheck: test: [CMD-SHELL, "pg_isready -U messenger -d messenger"] interval: 2s timeout: 3s retries: 30 redis: image: redis:7.4.5-bookworm command: [redis-server, --appendonly, "yes", --appendfsync, everysec, --maxmemory, 64mb, --maxmemory-policy, allkeys-lru] volumes: ["redis-data:/data"] healthcheck: test: [CMD, redis-cli, ping] interval: 2s timeout: 3s retries: 30 volumes: postgres-data: redis-data: secrets: postgres_password: {file: ./secrets/postgres_password} database_url: {file: ./secrets/database_url} cache_url: {file: ./secrets/cache_url} cursor_key: {file: ./secrets/cursor_key}