-
Notifications
You must be signed in to change notification settings - Fork 106
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
438 lines (403 loc) · 13.5 KB
/
docker-compose.yml
File metadata and controls
438 lines (403 loc) · 13.5 KB
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
x-logging: &default-logging
driver: "json-file"
options:
max-size: "1m"
max-file: "1"
tag: "{{.Name}}"
x-common-labels: &default-labels
logging: "promtail"
logging_jobname: "containerlogs"
stackname: "docker-monitoring-stack-gpnc"
services:
traefik:
image: traefik:3.0
container_name: traefik
ports:
- 80:80 # HTTP port
- 443:443 # HTTPS port
restart: always
labels:
# Traefik configuration
<<: *default-labels
traefik.enable: true
traefik.docker.network: traefik-public
traefik.http.services.traefik-dashboard.loadbalancer.server.port: 8080
# HTTP router configuration
traefik.http.routers.traefik-dashboard-http.entrypoints: http
traefik.http.routers.traefik-dashboard-http.rule: Host(`${TRAEFIK_DOMAIN?Variable not set}`)
# HTTPS router configuration
traefik.http.routers.traefik-dashboard-https.entrypoints: https
traefik.http.routers.traefik-dashboard-https.rule: Host(`${TRAEFIK_DOMAIN?Variable not set}`)
traefik.http.routers.traefik-dashboard-https.tls: true
traefik.http.routers.traefik-dashboard-https.tls.certresolver: le
traefik.http.routers.traefik-dashboard-https.service: api@internal
# HTTPS redirect middleware
traefik.http.middlewares.https-redirect.redirectscheme.scheme: https
traefik.http.middlewares.https-redirect.redirectscheme.permanent: true
traefik.http.routers.traefik-dashboard-http.middlewares: https-redirect
# HTTP Basic Auth middleware
traefik.http.middlewares.admin-auth.basicauth.users: ${TRAEFIK_USERNAME?Variable not set}:${TRAEFIK_HASHED_PASSWORD?Variable not set}
traefik.http.routers.traefik-dashboard-https.middlewares: admin-auth
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro # Docker socket for reading service labels
- traefik-public-certificates:/certificates # Certificate storage
command:
# Docker provider configuration
- --providers.docker
- --providers.docker.exposedbydefault=false
# Entrypoints configuration
- --entrypoints.http.address=:80
- --entrypoints.https.address=:443
# Let's Encrypt configuration
- --certificatesresolvers.le.acme.email=${ACME_EMAIL?Variable not set}
- --certificatesresolvers.le.acme.storage=/certificates/acme.json
- --certificatesresolvers.le.acme.tlschallenge=true
# Logging and API configuration
- --accesslog
- --log
- --api
networks:
- traefik-public # Public network for Traefik and other services
logging: *default-logging
mt5:
build:
context: backend/mt5
dockerfile: Dockerfile
container_name: mt5
volumes:
- ./config:/config
networks:
- traefik-public
- default
env_file:
- .env
restart: unless-stopped
labels:
<<: *default-labels
# Enable Traefik for this service
traefik.enable: true
traefik.docker.network: traefik-public
# Router for vnc.mt5.${domain} (Port 3000)
traefik.http.routers.vnc-mt5-http.rule: Host(`${VNC_DOMAIN}`)
traefik.http.routers.vnc-mt5-http.entrypoints: http
traefik.http.routers.vnc-mt5-http.middlewares: https-redirect
traefik.http.routers.vnc-mt5-https.rule: Host(`${VNC_DOMAIN}`)
traefik.http.routers.vnc-mt5-https.entrypoints: https
traefik.http.routers.vnc-mt5-https.tls: true
traefik.http.routers.vnc-mt5-https.tls.certresolver: le
traefik.http.routers.vnc-mt5-https.service: vnc-mt5-service
traefik.http.services.vnc-mt5-service.loadbalancer.server.port: 3000
# Router for api.mt5.${domain} (Port 5001)
traefik.http.routers.api-mt5-http.rule: Host(`${API_DOMAIN}`)
traefik.http.routers.api-mt5-http.entrypoints: http
traefik.http.routers.api-mt5-http.middlewares: https-redirect
traefik.http.routers.api-mt5-https.rule: Host(`${API_DOMAIN}`)
traefik.http.routers.api-mt5-https.entrypoints: https
traefik.http.routers.api-mt5-https.tls: true
traefik.http.routers.api-mt5-https.tls.certresolver: le
traefik.http.routers.api-mt5-https.service: api-mt5-service
traefik.http.services.api-mt5-service.loadbalancer.server.port: 5001
logging: *default-logging
depends_on:
- traefik
postgres:
image: postgres:15-alpine
container_name: postgres
restart: unless-stopped
env_file:
- .env
volumes:
- postgres-data:/var/lib/postgresql/data
networks:
- default
labels:
<<: *default-labels
logging: *default-logging
django:
build:
context: backend/django
dockerfile: Dockerfile
container_name: django
volumes:
- static_volume:/app/staticfiles
restart: unless-stopped
ports:
- 8000:8000
env_file:
- .env
depends_on:
- postgres
- traefik
- redis
networks:
- default
- traefik-public
labels:
<<: *default-labels
traefik.enable: true
traefik.docker.network: traefik-public
traefik.http.routers.django-http.rule: Host(`${DJANGO_DOMAIN}`)
traefik.http.routers.django-http.entrypoints: http
traefik.http.routers.django-http.middlewares: https-redirect
traefik.http.routers.django-http.service: django-service
traefik.http.routers.django-https.rule: Host(`${DJANGO_DOMAIN}`)
traefik.http.routers.django-https.entrypoints: https
traefik.http.routers.django-https.tls: true
traefik.http.routers.django-https.tls.certresolver: le
traefik.http.routers.django-https.service: django-service
traefik.http.services.django-service.loadbalancer.server.port: 8000
traefik.http.routers.django-static.rule: Host(`${DJANGO_DOMAIN}`) && PathPrefix(`/static/`)
traefik.http.routers.django-static.service: django-service
traefik.http.middlewares.static-stripprefix.stripprefix.prefixes: /static
traefik.http.routers.django-static.middlewares: static-stripprefix@docker
logging: *default-logging
redis:
image: redis:6
container_name: redis
ports:
- 6379:6379
cpus: 0.5
mem_limit: 512m
depends_on:
- traefik
networks:
- default
labels:
<<: *default-labels
logging: *default-logging
celery:
build:
context: backend/django
dockerfile: Dockerfile
container_name: celery
command: celery -A app worker --loglevel=info --concurrency=3
volumes:
- static_volume:/app/staticfiles
env_file:
- .env
depends_on:
- django
- redis
networks:
- default
labels:
<<: *default-labels
logging: *default-logging
celery-beat:
build:
context: backend/django
dockerfile: Dockerfile
container_name: celery-beat
command: celery -A app beat --loglevel=info
volumes:
- static_volume:/app/staticfiles
env_file:
- .env
depends_on:
- celery
- redis
networks:
- default
labels:
<<: *default-labels
logging: *default-logging
grafana:
image: grafana/grafana:${GRAFANA_VERSION:-11.0.0}
container_name: grafana
restart: unless-stopped
environment:
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
- GF_USERS_DEFAULT_THEME=dark
- GF_LOG_MODE=console
- GF_LOG_LEVEL=critical
- GF_PANELS_ENABLE_ALPHA=true
- GF_FEATURE_TOGGLES_ENABLE=accessControlOnCall lokiLogsDataplane
- GF_INSTALL_PLUGINS=grafana-polystat-panel,https://storage.googleapis.com/integration-artifacts/grafana-lokiexplore-app/grafana-lokiexplore-app-latest.zip;grafana-lokiexplore-app
volumes:
- ./monitoring/configs/grafana/provisioning/dashboards.yml:/etc/grafana/provisioning/dashboards/provisioning-dashboards.yaml:ro
- ./monitoring/configs/grafana/provisioning/datasources.yml:/etc/grafana/provisioning/datasources/provisioning-datasources.yaml:ro
- ./monitoring/configs/grafana/plugins/app.yaml:/etc/grafana/provisioning/plugins/app.yaml:ro
- ./monitoring/dashboards/node-metrics.json:/var/lib/grafana/dashboards/node-metrics.json:ro
- ./monitoring/dashboards/container-metrics.json:/var/lib/grafana/dashboards/container-metrics.json:ro
- ./monitoring/dashboards/log-search.json:/var/lib/grafana/dashboards/log-search.json:ro
- ./monitoring/dashboards/traefik_official.json:/var/lib/grafana/dashboards/traefik_official.json:ro
- ./monitoring/dashboards/altertmanager-dashboard.json:/var/lib/grafana/dashboards/altertmanager-dashboard.json:ro
- grafana-data:/var/lib/grafana
depends_on:
- prometheus
- traefik
ports:
- 3000:3000
cpus: 0.5
mem_limit: 512m
networks:
- default
- traefik-public
labels:
<<: *default-labels
traefik.enable: true
traefik.docker.network: traefik-public
traefik.http.routers.grafana.rule: Host(`${GRAFANA_DOMAIN?Variable not set}`)
traefik.http.routers.grafana.entrypoints: https
traefik.http.routers.grafana.tls: true
traefik.http.routers.grafana.tls.certresolver: le
traefik.http.services.grafana.loadbalancer.server.port: 3000
logging: *default-logging
prometheus:
image: prom/prometheus:${PROMETHEUS_VERSION:-v2.42.0}
container_name: prometheus
restart: unless-stopped
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--log.level=error"
- "--storage.tsdb.path=/prometheus"
- "--storage.tsdb.retention.time=7d"
- "--web.console.libraries=/usr/share/prometheus/console_libraries"
- "--web.console.templates=/usr/share/prometheus/consoles"
- "--web.external-url=http://localhost:9090"
volumes:
- ./monitoring/configs/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
- ./monitoring/configs/prometheus/recording-rules.yml:/etc/prometheus/recording-rules.yml
- ./monitoring/configs/prometheus/alerting-rules.yml:/etc/prometheus/alerting-rules.yml
- prometheus-data:/prometheus
depends_on:
- alertmanager
- traefik
ports:
- 9090:9090
cpus: 0.5
mem_limit: 512m
networks:
- default
labels:
<<: *default-labels
logging: *default-logging
cadvisor:
image: gcr.io/cadvisor/cadvisor:${CADVISOR_VERSION:-v0.46.0}
container_name: cadvisor
restart: unless-stopped
privileged: true
depends_on:
- traefik
volumes:
- /:/rootfs:ro
- /var/run:/var/run:rw
- /sys:/sys:ro
- /var/lib/docker:/var/lib/docker:ro
# https://github.com/google/cadvisor/issues/1565#issuecomment-718812180
- /var/run/docker.sock:/var/run/docker.sock
#- /dev/disk:/dev/disk:ro
cpus: 0.5
mem_limit: 512m
networks:
- default
labels:
<<: *default-labels
logging: *default-logging
node-exporter:
image: prom/node-exporter:${NODE_EXPORTER_VERSION:-v1.5.0}
container_name: node-exporter
restart: unless-stopped
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command:
- "--path.procfs=/host/proc"
- "--path.sysfs=/host/sys"
- "--collector.filesystem.ignored-mount-points"
- "^/(sys|proc|dev|host|etc|rootfs/var/lib/docker/containers|rootfs/var/lib/docker/overlay2|rootfs/run/docker/netns|rootfs/var/lib/docker/aufs)($$|/)"
depends_on:
- traefik
cpus: 0.5
mem_limit: 512m
networks:
- default
labels:
<<: *default-labels
logging: *default-logging
alertmanager:
image: prom/alertmanager:${ALERTMANAGER_VERSION:-v0.25.0}
container_name: alertmanager
command:
- "--config.file=/etc/alertmanager/config.yml"
- "--log.level=error"
- "--storage.path=/alertmanager"
- "--web.external-url=http://localhost:9093"
volumes:
- ./monitoring/configs/alertmanager/alertmanager-fallback-config.yml:/etc/alertmanager/config.yml
ports:
- 9093:9093
cpus: 0.5
mem_limit: 512m
networks:
- default
depends_on:
- uncomplicated-alert-receiver
- traefik
labels:
<<: *default-labels
logging: *default-logging
uncomplicated-alert-receiver:
image: ghcr.io/jamesread/uncomplicated-alert-receiver
container_name: uncomplicated-alert-receiver
ports:
- 9094:8080
cpus: 0.5
mem_limit: 512m
networks:
- default
depends_on:
- traefik
labels:
<<: *default-labels
logging: *default-logging
loki:
image: grafana/loki:3.0.0
container_name: loki
user: root
ports:
- 3100:3100
command: -config.file=/etc/loki/loki.yaml
volumes:
- ./monitoring/configs/loki/loki.yaml:/etc/loki/loki.yaml
- ./monitoring/configs/loki/rules.yaml:/etc/loki/rules/fake/loki-rules.yml
depends_on:
- traefik
cpus: 0.5
mem_limit: 512m
networks:
- default
labels:
<<: *default-labels
logging: *default-logging
promtail:
image: grafana/promtail:3.0.0
container_name: promtail
volumes:
- ./monitoring/configs/promtail/promtail.yaml:/etc/promtail/docker-config.yaml
- /var/lib/docker/containers:/var/lib/docker/containers:ro
- /var/run/docker.sock:/var/run/docker.sock
command: -config.file=/etc/promtail/docker-config.yaml
depends_on:
- loki
- traefik
cpus: 0.5
mem_limit: 512m
networks:
- default
labels:
<<: *default-labels
logging: *default-logging
volumes:
traefik-public-certificates: # Persistent volume for certificates
grafana-data: {}
prometheus-data: {}
postgres-data: {}
static_volume: {}
networks:
default:
driver: bridge
traefik-public:
external: true