version: '3.8' #============================================================================ # FOXHUNT HFT MONITORING STACK #============================================================================ # Complete monitoring and observability stack: # - Prometheus (metrics collection) # - Grafana (visualization and dashboards) # - AlertManager (alerting and notifications) # - Loki (log aggregation) # - Tempo (distributed tracing) # - cAdvisor (container metrics) # - Node Exporter (system metrics) # # Usage: docker-compose -f docker-compose.monitoring.yml up -d #============================================================================ services: #========================================================================== # METRICS COLLECTION #========================================================================== prometheus: image: prom/prometheus:v2.47.0 container_name: foxhunt-prometheus-monitoring hostname: foxhunt-prometheus ports: - "9090:9090" volumes: - prometheus-data:/prometheus - ./deployment/monitoring/prometheus.yml:/etc/prometheus/prometheus.yml:ro - ./deployment/monitoring/rules:/etc/prometheus/rules:ro command: - '--config.file=/etc/prometheus/prometheus.yml' - '--storage.tsdb.path=/prometheus' - '--storage.tsdb.retention.time=30d' - '--storage.tsdb.retention.size=50GB' - '--web.console.libraries=/etc/prometheus/console_libraries' - '--web.console.templates=/etc/prometheus/consoles' - '--web.enable-lifecycle' - '--web.enable-admin-api' - '--query.max-concurrency=50' - '--query.max-samples=50000000' networks: - monitoring-network restart: unless-stopped healthcheck: test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9090/-/healthy"] interval: 30s timeout: 10s retries: 5 start_period: 30s mem_limit: 4g logging: driver: "json-file" options: max-size: "100m" max-file: "5" #========================================================================== # VISUALIZATION & DASHBOARDS #========================================================================== grafana: image: grafana/grafana:10.1.0 container_name: foxhunt-grafana-monitoring hostname: foxhunt-grafana ports: - "3000:3000" volumes: - grafana-data:/var/lib/grafana - ./deployment/monitoring/grafana/dashboards:/etc/grafana/provisioning/dashboards:ro - ./deployment/monitoring/grafana/datasources:/etc/grafana/provisioning/datasources:ro - ./deployment/monitoring/grafana/plugins:/var/lib/grafana/plugins environment: - GF_SECURITY_ADMIN_USER=${GRAFANA_ADMIN_USER:-admin} - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD:-admin} - GF_USERS_ALLOW_SIGN_UP=false - GF_SERVER_ROOT_URL=http://localhost:3000 - GF_INSTALL_PLUGINS=grafana-piechart-panel,grafana-worldmap-panel,grafana-polystat-panel - GF_FEATURE_TOGGLES_ENABLE=ngalert - GF_ALERTING_ENABLED=true - GF_UNIFIED_ALERTING_ENABLED=true depends_on: prometheus: condition: service_healthy networks: - monitoring-network restart: unless-stopped healthcheck: test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3000/api/health || exit 1"] interval: 30s timeout: 10s retries: 5 start_period: 30s mem_limit: 1g logging: driver: "json-file" options: max-size: "50m" max-file: "5" #========================================================================== # ALERTING #========================================================================== alertmanager: image: prom/alertmanager:v0.26.0 container_name: foxhunt-alertmanager-monitoring hostname: foxhunt-alertmanager ports: - "9093:9093" volumes: - alertmanager-data:/alertmanager - ./deployment/monitoring/alertmanager.yml:/etc/alertmanager/alertmanager.yml:ro command: - '--config.file=/etc/alertmanager/alertmanager.yml' - '--storage.path=/alertmanager' - '--web.external-url=http://localhost:9093' - '--cluster.advertise-address=0.0.0.0:9093' networks: - monitoring-network restart: unless-stopped healthcheck: test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9093/-/healthy"] interval: 30s timeout: 10s retries: 5 start_period: 30s mem_limit: 512m logging: driver: "json-file" options: max-size: "50m" max-file: "5" #========================================================================== # LOG AGGREGATION #========================================================================== loki: image: grafana/loki:2.9.0 container_name: foxhunt-loki-monitoring hostname: foxhunt-loki ports: - "3100:3100" volumes: - loki-data:/loki - ./deployment/monitoring/loki.yml:/etc/loki/loki.yml:ro command: -config.file=/etc/loki/loki.yml networks: - monitoring-network restart: unless-stopped healthcheck: test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3100/ready"] interval: 30s timeout: 10s retries: 5 start_period: 30s mem_limit: 1g logging: driver: "json-file" options: max-size: "50m" max-file: "5" promtail: image: grafana/promtail:2.9.0 container_name: foxhunt-promtail-monitoring hostname: foxhunt-promtail volumes: - /var/log:/var/log:ro - /var/lib/docker/containers:/var/lib/docker/containers:ro - ./deployment/monitoring/promtail.yml:/etc/promtail/config.yml:ro command: -config.file=/etc/promtail/config.yml depends_on: - loki networks: - monitoring-network restart: unless-stopped mem_limit: 256m logging: driver: "json-file" options: max-size: "25m" max-file: "3" #========================================================================== # DISTRIBUTED TRACING #========================================================================== tempo: image: grafana/tempo:2.2.0 container_name: foxhunt-tempo-monitoring hostname: foxhunt-tempo ports: - "3200:3200" # Tempo HTTP API - "9095:9095" # Tempo gRPC - "4317:4317" # OTLP gRPC - "4318:4318" # OTLP HTTP volumes: - tempo-data:/var/tempo - ./deployment/monitoring/tempo.yml:/etc/tempo/tempo.yml:ro command: [ "-config.file=/etc/tempo/tempo.yml" ] networks: - monitoring-network restart: unless-stopped healthcheck: test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3200/ready"] interval: 30s timeout: 10s retries: 5 start_period: 30s mem_limit: 1g logging: driver: "json-file" options: max-size: "50m" max-file: "5" #========================================================================== # SYSTEM METRICS #========================================================================== node-exporter: image: prom/node-exporter:v1.6.1 container_name: foxhunt-node-exporter-monitoring hostname: foxhunt-node-exporter ports: - "9100:9100" volumes: - /proc:/host/proc:ro - /sys:/host/sys:ro - /:/rootfs:ro command: - '--path.procfs=/host/proc' - '--path.sysfs=/host/sys' - '--path.rootfs=/rootfs' - '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)' networks: - monitoring-network restart: unless-stopped healthcheck: test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9100/metrics"] interval: 30s timeout: 10s retries: 5 start_period: 30s mem_limit: 256m logging: driver: "json-file" options: max-size: "25m" max-file: "3" #========================================================================== # CONTAINER METRICS #========================================================================== cadvisor: image: gcr.io/cadvisor/cadvisor:v0.47.2 container_name: foxhunt-cadvisor-monitoring hostname: foxhunt-cadvisor ports: - "8080:8080" volumes: - /:/rootfs:ro - /var/run:/var/run:rw - /sys:/sys:ro - /var/lib/docker:/var/lib/docker:ro - /dev/disk/:/dev/disk:ro privileged: true devices: - /dev/kmsg:/dev/kmsg networks: - monitoring-network restart: unless-stopped healthcheck: test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/healthz"] interval: 30s timeout: 10s retries: 5 start_period: 30s mem_limit: 512m logging: driver: "json-file" options: max-size: "50m" max-file: "5" #========================================================================== # UPTIME MONITORING #========================================================================== uptime-kuma: image: louislam/uptime-kuma:1.23.0 container_name: foxhunt-uptime-kuma-monitoring hostname: foxhunt-uptime-kuma ports: - "3001:3001" volumes: - uptime-kuma-data:/app/data networks: - monitoring-network restart: unless-stopped healthcheck: test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3001"] interval: 30s timeout: 10s retries: 5 start_period: 30s mem_limit: 512m logging: driver: "json-file" options: max-size: "50m" max-file: "5" #============================================================================== # NETWORKS #============================================================================== networks: monitoring-network: driver: bridge driver_opts: com.docker.network.bridge.name: foxhunt-monitoring ipam: config: - subnet: 172.25.0.0/24 gateway: 172.25.0.1 #============================================================================== # VOLUMES #============================================================================== volumes: prometheus-data: driver: local driver_opts: type: none o: bind device: /opt/foxhunt/monitoring/prometheus grafana-data: driver: local driver_opts: type: none o: bind device: /opt/foxhunt/monitoring/grafana alertmanager-data: driver: local driver_opts: type: none o: bind device: /opt/foxhunt/monitoring/alertmanager loki-data: driver: local driver_opts: type: none o: bind device: /opt/foxhunt/monitoring/loki tempo-data: driver: local driver_opts: type: none o: bind device: /opt/foxhunt/monitoring/tempo uptime-kuma-data: driver: local