version: '3.8' services: # PostgreSQL for metadata storage postgres: image: postgres:15-alpine environment: POSTGRES_DB: agentflow POSTGRES_USER: agentflow POSTGRES_PASSWORD: agentflow_password volumes: - postgres_data:/var/lib/postgresql/data - ./migrations:/docker-entrypoint-initdb.d ports: - "5432:5432" healthcheck: test: ["CMD-SHELL", "pg_isready -U agentflow"] interval: 10s timeout: 5s retries: 5 # ClickHouse for observability data clickhouse: image: clickhouse/clickhouse-server:latest environment: CLICKHOUSE_DB: agentflow CLICKHOUSE_USER: agentflow CLICKHOUSE_PASSWORD: agentflow_password volumes: - clickhouse_data:/var/lib/clickhouse - ./clickhouse:/docker-entrypoint-initdb.d ports: - "8123:8123" - "9000:9000" healthcheck: test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8123/ping"] interval: 10s timeout: 5s retries: 5 # Redis for caching redis: image: redis:7-alpine command: redis-server --appendonly yes volumes: - redis_data:/data ports: - "6379:6379" healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 # NATS for messaging nats: image: nats:2.9-alpine command: ["-js", "-m", "8222"] ports: - "4222:4222" - "8222:8222" healthcheck: test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8222/healthz"] interval: 10s timeout: 5s retries: 5 # AgentFlow Control Plane control-plane: image: ghcr.io/siddhant-k-code/agentflow-infrastructure/agentflow-control-plane:latest environment: - DB_HOST=postgres - DB_USER=agentflow - DB_PASSWORD=agentflow_password - DB_NAME=agentflow - CLICKHOUSE_HOST=clickhouse - CLICKHOUSE_USER=agentflow - CLICKHOUSE_PASSWORD=agentflow_password - CLICKHOUSE_DB=agentflow - REDIS_HOST=redis - REDIS_PORT=6379 - NATS_URL=nats://nats:4222 ports: - "8080:8080" depends_on: postgres: condition: service_healthy clickhouse: condition: service_healthy redis: condition: service_healthy nats: condition: service_healthy healthcheck: test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/health"] interval: 30s timeout: 10s retries: 3 restart: unless-stopped # AgentFlow Workers worker: image: ghcr.io/siddhant-k-code/agentflow-infrastructure/agentflow-worker:latest environment: - DB_HOST=postgres - DB_USER=agentflow - DB_PASSWORD=agentflow_password - DB_NAME=agentflow - REDIS_HOST=redis - REDIS_PORT=6379 - NATS_URL=nats://nats:4222 - CONTROL_PLANE_URL=http://control-plane:8080 depends_on: control-plane: condition: service_healthy deploy: replicas: 3 restart: unless-stopped # Prometheus for metrics prometheus: image: prom/prometheus:latest 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' volumes: - ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml - prometheus_data:/prometheus ports: - "9090:9090" restart: unless-stopped # Grafana for visualization grafana: image: grafana/grafana:latest environment: - GF_SECURITY_ADMIN_PASSWORD=admin volumes: - grafana_data:/var/lib/grafana - ./monitoring/grafana/datasources:/etc/grafana/provisioning/datasources - ./monitoring/grafana/dashboards:/etc/grafana/provisioning/dashboards ports: - "3000:3000" restart: unless-stopped volumes: postgres_data: clickhouse_data: redis_data: prometheus_data: grafana_data: