Richard Jankowski | a186796 | 2017-06-20 13:35:31 -0400 | [diff] [blame] | 1 | # |
Richard Jankowski | cb33c47 | 2017-08-24 14:21:59 -0400 | [diff] [blame] | 2 | # 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 Jankowski | a186796 | 2017-06-20 13:35:31 -0400 | [diff] [blame] | 8 | # |
| 9 | # docker stack deploy -c docker-compose-consul-cluster.yml consul |
| 10 | # |
| 11 | # This command will create overlay network 'consul_net'. |
| 12 | # |
Richard Jankowski | cb33c47 | 2017-08-24 14:21:59 -0400 | [diff] [blame] | 13 | |
Richard Jankowski | 63ce1b4 | 2017-08-08 11:31:51 -0400 | [diff] [blame] | 14 | version: "3" |
| 15 | services: |
Richard Jankowski | a186796 | 2017-06-20 13:35:31 -0400 | [diff] [blame] | 16 | |
| 17 | consul: |
Richard Jankowski | cb33c47 | 2017-08-24 14:21:59 -0400 | [diff] [blame] | 18 | image: consul:0.9.2 |
Richard Jankowski | a186796 | 2017-06-20 13:35:31 -0400 | [diff] [blame] | 19 | |
| 20 | # Deploy to all docker manager nodes |
| 21 | deploy: |
Richard Jankowski | cb33c47 | 2017-08-24 14:21:59 -0400 | [diff] [blame] | 22 | mode: global |
Richard Jankowski | a186796 | 2017-06-20 13:35:31 -0400 | [diff] [blame] | 23 | 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 Jankowski | cb33c47 | 2017-08-24 14:21:59 -0400 | [diff] [blame] | 41 | - -raft-protocol=3 |
| 42 | - -rejoin |
Richard Jankowski | 63ce1b4 | 2017-08-08 11:31:51 -0400 | [diff] [blame] | 43 | - -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 Jankowski | a186796 | 2017-06-20 13:35:31 -0400 | [diff] [blame] | 49 | networks: |
| 50 | - net |
| 51 | - voltha-net |
| 52 | ports: |
| 53 | - "8300:8300" |
| 54 | - "8400:8400" |
| 55 | - "8500:8500" |
| 56 | - "8600:8600/udp" |
Richard Jankowski | cb33c47 | 2017-08-24 14:21:59 -0400 | [diff] [blame] | 57 | volumes: |
| 58 | - /cord/incubator/voltha/consul/data:/consul/data |
| 59 | - /cord/incubator/voltha/consul/config:/consul/config |
Richard Jankowski | a186796 | 2017-06-20 13:35:31 -0400 | [diff] [blame] | 60 | |
| 61 | networks: |
| 62 | net: |
| 63 | driver: overlay |
schowdhury | d908496 | 2017-06-21 14:51:49 -0700 | [diff] [blame] | 64 | driver_opts: |
| 65 | encrypted: "true" |
Richard Jankowski | a186796 | 2017-06-20 13:35:31 -0400 | [diff] [blame] | 66 | ipam: |
| 67 | driver: default |
| 68 | config: |
Richard Jankowski | 63ce1b4 | 2017-08-08 11:31:51 -0400 | [diff] [blame] | 69 | - subnet: 172.29.20.0/29 |
Richard Jankowski | a186796 | 2017-06-20 13:35:31 -0400 | [diff] [blame] | 70 | voltha-net: |
| 71 | external: |
| 72 | name: voltha_net |