---
version: '3.8'

services:

  node_exporter:
    profiles:
      - exporter
    image: quay.io/prometheus/node-exporter:latest
    container_name: node_exporter
    command:
      - '--path.rootfs=/host'
    network_mode: host
    pid: host
    restart: unless-stopped
    volumes:
      - '/:/host:ro,rslave'

  prometheus:
    profiles:
      - server
    depends_on:
      - node_exporter
    image: prom/prometheus
    container_name: prometheus
    restart: always
    ports:
      - 9090:9090
    volumes:
      - ./prometheus:/etc/prometheus

  grafana:
    profiles:
      - server
    depends_on:
      - prometheus
    image: grafana/grafana-enterprise
    container_name: grafana
    restart: always
    ports:
      - 3000:3000
    volumes:
      - ./grafana/provisioning:/etc/grafana/provisioning
      - ./grafana/dashboards:/var/lib/grafana/dashboards
