forked from tldr-devops/startpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
monitoring.yml
380 lines (364 loc) · 11.8 KB
/
monitoring.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
version: '3.8'
x-victoriametrics-labels: &victoriametrics-labels
labels:
- traefik.enable=true
- traefik.docker.network=monitoring
- traefik.http.routers.victoriametrics-http.rule=Host(`victoriametrics.${DOMAIN?Variable not set}`)
- traefik.http.routers.victoriametrics-http.entrypoints=http
#- traefik.http.routers.victoriametrics-http.middlewares=admin-auth
- traefik.http.routers.victoriametrics-http.service=victoriametrics
- traefik.http.routers.victoriametrics-http.middlewares=https-redirect
- traefik.http.routers.victoriametrics-https.rule=Host(`victoriametrics.${DOMAIN?Variable not set}`)
- traefik.http.routers.victoriametrics-https.entrypoints=https
- traefik.http.routers.victoriametrics-https.middlewares=admin-auth
- traefik.http.routers.victoriametrics-https.tls=true
- traefik.http.routers.victoriametrics-https.service=victoriametrics
- traefik.http.routers.victoriametrics-https.tls.certresolver=le
- traefik.http.services.victoriametrics.loadbalancer.server.port=8428
x-influxdb-labels: &influxdb-labels
labels:
- traefik.enable=true
- traefik.docker.network=monitoring
- traefik.http.routers.influxdb-http.rule=Host(`influxdb.${DOMAIN?Variable not set}`)
- traefik.http.routers.influxdb-http.entrypoints=http
#- traefik.http.routers.influxdb-http.middlewares=admin-auth
- traefik.http.routers.influxdb-http.service=influxdb
- traefik.http.routers.influxdb-http.middlewares=https-redirect
- traefik.http.routers.influxdb-https.rule=Host(`influxdb.${DOMAIN?Variable not set}`)
- traefik.http.routers.influxdb-https.entrypoints=https
#- traefik.http.routers.influxdb-https.middlewares=admin-auth
- traefik.http.routers.influxdb-https.tls=true
- traefik.http.routers.influxdb-https.service=influxdb
- traefik.http.routers.influxdb-https.tls.certresolver=le
- traefik.http.services.influxdb.loadbalancer.server.port=8086
x-grafana-labels: &grafana-labels
labels:
- traefik.enable=true
- traefik.docker.network=monitoring
- traefik.http.routers.grafana-http.rule=Host(`grafana.${DOMAIN?Variable not set}`)
- traefik.http.routers.grafana-http.entrypoints=http
#- traefik.http.routers.grafana-http.middlewares=admin-auth
- traefik.http.routers.grafana-http.service=grafana
- traefik.http.routers.grafana-http.middlewares=https-redirect
- traefik.http.routers.grafana-https.rule=Host(`grafana.${DOMAIN?Variable not set}`)
- traefik.http.routers.grafana-https.entrypoints=https
#- traefik.http.routers.grafana-https.middlewares=admin-auth
- traefik.http.routers.grafana-https.tls=true
- traefik.http.routers.grafana-https.service=grafana
- traefik.http.routers.grafana-https.tls.certresolver=le
- traefik.http.services.grafana.loadbalancer.server.port=3000
x-service: &service
logging:
driver: json-file
options:
max-size: "100m"
max-file: "2"
restart: always
networks:
- monitoring
services:
# https://docs.victoriametrics.com
# https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/deployment/docker/docker-compose.yml
victoriametrics:
container_name: victoriametrics
image: victoriametrics/victoria-metrics
deploy:
mode: replicated
replicas: 1
resources:
reservations:
cpus: '0.01'
memory: 100M
placement:
constraints:
- node.hostname == ${HOSTNAME?Variable HOSTNAME not set}
<<: *victoriametrics-labels
<<: *victoriametrics-labels
<<: *service
volumes:
- victoriametrics-configs:/etc/victoriametrics
- victoriametrics-data:/storage
command:
- --storageDataPath=/storage/vmetrics
- --graphiteListenAddr=:2003
- --opentsdbListenAddr=:4242
- --httpListenAddr=:8428
- --influxListenAddr=:8089
- --retentionPeriod=2w
user: root
vmagent:
container_name: vmagent
image: victoriametrics/vmagent
deploy:
mode: replicated
replicas: 1
resources:
reservations:
cpus: '0.01'
memory: 50M
<<: *service
volumes:
- victoriametrics-configs:/etc/victoriametrics
- victoriametrics-data:/storage
command:
- '--promscrape.config=/etc/victoriametrics/prometheus.yml'
- '--remoteWrite.url=http://victoriametrics:8428/api/v1/write'
vmalert:
container_name: vmalert
image: victoriametrics/vmalert
deploy:
mode: replicated
replicas: 1
resources:
reservations:
cpus: '0.01'
memory: 50M
<<: *service
volumes:
- victoriametrics-configs:/etc/victoriametrics
command:
- '--datasource.url=http://victoriametrics:8428/'
- '--remoteRead.url=http://victoriametrics:8428/'
- '--remoteWrite.url=http://victoriametrics:8428/'
- '--notifier.url=http://alertmanager:9093/'
- '--rule=/etc/victoriametrics/alerts/*.yml'
# display source of alerts in grafana
- "--external.url=http://grafana:3000"
- '--external.alert.source=explore?orgId=1&left=["now-1h","now","VictoriaMetrics",{"expr":"{{$$expr|quotesEscape|crlfEscape|queryEscape}}"},{"mode":"Metrics"},{"ui":[true,true,true,"none"]}]' ## when copypaste the line be aware of '$$' for escaping in '$expr'
# https://hub.docker.com/r/grafana/grafana
# https://grafana.com/docs/grafana/latest/administration/configure-docker/
# https://grafana.com/docs/grafana/latest/administration/configuration/#configure-with-environment-variables
# https://grafana.com/docs/grafana/latest/administration/provisioning/
# https://github.com/grafana/grafana/blob/main/devenv
grafana:
container_name: grafana
image: grafana/grafana
deploy:
mode: replicated
replicas: 1
resources:
reservations:
cpus: '0.01'
memory: 50M
<<: *grafana-labels
<<: *grafana-labels
<<: *service
volumes:
- grafana-data:/var/lib/grafana
- grafana-provisioning:/etc/grafana/provisioning
environment:
GF_INSTALL_PLUGINS: grafana-clock-panel
GF_SECURITY_ADMIN_PASSWORD: ${PASSWORD?Variable PASSWORD not set}
GF_SECURITY_ADMIN_USER: ${USERNAME?Variable USERNAME not set}
GF_SECURITY_SECRET_KEY: ${HASHED_PASSWORD?Variable HASHED_PASSWORD not set}
GF_SERVER_ROOT_URL: https://grafana.${DOMAIN?Variable not set}
GF_SERVER_ENABLE_GZIP: "true"
GF_SECURITY_COOKIE_SECURE: "true"
GF_SNAPSHOTS_EXTERNAL_ENABLED: "false"
INFLUXDB_TOKEN: ${HASHED_PASSWORD?Variable HASHED_PASSWORD not set}
INFLUXDB_ORG: ${DOMAIN?Variable DOMAIN not set}
INFLUXDB_BUCKET: telegraf
user: root
# https://hub.docker.com/_/influxdb
# https://docs.influxdata.com/influxdb/v2.1/install/?t=Docker
# https://docs.influxdata.com/influxdb/v2.1/reference/config-options/
# https://github.com/influxdata/community-templates/blob/master/docs/use_a_template.md
influxdb:
container_name: influxdb
image: influxdb:2.1
deploy:
mode: replicated
replicas: 1
resources:
reservations:
cpus: '0.01'
memory: 130M
placement:
constraints:
- node.hostname == ${HOSTNAME?Variable HOSTNAME not set}
<<: *influxdb-labels
<<: *influxdb-labels
<<: *service
volumes:
- influxdb-data:/var/lib/influxdb2
- influxdb-entrypoint:/docker-entrypoint-initdb.d
environment:
DOCKER_INFLUXDB_INIT_MODE: setup
DOCKER_INFLUXDB_INIT_USERNAME: ${USERNAME?Variable USERNAME not set}
DOCKER_INFLUXDB_INIT_PASSWORD: ${PASSWORD?Variable PASSWORD not set}
DOCKER_INFLUXDB_INIT_ORG: ${DOMAIN?Variable DOMAIN not set}
DOCKER_INFLUXDB_INIT_BUCKET: telegraf
DOCKER_INFLUXDB_INIT_RETENTION: 2w
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: ${HASHED_PASSWORD?Variable HASHED_PASSWORD not set}
user: root
# https://hub.docker.com/_/telegraf
# https://github.com/influxdata/telegraf/blob/master/docs/FAQ.md
# https://docs.influxdata.com/telegraf/v1.21/administration/commands/
telegraf-node:
container_name: telegraf-node
image: telegraf
deploy:
mode: global
resources:
reservations:
cpus: '0.01'
memory: 50M
<<: *service
volumes:
- telegraf-configs:/etc/telegraf
- /:/hostfs:ro
command:
- --config=/etc/telegraf/telegraf-node.conf
environment:
HOST_ETC: /hostfs/etc
HOST_PROC: /hostfs/proc
HOST_SYS: /hostfs/sys
HOST_VAR: /hostfs/var
HOST_RUN: /hostfs/run
HOST_MOUNT_PREFIX: /hostfs
INFLUXDB_TOKEN: ${HASHED_PASSWORD?Variable HASHED_PASSWORD not set}
INFLUXDB_ORG: ${DOMAIN?Variable DOMAIN not set}
INFLUXDB_BUCKET: telegraf
user: root
entrypoint: "telegraf"
telegraf:
container_name: telegraf
image: telegraf
deploy:
mode: replicated
replicas: 1
resources:
reservations:
cpus: '0.01'
memory: 50M
<<: *service
volumes:
- telegraf-configs:/etc/telegraf
environment:
SQL_ROOT_PASSWORD: ${SQL_ROOT_PASSWORD?Variable SQL_ROOT_PASSWORD not set}
TULEAP_SQL_PASSWORD: ${TULEAP_SQL_PASSWORD?Variable TULEAP_SQL_PASSWORD not set}
INFLUXDB_TOKEN: ${HASHED_PASSWORD?Variable HASHED_PASSWORD not set}
INFLUXDB_ORG: ${DOMAIN?Variable DOMAIN not set}
INFLUXDB_BUCKET: telegraf
networks:
- database
- monitoring
- bitwarden
- gitlab
- registry
- minio
- nocodb
- openproject
- portainer
- strapi
- appwrite
- taiga
- rocketchat
- vaultwarden
- tuleap
- nextcloud
x-volume: &volume
driver: local
x-volume-driver-opts: &volume-driver-opts
type: none
o: bind
volumes:
victoriametrics-data:
name: victoriametrics-data
<<: *volume
driver_opts:
<<: *volume-driver-opts
device: ${DATAPATH?Variable DATAPATH not set}/victoriametrics/data
victoriametrics-configs:
name: victoriametrics-configs
<<: *volume
driver_opts:
<<: *volume-driver-opts
device: ${DATAPATH?Variable DATAPATH not set}/victoriametrics/configs
influxdb-data:
name: influxdb-data
<<: *volume
driver_opts:
<<: *volume-driver-opts
device: ${DATAPATH?Variable DATAPATH not set}/influxdb/data
influxdb-entrypoint:
name: influxdb-entrypoint
<<: *volume
driver_opts:
<<: *volume-driver-opts
device: ${DATAPATH?Variable DATAPATH not set}/influxdb/entrypoint
telegraf-configs:
name: telegraf-configs
<<: *volume
driver_opts:
<<: *volume-driver-opts
device: ${DATAPATH?Variable DATAPATH not set}/telegraf/configs
grafana-data:
name: grafana-data
<<: *volume
driver_opts:
<<: *volume-driver-opts
device: ${DATAPATH?Variable DATAPATH not set}/grafana/data
grafana-provisioning:
name: grafana-provisioning
<<: *volume
driver_opts:
<<: *volume-driver-opts
device: ${DATAPATH?Variable DATAPATH not set}/grafana/provisioning
x-network: &network
external: true
networks:
monitoring:
name: monitoring
<<: *network
bitwarden:
name: bitwarden
<<: *network
gitlab:
name: gitlab
<<: *network
registry:
name: registry
<<: *network
minio:
name: minio
<<: *network
database:
name: database
<<: *network
nocodb:
name: nocodb
<<: *network
openproject:
name: openproject
<<: *network
portainer:
name: portainer
<<: *network
strapi:
name: strapi
<<: *network
appwrite:
name: appwrite
<<: *network
taiga:
name: taiga
<<: *network
rocketchat:
name: rocketchat
<<: *network
rocketchat:
name: rocketchat
<<: *network
vaultwarden:
name: vaultwarden
<<: *network
twake:
name: twake
<<: *network
tuleap:
name: tuleap
<<: *network
nextcloud:
name: nextcloud
<<: *network