blob: 16a4a459f2d0a48837ff7433a03b43e9cd3ad7c0 [file] [log] [blame]
# Copyright 2017 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# 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: "${REGISTRY}consul:${CONSUL_TAG:-0.9.2}"
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: 3
# Deploy to all docker manager nodes
deploy:
mode: global
placement:
constraints:
- node.role == manager
restart_policy:
condition: on-failure
entrypoint:
- consul
- agent
- -server
- -bootstrap-expect=${SWARM_MANAGER_COUNT:-3}
- -config-dir=/consul/config
- -data-dir=/consul/data # mandatory property
- -client=0.0.0.0
- -advertise={{ GetAllInterfaces | include "network" "172.29.20.0/29" | sort "size,address" | attr "address" }}
- -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:
- ${CONSUL_ROOT:-/cord/incubator/voltha/consul}/data:/consul/data
- ${CONSUL_ROOT:-/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