volumes: db_data: {} batcher_db_data: {} redis_data: {} backend_media: {} certbot_www: {} certbot_conf: {} services: backend: build: context: ./backend volumes: - backend_media:/app/media command: /app/scripts/gunicorn.sh restart: on-failure depends_on: postgres: &healthy-dependency condition: service_healthy rabbitmq: *healthy-dependency env_file: &backend-env-files - .env/prod/pg - .env/prod/back - .env/prod/rmq - .env/prod/bot - .env/prod/web bot: build: ./bot depends_on: backend: &started-dependency condition: service_started batcher: *started-dependency memcached: *started-dependency env_file: - .env/prod/bot - .env/prod/web command: /app/scripts/gunicorn.sh restart: on-failure memcached: image: memcached:latest postgres: &pg-conf image: postgres:17-alpine volumes: - db_data:/var/lib/postgresql/data env_file: - .env/prod/pg user: postgres healthcheck: &pg-healthcheck test: [ "CMD-SHELL", "pg_isready" ] interval: 5s timeout: 2s retries: 5 nginx: build: context: . dockerfile: nginx/Dockerfile ports: - '80:80' - '443:443' depends_on: bot: *started-dependency volumes: - ./backend/static/:/static/ restart: unless-stopped celery: build: ./backend command: /app/scripts/start_celery.sh env_file: *backend-env-files environment: - CELERY_WORKER_COUNT=10 depends_on: backend: *started-dependency rabbitmq: container_name: 'rabbitmq' image: 'rabbitmq:3-management-alpine' env_file: - .env/prod/rmq healthcheck: <<: *pg-healthcheck test: rabbitmq-diagnostics -q ping interval: 10s timeout: 2s redis: env_file: - .env/prod/redis image: redis command: bash -c "redis-server --appendonly yes --requirepass $${REDIS_PASSWORD}" volumes: - redis_data:/data healthcheck: <<: *pg-healthcheck test: "[ $$(redis-cli -a $${REDIS_PASSWORD} ping) = 'PONG' ]" batcher: build: ./batcher depends_on: redis: *healthy-dependency batcher-postgres: *healthy-dependency rabbitmq: *healthy-dependency env_file: - .env/prod/rmq - .env/prod/redis - .env/prod/batcher-pg - .env/prod/batcher - .env/prod/bot batcher-postgres: <<: *pg-conf volumes: - batcher_db_data:/var/lib/postgresql/data env_file: - .env/prod/batcher-pg