- install.sh always asks for the install directory (--prefix or a prompt with confirmation, no default); refuses system directories, the repository checkout itself, paths inside/containing it and non-empty directories (a resumed install is allowed). A preflight refusal says nothing was changed. - UI is part of the repository: committed build in deploy/ui-dist with SOURCE_HASH and a staleness guard (check-ui.sh, loud warning). install.sh and update.sh resolve the UI: --ui-dist FILE|DIR, --build-ui, committed build; install stops without a UI unless --no-ui. update.sh swaps the UI when its hash differs from the installed one (.ui-source-hash). - build-ui.sh: --docker, --local (host Node >= 20.19, temporary copy), --node-download (portable Node, SHA-256 verified), --publish. - Verified on Alpine 3.23: install without UI options installs the real UI; local build equals the Docker build; update skips an unchanged UI and warns on a stale build. --node-download is untested (needs network). - Docs: Scenario 2 guide, change summary, plan, README. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
4.0 KiB
4.0 KiB
UI delivery for system-service installs: plan (2026-10-05)
Problem: install.sh without --ui-dist installed only a placeholder page and merely warned. After the install "the UI is not there". The owner proposes two ways, both wanted:
- Keep an up-to-date UI build in the repository and use it at install time.
- Allow building the UI without a container.
The install script must treat the UI as a normal part of the repository and install it automatically.
Design
Committed build (deploy/ui-dist/)
- The built UI (index.html, assets, ...) is committed in
deploy/ui-dist/together withSOURCE_HASH: a SHA-256 over the UI sources it was built from (APP_UI/src,public,index.html,package.json,package-lock.json,vite.config.js,jsconfig.json; sorted,LC_ALL=C). It sits outsideAPP_UIso the container builds (which copyAPP_UI) are not affected. - Staleness guard: install and update compare the hash of the current
APP_UIsources withSOURCE_HASH. Equal = fresh. Different = the build is older than the sources: a loud warning, the build is still used unless a better source is selected (see order).deploy/native/check-ui.shexits 1 when the committed build is stale (for maintainers, before a commit or a release). - The installed web root records the hash it was installed from (
<webroot>/.ui-source-hash), soupdate.shknows when the UI changed.
Building without a container
build-ui.sh modes (default: Docker if available, otherwise local):
--docker: as now (node:20-alpine).--local: Node on the build host. Uses the system Node when it is 20.19 or newer; otherwise it stops with exact instructions per OS (Alpine:apk add nodejs npm; Debian/Ubuntu: Node 20+ from the Node.js distribution) or, with--node-download, fetches the official Node 20 LTS archive (glibc, x86_64/aarch64) into a temporary directory, verifies it against the published SHA-256 sums, builds and deletes it again (nothing is installed on the host).--publish: after the build, refreshdeploy/ui-dist/andSOURCE_HASHin the repository (maintainer action);-o FILEstill writes a tarball for another host.
UI source order in install.sh and update.sh
--ui-dist FILE|DIR(tarball or directory), explicit.--build-ui(build now fromAPP_UI, Docker or local as above; for hosts where the committed build is stale or missing).- The committed
deploy/ui-dist/found in the repository checkout (automatic). - Nothing found: install stops with the reasons and the ways out, unless
--no-uiis given (placeholder page on purpose).update.shkeeps the installed UI when no source is found.update.shinstalls the repository build automatically when its hash differs from the installed one;--ui-distand--build-uistill override.
Steps
deploy/native/lib.sh:ui_source_hash,ui_resolve(the order above),stage_uiaccepting a directory as well as a tarball, hash file in the web root.deploy/native/build-ui.sh:--docker,--local,--node-download,--publish; Node version check.deploy/native/check-ui.sh.install.shandupdate.shuseui_resolve; new options--build-ui,--no-ui; clear messages.- Commit the current build in
deploy/ui-dist/(built withbuild-ui.sh --publish);.gitignore,.dockerignoreadjustments. - Documentation: Scenario 2 guide (UI section rewritten: three ways, staleness, maintainer routine), README quick start, change summary.
Verification
check-ui.shon a fresh and on a deliberately stale tree.build-ui.sh --localon an Alpine container with the distribution's Node (no Docker inside), and--publishwith Docker.- Alpine install in a container without any UI option: the UI is installed automatically from the repository and served (HTTP 200, real index page, not the placeholder).
- Update with an unchanged and with a changed UI hash.
Out of scope
CI that rebuilds the UI on every commit, a pre-commit hook, Node installation through the package manager by the scripts.