name: mtusi2026lab2 services: postgres: image: postgres:17.6-bookworm environment: POSTGRES_DB: messenger POSTGRES_USER: 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: 2s retries: 20 api: build: . environment: APP_HOST: 0.0.0.0 APP_PORT: 8080 DATABASE_URL_FILE: /run/secrets/database_url VALKEY_URL: redis://valkey:6379/0 SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600} secrets: - database_url depends_on: postgres: condition: service_healthy ports: - "127.0.0.1:${APP_PORT:-8080}:8080" healthcheck: test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/ready', timeout=2).close()"] interval: 2s timeout: 3s retries: 20 start_period: 5s valkey: image: valkey/valkey:8.0.2-alpine healthcheck: test: ["CMD", "valkey-cli", "ping"] interval: 2s timeout: 2s retries: 20 secrets: postgres_password: file: ./secrets/postgres_password database_url: file: ./secrets/database_url volumes: postgres_data: