-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml.tmpl
56 lines (52 loc) · 1.4 KB
/
docker-compose.yml.tmpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
version: '3.6'
services:
{{env['DOCKER_SERVICE']}}:
image: consul
command: agent -config-file=/consul/config/config.json
{% if env['PERSISTENCE_DRIVER']|length -%}
volumes:
- {{env['DOCKER_SERVICE']}}-data:/consul/data
{%+ endif -%}
configs:
- source: consul_json
target: /consul/config/config.json
mode: 444
deploy:
replicas: 1
placement:
constraints:
- node.role == manager
restart_policy:
condition: on-failure
networks:
- vault-backend
- traefik-net
deploy:
labels:
- "traefik.enable=true"
- "traefik.http.routers.consul.rule=Host(`{{env['DOCKER_STACK']}}.{{env['DNS_SUFFIX']}}`)"
- "traefik.http.routers.consul.entrypoints=http"
- "traefik.http.services.consul.loadbalancer.server.port=8500"
{% if env['PERSISTENCE_DRIVER']|length -%}
volumes:
{{env['DOCKER_SERVICE']}}-data:
{% if env['PERSISTENCE_DRIVER'] == "vxflex" -%}
driver: rexray/scaleio
driver_opts:
size: 50
{% elif env['PERSISTENCE_DRIVER'] == "nfs" -%}
driver: local
driver_opts:
type: nfs
o: addr={{env['NFS_SERVER']}},rw
device: ":{{env['NFS_SHARE']}}/{{env['DOCKER_STACK']}}"
{% endif %}
{%+ endif -%}
configs:
consul_json:
file: ./consul/config/consul-config.json
networks:
vault-backend:
external: true
traefik-net:
external: true