services: postgres: image: postgres:16.4-alpine environment: POSTGRES_DB: ${POSTGRES_DB:-messenger} POSTGRES_USER: ${POSTGRES_USER:-messenger} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-local-only-password} volumes: ["postgres_data:/var/lib/postgresql/data"] healthcheck: {test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-messenger} -d ${POSTGRES_DB:-messenger}"], interval: 3s, timeout: 3s, retries: 20} redis: image: redis:7.4.2-alpine command: ["redis-server", "--appendonly", "yes", "--appendfsync", "everysec"] volumes: ["redis_data:/data"] healthcheck: {test: ["CMD", "redis-cli", "ping"], interval: 3s, timeout: 3s, retries: 20} api: build: . image: mtusi-messenger-lab2:2.0 environment: DATABASE_URL: postgresql://${POSTGRES_USER:-messenger}:${POSTGRES_PASSWORD:-local-only-password}@postgres:5432/${POSTGRES_DB:-messenger} REDIS_URL: redis://redis:6379/0 SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600} INSTANCE_ID: api-1 ENABLE_DEBUG_METRICS: ${ENABLE_DEBUG_METRICS:-1} ports: ["8080:8080"] depends_on: postgres: {condition: service_healthy} redis: {condition: service_healthy} healthcheck: {test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8080/health/ready')"], interval: 5s, timeout: 3s, retries: 20} volumes: postgres_data: redis_data: