networks:
  grafana-network:
    driver: bridge
    name: grafana
  traefik:
    external: true
  minecraft:
    external: true

volumes:
  prometheus_data: {}

services:
  grafana:
    image: grafana/grafana
    user: "USER:GROUP"
    container_name: grafana
    restart: unless-stopped
    networks:
      - grafana-network
      - traefik
    volumes:
      - ./grafana.ini:/etc/grafana/grafana.ini
      - /pwspool/software/grafana:/var/lib/grafana
    labels:
      - traefik.http.routers.grafana.rule=Host(`SITE_URL`)
      - traefik.http.routers.grafana.tls=true
      - traefik.http.routers.grafana.tls.certresolver=lets-encrypt
      - traefik.http.services.grafana.loadbalancer.server.port=3000
    depends_on:
      - node_exporter
      - prometheus

  node_exporter:
    image: quay.io/prometheus/node-exporter:latest
    container_name: node_exporter
    user: "USER:GROUP"
    restart: unless-stopped
    networks:
      - grafana-network
    pid: host
    command:
      - "--path.rootfs=/host"
    volumes:
      - "/:/host:ro,rslave"
    depends_on:
      - prometheus

  prometheus:
    image: prom/prometheus:latest
    container_name: prometheus
    restart: always
    networks:
      - grafana-network
      - minecraft
    volumes:
      - "./prometheus.yml:/etc/prometheus.yml"
      - prometheus_data:/prometheus
    command:
      - "--config.file=/etc/prometheus.yml"
      - "--storage.tsdb.path=/prometheus"
      - "--web.console.libraries=/usr/share/prometheus/console_libraries"
      - "--web.console.templates=/usr/share/prometheus/consoles"

