89 lines
1.8 KiB
YAML
89 lines
1.8 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
db:
|
|
image: postgres:15-alpine
|
|
container_name: px360_db
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
environment:
|
|
- POSTGRES_DB=px360
|
|
- POSTGRES_USER=px360
|
|
- POSTGRES_PASSWORD=px360
|
|
ports:
|
|
- "5432:5432"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U px360"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: px360_redis
|
|
ports:
|
|
- "6379:6379"
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
web:
|
|
build: .
|
|
container_name: px360_web
|
|
command: >
|
|
sh -c "python manage.py migrate &&
|
|
python manage.py collectstatic --noinput &&
|
|
gunicorn config.wsgi:application --bind 0.0.0.0:8000 --workers 3 --reload"
|
|
volumes:
|
|
- .:/app
|
|
- static_volume:/app/staticfiles
|
|
- media_volume:/app/media
|
|
ports:
|
|
- "8000:8000"
|
|
env_file:
|
|
- .env
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8000/health/"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
|
|
celery:
|
|
build: .
|
|
container_name: px360_celery
|
|
command: celery -A config worker -l info
|
|
volumes:
|
|
- .:/app
|
|
env_file:
|
|
- .env
|
|
depends_on:
|
|
- db
|
|
- redis
|
|
- web
|
|
|
|
celery-beat:
|
|
build: .
|
|
container_name: px360_celery_beat
|
|
command: celery -A config beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
|
|
volumes:
|
|
- .:/app
|
|
env_file:
|
|
- .env
|
|
depends_on:
|
|
- db
|
|
- redis
|
|
- web
|
|
|
|
volumes:
|
|
postgres_data:
|
|
static_volume:
|
|
media_volume:
|