update docker-compose.yml to support swarm mode
This commit is contained in:
parent
832be55eea
commit
7b5657d006
|
@ -1,38 +1,41 @@
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
prometheus_data: {}
|
prometheus-config:
|
||||||
grafana_data: {}
|
external:
|
||||||
|
name: prometheus-config
|
||||||
|
prometheus-data:
|
||||||
|
grafana-data:
|
||||||
|
alertmanager-config:
|
||||||
|
external:
|
||||||
|
name: alertmanager-config
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
front-tier:
|
front-tier:
|
||||||
driver: bridge
|
|
||||||
back-tier:
|
back-tier:
|
||||||
driver: bridge
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
prometheus:
|
prometheus:
|
||||||
image: prom/prometheus
|
image: prom/prometheus
|
||||||
container_name: prometheus
|
container_name: prometheus
|
||||||
volumes:
|
volumes:
|
||||||
- ./prometheus/:/etc/prometheus/
|
- prometheus-config:/etc/prometheus/
|
||||||
- prometheus_data:/prometheus
|
- prometheus-data:/prometheus
|
||||||
command:
|
command:
|
||||||
- '-config.file=/etc/prometheus/prometheus.yml'
|
- '-config.file=/etc/prometheus/prometheus.yml'
|
||||||
- '-storage.local.path=/prometheus'
|
- '-storage.local.path=/prometheus'
|
||||||
- '-alertmanager.url=http://alertmanager:9093'
|
- '-alertmanager.url=http://alertmanager:9093'
|
||||||
expose:
|
|
||||||
- 9090
|
|
||||||
ports:
|
ports:
|
||||||
- 9090:9090
|
- 9090:9090
|
||||||
links:
|
|
||||||
- cadvisor:cadvisor
|
|
||||||
- alertmanager:alertmanager
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- cadvisor
|
- cadvisor
|
||||||
networks:
|
networks:
|
||||||
- back-tier
|
- back-tier
|
||||||
|
deploy:
|
||||||
|
placement:
|
||||||
|
constraints:
|
||||||
|
- node.role == manager
|
||||||
|
- node.hostname == node1
|
||||||
node-exporter:
|
node-exporter:
|
||||||
container_name: node-exporter
|
container_name: node-exporter
|
||||||
image: prom/node-exporter
|
image: prom/node-exporter
|
||||||
|
@ -45,18 +48,18 @@ services:
|
||||||
- 9100
|
- 9100
|
||||||
networks:
|
networks:
|
||||||
- back-tier
|
- back-tier
|
||||||
alertmanager:
|
deploy:
|
||||||
image: prom/alertmanager
|
# alertmanager:
|
||||||
ports:
|
# image: prom/alertmanager
|
||||||
- 9093:9093
|
# ports:
|
||||||
volumes:
|
# - 9093:9093
|
||||||
- ./alertmanager/:/etc/alertmanager/
|
# volumes:
|
||||||
networks:
|
# - alertmanager-config:/etc/alertmanager/
|
||||||
- back-tier
|
# networks:
|
||||||
command:
|
# - back-tier
|
||||||
- '-config.file=/etc/alertmanager/config.yml'
|
# command:
|
||||||
- '-storage.path=/alertmanager'
|
# - '-config.file=/etc/alertmanager/config.yml'
|
||||||
|
# - '-storage.path=/alertmanager'
|
||||||
cadvisor:
|
cadvisor:
|
||||||
image: google/cadvisor
|
image: google/cadvisor
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -64,11 +67,10 @@ services:
|
||||||
- /var/run:/var/run:rw
|
- /var/run:/var/run:rw
|
||||||
- /sys:/sys:ro
|
- /sys:/sys:ro
|
||||||
- /var/lib/docker/:/var/lib/docker:ro
|
- /var/lib/docker/:/var/lib/docker:ro
|
||||||
expose:
|
|
||||||
- 8080
|
|
||||||
networks:
|
networks:
|
||||||
- back-tier
|
- back-tier
|
||||||
|
deploy:
|
||||||
|
mode: global
|
||||||
grafana:
|
grafana:
|
||||||
image: grafana/grafana
|
image: grafana/grafana
|
||||||
depends_on:
|
depends_on:
|
||||||
|
@ -76,7 +78,7 @@ services:
|
||||||
ports:
|
ports:
|
||||||
- 3000:3000
|
- 3000:3000
|
||||||
volumes:
|
volumes:
|
||||||
- grafana_data:/var/lib/grafana
|
- grafana-data:/var/lib/grafana
|
||||||
env_file:
|
env_file:
|
||||||
- config.monitoring
|
- config.monitoring
|
||||||
networks:
|
networks:
|
||||||
|
|
Loading…
Reference in New Issue