-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdocker-compose.yaml
411 lines (367 loc) · 10.8 KB
/
docker-compose.yaml
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
version: !!str 3.7
services:
minio:
image: minio/minio
container_name: minio
ports:
- "${MINIO_DATAPORT}:9000"
- "${MINIO_ACCESSPORT}:9001"
environment:
- MINIO_ACCESS_KEY=admin
- MINIO_SECRET_KEY=bucketsecret
- MINIO_PROMETHEUS_AUTH_TYPE=public
volumes:
- ./storage/miniodata/data:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 10s
retries: 5
command: server --console-address ':9001' /data
networks:
- net-thanos
restart: unless-stopped
createbuckets:
image: minio/mc
networks:
- net-thanos
depends_on:
- minio
entrypoint: >
/bin/sh -c "
/usr/bin/mc alias set myminio http://minio:9000 admin bucketsecret;
/usr/bin/mc mb myminio/prometheusthanos;
/usr/bin/mc policy set public myminio/prometheusthanos;
exit 0;
"
prometheus-node1:
image: prom/prometheus
container_name: prometheus-node1
volumes:
- ./prometheus/node1/prometheus.yml:/etc/prometheus/prometheus.yml
- ./storage/prometheus/node1/data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--storage.tsdb.min-block-duration=1m'
- '--storage.tsdb.max-block-duration=1m'
- '--storage.tsdb.retention.time=5m'
ports:
- "${PROMETHEUS_NODE1_EXPOSE}:9090"
networks:
- net-thanos
depends_on:
- minio
restart: unless-stopped
thanos-sidecar1:
image: thanosio/thanos:v0.31.0
container_name: thanos-sidecar1
volumes:
- ./storage/prometheus/node1/data:/var/prometheus
- ./thanos/bucket_config.yaml:/bucket_config.yaml
command:
- sidecar
- --tsdb.path=/var/prometheus
- --prometheus.url=http://prometheus-node1:9090
- --objstore.config-file=/bucket_config.yaml
- --http-address=0.0.0.0:${THANOS_SIDECAR1_HTTP}
- --grpc-address=0.0.0.0:${THANOS_SIDECAR1_GRPC}
ports:
- "${THANOS_SIDECAR1_HTTP_EXPOSE}:${THANOS_SIDECAR1_HTTP}"
- "${THANOS_SIDECAR1_GRPC_EXPOSE}:${THANOS_SIDECAR1_GRPC}"
networks:
- net-thanos
depends_on:
- prometheus-node1
restart: unless-stopped
prometheus-node2:
image: prom/prometheus
container_name: prometheus-node2
volumes:
- ./prometheus/node2/prometheus.yml:/etc/prometheus/prometheus.yml
- ./storage/prometheus/node2/data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--storage.tsdb.min-block-duration=1m'
- '--storage.tsdb.max-block-duration=1m'
- '--storage.tsdb.retention.time=5m'
ports:
- "${PROMETHEUS_NODE2_EXPOSE}:9090"
networks:
- net-thanos
depends_on:
- minio
restart: unless-stopped
thanos-sidecar2:
image: thanosio/thanos:v0.31.0
container_name: thanos-sidecar2
volumes:
- ./storage/prometheus/node2/data:/var/prometheus
- ./thanos/bucket_config.yaml:/bucket_config.yaml
command:
- sidecar
- --tsdb.path=/var/prometheus
- --prometheus.url=http://prometheus-node2:9090
- --objstore.config-file=/bucket_config.yaml
- --http-address=0.0.0.0:${THANOS_SIDECAR2_HTTP}
- --grpc-address=0.0.0.0:${THANOS_SIDECAR2_GRPC}
ports:
- "${THANOS_SIDECAR2_HTTP_EXPOSE}:${THANOS_SIDECAR2_HTTP}"
- "${THANOS_SIDECAR2_GRPC_EXPOSE}:${THANOS_SIDECAR2_GRPC}"
networks:
- net-thanos
depends_on:
- prometheus-node2
restart: unless-stopped
thanos-store:
image: thanosio/thanos:v0.31.0
container_name: thanos-store
volumes:
- ./thanos/bucket_config.yaml:/bucket_config.yaml
command:
- store
- --data-dir=/var/thanos/store
- --objstore.config-file=bucket_config.yaml
- --http-address=0.0.0.0:${THANOS_STORE_HTTP}
- --grpc-address=0.0.0.0:${THANOS_STORE_GRPC}
ports:
- "${THANOS_STORE_HTTP_EXPOSE}:${THANOS_STORE_HTTP}"
- "${THANOS_STORE_GRPC_EXPOSE}:${THANOS_STORE_GRPC}"
networks:
- net-thanos
depends_on:
- minio
restart: unless-stopped
thanos-querier:
image: thanosio/thanos:v0.31.0
container_name: thanos-querier
command:
- query
- --http-address=0.0.0.0:${THANOS_QUERY_HTTP}
- --store=thanos-sidecar1:${THANOS_SIDECAR1_GRPC}
- --store=thanos-sidecar2:${THANOS_SIDECAR2_GRPC}
- --store=thanos-store:${THANOS_STORE_GRPC}
- --store=thanos-receive:${THANOS_RECEIVE_GRPC}
- --store=thanos-rule:10901
- --query.replica-label=node
ports:
- "${THANOS_QUERY_HTTP_EXPOSE}:${THANOS_QUERY_HTTP}"
networks:
- net-thanos
depends_on:
- minio
- thanos-receive
- thanos-store
restart: unless-stopped
thanos-querier_frontend:
image: thanosio/thanos:v0.31.0
container_name: thanos-querier_frontend
command:
- query-frontend
- --http-address=0.0.0.0:${THANOS_QUERY_FRONTEND_HTTP}
- --query-frontend.downstream-url=http://thanos-querier:${THANOS_QUERY_HTTP}
- --query-frontend.compress-responses
- --query-range.partial-response
- --query-range.split-interval=24h
- --query-range.max-retries-per-request=5
- --query-frontend.log-queries-longer-than=5s
- --cache-compression-type=snappy
ports:
- "${THANOS_QUERY_FRONTEND_HTTP_EXPOSE}:${THANOS_QUERY_FRONTEND_HTTP}"
networks:
- net-thanos
depends_on:
- minio
- thanos-querier
restart: unless-stopped
thanos-receive:
image: thanosio/thanos:v0.31.0
container_name: thanos-receive
command:
- receive
- --tsdb.path=/data/remote-write-receive-data
- --http-address=0.0.0.0:${THANOS_RECEIVE_HTTP}
- --grpc-address=0.0.0.0:${THANOS_RECEIVE_GRPC}
- --receive.replication-factor=1
- --remote-write.address=0.0.0.0:${THANOS_RECEIVE_REMOTE}
- --objstore.config-file=/bucket_config.yaml
- --grpc-grace-period=1s
- --http-grace-period=1s
- --label=receive="true"
volumes:
- ./storage/thanos_receive:/data
- ./thanos/bucket_config.yaml:/bucket_config.yaml
networks:
- net-thanos
depends_on:
- minio
ports:
- "${THANOS_RECEIVE_REMOTE_EXPOSE}:${THANOS_RECEIVE_REMOTE}"
- "${THANOS_RECEIVE_GRPC_EXPOSE}:${THANOS_RECEIVE_GRPC}"
- "${THANOS_RECEIVE_HTTP_EXPOSE}:${THANOS_RECEIVE_HTTP}"
restart: unless-stopped
thanos-compactor:
image: thanosio/thanos:v0.31.0
container_name: thanos-compactor
command:
- compact
- --data-dir=/data/thanos-compact
- --objstore.config-file=/bucket_config.yaml
- --consistency-delay=15m
- --retention.resolution-raw=90d
- --retention.resolution-5m=120d
- --retention.resolution-1h=1y
- --compact.concurrency=6
- --downsample.concurrency=6
- --delete-delay=15m
- --wait
- --wait-interval=5m
volumes:
- ./storage/thanos_compact:/data
- ./thanos/bucket_config.yaml:/bucket_config.yaml
networks:
- net-thanos
depends_on:
- minio
- thanos-store
ports:
- "10902:10902"
restart: unless-stopped
thanos-rule:
image: thanosio/thanos:v0.31.0
container_name: thanos-rule
command:
- rule
- --data-dir=/data
- --log.format=logfmt
- --log.level=debug
- --rule-file=/etc/config/rules.yml
- --query=http://thanos-querier:${THANOS_QUERY_HTTP}
- --alert.query-url=${ALERTQUERY}
- --objstore.config-file=/bucket_config.yaml
- "--alertmanagers.url=${ALERTMANAGER_URL}"
volumes:
- ./storage/thanos_rule:/data
- ./thanos/rules:/etc/config/
- ./thanos/bucket_config.yaml:/bucket_config.yaml
ports:
- "${THANOS_RULES_EXPOSE}:10902"
networks:
- net-thanos
depends_on:
- minio
- thanos-querier
- thanos-receive
expose:
- 10902
- 10901
restart: unless-stopped
alertmanager:
image: prom/alertmanager:v0.21.0
container_name: alertmanager
user: root
volumes:
- ./prometheus/alert:/etc/config/
- ./storage/alertmanager:/data
command:
- '--config.file=/etc/config/alertmanager.yml'
restart: unless-stopped
expose:
- 9093
ports:
- "${ALERTMANAGER_EXPOSE}:9093"
networks:
- net-thanos
depends_on:
- minio
- thanos-querier
- thanos-receive
node-exporter:
container_name: node-exporter
image: prom/node-exporter:latest
restart: unless-stopped
expose:
- "9100"
networks:
- net-thanos
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
- /:/host:ro,rslave
command:
- '--path.rootfs=/host'
- '--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)($$|/)"
labels:
- "app.name=node-exporter"
- "app.part-of=monitoring"
cadvisor:
container_name: cadvisor
image: gcr.io/cadvisor/cadvisor
volumes:
- /:/rootfs:ro
- /var/run:/var/run:rw
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
ports:
- 8080:8080
restart: unless-stopped
labels:
- "app.name=cadvisor"
- "app.part-of=monitoring"
networks:
- net-thanos
remote-write:
image: prom/prometheus
container_name: remote-write
volumes:
- ./prometheus/remote-write/prometheus.yml:/etc/prometheus/prometheus.yml
- ./storage/prometheus/remote-write/data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--storage.tsdb.min-block-duration=1m'
- '--storage.tsdb.max-block-duration=1m'
- '--storage.tsdb.retention.time=5m'
# ports:
# - "9099:9090"
networks:
- net-thanos
depends_on:
- minio
- thanos-receive
restart: unless-stopped
grafana:
container_name: grafana
image: grafana/grafana:latest
user: "472"
depends_on:
- thanos-querier
ports:
- 3000:3000
volumes:
- ./storage/grafana-storage:/var/lib/grafana
- ./grafana/provisioning/:/etc/grafana/provisioning/
restart: unless-stopped
labels:
- "app.name=grafana"
- "app.part-of=monitoring"
environment:
GF_SECURITY_ADMIN_USER: ${GRAFANA_ADMIN_USERNAME}
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_ADMIN_PASSWORD}
GF_USERS_ALLOW_SIGN_UP: false
networks:
- net-thanos
networks:
net-thanos:
driver: bridge
# volumes:
# thanos_receive: {}
# thanos_compact: {}
# grafana-storage: {}
# thanos_rule: {}
# alertmanager: {}