# Minimal observability stack for network-device telemetry.
#
#   Cisco IOS-XE router  ──[gRPC dial-out]──>  Telegraf :57000
#                                                    │
#                                               InfluxDB :8086
#                                                    │
#                                                Grafana :3001
#
# All three services use upstream images — no custom Dockerfile needed.
# Volumes are labelled :z for SELinux compatibility (Fedora/RHEL).

services:
  influxdb:
    image: influxdb:2.7
    container_name: obs-influxdb
    restart: unless-stopped
    ports:
      - "8086:8086"
    environment:
      - DOCKER_INFLUXDB_INIT_MODE=setup
      - DOCKER_INFLUXDB_INIT_USERNAME=admin
      - DOCKER_INFLUXDB_INIT_PASSWORD=adminpassword
      - DOCKER_INFLUXDB_INIT_ORG=myorg
      - DOCKER_INFLUXDB_INIT_BUCKET=telegraf
      - DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=my-super-secret-auth-token
    volumes:
      - influxdb_data:/var/lib/influxdb2:z
    networks: [monitoring]

  telegraf:
    image: telegraf:latest
    container_name: obs-telegraf
    restart: unless-stopped
    ports:
      - "57000:57000"            # gRPC dial-out listener for Cisco MDT
    environment:
      - INFLUXDB_TOKEN=my-super-secret-auth-token
    volumes:
      - ./telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro,z
    networks: [monitoring]
    depends_on: [influxdb]

  grafana:
    image: grafana/grafana:latest
    container_name: obs-grafana
    restart: unless-stopped
    ports:
      - "3001:3000"
    environment:
      - GF_SECURITY_ADMIN_USER=admin
      - GF_SECURITY_ADMIN_PASSWORD=admin
      - GF_USERS_ALLOW_SIGN_UP=false
    volumes:
      - grafana_data:/var/lib/grafana:z
    networks: [monitoring]
    depends_on: [influxdb]

networks:
  monitoring:
    driver: bridge

volumes:
  influxdb_data:
  grafana_data:
