-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
340 lines (323 loc) · 8.16 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
version: "3.8"
services:
####
#metrics
####
prometheus:
image: prom/prometheus:v2.41.0
container_name: prometheus
volumes:
- ./configs/prometheus/:/etc/prometheus/
- prometheus:/prometheus
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.path=/prometheus"
- "--web.console.libraries=/etc/prometheus/console_libraries"
- "--web.console.templates=/etc/prometheus/consoles"
- "--storage.tsdb.retention.time=12h"
- "--web.enable-lifecycle"
- "--log.level=info"
restart: unless-stopped
ports:
- "9090:9090"
networks:
- stack
labels:
org.label-schema.group: "monitoring"
org.label-schema.logging_agent: "promtail"
org.label-schema.logging_jobname: "container_logs"
nodeexporter:
image: prom/node-exporter:v1.5.0
container_name: nodeexporter
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command:
- "--path.procfs=/host/proc"
- "--path.rootfs=/rootfs"
- "--path.sysfs=/host/sys"
- "--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)"
restart: unless-stopped
ports:
- "9100:9100"
networks:
- stack
labels:
org.label-schema.group: "monitoring"
cadvisor:
image: gcr.io/cadvisor/cadvisor:v0.46.0
container_name: cadvisor
privileged: true
devices:
- /dev/kmsg:/dev/kmsg
volumes:
- /:/rootfs:ro
- /var/run:/var/run:rw
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
- /cgroup:/cgroup:ro #only for linux
restart: unless-stopped
ports:
- "8000:8000"
networks:
- stack
labels:
org.label-schema.group: "monitoring"
####
#Metrics additions
####
pushgateway:
image: prom/pushgateway:v1.5.1
container_name: pushgateway
restart: unless-stopped
ports:
- "9091:9091"
networks:
- stack
labels:
org.label-schema.group: "monitoring"
####
#visualization
####
grafana:
image: grafana/grafana:9.3.2
container_name: grafana
volumes:
- grafana:/var/lib/grafana
- ./configs/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards
- ./configs/grafana/provisioning/datasources:/etc/grafana/provisioning/datasources
environment:
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
- GF_AUTH_DISABLE_LOGIN_FORM=true
#- GF_SECURITY_ADMIN_USER=${ADMIN_USER:-admin}
#- GF_SECURITY_ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin}
#- GF_USERS_ALLOW_SIGN_UP=false
restart: unless-stopped
ports:
- "3000:3000"
healthcheck:
test:
[
"CMD-SHELL",
"wget --no-verbose --tries=1 --spider http://localhost:3000/api/health || exit 1",
]
interval: 10s
timeout: 5s
retries: 5
networks:
- stack
labels:
org.label-schema.group: "visualization"
org.label-schema.logging_agent: "promtail"
org.label-schema.logging_jobname: "container_logs"
####
#logging
####
init:
image: grafana/loki:2.7.3
user: root
entrypoint:
- "chown"
- "10001:10001"
- "/loki"
volumes:
- ./loki:/loki
networks:
- stack
labels:
org.label-schema.group: "logging"
loki-read:
image: grafana/loki:2.7.3
# can't have a specific docker name due to replication
volumes:
- ./configs/loki:/etc/loki/
ports:
- "3100"
- "7946"
# uncomment to use interactive debugging
# - "40000-40001:40000" # # makes the replicas available on ports 40000, 40001
#cap_add:
# - SYS_PTRACE
#security_opt:
# - apparmor=unconfined
command: "-config.file=/etc/loki/loki.yaml -target=read"
restart: always
deploy:
mode: replicated
replicas: 3
networks:
- stack
labels:
org.label-schema.group: "logging"
loki-write:
image: grafana/loki:2.7.3
# can't have a specific docker name due to replication
volumes:
- ./configs/loki:/etc/loki/
ports:
- "3100"
- "7946"
# uncomment to use interactive debugging
# - "50000-50001:40000" # makes the replicas available on ports 50000, 50001
# cap_add:
# - SYS_PTRACE
# security_opt:
# - apparmor=unconfined
command: "-config.file=/etc/loki/loki.yaml -target=write"
restart: always
deploy:
mode: replicated
replicas: 3
networks:
- stack
labels:
org.label-schema.group: "logging"
promtail:
image: grafana/promtail:2.7.3
container_name: promtail
command: -config.file=/etc/promtail/promtail.yaml
volumes:
- ./configs/promtail:/etc/promtail/
- ./loki/:/var/log/
ports:
- "9080:9080"
networks:
- stack
labels:
org.label-schema.group: "logging"
#random log generator
flog:
image: mingrammer/flog
command:
- --loop
- --format=json
- --number=10 # number of log lines to generate per second
- --delay=100ms # delay between log lines
- --output=/var/log/generated-logs.txt
- --overwrite
- --type=log
volumes:
- ./loki/:/var/log/ #store logs here so that promtail can fetch them
networks:
- stack
labels:
org.label-schema.group: "logging"
org.label-schema.logging_agent: "promtail"
org.label-schema.logging_jobname: "container_logs"
####
#alerting
####
alertmanager:
image: prom/alertmanager:v0.25.0
container_name: alertmanager
volumes:
- ./configs/alertmanager/alertmanager.yml:/etc/alertmanager/alertmanager.yml
- alertmanager-data:/data
command:
- "--config.file=/etc/alertmanager/alertmanager.yml"
- "--storage.path=/alertmanager"
restart: unless-stopped
ports:
- "9093:9093"
networks:
- stack
labels:
org.label-schema.group: "alerting"
org.label-schema.logging_agent: "promtail"
org.label-schema.logging_jobname: "container_logs"
####
#oncall
####
#https://hub.docker.com/r/grafana/oncall
####
# Gateway
####
loki-gateway:
image: nginx:1.19
container_name: gateway
volumes:
- ./configs/nginx/nginx.conf:/etc/nginx/nginx.conf
ports:
- "8080:80"
- "3100"
networks:
- stack
labels:
org.label-schema.group: "gateway"
org.label-schema.logging_agent: "promtail"
org.label-schema.logging_jobname: "container_logs"
####
# Storage
####
minio:
image: minio/minio
container_name: s3
entrypoint:
- sh
- -euc
- |
mkdir -p /data/loki-data && \
mkdir -p /data/loki-ruler && \
minio server /data
environment:
- MINIO_ACCESS_KEY=loki
- MINIO_SECRET_KEY=supersecret
- MINIO_PROMETHEUS_AUTH_TYPE=public
- MINIO_UPDATE=off
ports:
- "9000:9000"
volumes:
- ./.data/minio:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 15s
timeout: 20s
retries: 5
networks:
- stack
labels:
org.label-schema.group: "storage"
####
#tracing
####
#tempo:
# image: grafana/tempo:0.7.0
# container_name: tempo
# command: ["-config.file=/etc/tempo.yaml"]
# volumes:
# - ./etc/tempo-local.yaml:/etc/tempo.yaml
# - ./data/tempo-data:/tmp/tempo
# ports:
# - "14268" # jaeger ingest, Jaeger - Thrift HTTP
# - "14250" # Jaeger - GRPC
# - "55680" # OpenTelemetry
# - "3100" # tempo
# - "6831/udp" # Jaeger - Thrift Compact
# - "6832/udp" # Jaeger - Thrift Binary
# networks:
# - stack
# labels:
# org.label-schema.group: "tracing"
#
#tempo-query:
# image: grafana/tempo-query:0.7.0
# container_name: tempo-query
# command: ["--grpc-storage-plugin.configuration-file=/etc/tempo-query.yaml"]
# volumes:
# - ./etc/tempo-query.yaml:/etc/tempo-query.yaml
# ports:
# - "16686:16686" # jaeger-ui
# depends_on:
# - tempo
# networks:
# - stack
# labels:
# org.label-schema.group: "tracing"
networks:
stack:
volumes:
prometheus:
grafana:
alertmanager-data: