db_kyc_project/docker-compose-prod.yml

117 lines
2.5 KiB
YAML
Raw Permalink Normal View History

2024-12-12 22:12:00 +03:00
volumes:
db_data: {}
batcher_db_data: {}
redis_data: {}
backend_media: {}
2024-12-17 16:48:36 +03:00
backend_static: {}
2024-12-12 22:12:00 +03:00
services:
backend:
build:
context: ./backend
volumes:
- backend_media:/app/media
2024-12-17 16:48:36 +03:00
- backend_static:/app/static
command: /app/scripts/gunicorn.sh
2024-12-12 22:12:00 +03:00
restart: on-failure
depends_on:
postgres: &healthy-dependency
condition: service_healthy
rabbitmq: *healthy-dependency
env_file: &backend-env-files
2024-12-12 22:12:00 +03:00
- .env/prod/pg
- .env/prod/back
- .env/prod/rmq
- .env/prod/bot
2024-12-14 08:52:01 +03:00
- .env/prod/web
2024-12-12 22:12:00 +03:00
bot:
build: ./bot
2024-12-12 22:12:00 +03:00
depends_on:
backend: &started-dependency
condition: service_started
batcher: *started-dependency
2024-12-12 22:12:00 +03:00
env_file:
- .env/prod/bot
2024-12-14 01:37:54 +03:00
- .env/prod/web
command: /app/scripts/gunicorn.sh
2024-12-12 22:12:00 +03:00
restart: on-failure
2024-12-14 08:52:01 +03:00
postgres: &pg-conf
image: postgres:17-alpine
2024-12-12 22:12:00 +03:00
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
2024-12-12 22:12:00 +03:00
nginx:
build:
context: .
dockerfile: nginx/Dockerfile
ports:
- '80:80'
- '443:443'
depends_on:
bot: *started-dependency
2024-12-12 22:12:00 +03:00
volumes:
2024-12-17 16:48:36 +03:00
- backend_static:/static/
2024-12-21 11:53:35 +03:00
- backend_media:/media/
2024-12-12 22:12:00 +03:00
restart: unless-stopped
celery:
build: ./backend
command: /app/scripts/start_celery.sh
env_file: *backend-env-files
environment:
- CELERY_WORKER_COUNT=10
2024-12-12 22:12:00 +03:00
depends_on:
backend: *started-dependency
2024-12-12 22:12:00 +03:00
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
2024-12-12 22:12:00 +03:00
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' ]"
2024-12-12 22:12:00 +03:00
batcher:
build: ./batcher
2024-12-12 22:12:00 +03:00
depends_on:
redis: *healthy-dependency
batcher-postgres: *healthy-dependency
rabbitmq: *healthy-dependency
2024-12-12 22:12:00 +03:00
env_file:
- .env/prod/rmq
- .env/prod/redis
- .env/prod/batcher-pg
- .env/prod/batcher
- .env/prod/bot
batcher-postgres:
<<: *pg-conf
2024-12-12 22:12:00 +03:00
volumes:
- batcher_db_data:/var/lib/postgresql/data
env_file:
- .env/prod/batcher-pg