blob: 78f83e10e25205c35ce1371c0793eca76032b27a [file] [log] [blame]
Richard Jankowskia1867962017-06-20 13:35:31 -04001#
Richard Jankowskicb33c472017-08-24 14:21:59 -04002# This stackfile deploys a Consul cluster to a docker swarm.
3#
4# The Consul cluster depends on:
5# - voltha_net (overlay network)
6#
7# To deploy the cluster, issue the command:
Richard Jankowskia1867962017-06-20 13:35:31 -04008#
9# docker stack deploy -c docker-compose-consul-cluster.yml consul
10#
11# This command will create overlay network 'consul_net'.
12#
Richard Jankowskicb33c472017-08-24 14:21:59 -040013
Richard Jankowski63ce1b42017-08-08 11:31:51 -040014version: "3"
15services:
Richard Jankowskia1867962017-06-20 13:35:31 -040016
17 consul:
Richard Jankowskicb33c472017-08-24 14:21:59 -040018 image: consul:0.9.2
Richard Jankowskia1867962017-06-20 13:35:31 -040019
20 # Deploy to all docker manager nodes
21 deploy:
Richard Jankowskicb33c472017-08-24 14:21:59 -040022 mode: global
Richard Jankowskia1867962017-06-20 13:35:31 -040023 placement:
24 constraints:
25 - node.role == manager
26 restart_policy:
27 condition: on-failure
28 environment:
29 CONSUL_LOCAL_CONFIG: "{disable_update_check: true}"
30 CONSUL_BIND_INTERFACE: eth0
31 entrypoint:
32 - consul
33 - agent
34 - -server
35 - -bootstrap-expect=3
36 - -config-dir=/consul/config
37 - -data-dir=/consul/data # mandatory property
38 - -bind={{ GetInterfaceIP "eth0" }}
39 - -client=0.0.0.0
40 - -ui
Richard Jankowskicb33c472017-08-24 14:21:59 -040041 - -raft-protocol=3
42 - -rejoin
Richard Jankowski63ce1b42017-08-08 11:31:51 -040043 - -retry-join=172.29.20.2
44 - -retry-join=172.29.20.3
45 - -retry-join=172.29.20.4
46 - -retry-join=172.29.20.5
47 - -retry-join=172.29.20.6
48 - -retry-join=172.29.20.7
Richard Jankowskia1867962017-06-20 13:35:31 -040049 networks:
50 - net
51 - voltha-net
52 ports:
53 - "8300:8300"
54 - "8400:8400"
55 - "8500:8500"
56 - "8600:8600/udp"
Richard Jankowskicb33c472017-08-24 14:21:59 -040057 volumes:
58 - /cord/incubator/voltha/consul/data:/consul/data
59 - /cord/incubator/voltha/consul/config:/consul/config
Richard Jankowskia1867962017-06-20 13:35:31 -040060
61networks:
62 net:
63 driver: overlay
schowdhuryd9084962017-06-21 14:51:49 -070064 driver_opts:
65 encrypted: "true"
Richard Jankowskia1867962017-06-20 13:35:31 -040066 ipam:
67 driver: default
68 config:
Richard Jankowski63ce1b42017-08-08 11:31:51 -040069 - subnet: 172.29.20.0/29
Richard Jankowskia1867962017-06-20 13:35:31 -040070 voltha-net:
71 external:
72 name: voltha_net