Created
October 11, 2021 07:21
-
-
Save prologic/780278c6919e490fbd9f9eb16f37d5f4 to your computer and use it in GitHub Desktop.
Consul Stack (Docker Swarm)
This file contains 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.8" | |
services: | |
seed: | |
image: consul:latest | |
environment: | |
- "CONSUL_LOCAL_CONFIG={\"disable_update_check\": true}" | |
- "CONSUL_BIND_INTERFACE=eth0" | |
entrypoint: | |
- timeout | |
- -sTERM | |
- "300" | |
- 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" | |
server: | |
image: consul:latest | |
entrypoint: | |
- consul | |
- agent | |
- -server | |
- -data-dir=/data | |
- -bind={{ GetInterfaceIP "eth0" }} | |
- -client=0.0.0.0 | |
- -retry-join=seed:8301 | |
- -ui | |
environment: | |
- "CONSUL_LOCAL_CONFIG={\"disable_update_check\": true}" | |
- "CONSUL_BIND_INTERFACE=eth0" | |
- "CONSUL_HTTP_ADDR=0.0.0.0" | |
volumes: | |
- consul:/data | |
networks: | |
- consul | |
- traefik | |
deploy: | |
mode: global | |
placement: | |
constraints: | |
- "node.role == manager" | |
labels: | |
- "traefik.enable=true" | |
- "traefik.docker.network=traefik" | |
- "traefik.http.services.consul_server.loadbalancer.server.port=8500" | |
- "traefik.http.routers.consul_server.rule=Host(`consul.mills.io`)" | |
- "traefik.http.routers.consul_server.priority=2" | |
restart_policy: | |
condition: on-failure | |
networks: | |
consul: | |
driver: overlay | |
traefik: | |
external: true | |
volumes: | |
consul: | |
driver: local |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment