From bd0e0f25db3815c90affd3479c4a7c220e504999 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Thu, 8 May 2025 17:09:32 +0200 Subject: [PATCH] docker: add an healthcheck for ipinfo updater container We could add a dependency of the orchestrator on it, but it may break some setups. We'll see later. --- docker/docker-compose-ipinfo.yml | 5 +++++ docker/ipinfo-geoipupdate.sh | 3 +++ 2 files changed, 8 insertions(+) diff --git a/docker/docker-compose-ipinfo.yml b/docker/docker-compose-ipinfo.yml index 6035ba2e..5a5a8fea 100644 --- a/docker/docker-compose-ipinfo.yml +++ b/docker/docker-compose-ipinfo.yml @@ -10,3 +10,8 @@ services: - UPDATE_FREQUENCY=48h volumes: - akvorado-geoip:/data + healthcheck: + interval: 10s + timeout: 10s + retries: 0 + test: ["CMD", "test", "-f", "/tmp/healthy"] diff --git a/docker/ipinfo-geoipupdate.sh b/docker/ipinfo-geoipupdate.sh index 5bcb2c45..c2fcf0cb 100644 --- a/docker/ipinfo-geoipupdate.sh +++ b/docker/ipinfo-geoipupdate.sh @@ -3,6 +3,7 @@ trap exit TERM while true; do + ok=1 for DATABASE in ${IPINFO_DATABASES}; do if [ -f ${DATABASE}.mmdb ]; then # Is it up-to-date? @@ -29,10 +30,12 @@ while true; do *) echo "Failed to download ${DATABASE}.mmdb database (HTTP error $RESPONSE)." rm "${DATABASE}.mmdb.new" 2> /dev/null + ok=0 ;; esac done + [ $ok -eq 1 ] && touch /tmp/healthy sleep "$UPDATE_FREQUENCY" & wait $! done