-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdocker-compose.yml
169 lines (168 loc) · 4.27 KB
/
docker-compose.yml
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
version: "3.7"
services:
traefik_init:
image: traefik:v1.7
command:
- "storeconfig"
- "--api"
- "--entrypoints=Name:http Address::80 Redirect.EntryPoint:https"
- "--entrypoints=Name:https Address::443 TLS"
- "--defaultentrypoints=http,https"
- "--acme"
- "--acme.storage=traefik/acme/account"
- "--acme.entryPoint=https"
- "--acme.httpChallenge.entryPoint=http"
- "--acme.onHostRule=true"
- "--acme.onDemand=false"
- "--acme.email=foobar@example.com"
- "--docker"
- "--docker.swarmMode"
- "--docker.domain=example.com"
- "--docker.watch"
- "--consul"
- "--consul.endpoint=haswarm_consul:8500"
- "--consul.prefix=traefik"
networks:
- traefik
deploy:
restart_policy:
condition: on-failure
delay: 10s
max_attempts: 5
window: 30s
depends_on:
- consul
traefik_master:
image: traefik:v2.2
depends_on:
- traefik_init
- consul
command:
- "--api"
- "--api.insecure=true"
- "--api.dashboard=true"
- "--providers.consul"
- "--providers.consul.endpoints=haswarm_consul:8500"
- "--providers.docker"
- "--providers.docker.swarmMode=true"
- "--providers.docker.endpoint=unix:///var/run/docker.sock"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
ports:
- target: 8080
published: 8080
protocol: tcp
mode: host
networks:
- traefik
deploy:
placement:
constraints:
- node.role == manager
update_config:
parallelism: 1
delay: 10s
restart_policy:
condition: any
traefik:
image: traefik:v2.2
depends_on:
- trafik_init
- traefik_master
- consul
command:
- "--providers.consul"
- "--providers.consul.endpoints=haswarm_consul:8500"
environment:
- SWARM_NODE="{{.Node.Hostname}}"
networks:
- webgateway
- traefik
ports:
- "80:80"
- "443:443"
deploy:
#mode: global
replicas: 3
placement:
constraints:
- node.labels.load_balancer == true
update_config:
parallelism: 1
delay: 10s
restart_policy:
condition: any
consul:
image: consul:1.7
command: agent -server -bootstrap-expect=1
environment:
- CONSUL_LOCAL_CONFIG={"datacenter":"hetzner","server":true}
- CONSUL_BIND_INTERFACE=eth0
- CONSUL_CLIENT_INTERFACE=eth0
deploy:
placement:
constraints:
- node.role == manager
restart_policy:
condition: any
delay: 10s
max_attempts: 100
window: 30s
networks:
- traefik
consul_backup:
image: consul:1.7
command: agent -server --retry-join=haswarm_consul
depends_on:
- consul
environment:
- CONSUL_LOCAL_CONFIG={"datacenter":"hetzner","server":true}
- CONSUL_BIND_INTERFACE=eth0
- CONSUL_CLIENT_INTERFACE=eth0
deploy:
placement:
constraints:
- node.hostname == docker3-prod
replicas: 1
restart_policy:
condition: any
delay: 10s
max_attempts: 100
window: 30s
networks:
- traefik
## These are for testing
# whoami:
# # A container that exposes an API to show its IP address
# image: containous/whoami
# deploy:
# restart_policy:
# condition: none
# replicas: 1
# labels:
# - traefik.http.routers.haswarm-whoami.rule=Host(`whoami.docker.localhost`)
# - traefik.http.services.haswarm-whoami.loadbalancer.server.port=80
# networks:
# - traefik
# environment:
# - SWARM_NODE="{{.Node.Hostname}}"
# alpine:
# # A container that exposes an API to show its IP address
# image: alpine
# command: tail -F anything
# deploy:
# restart_policy:
# condition: none
# replicas: 1
# labels:
# - "traefik.http.routers.whoami.rule=Host(`whoiswho.docker.localhost`)"
# networks:
# - traefik
# environment:
# - SWARM_NODE="{{.Node.Hostname}}"
networks:
webgateway:
driver: overlay
external: true
traefik:
driver: overlay