diff --git a/README.md b/README.md index fbb2124..41293b4 100644 --- a/README.md +++ b/README.md @@ -94,3 +94,9 @@ Several projects utilize this Prometheus stack. Here's the list of projects: *Have an intersting Project which use this Repo? Submit yours to the list* +## Swarm mode Configuration + +edit file `docker-compose.yml` change `node.hostname = ` to your swarm node name for both `alertmanager` and `prometheus` +``` +docker stack deploy -c docker-compose.yml monitor +``` \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 7a1d66e..f5f5245 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: '2' +version: '3' volumes: prometheus_data: {} @@ -6,9 +6,7 @@ volumes: networks: front-tier: - driver: bridge back-tier: - driver: bridge services: prometheus: @@ -32,7 +30,10 @@ services: - cadvisor networks: - back-tier - + deploy: + placement: + constraints: + - node.hostname == node-exporter: container_name: node-exporter image: prom/node-exporter @@ -45,6 +46,7 @@ services: - 9100 networks: - back-tier + deploy: alertmanager: image: prom/alertmanager ports: @@ -56,7 +58,10 @@ services: command: - '-config.file=/etc/alertmanager/config.yml' - '-storage.path=/alertmanager' - + deploy: + placement: + constraints: + - node.hostname == cadvisor: image: google/cadvisor volumes: @@ -68,6 +73,8 @@ services: - 8080 networks: - back-tier + deploy: + mode: global grafana: image: grafana/grafana @@ -81,4 +88,4 @@ services: - config.monitoring networks: - back-tier - - front-tier + - front-tier \ No newline at end of file