@@ -47,17 +47,34 @@ services:
4747 - SYS_TIME
4848 - SYS_NICE
4949 restart : unless-stopped
50+ depends_on :
51+ unbound :
52+ condition : service_healthy
5053
5154 unbound :
5255 container_name : unbound
5356 image : " mvance/unbound-rpi:latest"
5457 hostname : unbound
58+ command : >
59+ sh -c "
60+ if [ ! -f /opt/unbound/etc/unbound/unbound_control.key ]; then
61+ echo 'Generating Unbound control keys...';
62+ unbound-control-setup -d /opt/unbound/etc/unbound;
63+ fi &&
64+ unbound -d -c /opt/unbound/etc/unbound/unbound.conf
65+ "
5566 networks :
5667 macvlan :
5768 ipv4_address : ${IP_UNBOUND}
5869 volumes :
5970 - " ./unbound:/opt/unbound/etc/unbound"
6071 restart : unless-stopped
72+ healthcheck :
73+ test : ["CMD-SHELL", "unbound-control -c /opt/unbound/etc/unbound/unbound.conf status"]
74+ interval : 30s
75+ timeout : 10s
76+ retries : 3
77+ start_period : 30s
6178
6279 caddy :
6380 container_name : caddy
@@ -84,6 +101,12 @@ services:
84101 - IP_GRAFANA=${IP_GRAFANA}
85102 - IP_UPTIME_KUMA=${IP_UPTIME_KUMA}
86103 - IP_UMAMI_APP=${IP_UMAMI_APP}
104+ healthcheck :
105+ test : ["CMD", "wget", "--quiet", "--spider", "--tries=1", "http://localhost:8081/health"]
106+ interval : 30s
107+ timeout : 10s
108+ retries : 3
109+ start_period : 30s
87110
88111 umami_db :
89112 image : postgres:alpine
@@ -122,6 +145,12 @@ services:
122145 APP_SECRET : ${UMAMI_APP_SECRET}
123146 TZ : " America/New_York"
124147 DISABLE_LOGIN : " false"
148+ healthcheck :
149+ test : ["CMD-SHELL", "wget --quiet --spider --tries=1 http://localhost:3000 || exit 1"]
150+ interval : 30s
151+ timeout : 10s
152+ retries : 3
153+ start_period : 30s
125154
126155 # --- Monitoring Services ---
127156 prometheus :
@@ -140,6 +169,12 @@ services:
140169 networks :
141170 macvlan :
142171 ipv4_address : ${IP_PROMETHEUS}
172+ healthcheck :
173+ test : ["CMD-SHELL", "wget --quiet --spider --tries=1 http://localhost:9090/-/healthy || exit 1"]
174+ interval : 30s
175+ timeout : 10s
176+ retries : 3
177+ start_period : 30s
143178
144179 grafana :
145180 image : grafana/grafana-oss:latest
@@ -157,6 +192,12 @@ services:
157192 networks :
158193 macvlan :
159194 ipv4_address : ${IP_GRAFANA}
195+ healthcheck :
196+ test : ["CMD-SHELL", "wget --quiet --spider --tries=1 http://localhost:3000/api/health || exit 1"]
197+ interval : 30s
198+ timeout : 10s
199+ retries : 3
200+ start_period : 30s
160201
161202 rpi_node_exporter :
162203 image : prom/node-exporter:latest
@@ -174,6 +215,12 @@ services:
174215 - " --path.sysfs=/host/sys"
175216 - " --path.rootfs=/rootfs"
176217 - " --collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc|rootfs/var/lib/docker/containers|rootfs/var/lib/docker/overlay2|rootfs/run/docker/netns|rootfs/var/lib/docker/aufs)($$|/)"
218+ healthcheck :
219+ test : ["CMD-SHELL", "wget --quiet --spider --tries=1 http://localhost:9100/metrics || exit 1"]
220+ interval : 30s
221+ timeout : 10s
222+ retries : 3
223+ start_period : 30s
177224
178225 cadvisor :
179226 image : gcr.io/cadvisor/cadvisor:latest
@@ -204,6 +251,12 @@ services:
204251 networks :
205252 macvlan :
206253 ipv4_address : ${IP_BLACKBOX}
254+ healthcheck :
255+ test : ["CMD-SHELL", "wget --quiet --spider --tries=1 http://localhost:9115 || exit 1"]
256+ interval : 30s
257+ timeout : 10s
258+ retries : 3
259+ start_period : 30s
207260
208261 uptime_kuma :
209262 image : louislam/uptime-kuma:latest
0 commit comments