version: '3.8' services: # OpenDistillery Main Application opendistillery-api: build: context: . dockerfile: Dockerfile.production ports: - "8000:8000" environment: - OPENDISTILLERY_ENV=production - DATABASE_HOST=postgres - REDIS_HOST=redis - PROMETHEUS_HOST=prometheus depends_on: - postgres - redis - prometheus volumes: - ./logs:/app/logs - ./config:/app/config networks: - opendistillery-network restart: unless-stopped healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8000/health"] interval: 30s timeout: 10s retries: 3 start_period: 40s # OpenDistillery Worker Nodes opendistillery-worker: build: context: . dockerfile: Dockerfile.production command: ["opendistillery-worker"] environment: - OPENDISTILLERY_ENV=production - DATABASE_HOST=postgres - REDIS_HOST=redis depends_on: - postgres - redis volumes: - ./logs:/app/logs - ./config:/app/config networks: - opendistillery-network restart: unless-stopped deploy: replicas: 3 # PostgreSQL Database postgres: image: postgres:15-alpine environment: POSTGRES_DB: opendistillery POSTGRES_USER: opendistillery POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} volumes: - postgres_data:/var/lib/postgresql/data - ./scripts/init-db.sql:/docker-entrypoint-initdb.d/init-db.sql networks: - opendistillery-network restart: unless-stopped healthcheck: test: ["CMD-SHELL", "pg_isready -U opendistillery"] interval: 10s timeout: 5s retries: 5 # Redis Cache & Session Store redis: image: redis:7-alpine command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD} 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=200h' - '--web.enable-lifecycle' networks: - opendistillery-network restart: unless-stopped # Grafana Dashboards grafana: image: grafana/grafana:latest ports: - "3000:3000" environment: - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD} - GF_USERS_ALLOW_SIGN_UP=false volumes: - grafana_data:/var/lib/grafana - ./monitoring/grafana/dashboards:/etc/grafana/provisioning/dashboards - ./monitoring/grafana/datasources:/etc/grafana/provisioning/datasources networks: - opendistillery-network restart: unless-stopped depends_on: - prometheus # Elasticsearch for Logging elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch:8.11.0 environment: - discovery.type=single-node - xpack.security.enabled=false - "ES_JAVA_OPTS=-Xms512m -Xmx512m" volumes: - elasticsearch_data:/usr/share/elasticsearch/data networks: - opendistillery-network restart: unless-stopped # Kibana for Log Analysis kibana: image: docker.elastic.co/kibana/kibana:8.11.0 ports: - "5601:5601" environment: - ELASTICSEARCH_HOSTS=http://elasticsearch:9200 depends_on: - elasticsearch networks: - opendistillery-network restart: unless-stopped # Logstash for Log Processing logstash: image: docker.elastic.co/logstash/logstash:8.11.0 volumes: - ./monitoring/logstash/pipeline:/usr/share/logstash/pipeline - ./logs:/app/logs:ro environment: - "LS_JAVA_OPTS=-Xmx256m -Xms256m" depends_on: - elasticsearch networks: - opendistillery-network restart: unless-stopped # NGINX Load Balancer nginx: image: nginx:alpine ports: - "80:80" - "443:443" volumes: - ./nginx/nginx.conf:/etc/nginx/nginx.conf - ./nginx/ssl:/etc/nginx/ssl - ./nginx/logs:/var/log/nginx depends_on: - opendistillery-api networks: - opendistillery-network restart: unless-stopped # Jaeger Distributed Tracing jaeger: image: jaegertracing/all-in-one:latest ports: - "16686:16686" - "14268:14268" environment: - COLLECTOR_OTLP_ENABLED=true networks: - opendistillery-network restart: unless-stopped # MinIO Object Storage minio: image: minio/minio:latest ports: - "9000:9000" - "9001:9001" environment: - MINIO_ROOT_USER=${MINIO_ROOT_USER} - MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD} volumes: - minio_data:/data command: server /data --console-address ":9001" networks: - opendistillery-network restart: unless-stopped # Vault for Secrets Management vault: image: vault:latest ports: - "8200:8200" environment: - VAULT_DEV_ROOT_TOKEN_ID=${VAULT_ROOT_TOKEN} - VAULT_DEV_LISTEN_ADDRESS=0.0.0.0:8200 cap_add: - IPC_LOCK volumes: - vault_data:/vault/data networks: - opendistillery-network restart: unless-stopped networks: opendistillery-network: driver: bridge volumes: postgres_data: redis_data: prometheus_data: grafana_data: elasticsearch_data: minio_data: vault_data: 