# Grafana - Visualization dashboards for Smart City Digital Twin Martinique
# Usage: docker compose -f docker-compose.grafana.yml up -d
# Note: run from the project root or pass -p smart-city to attach to the smart-city project

networks:
  smartcity-shared:
    external: true
  traefik-public:
    external: true

volumes:
  grafana_data:
    external: false
    name: digital-twin_grafana_data

services:
  grafana:
    image: grafana/grafana:10.2.0
    container_name: smart-city-grafana
    networks:
      - smartcity-shared
      - traefik-public
    ports:
      - "3001:3000"
    environment:
      # Anonymous auth - must match the org name in Grafana's database
      - GF_AUTH_ANONYMOUS_ENABLED=true
      - GF_AUTH_ANONYMOUS_ORG_NAME=Digitribe
      - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
      # Admin credentials
      - GF_SECURITY_ADMIN_USER=admin
      - GF_SECURITY_ADMIN_PASSWORD=Digitribe972
      # Plugins
      - GF_INSTALL_PLUGINS=grafana-piechart-panel,grafana-simple-json-datasource
    volumes:
      - grafana_data:/var/lib/grafana
      - ./grafana/provisioning:/etc/grafana/provisioning
    restart: unless-stopped
