name: VKResenderAPI x-app-common: &app-common build: context: . target: production tty: true restart: unless-stopped stop_signal: SIGINT env_file: - .env environment: DEBUG: true DATABASE_URL: "postgresql://postgres:example@pgbouncer:5432/postgres" REDIS_URL: "redis://valkey:6379/0" depends_on: pgbouncer: condition: service_healthy valkey: condition: service_healthy services: db: image: postgres:17.2-alpine restart: unless-stopped ports: - ${POSTGRES_PORT:-5432}:5432 environment: POSTGRES_PASSWORD: example volumes: - "${POSTGRES_DATA:-./postgres}:/var/lib/postgresql/data/" healthcheck: test: [ "CMD-SHELL", "pg_isready -U postgres" ] interval: 5s timeout: 10s retries: 5 pgbouncer: image: edoburu/pgbouncer:latest restart: unless-stopped environment: - POOL_MODE=transaction - MAX_DB_CONNECTIONS=3000 - DEFAULT_POOL_SIZE=100 - AUTH_TYPE=md5 - AUTH_FILE=/etc/pgbouncer/userlist.txt - DATABASE_URL=postgresql://postgres:example@db:5432/postgres volumes: - ./userlist.txt:/etc/pgbouncer/userlist.txt healthcheck: test: ["CMD", "pg_isready", "-h", "127.0.0.1", "-p", "5432"] interval: 10s timeout: 5s retries: 3 depends_on: db: condition: service_healthy valkey: image: valkey/valkey:alpine restart: unless-stopped ports: - ${VALKEY_PORT:-6379}:6379 healthcheck: test: [ "CMD", "redis-cli", "ping" ] interval: 5s timeout: 10s retries: 5 web: <<: *app-common ports: - "${APP_PORT:-9000}:${APP_PORT:-9000}" worker: <<: *app-common command: celery -A core.worker worker --autoscale=0,4 -E --loglevel=info beat: <<: *app-common command: celery -A core.worker beat --loglevel=info