version: '3.8' services: # OpenDistillery API Server opendistillery-api: build: context: . dockerfile: Dockerfile ports: - "8000:8000" - "8001:8001" # Metrics port environment: - ENVIRONMENT=production - SECRET_KEY=${SECRET_KEY:-your-secret-key-here} - DATABASE_URL=${DATABASE_URL:-postgresql://user:password@db:5432/opendistillery} - REDIS_URL=${REDIS_URL:-redis://redis:6379/0} - OPENAI_API_KEY=${OPENAI_API_KEY:-your-openai-key-here} - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:-} - LOG_LEVEL=info - PROMETHEUS_ENABLED=true volumes: - ./logs:/app/logs - ./data:/app/data - ./config:/app/config depends_on: - postgres - redis - prometheus networks: - opendistillery-network restart: unless-stopped healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8000/api/v1/health"] interval: 30s timeout: 10s retries: 3 start_period: 40s # PostgreSQL Database postgres: image: postgres:15-alpine environment: - POSTGRES_DB=opendistillery - POSTGRES_USER=opendistillery - POSTGRES_PASSWORD=secure_password - POSTGRES_INITDB_ARGS=--encoding=UTF8 --locale=C volumes: - postgres_data:/var/lib/postgresql/data - ./database/init.sql:/docker-entrypoint-initdb.d/init.sql ports: - "5432:5432" networks: - opendistillery-network restart: unless-stopped healthcheck: test: ["CMD-SHELL", "pg_isready -U opendistillery"] interval: 10s timeout: 5s retries: 5 # Redis Cache redis: image: redis:7-alpine command: redis-server --appendonly yes --requirepass redis_password ports: - "6379:6379" volumes: - redis_data:/data networks: - opendistillery-network restart: unless-stopped healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 # Prometheus Monitoring prometheus: image: prom/prometheus:latest ports: - "9090:9090" volumes: - ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml - prometheus_data:/prometheus command: - '--config.file=/etc/prometheus/prometheus.yml' - '--storage.tsdb.path=/prometheus' - '--web.console.libraries=/etc/prometheus/console_libraries' - '--web.console.templates=/etc/prometheus/consoles' - '--storage.tsdb.retention.time=15d' - '--web.enable-lifecycle' networks: - opendistillery-network restart: unless-stopped # Grafana Dashboards grafana: image: grafana/grafana:latest ports: - "3000:3000" environment: - GF_SECURITY_ADMIN_PASSWORD=admin - GF_USERS_ALLOW_SIGN_UP=false - GF_INSTALL_PLUGINS=grafana-piechart-panel volumes: - grafana_data:/var/lib/grafana - ./monitoring/grafana/provisioning:/etc/grafana/provisioning networks: - opendistillery-network restart: unless-stopped depends_on: - prometheus # Development Tools jupyter: build: context: . dockerfile: Dockerfile.jupyter ports: - "8888:8888" environment: - JUPYTER_ENABLE_LAB=yes - JUPYTER_TOKEN=opendistillery volumes: - ./notebooks:/home/jovyan/work - ./src:/home/jovyan/work/src networks: - opendistillery-network restart: unless-stopped # Worker for background tasks celery-worker: build: context: . dockerfile: Dockerfile command: ["celery", "-A", "src.workers.celery_app", "worker", "--loglevel=info"] environment: - OPENDISTILLERY_ENV=development - DATABASE_URL=postgresql://opendistillery:secure_password@postgres:5432/opendistillery - REDIS_URL=redis://redis:6379/0 - CELERY_BROKER_URL=redis://redis:6379/1 - CELERY_RESULT_BACKEND=redis://redis:6379/1 volumes: - ./logs:/app/logs - ./data:/app/data depends_on: - postgres - redis networks: - opendistillery-network restart: unless-stopped # Flower for monitoring Celery flower: build: context: . dockerfile: Dockerfile command: ["celery", "-A", "src.workers.celery_app", "flower"] ports: - "5555:5555" environment: - CELERY_BROKER_URL=redis://redis:6379/1 - CELERY_RESULT_BACKEND=redis://redis:6379/1 depends_on: - redis networks: - opendistillery-network restart: unless-stopped networks: opendistillery-network: driver: bridge volumes: postgres_data: redis_data: prometheus_data: grafana_data: