# infra/monitoring/docker-compose.monitoring.yml
# Docker Compose stack for Genesis Prometheus + Grafana + Loki monitoring.
#
# Services:
#   prometheus — metrics collection (port 9090)
#   grafana    — dashboards and alerting (port 3001)
#   loki       — log aggregation (port 3100)
#   promtail   — log shipper feeding Loki
#
# Usage:
#   docker compose -f infra/monitoring/docker-compose.monitoring.yml up -d
#
# VERIFICATION_STAMP
# Story: MON-003
# Verified By: parallel-builder
# Verified At: 2026-02-25
# Tests: 7/7
# Coverage: 100%

version: "3.8"

services:
  prometheus:
    image: prom/prometheus:latest
    container_name: genesis-prometheus
    ports:
      - "9090:9090"
    volumes:
      - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
      - prometheus_data:/prometheus
    command:
      - "--config.file=/etc/prometheus/prometheus.yml"
      - "--storage.tsdb.path=/prometheus"
      - "--web.console.libraries=/usr/share/prometheus/console_libraries"
      - "--web.console.templates=/usr/share/prometheus/consoles"
    restart: unless-stopped

  grafana:
    image: grafana/grafana:latest
    container_name: genesis-grafana
    ports:
      - "3001:3000"
    volumes:
      - ./grafana/provisioning:/etc/grafana/provisioning:ro
      - grafana_data:/var/lib/grafana
    environment:
      - GF_SECURITY_ADMIN_USER=admin
      - GF_SECURITY_ADMIN_PASSWORD=genesis2026
      - GF_USERS_ALLOW_SIGN_UP=false
    depends_on:
      - prometheus
      - loki
    restart: unless-stopped

  loki:
    image: grafana/loki:latest
    container_name: genesis-loki
    ports:
      - "3100:3100"
    volumes:
      - loki_data:/loki
    command: -config.file=/etc/loki/local-config.yaml
    restart: unless-stopped

  promtail:
    image: grafana/promtail:latest
    container_name: genesis-promtail
    volumes:
      - /var/log:/var/log:ro
      - /mnt/e/genesis-system/logs:/genesis/logs:ro
    command: -config.file=/etc/promtail/config.yml
    depends_on:
      - loki
    restart: unless-stopped

volumes:
  prometheus_data:
  grafana_data:
  loki_data:
