Skip to content

K2GO-394 feat(dashboard): base-map downloads via the durable job engine - #559

Merged
luisguzman-adfa merged 2 commits into
mainfrom
feat/K2GO-394-dashnode-basemaps
Sep 7, 2026
Merged

K2GO-394 feat(dashboard): base-map downloads via the durable job engine#559
luisguzman-adfa merged 2 commits into
mainfrom
feat/K2GO-394-dashnode-basemaps

Conversation

@luisguzman-adfa

Copy link
Copy Markdown
Collaborator

What this changes

Base-map (pmtiles) downloads now run through dash-node, the dashboard durable job
engine, with the server up -- the same path ZIM downloads already use. This
replaces the blocking aria2c that the maps runrole ran in-proot, which wedged at
zero connections on a full network drop and never recovered.

Two areas, both separate from the controller app (that integration is a later PR):

  1. Dashboard (static/dashboard): a new basemaps job type and runner
    (sockets/maps-base.exec.ts). It mirrors the proven kiwix runner -- the
    canonical aria2 flag set plus the withRetry outer reconnect loop -- and
    downloads the DIRECT pmtiles URL into /library/www/maps. It is reached
    through the generic REST surface (POST /api/basemaps/download, and the shared
    cancel/pause/resume/retry). Dashboard version 1.3.1 -> 1.3.2.

  2. Maps role (tools/upstream-patches/patches/0003-maps-download-is-proot-delegate.patch):
    gate the stock download when: not is_proot (unchanged off proot) and, when: is_proot, assert dash-node already placed the file at dest_path. The role
    then only post-processes; its download tasks skip via creates:.

Why

On proot (Android) a blocking aria2 cannot recover a mobile-radio drop: it sits at
zero connections and never exits, so nothing retries. dash-node downloads with
--continue plus an outer reconnect loop -- the mechanism already proven for ZIMs.

Verification

Device-verified on a fresh rootfs at 4 MB/s: a 978 MB terrain pmtiles, wifi cut
mid-download. retryAttempt climbed 1..5 ("Reconnecting n/5"), the partial was
kept, and after restoring wifi the retry resumed from the partial via --continue
to done. Cancel prunes the partial, so the role does not take a preallocated
partial as complete.

To confirm before merge: that the maps role routes only pmtiles
(expand_archive=false) through download_large_file.yml on proot, so the
is_proot presence assert never meets a file the app did not delegate to dash-node.

Add a "basemaps" job type and runner (sockets/maps-base.exec.ts). The app now
downloads the global map pmtiles through dash-node, with the server up, instead
of a blocking aria2c in the maps runrole. That in-proot aria2c wedged at CN:0 on
a full network drop and never recovered.

The runner mirrors kiwix.exec.ts: the canonical aria2 flag set plus the withRetry
outer reconnect loop. On a full interface loss aria2 exits (code 19, DNS) and the
loop re-runs it, which resumes via --continue. The poll shows "Reconnecting n/5".
It downloads the DIRECT pmtiles URL, not a .meta4 metalink. Metalink downloads
were the exact case aria2 could not recover. Files land in /library/www/maps, so
the role's "creates:" and .meta4 probe then skip the download. A cancel prunes the
partial, because aria2 preallocates the full size and the role would take that
partial as complete.

Reached through the generic surface (POST /api/basemaps/download; GET and POST
/api/basemaps/jobs/:id/{cancel,pause,resume,retry}). Kept separate from the FQR
"maps" type (tile-extract). Bumps the dashboard version to 1.3.2.

Device-verified on a fresh rootfs at 4 MB/s: cut wifi mid-download, retryAttempt
climbed 1..5 with the partial kept, then restore resumed from the partial to done.
…node

Upstream patch 0003 for roles/maps/tasks/download_large_file.yml. On proot the
blocking aria2c cannot recover a full mobile-radio drop; it wedges with no exit.
Gate the stock download "when: not is_proot", so it is unchanged off proot. Add a
"when: is_proot" step that asserts dash-node already placed the pmtiles at
dest_path. dash-node downloads it first, with resume; the role then only
post-processes.
@luisguzman-adfa
luisguzman-adfa merged commit 5bf56ad into main Sep 7, 2026
4 checks passed
@luisguzman-adfa
luisguzman-adfa deleted the feat/K2GO-394-dashnode-basemaps branch September 7, 2026 15:56
@luisguzman-adfa
luisguzman-adfa restored the feat/K2GO-394-dashnode-basemaps branch September 7, 2026 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant