diff --git a/bin/pull-maps.sh b/bin/pull-maps.sh index e7bb39e..03f6829 100755 --- a/bin/pull-maps.sh +++ b/bin/pull-maps.sh @@ -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 diff --git a/docker-compose.yaml b/docker-compose.yaml index e0d93b3..235e85e 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -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.