-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yaml
236 lines (224 loc) · 5.58 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
version: '3.9'
# https://docs.docker.com/compose/compose-file/compose-file-v3/#logging
x-logging: &logging
logging:
driver: 'json-file'
options:
max-size: '50m'
max-file: '5'
tag: '{{.ImageName}}|{{.Name}}|{{.ImageFullID}}|{{.FullID}}'
x-networking: &networking
networks:
- monitoring
services:
# https://prometheus.io/docs/prometheus/latest/getting_started/
prometheus:
container_name: prometheus
image: prom/prometheus:v2.31.1
restart: unless-stopped
ports:
- target: 9090
published: 9090
protocol: tcp
mode: host
command:
- --config.file=/etc/prometheus/prometheus.yaml
- --storage.tsdb.path=/prometheus
- --storage.tsdb.retention.time=15d
- --web.enable-lifecycle
- --web.enable-admin-api
volumes:
- type: volume
source: prometheus-volume
target: /prometheus
- type: bind
source: ./prometheus
target: /etc/prometheus
read_only: true
depends_on:
- alertmanager
<<: *logging
<<: *networking
# https://prometheus.io/docs/alerting/latest/alertmanager/
alertmanager:
container_name: alertmanager
image: prom/alertmanager:v0.23.0
restart: unless-stopped
ports:
- target: 9093
published: 9093
protocol: tcp
mode: host
command:
- --config.file=/etc/alertmanager/alertmanager.yaml
volumes:
- type: bind
source: ./alertmanager
target: /etc/alertmanager
read_only: true
<<: *logging
<<: *networking
# https://grafana.com/docs/grafana/latest/administration/configure-docker/
grafana:
container_name: grafana
image: grafana/grafana:8.1.2
ports:
- target: 3000
published: 3000
protocol: tcp
mode: host
environment:
GF_INSTALL_PLUGINS: 'grafana-clock-panel,grafana-simple-json-datasource'
volumes:
- type: volume
source: grafana-volume
target: /var/lib/grafana
- type: bind
source: ./grafana/provisioning
target: /etc/grafana/provisioning
read_only: true
depends_on:
- prometheus
- loki
<<: *logging
<<: *networking
# https://grafana.com/docs/loki/latest/
loki:
container_name: loki
image: grafana/loki:2.4.1
restart: unless-stopped
ports:
- target: 3100
published: 3100
protocol: tcp
mode: host
command:
- -config.file=/etc/loki/loki.yaml
volumes:
- type: bind
source: ./loki
target: /etc/loki
read_only: true
- type: volume
source: loki-volume
target: /loki
<<: *logging
<<: *networking
# https://grafana.com/docs/loki/latest/clients/promtail/
promtail:
container_name: promtail
image: grafana/promtail:2.4.1
restart: unless-stopped
ports:
- target: 9080
published: 9080
protocol: tcp
mode: host
command:
- -config.file=/etc/promtail/promtail.yaml
volumes:
- type: bind
source: ./promtail
target: /etc/promtail
read_only: true
- type: bind
source: /var/lib/docker/containers
target: /var/lib/docker/contauiners
read_only: true
depends_on:
- loki
<<: *logging
<<: *networking
# https://github.com/prymitive/karma
karma:
container_name: karma
image: ghcr.io/prymitive/karma:v0.93
restart: unless-stopped
ports:
- target: 8080
published: 8080
protocol: tcp
mode: host
command:
- --config.file=/docs/karma.yaml
volumes:
- type: bind
source: ./karma
target: /docs
read_only: true
depends_on:
- alertmanager
<<: *logging
<<: *networking
# https://github.com/google/cadvisor
cadvisor:
container_name: cadvisor
image: gcr.io/cadvisor/cadvisor:v0.38.8
restart: unless-stopped
privileged: true
devices:
- /dev/kmsg
volumes:
- type: bind
source: /
target: /rootfs
read_only: true
- type: bind
source: /var/run
target: /var/run
- type: bind
source: /sys
target: /sys
read_only: true
- type: bind
source: /sys/fs/cgroup
target: /sys/fs/cgroup
read_only: true
- type: bind
source: /var/lib/docker
target: /var/lib/docker
read_only: true
- type: bind
source: /dev/disk
target: /dev/disk
read_only: true
<<: *logging
<<: *networking
# https://github.com/prometheus/node_exporter
node_exporter:
container_name: node_exporter
image: prom/node-exporter:v1.3.0
restart: unless-stopped
command:
- --path.procfs=/host/proc
- --path.rootfs=/rootfs
- --path.sysfs=/host/sys
- --collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)
volumes:
- type: bind
source: /
target: /host
read_only: true
bind:
propagation: rslave
network_mode: host
pid: host
<<: *logging
# https://docs.docker.com/compose/compose-file/compose-file-v3/#volume-configuration-reference
volumes:
prometheus-volume:
driver: local
name: prometheus-volume
grafana-volume:
driver: local
name: grafana-volume
loki-volume:
driver: local
name: loki-volume
# https://docs.docker.com/compose/compose-file/compose-file-v3/#network-configuration-reference
networks:
monitoring:
name: monitoring
driver: bridge
driver_opts:
com.docker.network.bridge.host_binding_ipv4: 127.0.0.1