version: '3.7' services: init: image: alpine:latest command: - /bin/sh - -c - | wget --no-cache -q https://raw.githubusercontent.com/ethibox/stacks/master/configs/prometheus.yml -O /mnt/prometheus.yml wget --no-cache -q https://raw.githubusercontent.com/ethibox/stacks/master/configs/alertmanager.yml -O /mnt/alertmanager.yml wget --no-cache -q https://raw.githubusercontent.com/ethibox/stacks/master/configs/alert.rules.yml -O /mnt/alert.rules.yml wget --no-cache -q https://raw.githubusercontent.com/ethibox/stacks/master/configs/blackbox.yml -O /mnt/blackbox.yml sed -i -e 's/SMTP_HOST/'${SMTP_HOST:-mail.service.host:587}'/g' /mnt/alertmanager.yml sed -i -e 's/SMTP_FROM/'${SMTP_FROM:-noreply@ethibox.fr}'/g' /mnt/alertmanager.yml sed -i -e 's/SMTP_USERNAME/'${SMTP_USERNAME:-noreply@ethibox.fr}'/g' /mnt/alertmanager.yml sed -i -e 's/SMTP_PASSWORD/'${SMTP_PASSWORD:-myp@ssw0rd}'/g' /mnt/alertmanager.yml sed -i -e 's/SMTP_TO/'${SMTP_TO:-noreply@ethibox.fr}'/g' /mnt/alertmanager.yml volumes: - ${VOLUME_PATH}config:/mnt deploy: restart_policy: condition: on-failure prometheus: image: prom/prometheus:v2.18.1 command: - --config.file=/etc/prometheus/prometheus.yml - --storage.tsdb.path=/prometheus - --storage.tsdb.retention.time=7d - --web.console.libraries=/usr/share/prometheus/console_libraries - --web.console.templates=/usr/share/prometheus/consoles - --web.route-prefix=/prometheus - --web.external-url=http://${DOMAIN:-monitoring.localhost}/prometheus volumes: - ${VOLUME_PATH}prometheus:/prometheus - ${VOLUME_PATH}config:/etc/prometheus/ deploy: labels: - traefik.port=9090 - traefik.enable=true - traefik.frontend.rule=Host:${DOMAIN:-monitoring.localhost};PathPrefix:/prometheus - traefik.frontend.auth.basic.users=admin:${HTPASSWD:?err} resources: limits: memory: 400M reservations: memory: 350M networks: - internal - traefik grafana: image: grafana/grafana:6.7.3 user: root volumes: - ${VOLUME_PATH}grafana:/var/lib/grafana deploy: labels: - traefik.port=3000 - traefik.enable=true - traefik.frontend.rule=Host:${DOMAIN:-monitoring.localhost} networks: - internal - traefik cadvisor: image: gcr.io/google-containers/cadvisor:v0.36.0 volumes: - /:/rootfs:ro - /var/run:/var/run:rw - /sys:/sys:ro - /var/lib/docker/:/var/lib/docker:ro deploy: mode: global resources: limits: cpus: '0.5' memory: 128M reservations: cpus: '0.1' memory: 64M networks: - internal node-exporter: image: stefanprodan/swarmprom-node-exporter:v0.16.0 volumes: - /sys:/host/sys:ro - /:/rootfs:ro - /proc:/host/proc:ro - /etc/hostname:/etc/nodename environment: - NODE_ID={{.Node.ID}} command: - '--path.sysfs=/host/sys' - '--path.procfs=/host/proc' - '--collector.textfile.directory=/etc/node-exporter/' - '--collector.filesystem.ignored-mount-points=^/(sys|proc|dev|host|etc)($$|/)' - '--no-collector.ipvs' deploy: mode: global resources: limits: memory: 128M reservations: memory: 64M networks: - internal alertmanager: image: prom/alertmanager:v0.16.1 command: --config.file=/etc/alertmanager/alertmanager.yml volumes: - ${VOLUME_PATH}config:/etc/alertmanager/ networks: - internal blackbox-exporter: image: prom/blackbox-exporter:v0.14.0 command: --config.file=/config/blackbox.yml volumes: - ${VOLUME_PATH}config:/config networks: - internal volumes: config: grafana: prometheus: networks: internal: driver: overlay attachable: true traefik: external: true name: traefik-net