blob: 78f83e10e25205c35ce1371c0793eca76032b27a [file] [log] [blame]
#
# This stackfile deploys a Consul cluster to a docker swarm.
#
# The Consul cluster depends on:
# - voltha_net (overlay network)
#
# To deploy the cluster, issue the command:
#
# docker stack deploy -c docker-compose-consul-cluster.yml consul
#
# This command will create overlay network 'consul_net'.
#
version: "3"
services:
consul:
image: consul:0.9.2
# Deploy to all docker manager nodes
deploy:
mode: global
placement:
constraints:
- node.role == manager
restart_policy:
condition: on-failure
environment:
CONSUL_LOCAL_CONFIG: "{disable_update_check: true}"
CONSUL_BIND_INTERFACE: eth0
entrypoint:
- consul
- agent
- -server
- -bootstrap-expect=3
- -config-dir=/consul/config
- -data-dir=/consul/data # mandatory property
- -bind={{ GetInterfaceIP "eth0" }}
- -client=0.0.0.0
- -ui
- -raft-protocol=3
- -rejoin
- -retry-join=172.29.20.2
- -retry-join=172.29.20.3
- -retry-join=172.29.20.4
- -retry-join=172.29.20.5
- -retry-join=172.29.20.6
- -retry-join=172.29.20.7
networks:
- net
- voltha-net
ports:
- "8300:8300"
- "8400:8400"
- "8500:8500"
- "8600:8600/udp"
volumes:
- /cord/incubator/voltha/consul/data:/consul/data
- /cord/incubator/voltha/consul/config:/consul/config
networks:
net:
driver: overlay
driver_opts:
encrypted: "true"
ipam:
driver: default
config:
- subnet: 172.29.20.0/29
voltha-net:
external:
name: voltha_net