-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathdocker-compose.yml
172 lines (166 loc) · 4.41 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
version: "3.8"
services:
grafana:
container_name: monitoring-grafana
image: grafana/grafana:latest
hostname: rpi-grafana
restart: unless-stopped
user: "472"
networks:
- internal
ports:
- "3000:3000"
env_file:
- ./grafana/.env
volumes:
- grafana-data:/var/lib/grafana
- ./grafana/provisioning:/etc/grafana/provisioning
depends_on:
- prometheus
healthcheck:
test: ["CMD", "wget", "-O", "/dev/null", "http://localhost:3000/api/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
labels:
- "com.example.description=Grafana Dashboard"
- "com.example.service=monitoring"
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
cadvisor:
container_name: monitoring-cadvisor
image: gcr.io/cadvisor/cadvisor:latest
hostname: rpi-cadvisor
restart: unless-stopped
cap_add:
- SYS_ADMIN
networks:
- internal
expose:
- 8080
command:
- '-housekeeping_interval=15s'
- '-docker_only=true'
- '-store_container_labels=false'
devices:
- /dev/kmsg
volumes:
- /:/rootfs:ro
- /var/run:/var/run:rw
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
- /dev/disk/:/dev/disk:ro
- /etc/machine-id:/etc/machine-id:ro
healthcheck:
test: ["CMD", "wget", "-O", "/dev/null", "http://localhost:8080/healthz"]
interval: 30s
timeout: 10s
retries: 3
labels:
- "com.example.description=cAdvisor Container Monitoring"
- "com.example.service=monitoring"
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
mem_limit: 256m
mem_reservation: 128m
node-exporter:
container_name: monitoring-node-exporter
image: prom/node-exporter:latest
hostname: rpi-exporter
restart: unless-stopped
networks:
- internal
expose:
- 9100
command:
- --path.procfs=/host/proc
- --path.sysfs=/host/sys
- --path.rootfs=/host
- --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)($$|/)
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
- /:/host:ro,rslave
healthcheck:
test: ["CMD", "wget", "-O", "/dev/null", "http://localhost:9100/metrics"]
interval: 30s
timeout: 10s
retries: 3
labels:
- "com.example.description=Node Exporter"
- "com.example.service=monitoring"
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
mem_limit: 128m
mem_reservation: 64m
prometheus:
container_name: monitoring-prometheus
image: prom/prometheus:latest
hostname: rpi-prometheus
restart: unless-stopped
user: "nobody"
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--storage.tsdb.retention.time=1y'
- '--storage.tsdb.retention.size=10GB'
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
networks:
- internal
expose:
- 9090
volumes:
- prometheus-data:/prometheus
- ./prometheus:/etc/prometheus/
depends_on:
- cadvisor
- node-exporter
healthcheck:
test: ["CMD", "wget", "-O", "/dev/null", "http://localhost:9090/-/healthy"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
labels:
- "com.example.description=Prometheus Time Series Database"
- "com.example.service=monitoring"
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
mem_limit: 1g
mem_reservation: 512m
volumes:
grafana-data:
labels:
- "com.example.description=Grafana Persistent Data"
- "com.example.service=monitoring"
prometheus-data:
labels:
- "com.example.description=Prometheus Persistent Data"
- "com.example.service=monitoring"
networks:
internal:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.20.0.0/16
gateway: 172.20.0.1
labels:
- "com.example.description=Monitoring Network"
- "com.example.service=monitoring"