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 |
David K. Bainbridge | e45c194 | 2017-10-12 07:49:14 -0700 | [diff] [blame] | 19 | logging: |
| 20 | driver: "json-file" |
| 21 | options: |
| 22 | max-size: "10m" |
| 23 | max-file: 3 |
Richard Jankowski | a186796 | 2017-06-20 13:35:31 -0400 | [diff] [blame] | 24 | |
| 25 | # Deploy to all docker manager nodes |
| 26 | deploy: |
Richard Jankowski | cb33c47 | 2017-08-24 14:21:59 -0400 | [diff] [blame] | 27 | mode: global |
Richard Jankowski | a186796 | 2017-06-20 13:35:31 -0400 | [diff] [blame] | 28 | 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 Jankowski | cb33c47 | 2017-08-24 14:21:59 -0400 | [diff] [blame] | 46 | - -raft-protocol=3 |
| 47 | - -rejoin |
Richard Jankowski | 63ce1b4 | 2017-08-08 11:31:51 -0400 | [diff] [blame] | 48 | - -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 Jankowski | a186796 | 2017-06-20 13:35:31 -0400 | [diff] [blame] | 54 | networks: |
| 55 | - net |
| 56 | - voltha-net |
| 57 | ports: |
| 58 | - "8300:8300" |
| 59 | - "8400:8400" |
| 60 | - "8500:8500" |
| 61 | - "8600:8600/udp" |
Richard Jankowski | cb33c47 | 2017-08-24 14:21:59 -0400 | [diff] [blame] | 62 | volumes: |
| 63 | - /cord/incubator/voltha/consul/data:/consul/data |
| 64 | - /cord/incubator/voltha/consul/config:/consul/config |
Richard Jankowski | a186796 | 2017-06-20 13:35:31 -0400 | [diff] [blame] | 65 | |
| 66 | networks: |
| 67 | net: |
| 68 | driver: overlay |
schowdhury | d908496 | 2017-06-21 14:51:49 -0700 | [diff] [blame] | 69 | driver_opts: |
| 70 | encrypted: "true" |
Richard Jankowski | a186796 | 2017-06-20 13:35:31 -0400 | [diff] [blame] | 71 | ipam: |
| 72 | driver: default |
| 73 | config: |
Richard Jankowski | 63ce1b4 | 2017-08-08 11:31:51 -0400 | [diff] [blame] | 74 | - subnet: 172.29.20.0/29 |
Richard Jankowski | a186796 | 2017-06-20 13:35:31 -0400 | [diff] [blame] | 75 | voltha-net: |
| 76 | external: |
| 77 | name: voltha_net |