forked from swarmstack/swarmstack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
536 lines (509 loc) · 15.2 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
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
version: "3.5"
networks:
net:
driver: overlay
driver_opts:
encrypted: "true"
attachable: true
volumes:
alertmanager:
driver: pxd
driver_opts:
repl: 2
size: 2
alertmanagerB:
driver: pxd
driver_opts:
repl: 2
size: 2
caddycerts:
driver: pxd
driver_opts:
repl: 2
size: 1
grafana:
driver: pxd
driver_opts:
repl: 2
size: 10
portainer_data:
driver: pxd
driver_opts:
repl: 2
size: 10
portainer_certs:
driver: pxd
driver_opts:
repl: 2
size: 1
prometheus:
driver: pxd
driver_opts:
repl: 2
size: 10
swarm-endpoints:
driver: pxd
driver_opts:
repl: 2
size: 1
shared: "true"
configs:
alertmanager_config:
file: ./alertmanager/conf/alertmanager.yml
name: alertmanager_config$CONFALERTMANANGER
caddy_config:
file: ./caddy/Caddyfile
name: caddy_config$CONFCADDY
caddy_www:
file: ./caddy/index.html
name: caddy_www$CONFCADDY
#caddy_cert:
# file: ./caddy/caddycerts/cert.pem
# name: caddy_cert$CONFCADDYCERT
#caddy_key:
# file: ./caddy/caddycerts/key.pem
# name: caddy_key$CONFCADDYCERT
docker_garbage_collection:
file: ./docker-gc-exclude
name: docker_garbage_collection$CONFDOCKERGC
grafana_dashboards_nodes:
file: ./grafana/dashboards/nodes-netdata-dockerd-cadvisor.json
#file: ./grafana/dashboards/nodes-node-exporter-dockerd-cadvisor.json
name: grafana_dashboards_nodes$CONFGRAFANADASH
grafana_dashboards_containers:
file: ./grafana/dashboards/containers-netdata-dockerd-cadvisor.json
#file: ./grafana/dashboards/containers-node-exporter-dockerd-cadvisor.json
name: grafana_dashboards_containers$CONFGRAFANADASH
grafana_dashboards_etcd_cluster:
file: ./grafana/dashboards/etcd-cluster.json
name: grafana_dashboards_etcd_cluster$CONFGRAFANADASH
grafana_dashboards_portworx_cluster_status:
file: ./grafana/dashboards/portworx-cluster-status.json
name: grafana_dashboards_portworx_cluster_status$CONFGRAFANADASH
grafana_dashboards_portworx_volumes_status:
file: ./grafana/dashboards/portworx-volumes-status.json
name: grafana_dashboards_portworx_volumes_status$CONFGRAFANADASH
grafana_dashboards_prometheus_2_stats:
file: ./grafana/dashboards/prometheus-2-stats.json
name: grafana_dashboards_prometheus_2_stats$CONFGRAFANADASH
grafana_provisioning_datasources:
file: ./grafana/datasources/prometheus.yaml
grafana_provisioning_dashboards:
file: ./grafana/dashboards.yml
karma_conf:
file: ./karma/karma.yaml
name: karma_conf$CONFKARMA
prometheus_conf:
file: ./prometheus/conf/prometheus.yml
name: prometheus_conf$CONFPROM
prometheus_rules_nodes:
file: ./prometheus/rules/nodes.yml
name: prometheus_rules_nodes$CONFPROMRULES
prometheus_rules_containers:
file: ./prometheus/rules/containers.yml
name: prometheus_rules_containers$CONFPROMRULES
prometheus_rules_portworx:
file: ./prometheus/rules/portworx.yml
name: prometheus_rules_portworx$CONFPROMRULES
services:
alertmanager:
image: prom/alertmanager:latest
command:
- '--config.file=/etc/alertmanager/alertmanager.yml'
- '--storage.path=/alertmanager'
- '--cluster.listen-address=0.0.0.0:9094'
- '--cluster.advertise-address=:9094'
- '--cluster.peer=alertmanagerB:9094'
configs:
- source: alertmanager_config
target: /etc/alertmanager/alertmanager.yml
deploy:
labels:
prometheus.enable: "true"
prometheus.port: "9093"
prometheus.path: "/metrics"
mode: replicated
placement:
constraints:
- node.Labels.storagegroup==RED
replicas: 1
resources:
limits:
memory: 128M
reservations:
memory: 64M
healthcheck:
test: "/bin/wget -q -Y off http://localhost:9093/metrics -O /dev/null > /dev/null 2>&1"
interval: 25s
timeout: 3s
start_period: 30s
networks:
- net
volumes:
- alertmanager:/alertmanager
alertmanagerB:
image: prom/alertmanager:latest
command:
- '--config.file=/etc/alertmanager/alertmanager.yml'
- '--storage.path=/alertmanager'
- '--cluster.listen-address=0.0.0.0:9094'
- '--cluster.advertise-address=:9094'
- '--cluster.peer=alertmanager:9094'
configs:
- source: alertmanager_config
target: /etc/alertmanager/alertmanager.yml
deploy:
labels:
prometheus.enable: "true"
prometheus.port: "9093"
prometheus.path: "/metrics"
mode: replicated
placement:
constraints:
- node.Labels.storagegroup==RED
replicas: 1
resources:
limits:
memory: 128M
reservations:
memory: 64M
healthcheck:
test: "/bin/wget -q -Y off http://localhost:9093/metrics -O /dev/null > /dev/null 2>&1"
interval: 25s
timeout: 3s
start_period: 30s
networks:
- net
volumes:
- alertmanagerB:/alertmanager
caddy:
image: swarmstack/caddy:no-stats
configs:
- source: caddy_config
target: /etc/Caddyfile
- source: caddy_www
target: /www/index.html
#- source: caddy_cert
# target: /etc/caddycerts/cert.pem
#- source: caddy_key
# target: /etc/caddycerts/key.pem
deploy:
labels:
prometheus.enable: "true"
prometheus.port: "9180"
prometheus.path: "/metrics"
mode: replicated
placement:
constraints:
- node.Labels.storagegroup==RED
replicas: 1
resources:
limits:
memory: 128M
reservations:
memory: 64M
environment:
- ADMIN_USER=${ADMIN_USER:-admin}
- ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin}
- CADDY_CERT=${CADDY_CERT:-self_signed}
- CADDY_KEY=${CADDY_KEY:-}
- CADDY_URL=${CADDY_URL:-}
- CADDYPATH=/etc/caddycerts
- PUSH_USER=${PUSH_USER:-pushuser}
- PUSH_PASSWORD=${PUSH_PASSWORD:-pushpass}
#- http_proxy=http://proxy.example.com:80
#- https_proxy=https://proxy.example.com:443
#- no_proxy=10.0.0.0/8,.example.com
networks:
- net
ports:
- "80:80"
- "443:443"
- "3000:3000"
- "9000:9000"
- "9090:9090"
- "9091:9091"
- "9093:9093"
- "9094:9094"
- "9095:9093"
- "19998:19999"
volumes:
- caddycerts:/etc/caddycerts
cadvisor:
image: gcr.io/google-containers/cadvisor:v0.35.0
command: -logtostderr -docker_only
deploy:
labels:
prometheus.enable: "true"
prometheus.port: "8080"
prometheus.path: "/metrics"
mode: global
resources:
limits:
memory: 128M
reservations:
memory: 64M
networks:
- net
volumes:
- /:/rootfs:ro
- /var/run:/var/run:ro
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
- /dev/disk/:/dev/disk:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
docker-gc:
image: clockworksoul/docker-gc-cron:latest
configs:
- source: docker_garbage_collection
target: /etc/docker-gc-exclude
deploy:
mode: global
resources:
limits:
memory: 128M
reservations:
memory: 64M
environment:
- CRON=25 11 * * *
# By default, docker will not remove an image if it is tagged in multiple repositories. If
# you have a server running docker where this is the case, for example in CI environments
# where dockers are being built, re-tagged, and pushed, you can set this flag to 1 to override.
- FORCE_IMAGE_REMOVAL=1
# By default, if an error is encountered when cleaning up a container, Docker will report the
# error back and leave it on disk. This can sometimes lead to containers accumulating. If
# you run into this issue, you can force the removal of the container by setting this flag.
- FORCE_CONTAINER_REMOVAL=1
# By default, docker-gc will not remove a container if it exited less than 1 hour ago.
# Set the GRACE_PERIOD_SECONDS variable to override this default.
- GRACE_PERIOD_SECONDS=3600
# By default, docker-gc will proceed with deletion of containers and images. To test your
# settings set the DRY_RUN variable to override this default
- DRY_RUN=0
# By default, this process will leave any dangling volumes untouched. To instruct the
# process to automatically clean up any dangling volumes, simply set this value to 1.
- CLEAN_UP_VOLUMES=0
# If you don't like all your log output and cron times being in UTC, you can set the
# TZ variable to override the default.
#- TZ=America/Chicago
volumes:
- /var/run/docker.sock:/var/run/docker.sock
grafana:
image: grafana/grafana:latest
configs:
- source: grafana_dashboards_containers
target: /etc/grafana/dashboards/containers.json
- source: grafana_dashboards_etcd_cluster
target: /etc/grafana/dashboards/etcd-cluster.json
- source: grafana_dashboards_nodes
target: /etc/grafana/dashboards/nodes.json
- source: grafana_dashboards_portworx_cluster_status
target: /etc/grafana/dashboards/portworx-cluster-status.json
- source: grafana_dashboards_portworx_volumes_status
target: /etc/grafana/dashboards/portworx-volumes-status.json
- source: grafana_dashboards_prometheus_2_stats
target: /etc/grafana/dashboards/prometheus-2-stats.json
- source: grafana_provisioning_dashboards
target: /etc/grafana/provisioning/dashboards/dashboards.yml
- source: grafana_provisioning_datasources
target: /etc/grafana/provisioning/datasources/prometheus.yaml
deploy:
labels:
prometheus.enable: "true"
prometheus.port: "3000"
prometheus.path: "/metrics"
mode: replicated
placement:
constraints:
- node.Labels.storagegroup==RED
replicas: 1
resources:
limits:
memory: 256M
reservations:
memory: 128M
environment:
- GF_SECURITY_ADMIN_USER=${ADMIN_USER:-admin}
- GF_SECURITY_ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin}
- GF_USERS_ALLOW_SIGN_UP=false
#- GF_PATHS_PROVISIONING=/etc/grafana/provisioning/
#- GF_SERVER_ROOT_URL=${GF_SERVER_ROOT_URL:-localhost}
#- GF_SMTP_ENABLED=${GF_SMTP_ENABLED:-false}
#- GF_SMTP_FROM_ADDRESS=${GF_SMTP_FROM_ADDRESS:[email protected]}
#- GF_SMTP_FROM_NAME=${GF_SMTP_FROM_NAME:-Grafana}
#- GF_SMTP_HOST=${GF_SMTP_HOST:-smtp:25}
#- GF_SMTP_USER=${GF_SMTP_USER}
#- GF_SMTP_PASSWORD=${GF_SMTP_PASSWORD}
#- http_proxy=http://proxy.example.com:80
#- https_proxy=https://proxy.example.com:443
#- no_proxy=10.0.0.0/8,.example.com
healthcheck:
test: "wget -q -Y off -O /dev/null http://localhost:3000/login > /dev/null 2>&1"
interval: 25s
timeout: 3s
start_period: 120s
networks:
- net
volumes:
- grafana:/var/lib/grafana
karma:
image: lmierzwa/karma:v0.68
configs:
- source: karma_conf
target: /karma.yaml
deploy:
labels:
prometheus.enable: "true"
prometheus.port: "8080"
prometheus.path: "/metrics"
mode: replicated
replicas: 1
networks:
- net
kthxbye:
image: lmierzwa/kthxbye:v0.8
command:
- '-alertmanager.uri'
- 'http://alertmanager:9093'
- '-extend-if-expiring-in'
- '5m'
- '-extend-by'
- '12h'
- '-extend-with-prefix'
- 'ACK'
- '-interval'
- '60s'
- '-max-duration'
- '0'
deploy:
mode: replicated
replicas: 1
labels:
prometheus.enable: "true"
prometheus.port: "8080"
prometheus.path: "/metrics"
networks:
- net
portainer:
image: portainer/portainer:latest
command: -H tcp://tasks.portainer-agent:9001 --tlsskipverify
deploy:
mode: replicated
placement:
constraints:
- node.role == manager
- node.Labels.storagegroup==RED
replicas: 1
networks:
- net
volumes:
- portainer_certs:/certs
- portainer_data:/data
portainer-agent:
image: portainer/agent:latest
deploy:
mode: global
placement:
constraints: [node.platform.os == linux]
environment:
- AGENT_CLUSTER_ADDR=tasks.portainer-agent
- LOG_LEVEL=warn
networks:
- net
volumes:
- /var/lib/docker/volumes:/var/lib/docker/volumes
- /var/run/docker.sock:/var/run/docker.sock
prometheus:
image: prom/prometheus:latest
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--web.console.libraries=/etc/prometheus/console_libraries'
- '--web.console.templates=/etc/prometheus/consoles'
- '--storage.tsdb.path=/prometheus'
- '--storage.tsdb.retention.time=48h'
- '--web.enable-admin-api'
configs:
- source: prometheus_conf
target: /etc/prometheus/prometheus.yml
- source: prometheus_rules_nodes
target: /etc/prometheus/nodes.yml
- source: prometheus_rules_containers
target: /etc/prometheus/containers.yml
- source: prometheus_rules_portworx
target: /etc/prometheus/portworx.yml
deploy:
labels:
prometheus.enable: "true"
prometheus.port: "9090"
prometheus.path: "/metrics"
mode: replicated
placement:
constraints:
- node.Labels.storagegroup==RED
replicas: 1
resources:
limits:
memory: 2048M
reservations:
memory: 1024M
healthcheck:
test: "/bin/wget -q -Y off http://localhost:9090/status -O /dev/null > /dev/null 2>&1"
interval: 25s
timeout: 3s
start_period: 60s
networks:
- net
volumes:
- prometheus:/prometheus
- swarm-endpoints:/etc/swarm-endpoints/:ro
pushgateway:
image: prom/pushgateway:latest
deploy:
labels:
prometheus.enable: "true"
prometheus.port: "9091"
prometheus.path: "/metrics"
mode: replicated
replicas: 1
resources:
limits:
memory: 512M
reservations:
memory: 128M
healthcheck:
test: "/bin/wget -q -Y off http://localhost:9091/ -O /dev/null > /dev/null 2>&1"
interval: 25s
timeout: 3s
start_period: 30s
networks:
- net
swarm-discovery-server:
image: bborysenko/prometheus-swarm-discovery:0.3.0
command:
- server
- -l=warn
deploy:
placement:
constraints:
- node.role == manager
networks:
- net
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
swarm-discovery-client:
image: bborysenko/prometheus-swarm-discovery:0.3.0
command:
- client
- -i=5
- -s=http://swarm-discovery-server:8080
- -o=/swarm-endpoints/swarm-endpoints.json
- -p=swarmstack_prometheus
- -l=warn
deploy:
placement:
constraints:
- node.Labels.storagegroup==RED
networks:
- net
volumes:
- swarm-endpoints:/swarm-endpoints/