Skip to content

Commit c2a95d3

Browse files
committed
Replace Docker healthcheck with s6 readiness notifications
Docker's healthcheck polling was used to determine when services were ready. s6-notifyoncheck provides the same readiness detection but integrates natively with the s6 supervision tree, enabling proper dependency ordering between services (e.g. buildkitd waits for dnsmasq and haproxy) without external polling.
1 parent 8a28180 commit c2a95d3

File tree

18 files changed

+11
-19
lines changed

18 files changed

+11
-19
lines changed

compose.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,3 @@ services:
3333
- ALLOWED_IP_RULES=${ALLOWED_IP_RULES:-}
3434
- EXTERNAL_RESOLVER=${EXTERNAL_RESOLVER:-1.1.1.1,8.8.8.8}
3535
restart: unless-stopped
36-
healthcheck:
37-
test: ["CMD", "sh", "-c", "curl -sf --unix-socket /var/run/haproxy-health.sock http://localhost/health"]
38-
interval: 30s
39-
timeout: 5s
40-
retries: 10
41-
start_period: 5s

docker/Dockerfile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,5 @@ COPY files/THIRD_PARTY_LICENSES /opt/buildcage/THIRD_PARTY_LICENSES
6868
# s6 service definitions and init scripts
6969
COPY files/s6-rc.d/ /etc/s6-overlay/s6-rc.d/
7070
COPY files/s6-scripts/ /etc/s6-overlay/scripts/
71-
RUN chmod +x /etc/s6-overlay/scripts/* && \
72-
chmod +x /etc/s6-overlay/s6-rc.d/dnsmasq/run && \
73-
chmod +x /etc/s6-overlay/s6-rc.d/haproxy/run && \
74-
chmod +x /etc/s6-overlay/s6-rc.d/haproxy-log/run
7571

7672
ENTRYPOINT ["/init"]
77-
CMD ["buildkitd", "--oci-worker-net=cni"]

docker/files/s6-rc.d/buildkitd/dependencies.d/dnsmasq

Whitespace-only changes.

docker/files/s6-rc.d/buildkitd/dependencies.d/haproxy

Whitespace-only changes.

docker/files/s6-rc.d/buildkitd/dependencies.d/init-iptables

Whitespace-only changes.

docker/files/s6-rc.d/buildkitd/run

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/command/with-contenv sh
2+
exec buildkitd --oci-worker-net=cni
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
longrun
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
nslookup localhost 127.0.0.1 > /dev/null 2>&1
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3

docker/files/s6-rc.d/dnsmasq/run

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/command/with-contenv sh
2-
exec dnsmasq --conf-file=/etc/dnsmasq.conf -k
2+
exec s6-notifyoncheck -d -w 250 -n 12 dnsmasq --conf-file=/etc/dnsmasq.conf -k

0 commit comments

Comments
 (0)