378 lines
11 KiB
YAML
378 lines
11 KiB
YAML
# CI/CD Chaos Engine - Over-engineered Docker Compose Configuration
|
|
# This configuration demonstrates professional multi-container orchestration with satirical complexity
|
|
|
|
version: '3.8'
|
|
|
|
services:
|
|
# Main chaos engine application
|
|
chaos-engine:
|
|
build:
|
|
context: .
|
|
dockerfile: docker/Dockerfile
|
|
args:
|
|
CHAOS_LEVEL: 8
|
|
ROAST_INTENSITY: 9
|
|
BUILD_DATE: ${BUILD_DATE:-$(date -u +'%Y-%m-%dT%H:%M:%SZ')}
|
|
GIT_COMMIT: ${GIT_COMMIT:-$(git rev-parse --short HEAD 2>/dev/null || echo 'unknown')}
|
|
GIT_BRANCH: ${GIT_BRANCH:-$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo 'unknown')}
|
|
container_name: cicd-chaos-engine
|
|
restart: unless-stopped
|
|
environment:
|
|
- CHAOS_LEVEL=8
|
|
- ROAST_INTENSITY=9
|
|
- CELEBRATION_MODE=full
|
|
- DEVELOPER_CHALLENGE=true
|
|
- LOG_LEVEL=INFO
|
|
- PYTHONUNBUFFERED=1
|
|
- PYTHONDONTWRITEBYTECODE=1
|
|
volumes:
|
|
- ./scripts:/app/scripts:ro
|
|
- ./config:/app/config:ro
|
|
- ./logs:/app/logs
|
|
- ./artifacts:/app/artifacts
|
|
- ./reports:/app/reports
|
|
ports:
|
|
- "8080:8080"
|
|
- "9090:9090"
|
|
healthcheck:
|
|
test: ["CMD", "/app/healthcheck.sh"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
networks:
|
|
- chaos-network
|
|
depends_on:
|
|
- redis
|
|
- postgres
|
|
- grafana
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.routers.chaos-engine.rule=Host(`chaos.local`)"
|
|
- "traefik.http.routers.chaos-engine.entrypoints=web"
|
|
- "traefik.http.services.chaos-engine.loadbalancer.server.port=8080"
|
|
|
|
# Redis cache (overkill for this application)
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: cicd-chaos-redis
|
|
restart: unless-stopped
|
|
command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
|
|
volumes:
|
|
- redis_data:/data
|
|
- ./config/redis.conf:/etc/redis/redis.conf:ro
|
|
ports:
|
|
- "6379:6379"
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 3s
|
|
retries: 3
|
|
networks:
|
|
- chaos-network
|
|
labels:
|
|
- "traefik.enable=false"
|
|
|
|
# PostgreSQL database (excessive for this demo)
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: cicd-chaos-postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_DB: chaos_db
|
|
POSTGRES_USER: chaos_user
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-chaos_password}
|
|
PGDATA: /var/lib/postgresql/data/pgdata
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
- ./config/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
|
- postgres_logs:/var/log/postgresql
|
|
ports:
|
|
- "5432:5432"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U chaos_user -d chaos_db"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- chaos-network
|
|
labels:
|
|
- "traefik.enable=false"
|
|
|
|
# Grafana for monitoring (overkill)
|
|
grafana:
|
|
image: grafana/grafana:10.0.0
|
|
container_name: cicd-chaos-grafana
|
|
restart: unless-stopped
|
|
environment:
|
|
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD:-admin}
|
|
GF_USERS_ALLOW_SIGN_UP: "false"
|
|
GF_INSTALL_PLUGINS: "grafana-clock-panel,grafana-simple-json-datasource"
|
|
volumes:
|
|
- grafana_data:/var/lib/grafana
|
|
- ./config/grafana/provisioning:/etc/grafana/provisioning:ro
|
|
- ./config/grafana/dashboards:/var/lib/grafana/dashboards:ro
|
|
ports:
|
|
- "3000:3000"
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/api/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
networks:
|
|
- chaos-network
|
|
depends_on:
|
|
- postgres
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.routers.grafana.rule=Host(`grafana.chaos.local`)"
|
|
- "traefik.http.routers.grafana.entrypoints=web"
|
|
- "traefik.http.services.grafana.loadbalancer.server.port=3000"
|
|
|
|
# Prometheus for metrics collection (excessive)
|
|
prometheus:
|
|
image: prom/prometheus:v2.45.0
|
|
container_name: cicd-chaos-prometheus
|
|
restart: unless-stopped
|
|
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'
|
|
- '--web.enable-admin-api'
|
|
volumes:
|
|
- prometheus_data:/prometheus
|
|
- ./config/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
|
- ./config/prometheus/rules:/etc/prometheus/rules:ro
|
|
ports:
|
|
- "9091:9090"
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9090/-/healthy"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
networks:
|
|
- chaos-network
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.routers.prometheus.rule=Host(`prometheus.chaos.local`)"
|
|
- "traefik.http.routers.prometheus.entrypoints=web"
|
|
- "traefik.http.services.prometheus.loadbalancer.server.port=9090"
|
|
|
|
# Nginx reverse proxy (overkill)
|
|
nginx:
|
|
image: nginx:alpine
|
|
container_name: cicd-chaos-nginx
|
|
restart: unless-stopped
|
|
volumes:
|
|
- ./config/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
|
- ./config/nginx/conf.d:/etc/nginx/conf.d:ro
|
|
- nginx_logs:/var/log/nginx
|
|
- nginx_cache:/var/cache/nginx
|
|
ports:
|
|
- "80:80"
|
|
- "443:443"
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
networks:
|
|
- chaos-network
|
|
depends_on:
|
|
- chaos-engine
|
|
labels:
|
|
- "traefik.enable=false"
|
|
|
|
# Traefik reverse proxy (even more overkill)
|
|
traefik:
|
|
image: traefik:v2.10
|
|
container_name: cicd-chaos-traefik
|
|
restart: unless-stopped
|
|
command:
|
|
- "--api.insecure=true"
|
|
- "--providers.docker=true"
|
|
- "--providers.docker.exposedbydefault=false"
|
|
- "--entrypoints.web.address=:80"
|
|
- "--entrypoints.websecure.address=:443"
|
|
- "--entrypoints.web.http.redirections.entryPoint.to=websecure"
|
|
- "--certificatesresolvers.myresolver.acme.tlschallenge=true"
|
|
- "--certificatesresolvers.myresolver.acme.email=chaos@example.com"
|
|
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
|
- traefik_letsencrypt:/letsencrypt
|
|
ports:
|
|
- "8081:8080" # Traefik dashboard
|
|
- "80:80"
|
|
- "443:443"
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/ping"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
networks:
|
|
- chaos-network
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.routers.traefik.rule=Host(`traefik.chaos.local`)"
|
|
- "traefik.http.routers.traefik.entrypoints=web"
|
|
- "traefik.http.routers.traefik.service=api@internal"
|
|
|
|
# Fluentd for log aggregation (excessive)
|
|
fluentd:
|
|
build:
|
|
context: .
|
|
dockerfile: docker/fluentd.Dockerfile
|
|
container_name: cicd-chaos-fluentd
|
|
restart: unless-stopped
|
|
volumes:
|
|
- ./config/fluentd/conf:/fluentd/etc
|
|
- ./logs:/logs
|
|
- fluentd_data:/fluentd/log
|
|
ports:
|
|
- "24224:24224"
|
|
- "24224:24224/udp"
|
|
networks:
|
|
- chaos-network
|
|
depends_on:
|
|
- elasticsearch
|
|
labels:
|
|
- "traefik.enable=false"
|
|
|
|
# Elasticsearch for log storage (way overkill)
|
|
elasticsearch:
|
|
image: docker.elastic.co/elasticsearch/elasticsearch:8.9.0
|
|
container_name: cicd-chaos-elasticsearch
|
|
restart: unless-stopped
|
|
environment:
|
|
- discovery.type=single-node
|
|
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
|
- xpack.security.enabled=false
|
|
volumes:
|
|
- elasticsearch_data:/usr/share/elasticsearch/data
|
|
ports:
|
|
- "9200:9200"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "curl -f http://localhost:9200/_cluster/health || exit 1"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
networks:
|
|
- chaos-network
|
|
labels:
|
|
- "traefik.enable=false"
|
|
|
|
# Kibana for log visualization (excessive)
|
|
kibana:
|
|
image: docker.elastic.co/kibana/kibana:8.9.0
|
|
container_name: cicd-chaos-kibana
|
|
restart: unless-stopped
|
|
environment:
|
|
- ELASTICSEARCH_HOSTS=http://elasticsearch:9200
|
|
volumes:
|
|
- kibana_data:/usr/share/kibana/data
|
|
ports:
|
|
- "5601:5601"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "curl -f http://localhost:5601/api/status || exit 1"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
networks:
|
|
- chaos-network
|
|
depends_on:
|
|
- elasticsearch
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.routers.kibana.rule=Host(`kibana.chaos.local`)"
|
|
- "traefik.http.routers.kibana.entrypoints=web"
|
|
- "traefik.http.services.kibana.loadbalancer.server.port=5601"
|
|
|
|
# Jaeger for distributed tracing (absolutely overkill)
|
|
jaeger:
|
|
image: jaegertracing/all-in-one:latest
|
|
container_name: cicd-chaos-jaeger
|
|
restart: unless-stopped
|
|
environment:
|
|
- COLLECTOR_OTLP_ENABLED=true
|
|
ports:
|
|
- "16686:16686" # UI
|
|
- "14268:14268" # HTTP collector
|
|
- "14250:14250" # gRPC collector
|
|
- "4317:4317" # OTLP gRPC
|
|
- "4318:4318" # OTLP HTTP
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:16686"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
networks:
|
|
- chaos-network
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.routers.jaeger.rule=Host(`jaeger.chaos.local`)"
|
|
- "traefik.http.routers.jaeger.entrypoints=web"
|
|
- "traefik.http.services.jaeger.loadbalancer.server.port=16686"
|
|
|
|
# Jenkins for CI/CD (completely overkill for this demo)
|
|
jenkins:
|
|
image: jenkins/jenkins:lts-jdk17
|
|
container_name: cicd-chaos-jenkins
|
|
restart: unless-stopped
|
|
environment:
|
|
- JAVA_OPTS=-Xmx2048m
|
|
- JENKINS_OPTS=--httpPort=8081 --httpsPort=-1
|
|
volumes:
|
|
- jenkins_home:/var/jenkins_home
|
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
|
ports:
|
|
- "8082:8081"
|
|
- "50000:50000"
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8081/login"]
|
|
interval: 60s
|
|
timeout: 10s
|
|
retries: 5
|
|
networks:
|
|
- chaos-network
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.routers.jenkins.rule=Host(`jenkins.chaos.local`)"
|
|
- "traefik.http.routers.jenkins.entrypoints=web"
|
|
- "traefik.http.services.jenkins.loadbalancer.server.port=8081"
|
|
|
|
volumes:
|
|
redis_data:
|
|
driver: local
|
|
postgres_data:
|
|
driver: local
|
|
postgres_logs:
|
|
driver: local
|
|
grafana_data:
|
|
driver: local
|
|
prometheus_data:
|
|
driver: local
|
|
nginx_logs:
|
|
driver: local
|
|
nginx_cache:
|
|
driver: local
|
|
traefik_letsencrypt:
|
|
driver: local
|
|
fluentd_data:
|
|
driver: local
|
|
elasticsearch_data:
|
|
driver: local
|
|
kibana_data:
|
|
driver: local
|
|
jenkins_home:
|
|
driver: local
|
|
|
|
networks:
|
|
chaos-network:
|
|
driver: bridge
|
|
ipam:
|
|
config:
|
|
- subnet: 172.20.0.0/16 |