blob: 5bd37b9dca4da18e3cc6c8a2e3721298aa17327c [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
David K. Bainbridge4e920b72017-10-12 07:49:14 -070019 logging:
20 driver: "json-file"
21 options:
22 max-size: "10m"
23 max-file: 3
Richard Jankowskia1867962017-06-20 13:35:31 -040024
25 # Deploy to all docker manager nodes
26 deploy:
Richard Jankowskicb33c472017-08-24 14:21:59 -040027 mode: global
Richard Jankowskia1867962017-06-20 13:35:31 -040028 placement:
29 constraints:
30 - node.role == manager
31 restart_policy:
32 condition: on-failure
33 environment:
34 CONSUL_LOCAL_CONFIG: "{disable_update_check: true}"
35 CONSUL_BIND_INTERFACE: eth0
36 entrypoint:
37 - consul
38 - agent
39 - -server
40 - -bootstrap-expect=3
41 - -config-dir=/consul/config
42 - -data-dir=/consul/data # mandatory property
43 - -bind={{ GetInterfaceIP "eth0" }}
44 - -client=0.0.0.0
45 - -ui
Richard Jankowskicb33c472017-08-24 14:21:59 -040046 - -raft-protocol=3
47 - -rejoin
Richard Jankowski63ce1b42017-08-08 11:31:51 -040048 - -retry-join=172.29.20.2
49 - -retry-join=172.29.20.3
50 - -retry-join=172.29.20.4
51 - -retry-join=172.29.20.5
52 - -retry-join=172.29.20.6
53 - -retry-join=172.29.20.7
Richard Jankowskia1867962017-06-20 13:35:31 -040054 networks:
55 - net
56 - voltha-net
57 ports:
58 - "8300:8300"
59 - "8400:8400"
60 - "8500:8500"
61 - "8600:8600/udp"
Richard Jankowskicb33c472017-08-24 14:21:59 -040062 volumes:
63 - /cord/incubator/voltha/consul/data:/consul/data
64 - /cord/incubator/voltha/consul/config:/consul/config
Richard Jankowskia1867962017-06-20 13:35:31 -040065
66networks:
67 net:
68 driver: overlay
schowdhuryd9084962017-06-21 14:51:49 -070069 driver_opts:
70 encrypted: "true"
Richard Jankowskia1867962017-06-20 13:35:31 -040071 ipam:
72 driver: default
73 config:
Richard Jankowski63ce1b42017-08-08 11:31:51 -040074 - subnet: 172.29.20.0/29
Richard Jankowskia1867962017-06-20 13:35:31 -040075 voltha-net:
76 external:
77 name: voltha_net