87 lines
1.8 KiB
YAML
87 lines
1.8 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# Redis - Message broker for Celery
|
|
redis:
|
|
image: redis:7-alpine
|
|
ports:
|
|
- "6379:6379"
|
|
volumes:
|
|
- redis_data:/data
|
|
command: redis-server --appendonly yes
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# FastAPI Application
|
|
web:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.celery
|
|
ports:
|
|
- "8080:8080"
|
|
environment:
|
|
- REDIS_URL=redis://redis:6379/0
|
|
- KUBECONFIG=/tmp/kubeconfig
|
|
volumes:
|
|
- ./kubeconfig:/tmp/kubeconfig:ro
|
|
depends_on:
|
|
redis:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
# Celery Worker
|
|
worker:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.celery
|
|
command: python app/workers/celery_worker.py
|
|
environment:
|
|
- REDIS_URL=redis://redis:6379/0
|
|
- KUBECONFIG=/tmp/kubeconfig
|
|
volumes:
|
|
- ./kubeconfig:/tmp/kubeconfig:ro
|
|
depends_on:
|
|
redis:
|
|
condition: service_healthy
|
|
deploy:
|
|
replicas: 2
|
|
|
|
# Celery Beat Scheduler
|
|
beat:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.celery
|
|
command: python app/workers/celery_beat.py
|
|
environment:
|
|
- REDIS_URL=redis://redis:6379/0
|
|
- KUBECONFIG=/tmp/kubeconfig
|
|
volumes:
|
|
- ./kubeconfig:/tmp/kubeconfig:ro
|
|
depends_on:
|
|
redis:
|
|
condition: service_healthy
|
|
|
|
# Flower - Celery Monitoring
|
|
flower:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.celery
|
|
command: celery -A app.celery_app flower --port=5555
|
|
ports:
|
|
- "5555:5555"
|
|
environment:
|
|
- REDIS_URL=redis://redis:6379/0
|
|
depends_on:
|
|
redis:
|
|
condition: service_healthy
|
|
|
|
volumes:
|
|
redis_data:
|