Skip to content

Instantly share code, notes, and snippets.

@yutopio
Created November 23, 2019 07:01
Show Gist options
  • Save yutopio/4a24dbaf29a2f0fd78f81e8e061b5b95 to your computer and use it in GitHub Desktop.
Save yutopio/4a24dbaf29a2f0fd78f81e8e061b5b95 to your computer and use it in GitHub Desktop.
Swarm visualizer + cAdvisor + InfluxDB + Grafana stack
# docker stack deploy -c monitor.yaml monitor
# docker exec `docker ps | grep -i influx | awk '{print $1}'` influx -execute 'CREATE DATABASE cadvisor'
version: '3.7'
services:
swarm-visualizer:
image: dockersamples/visualizer
ports:
- "9000:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
deploy:
replicas: 1
placement:
constraints:
- node.role == manager
cadvisor:
image: google/cadvisor
hostname: '{{.Node.Hostname}}'
command: -logtostderr -storage_driver=influxdb -storage_driver_db=cadvisor -storage_driver_host=influx:8086
ports:
- "8080:8080"
volumes:
- /:/rootfs:ro
- /var/run:/var/run:ro
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
- /dev/disk/:/dev/disk:ro
depends_on:
- influx
deploy:
mode: global
influx:
image: influxdb
volumes:
- influx:/var/lib/influxdb
deploy:
replicas: 1
placement:
constraints:
- node.role == manager
grafana:
image: grafana/grafana
ports:
- "3000:3000"
volumes:
- grafana:/var/lib/grafana
depends_on:
- influx
deploy:
replicas: 1
placement:
constraints:
- node.role == manager
volumes:
influx:
driver: local
grafana:
driver: local
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment