version: '3.4' services: prometheus: image: 'prom/prometheus:v2.31.1' user: root deploy: mode: 'replicated' replicas: 1 placement: constraints: - 'node.labels.class == admin' configs: - source: prometheus_v6 target: /etc/prometheus/prometheus.yml networks: - 'default' - 'monitoring' volumes: - 'prometheus:/prometheus' - '/var/run/docker.sock:/var/run/docker.sock' cadvisor: image: 'gcr.io/cadvisor/cadvisor:v0.38.8' deploy: mode: 'global' networks: - 'monitoring' volumes: - '/:/rootfs:ro' - '/var/run:/var/run:ro' - '/sys:/sys:ro' - '/var/lib/docker:/var/lib/docker:ro' - '/dev/disk:/dev/disk:ro' - '/var/run/docker.sock:/var/run/docker.sock:ro' grafana: image: 'grafana/grafana:8.2.5' deploy: mode: 'replicated' replicas: 1 placement: constraints: - 'node.labels.class == admin' labels: - 'traefik.enable=true' - 'traefik.http.routers.grafana.rule=Host(`mon.rustybever.be`)' - 'traefik.http.routers.grafana.tls=true' - 'traefik.http.routers.grafana.tls.certresolver=letsEncrypt' - 'traefik.http.services.grafana.loadbalancer.server.port=3000' networks: - 'default' - 'public' volumes: - 'grafana:/var/lib/grafana' node-exporter: image: 'prom/node-exporter:v1.3.1' command: - '--path.procfs=/host/proc' - '--path.rootfs=/rootfs' - '--path.sysfs=/host/sys' - '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)' deploy: mode: 'global' networks: - 'monitoring' volumes: - '/proc:/host/proc:ro' - '/sys:/host/sys:ro' - '/:/rootfs:ro' # Hopefully causes node-exporter to show the correct hostname - '/etc/hostname:/etc/hostname:ro' configs: prometheus_v6: external: true networks: public: external: true monitoring: external: true volumes: prometheus: grafana: