Unverified Commit 68131ee2 authored by 田浩's avatar 田浩 Committed by GitHub
Browse files

Merge pull request #85 from llitfkitfk/version-2

using hostname env for docker stack deploy
parents e5f8ba10 c6b5d73f
......@@ -28,19 +28,9 @@ Clone the project locally to your Docker host.
If you would like to change which targets should be monitored or make configuration changes edit the [/prometheus/prometheus.yml](https://github.com/vegasbrianc/prometheus/blob/version-2/prometheus/prometheus.yml) file. The targets section is where you define what should be monitored by Prometheus. The names defined in this file are actually sourced from the service name in the docker-compose file. If you wish to change names of the services you can add the "container_name" parameter in the `docker-compose.yml` file.
**Note**: before deploy the stack, need modify the docker-compose.yml
```
...
deploy:
placement:
constraints:
- node.hostname == <hostname-of-swarm-node-where-config-files-exist>
...
```
Once configurations are done let's start it up. From the /prometheus project directory run the following command:
$ docker stack deploy -c docker-compose.yml prom
$ HOSTNAME=$(hostname) docker stack deploy -c docker-compose.yml prom
That's it the `docker stack deploy' command deploys the entire Grafana and Prometheus stack automagically to the Docker Swarm. By default cAdvisor and node-exporter are set to Global deployment which means they will propogate to every docker host attached to the Swarm.
......
......@@ -33,7 +33,7 @@ services:
deploy:
placement:
constraints:
- node.hostname == moby
- node.hostname == ${HOSTNAME}
node-exporter:
image: prom/node-exporter
......@@ -69,7 +69,7 @@ services:
deploy:
placement:
constraints:
- node.hostname == moby
- node.hostname == ${HOSTNAME}
cadvisor:
image: google/cadvisor
volumes:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment