mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-12 06:24:10 +01:00
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.
This commit is contained in:
@@ -10,3 +10,8 @@ services:
|
|||||||
- UPDATE_FREQUENCY=48h
|
- UPDATE_FREQUENCY=48h
|
||||||
volumes:
|
volumes:
|
||||||
- akvorado-geoip:/data
|
- akvorado-geoip:/data
|
||||||
|
healthcheck:
|
||||||
|
interval: 10s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 0
|
||||||
|
test: ["CMD", "test", "-f", "/tmp/healthy"]
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
trap exit TERM
|
trap exit TERM
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
|
ok=1
|
||||||
for DATABASE in ${IPINFO_DATABASES}; do
|
for DATABASE in ${IPINFO_DATABASES}; do
|
||||||
if [ -f ${DATABASE}.mmdb ]; then
|
if [ -f ${DATABASE}.mmdb ]; then
|
||||||
# Is it up-to-date?
|
# Is it up-to-date?
|
||||||
@@ -29,10 +30,12 @@ while true; do
|
|||||||
*)
|
*)
|
||||||
echo "Failed to download ${DATABASE}.mmdb database (HTTP error $RESPONSE)."
|
echo "Failed to download ${DATABASE}.mmdb database (HTTP error $RESPONSE)."
|
||||||
rm "${DATABASE}.mmdb.new" 2> /dev/null
|
rm "${DATABASE}.mmdb.new" 2> /dev/null
|
||||||
|
ok=0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
[ $ok -eq 1 ] && touch /tmp/healthy
|
||||||
sleep "$UPDATE_FREQUENCY" &
|
sleep "$UPDATE_FREQUENCY" &
|
||||||
wait $!
|
wait $!
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user