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)
This commit is contained in:
1 parent
f9fbcdbbc5
commit
ea14b110e6
2 files changed
+10
-3
No files matched your search
+3
-1
@@ -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
|
||||
# reading the old copy until restarted.
|
||||
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
|
||||
fi
|
||||
if [ "$(stat -c %s "$part" 2>/dev/null || echo -1)" = "$size" ]; then
|
||||
|
||||
+7
-2
@@ -105,8 +105,11 @@ services:
|
||||
# offline.pmtiles/terrain.pmtiles). On the default compose network (not
|
||||
# network_mode: "service:maptool" — KIWIX_URL above reaches it by this
|
||||
# service's own name), so maptool and kiwix stay independent containers.
|
||||
# Keeps restarting (harmlessly) if data/kiwix/wikipedia.zim isn't there
|
||||
# yet — GET /api/kiwix just reports unavailable until it comes up.
|
||||
# Waits (entrypoint below) while data/kiwix/wikipedia.zim is missing or
|
||||
# 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 —
|
||||
# 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
|
||||
# it) — no ports: mapping needed, nothing outside the compose network
|
||||
# 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"]
|
||||
volumes:
|
||||
# :z, shared for the same reason as maptool's own ./data mount above.
|
||||
|
||||
Reference in new issue
Block a user