services: nginx: image: nginx:1.25-alpine ports: - "8080:80" volumes: - ./infra/nginx.conf:/etc/nginx/nginx.conf:ro depends_on: api: condition: service_healthy restart: unless-stopped api: build: . environment: - APP_HOST=${APP_HOST} - APP_PORT=${APP_PORT} - DATABASE_URL=${DATABASE_URL} - SESSION_TTL_SECONDS=${SESSION_TTL_SECONDS} - REDIS_URL=${REDIS_URL} - INSTANCE_ID_PREFIX=api depends_on: postgres: condition: service_healthy redis: condition: service_healthy restart: unless-stopped healthcheck: test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/ready', timeout=2)"] #засекретить interval: 10s timeout: 3s start_period: 15s retries: 3 deploy: replicas: 2 postgres: image: postgres:16.3-alpine environment: POSTGRES_USER: ${POSTGRES_USER} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} POSTGRES_DB: ${POSTGRES_DB} ports: - "127.0.0.1:5433:5432" volumes: - pgdata:/var/lib/postgresql/data - ./migrations:/docker-entrypoint-initdb.d:ro command: postgres -c shared_preload_libraries=pg_stat_statements healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"] interval: 5s timeout: 3s start_period: 10s retries: 5 restart: unless-stopped redis: image: redis:8.10-alpine command: redis-server --appendonly yes --save 60 1 ports: - "127.0.0.1:6379:6379" volumes: - redisdata:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 3s start_period: 5s retries: 5 restart: unless-stopped volumes: pgdata: redisdata: