-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
415 lines (371 loc) · 9.36 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
---
version: "3.7"
## DSL Config
x-influxlog: &syslog
logging:
driver: syslog
options:
#syslog-address: "udp://{{.Node.Hostname}}:6154"
#syslog-address: "udp://{{.Swarm.NodeAddr}}:6154"
syslog-address: "udp://127.0.0.1:6154"
syslog-format: rfc5424micro
tag: "{{.ImageName}}/{{.Name}}/{{.ID}}"
x-replicas: &replicated
replicas: 1
x-global: &global
mode: global
x-worker: &worker
placement:
constraints: [node.role == worker]
x-manager: &manager
placement:
constraints: [node.role == manager]
x-restart: &on-failure
restart_policy:
condition: on-failure
max_attempts: 3
delay: 5s
rollback_config:
parallelism: 2
delay: 10s
monitor: 10s
order: start-first
failure_action: continue
update_config:
parallelism: 2
delay: 10s
monitor: 10s
order: start-first
failure_action: rollback
x-stop-grace: &stopperiod
stop_grace_period: 30s
x-default-healthcheck: &heathcheck-pass
test: ["CMD", "exit 0"]
interval: 25s
timeout: 5s
retries: 3
x-traefik-off: &traefik-off
traefik.enabled: "false"
x-traefik-on: &traefik-on
traefik.enabled: "true"
traefik.frontend.errors.network.backend: "error"
traefik.frontend.errors.network.query: "/"
traefik.frontend.errors.network.status: "404,500-511"
traefik.frontned.entrypoints: 'http,https,ws,wss'
traefik.frontend.priority: "5"
traefik.port: "80"
x-default-route: &default-route
<<: *traefik-on
traefik.frontend.rule: "HostRegexp:{catchall:.*}"
traefik.frontend.priority: "1"
x-vhost-route: &vhost-route
<<: *traefik-on
traefik.frontend.priority: "10"
x-orbiter-disable: &orbiter-off
orbiter: "false"
<<: *traefik-off
x-orbiter-enable: &orbiter-on
orbiter: "true"
orbiter.up: "3"
orbiter.down: "1"
<<: *traefik-on
configs:
telegraf.conf:
file: ./config/telegraf.conf
name: telegraf.conf-${RELEASE_VERSION}
kapacitor.conf:
file: ./config/kapacitor.conf
name: kapacitor.conf-${RELEASE_VERSION}
haasio.yml:
file: ./config/haasio.yml
name: haasio.yml-${RELEASE_VERSION}
volumes:
mqtt-data: {}
chronograf-data: {}
kapacitor-data: {}
influxdb-data: {}
portainer_data: {}
networks:
internal:
external: true
name: internal
default:
external: true
name: ${DEFAULT_NETWORK}
services:
influxdb:
ports:
- "8086/tcp"
networks:
- internal
image: influxdb:latest
deploy:
<<: *replicated
<<: *on-failure
<<: *manager
labels:
<<: *orbiter-on
<<: *vhost-route
traefik.frontend.rule: "Host:influx.${DOMAINNAME}"
traefik.frontend.port: "8086"
broker:
image: matteocollina/mosca:latest
ports:
- "1883:1883"
- "80/tcp"
deploy:
<<: *replicated
<<: *on-failure
labels:
<<: *orbiter-on
<<: *vhost-route
traefik.port: "80"
traefik.frontend.rule: "Host:broker.${DOMAINNAME}"
volumes:
- mqtt-data:/db
networks:
- default
depends_on:
- influxdb
telegraf:
image: telegraf:latest
hostname: "{{.Node.ID}}"
configs:
- source: telegraf.conf
target: /etc/telegraf/telegraf.conf
ports:
- "6514:6514/tcp"
- "6514:6514/udp"
deploy:
<<: *global
<<: *on-failure
labels:
<<: *orbiter-off
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /:/hostfs:ro
environment:
HOST_MOUNT_PREFIX: "/hostfs"
HOST_MOUNT_PROC: "/hostfs/proc"
DOCKER_HOST: "unix:///var/run/docker.sock"
networks:
internal:
aliases:
- telegraf
depends_on:
- influxdb
kapacitor:
image: kapacitor:latest
hostname: "{{.Node.ID}}"
configs:
- source: kapacitor.conf
target: /etc/kapacitor/kapacitor.conf
deploy:
<<: *manager
<<: *replicated
<<: *on-failure
labels:
<<: *orbiter-off
volumes:
- kapacitor-data:/var/lib/kapacitor
- /var/run/docker.sock:/var/run/docker.sock
ports:
# The API for Kapacitor is served on port 9092
- "9092/tcp"
networks:
- internal
depends_on:
- influxdb
shepherd:
image: 'mazzolino/shepherd'
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
# /root/.docker/config.json:/root/.docker/config.json:ro
environment:
SLEEP_TIME: "5m"
BLACKLIST_SERVICES: "shepherd autoscale traefik agent"
WITH_REGISTRY_AUTH: "true"
DOCKER_HOST: "unix:///var/run/docker.sock"
deploy:
<<: *on-failure
<<: *global
<<: *manager
labels:
<<: *orbiter-off
autoscale:
image: gianarb/orbiter:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
deploy:
<<: *manager
<<: *global
<<: *on-failure
labels:
<<: *orbiter-off
<<: *vhost-route
traefik.port: "8000"
traefik.frontend.rule: "Host:autoscale.${DOMAINNAME}"
ports:
- '8000/tcp'
adminagent:
image: portainer/agent:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
ports:
- target: 9001
published: 9001
protocol: tcp
mode: host
environment:
AGENT_CLUSTER_ADDR: tasks.adminagent
networks:
- internal
deploy:
<<: *global
<<: *manager
<<: *on-failure
labels:
orbiter: "false"
traefik.enable: "false"
# TODO: acme && cloudflair
loadbalancer:
image: traefik:1.7
command: |
--docker
--docker.useBindPortIP=true
--docker.swarmmode
--docker.watch
--docker.domain=${DOMAINNAME}
--docker.network=${DEFAULT_NETWORK}
--docker.exposedbydefault=true
--logLevel=DEBUG
--entryPoints="Name:http Address::80 Redirect.EntryPoint:https"
--entryPoints="Name:https Address::443 TLS" #Redirect.EntryPoint:https
--defaultentrypoints="http,https,ws,wss"
--api
--api.entryPoint=traefik
--api.dashboard=true
--accesslog
--ping
--ping.entrypoint=http
--web.metrics.influxdb=true
--web.metrics.influxdb.address=influxdb:8086
--web.metrics.influxdb.database=telegraf
--web.metrics.influxdb.protocol=http
--tracing
--tracing.backend=zipkin
--tracing.spanNameLimit=265
deploy:
<<: *manager
<<: *replicated
<<: *on-failure
labels:
<<: *vhost-route
<<: *orbiter-off
traefik.port: "8080"
traefik.frontend.rule: "Host:loadbalancer.${DOMAINNAME}"
ports:
- "80:80/tcp"
- "443:443/tcp"
- "8080/tcp"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /dev/null:/traefik.toml
networks:
- default
- internal
depends_on:
- influxdb
- telegraf
admin:
image: 'portainer/portainer:latest'
ports:
- '9000/tcp'
networks:
- default
- internal
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
depends_on:
- agent
- telegraf
command: |
-H "tcp://tasks.adminagent:9001"
--tlsskipverify
--no-auth
--no-analytics
--logo "https://dms-discourse-static.s3.amazonaws.com/original/3X/4/8/482ecb2309ea9a1892d570a6b4da6a77e84da941.png"
deploy:
<<: *replicated
<<: *on-failure
labels:
<<: *default-route
<<: *orbiter-on
traefik.frontend.priority: 3
traefik.port: "9000"
monitoring:
image: chronograf:latest
deploy:
<<: *replicated
<<: *on-failure
labels:
<<: *vhost-route
<<: *orbiter-on
traefik.port: "8888"
traefik.frontend.rule: "Host:monitoring.${DOMAINNAME}"
ports:
- '8888/tcp'
volumes:
- chronograf-data:/var/lib/chronograf
networks:
- internal
- default
depends_on:
- influxdb
- kapacitor
- telegraf
command: --influxdb-url=http://influxdb:8086 --kapacitor-url=http://kapacitor:9092
homeassistant:
image: 'homeassistant/home-assistant:latest'
configs:
- source: haasio.yml
target: /config/configuration.yaml
ports:
- "8123/tcp"
deploy:
<<: *replicated
<<: *on-failure
labels:
<<: *orbiter-on
<<: *vhost-route
traefik.frontend.rule: "Host:dashboard:${DOMAINNAME}"
traefik.port: 8123
errorpage:
image: 'guillaumebriday/traefik-custom-error-pages:latest'
ports:
- '80/tcp'
networks:
- default
deploy:
<<: *replicated
<<: *on-failure
labels:
<<: *orbiter-on
<<: *default-route
traefik.backend: "error"
systemprune:
deploy:
<<: *global
restart_policy:
condition: any
delay: 72h
<<: *on-failure
labels:
<<: *orbiter-off
volumes:
- /var/run/docker.sock:/var/run/docker.sock
image: docker:dind
command: system prune -af --filter "until=24h" --filter="label!=net.matrix.application==infrastructure"
...
# vim: set sts=2 sw=2 ts=2 et ai: