kiwix waits for a non-empty ZIM instead of a restart loop (on the car's server each restart's veth set off avahi's mDNS announcements and filled the Pi's Wi-Fi); pull-maps drops a connection a minute without data so the retry resumes (Wi-Fi switched under it)
CI / check (push) Successful in 22s
CI / deploy (push) Successful in 17s

This commit is contained in:
randy committed 2026-11-29 17:03:53 +01:00
1 parent f9fbcdbbc5
commit ea14b110e6
2 files changed
+10 -3

No files matched your search

+3 -1
View File
@@ -54,7 +54,9 @@ while IFS=$'\t' read -r size mtime path; do
# Into a temp file, renamed when complete: the app and Valhalla keep # Into a temp file, renamed when complete: the app and Valhalla keep
# reading the old copy until restarted. # reading the old copy until restarted.
if [ "$(stat -c %s "$part" 2>/dev/null || echo -1)" != "$size" ]; then if [ "$(stat -c %s "$part" 2>/dev/null || echo -1)" != "$size" ]; then
curl -fsS --retry 10 --retry-all-errors --retry-delay 5 -C - -o "$part" -H "@$auth" \ # --speed-*: a connection that went dead (Wi-Fi switched, proxy gone)
# is dropped after a minute without data and the retry resumes.
curl -fsS --retry 10 --retry-all-errors --retry-delay 5 --speed-limit 1024 --speed-time 60 -C - -o "$part" -H "@$auth" \
--get --data-urlencode "path=$path" "$server/api/sync/maps/file" || true --get --data-urlencode "path=$path" "$server/api/sync/maps/file" || true
fi fi
if [ "$(stat -c %s "$part" 2>/dev/null || echo -1)" = "$size" ]; then if [ "$(stat -c %s "$part" 2>/dev/null || echo -1)" = "$size" ]; then
+7 -2
View File
@@ -105,8 +105,11 @@ services:
# offline.pmtiles/terrain.pmtiles). On the default compose network (not # offline.pmtiles/terrain.pmtiles). On the default compose network (not
# network_mode: "service:maptool" — KIWIX_URL above reaches it by this # network_mode: "service:maptool" — KIWIX_URL above reaches it by this
# service's own name), so maptool and kiwix stay independent containers. # service's own name), so maptool and kiwix stay independent containers.
# Keeps restarting (harmlessly) if data/kiwix/wikipedia.zim isn't there # Waits (entrypoint below) while data/kiwix/wikipedia.zim is missing or
# yet — GET /api/kiwix just reports unavailable until it comes up. # empty — GET /api/kiwix just reports unavailable until it comes up. Not
# a restart loop: on the car's server (host network, placeholder ZIM
# until the map pull brings it) one restart a second meant a new veth
# each time, and avahi's mDNS announcements of them filled the Pi's Wi-Fi.
# #
# The volume binds the exact *file* path, not the data/kiwix/ directory — # The volume binds the exact *file* path, not the data/kiwix/ directory —
# deliberately, so data/kiwix/wikipedia.zim can be a symlink to wherever # deliberately, so data/kiwix/wikipedia.zim can be a symlink to wherever
@@ -131,6 +134,8 @@ services:
# this same prefix off incoming request paths, so both ends agree on # this same prefix off incoming request paths, so both ends agree on
# it) — no ports: mapping needed, nothing outside the compose network # it) — no ports: mapping needed, nothing outside the compose network
# ever talks to this container directly. # ever talks to this container directly.
# The image's own entrypoint (dumb-init, start.sh), after the wait.
entrypoint: ["/usr/bin/dumb-init", "--", "sh", "-c", "until [ -s /data/wikipedia.zim ]; do sleep 60; done; exec /usr/local/bin/start.sh \"$$@\"", "kiwix"]
command: ["--urlRootLocation=/kiwix", "/data/wikipedia.zim"] command: ["--urlRootLocation=/kiwix", "/data/wikipedia.zim"]
volumes: volumes:
# :z, shared for the same reason as maptool's own ./data mount above. # :z, shared for the same reason as maptool's own ./data mount above.