name: mtusi-lab2 services: postgres: image: postgres:17.4-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: 3s retries: 30 restart: unless-stopped api: build: . environment: APP_HOST: 0.0.0.0 APP_PORT: '8080' APP_ENV: lab DATABASE_URL_FILE: /run/secrets/database_url SESSION_STORE: postgres SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600} DB_POOL_SIZE: ${DB_POOL_SIZE:-8} secrets: [database_url] ports: - '127.0.0.1:${API_PORT:-8080}:8080' depends_on: postgres: condition: service_healthy healthcheck: test: [CMD, python, -c, "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/ready', timeout=4)"] interval: 2s timeout: 5s retries: 30 init: true stop_grace_period: 15s restart: unless-stopped volumes: postgres_data: secrets: postgres_password: file: ./secrets/postgres_password database_url: file: ./secrets/database_url