version: "3"

networks:
  grafana-network:
    driver: bridge
  traefik_traefik-network:
    external: true
  minecraft_minecraft_network:
    external: true

volumes:
  grafana_data: {}
  prometheus_data: {}

services:
  grafana:
    image: grafana/grafana
    user: "[[USER_ID]]"
    container_name: grafana
    restart: always
    networks:
      - grafana-network
      - traefik_traefik-network
    volumes:
      - ./olomana.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
      - traefik.port=3000
    depends_on:
      - node_exporter
      - prometheus

  node_exporter:
    image: quay.io/prometheus/node-exporter:latest
    container_name: node_exporter
    user: "[[USER_ID]]:[[GROUP_ID]]"
    restart: always
    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_minecraft_network
    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"

