# https://docs.docker.com/compose/compose-file/
version: "3.6"

# https://docs.docker.com/compose/compose-file/#networks
networks:
  rabbitmq-prometheus:

# https://docs.docker.com/compose/compose-file/#volumes
volumes:
  rabbitmq-prometheus_prometheus:
  rabbitmq-prometheus_grafana:

services:
  grafana:
    # https://hub.docker.com/r/grafana/grafana/tags
    image: grafana/grafana:8.3.4
    ports:
      - "3000:3000"
    networks:
      - "rabbitmq-prometheus"
    volumes:
      - rabbitmq-prometheus_grafana:/var/lib/grafana
      - ./grafana/dashboards.yml:/etc/grafana/provisioning/dashboards/rabbitmq.yaml
      - ./grafana/datasources.yml:/etc/grafana/provisioning/datasources/prometheus.yaml
      - ./grafana/dashboards:/dashboards
    environment:
      # https://grafana.com/plugins/flant-statusmap-panel
      # https://grafana.com/plugins/grafana-piechart-panel
      # https://grafana.com/plugins/grafana-polystat-panel
      # https://grafana.com/plugins/jdbranham-diagram-panel
      # https://grafana.com/plugins/michaeldmoore-multistat-panel
      # https://grafana.com/plugins/vonage-status-panel
      # https://grafana.com/plugins/yesoreyeram-boomtable-panel
      GF_INSTALL_PLUGINS: "flant-statusmap-panel,grafana-piechart-panel"
  prometheus:
    # https://hub.docker.com/r/prom/prometheus/tags
    image: prom/prometheus:v2.28.1
    networks:
      - "rabbitmq-prometheus"
    ports:
      - "9090:9090"
    volumes:
      - rabbitmq-prometheus_prometheus:/prometheus
      - ./prometheus.yml:/etc/prometheus/prometheus.yml
  node-exporter:
    command:
      - '--path.procfs=/host/proc'
      - '--path.rootfs=/rootfs'
      - '--path.sysfs=/host/sys'
      - '--collector.filesystem.ignored-mount-points=^/(sys|proc|dev|host|etc)($$|/)'
    expose:
      - 9100
    # https://hub.docker.com/r/prom/node-exporter/tags
    image: prom/node-exporter:v1.2.0
    networks:
      - "rabbitmq-prometheus"
    volumes:
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro
      - /:/rootfs:ro
  cadvisor:
    expose:
      - 8080
    # https://hub.docker.com/r/google/cadvisor/tags
    image: google/cadvisor:v0.33.0
    networks:
      - "rabbitmq-prometheus"
    volumes:
      - /:/rootfs:ro
      - /var/run:/var/run:rw
      - /sys:/sys:ro
      - /var/lib/docker/:/var/lib/docker:ro
      #- /cgroup:/cgroup:ro #doesn't work on MacOS only for Linux
