Created
January 14, 2019 05:36
-
-
Save prologic/7a2efaa659f43a0b2e4c9a46bd93e0f9 to your computer and use it in GitHub Desktop.
Docker Stack for Consul
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.4" | |
services: | |
seed: | |
image: consul:latest | |
environment: | |
- "CONSUL_LOCAL_CONFIG={\"disable_update_check\": true}" | |
- "CONSUL_BIND_INTERFACE=eth0" | |
entrypoint: | |
- timeout #this seed fires up the cluster after which it is no longer needed | |
- -sTERM #this is the same signal as docker would send on a scale down / stop | |
- -t300 #terminate after 5 mins | |
- consul | |
- agent | |
- -server | |
- -bootstrap-expect=3 | |
- -data-dir=/tmp/consuldata | |
- -bind={{ GetInterfaceIP "eth0" }} | |
networks: | |
- consul | |
deploy: | |
restart_policy: | |
condition: none | |
replicas: 1 | |
placement: | |
constraints: | |
- "node.role == manager" | |
cluster: | |
image: consul:latest | |
environment: | |
- "CONSUL_LOCAL_CONFIG={\"disable_update_check\": true}" | |
- "CONSUL_BIND_INTERFACE=eth0" | |
- "CONSUL_HTTP_ADDR=0.0.0.0" | |
entrypoint: | |
- consul | |
- agent | |
- -server | |
- -data-dir=/tmp/consul | |
- -bind={{ GetInterfaceIP "eth0" }} | |
- -client=0.0.0.0 | |
- -retry-join=seed:8301 | |
- -ui ##assuming you want the UI on | |
networks: | |
- "consul" | |
ports: | |
- "8600:8600" | |
deploy: | |
mode: global ##this will deploy to all nodes that | |
labels: | |
- "traefik.enable=true" | |
- "traefik.port=8500" | |
- "traefik.backend=consul" | |
- "traefik.docker.network=traefik" | |
- "traefik.frontend.rule=Host:consul.mydomain.tld" | |
networks: | |
consul: | |
driver: overlay | |
traefik: | |
external: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment