Skip to content

Add update orchestrator with image-owned webconfig trampoline - #160

Merged
d4rken merged 4 commits into
devfrom
feat/c1a-update-orchestrator
May 21, 2026
Merged

Add update orchestrator with image-owned webconfig trampoline#160
d4rken merged 4 commits into
devfrom
feat/c1a-update-orchestrator

Conversation

@d4rken

@d4rken d4rken commented May 21, 2026

Copy link
Copy Markdown
Member

Adds the on-device update orchestrator that sequences the four feeder-update phases (apt, feed, webconfig, runtime-overlay) so webconfig's "Update System" button has a single launch path instead of four.

The orchestrator script ships inside the runtime overlay at /opt/airplanes-runtime/current/lib/airplanes-update-orchestrator, where it travels with each runtime release. A small image-owned trampoline at /usr/local/lib/airplanes-webconfig/start-orchestrator.sh is what webconfig's sudoers entry pins to; it exec()s the overlay-shipped binary after verifying that it is a regular file and executable, or exits 75 (EX_TEMPFAIL) so the capability gate in webconfig translates a missing overlay to HTTP 503 rather than a 500.

Per-step state is persisted atomically to /run/airplanes/orchestrator.state (JSON, schema covers step / status / started_at / finished_at / error / apt_irreversible) so an HTTP poller can render progress. apt failures are flagged as irreversible in the state file; other steps' self-updaters do their own rollback. After the feed step succeeds, the orchestrator SIGHUPs airplanes-webconfig so any feed-env schema change is observed in the live process.

This PR does not bump AIRPLANES_RUNTIME_OVERLAY_TAG, so the orchestrator binary will land in feeder images only after the next auto-published runtime-dev-<YYYYMMDD>-<sha> tag is consumed by a follow-up image config bump. The trampoline lands immediately and is asserted by boot-smoke.

Sequences the four feeder-update phases (apt, feed, webconfig, runtime-overlay) behind a single entrypoint so webconfig's Update System button has one launch path. The trampoline at /usr/local/lib/airplanes-webconfig/start-orchestrator.sh is image-owned so webconfig's sudoers entry pins a stable absolute path; the orchestrator binary itself lives in the runtime overlay and moves with each runtime release.
@d4rken d4rken added the enhancement New feature or request label May 21, 2026
d4rken added 3 commits May 21, 2026 19:31
…n-absent

Adds a flock at startup so concurrent invocations exit 75 without racing on state file writes or apt. Sets APT_IRREVERSIBLE before the 'apt/running' state-file write so a poller landing during the mutation window observes the correct flag. Chains apt-get update with apt-get upgrade via && so update failures surface. Replaces unused per-component dry-run gates with a plain helper-present check; the self-update helpers themselves are authoritative for 'is anything newer'.
…defaults

Treat the runtime self-updater's FAILED_PRE_MUTATION + same_version_replay_* failure_reason as a no-op success — the orchestrator's contract is 'invoke when newer'; the helper itself decides what's newer and a same-version replay is the no-op case. Defaults for systemctl / apt-get pinned to absolute paths to match the header's stated privilege boundary. Reset APT_IRREVERSIBLE on the apt-get-not-found skip path so a poller doesn't see a stale 'irreversible' flag when no mutation happened.
Prior shape translated any pre-existing FAILED_PRE_MUTATION + same_version_replay_* state into orchestrator success — even when the current invocation exited without touching the state file (e.g. lock contention against rc=75). Snapshot mtime + inode before invoking the runtime self-updater and only honor the translation when this invocation actually rewrote the file.
@d4rken
d4rken merged commit 6460eec into dev May 21, 2026
18 checks passed
@d4rken
d4rken deleted the feat/c1a-update-orchestrator branch May 21, 2026 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant