From b10bf54e8992355cc2385a8e1a3255dd170cf9c6 Mon Sep 17 00:00:00 2001 From: Kroese Date: Sat, 30 May 2026 21:23:31 +0200 Subject: [PATCH 1/3] feat: Add healthcheck script --- src/check.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/check.sh diff --git a/src/check.sh b/src/check.sh new file mode 100644 index 0000000..b7389e9 --- /dev/null +++ b/src/check.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +set -Eeuo pipefail + +: "${NETWORK:="Y"}" + +[ -f "/run/shm/qemu.end" ] && echo "QEMU is shutting down.." && exit 1 +[ ! -s "/run/shm/qemu.pid" ] && echo "QEMU is not running yet.." && exit 0 +[[ "$NETWORK" == [Nn]* ]] && echo "Networking is disabled.." && exit 0 + +file="/run/shm/qemu.ip" +[ ! -s "$file" ] && echo "The container has not enabled networking yet..." && exit 0 + +ip=$(<"$file") + +if ! curl -m 20 -ILfSs "http://$ip:80/" > /dev/null; then + echo "Failed to reach ZimaOS at port 80" && exit 1 +fi + +echo "Healthcheck OK" +exit 0 From 85ff898470f2e118439d8a3bb12a2019ac6890f0 Mon Sep 17 00:00:00 2001 From: Kroese Date: Sat, 30 May 2026 21:24:52 +0200 Subject: [PATCH 2/3] Update HEALTHCHECK command in Dockerfile --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2a86ab6..023397d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,7 +27,6 @@ ENV RAM_SIZE="4G" ENV CPU_CORES="2" ENV DISK_SIZE="1T" -HEALTHCHECK --interval=60s --timeout=10s --start-period=60s --retries=3 \ - CMD curl -LfSs http://localhost:80 >/dev/null || exit 1 +HEALTHCHECK --interval=60s --start-period=45s --retries=2 CMD /run/check.sh ENTRYPOINT ["/usr/bin/tini", "-s", "/run/entry.sh"] From c675335ce70e107a7afa62440e7ca0357e88a8f4 Mon Sep 17 00:00:00 2001 From: Kroese Date: Sat, 30 May 2026 21:39:13 +0200 Subject: [PATCH 3/3] Update exit code for networking check in check.sh Change exit code for networking check failure from 0 to 1. --- src/check.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/check.sh b/src/check.sh index b7389e9..24f624a 100644 --- a/src/check.sh +++ b/src/check.sh @@ -8,7 +8,7 @@ set -Eeuo pipefail [[ "$NETWORK" == [Nn]* ]] && echo "Networking is disabled.." && exit 0 file="/run/shm/qemu.ip" -[ ! -s "$file" ] && echo "The container has not enabled networking yet..." && exit 0 +[ ! -s "$file" ] && echo "The container has not enabled networking yet..." && exit 1 ip=$(<"$file")