Private
Public Access
4.5 KiB
4.5 KiB
Runtime package cleanup
Objective and invariants
Make the Bearer package install only the runtime. Follow the useful parts of the PHP-FPM package model.
- The package must not own an application webroot.
- Bearer must not run as root by default.
- The administrator must control process counts and memory limits.
- Existing source deployments and package upgrades must retain their configuration.
- Debian and RPM packages must describe the same runtime boundary.
Success criteria
- Debian and RPM payloads contain no files from
site/. - The packaged service runs as an unprivileged account.
- The unit has no fixed total-memory policy.
- The setup guide distinguishes the request memory limit from a systemd service limit.
- The setup guide explains the single-site trust boundary.
- Package checks reject an application webroot in the payload.
- Relevant builds and tests pass.
Current state
- Status: complete
- Source:
/root/mount_ssh/capy-bearer - Runtime: no deployment is part of this change
Goal tree
- G1: Make the packages runtime-only.
- G1.1: Remove the site copy and obsolete package options.
- G1.2: Remove site claims and webroot checks from package metadata.
- G1.3: Reject accidental site and development payloads during package validation.
- G2: Use an unprivileged default service identity.
- G2.1: Set the Debian and source service units to
www-data. - G2.2: Give the RPM a dedicated
beareraccount and unit files. - G2.3: Migrate ownership of standard mutable state once during package installation.
- G2.1: Set the Debian and source service units to
- G3: Put resource controls in the correct configuration layer.
- G3.1: Remove the fixed total service memory limit.
- G3.2: Document
WASM_MEMORY_LIMIT_BYTES, worker settings, and systemd drop-ins.
- G4: Document the site-root behavior.
- G4.1: Explain FastCGI routing through
SCRIPT_FILENAME. - G4.2: Explain the shared scan, WebSocket, task, and file-access boundary.
- G4.1: Explain FastCGI routing through
- G5: Verify the complete change.
Next
- Build target-distribution artifacts before any server installation.
- Test each package installation in a disposable host with the target distribution.
Decisions, assumptions, and risks
- Decision: Use
www-dataon the Debian-oriented units. Ubuntu does not provide awww-runaccount. - Decision: Use a dedicated
beareraccount in the RPM because RPM web-server account names differ. - Decision: Keep four request workers and two proactive compiler workers as configurable defaults.
- Decision: Use a systemd drop-in for the total service memory limit. Keep the per-request Wasm limit in Bearer configuration.
- Assumption: One Bearer instance can serve sites that intentionally share one filesystem and runtime trust boundary.
- Risk: Independent sites need separate instances because Bearer has one proactive scan root and one WebSocket document root.
Evidence
- 2026-09-12:
scripts/make_deb.shandscripts/make_rpm.shcopysite/into the package webroot. - 2026-09-12: Both service units omit
UserandGroup, so systemd runs Bearer as root. - 2026-09-12:
WORKER_COUNTandPROACTIVE_COMPILE_JOBSalready come from/etc/bearer/settings.cfg. - 2026-09-12: Normal FastCGI requests execute nginx's
SCRIPT_FILENAME. Other runtime features still use the globalSITE_DIRECTORY. - 2026-09-12: The Debian and RPM builders completed. Payload inspection found no application root, bundled site, source tree, test tree, or development documentation.
- 2026-09-12: The generated Debian package reports an apparent installed size of 44,077 KiB after removing headers and development files.
- 2026-09-12: An isolated runtime started as
www-data. Its private CLI socket and state paths hadwww-data:www-dataownership. - 2026-09-12: The package layout test, shell syntax checks, documentation example checks, and
git diff --checkpassed. - 2026-09-12: Adversarial review found an RPM account blocker and three documentation or migration warnings. The changes add RPM-specific units, account provisioning, exact-default migration, a slim payload, and complete process-count guidance.
- 2026-09-12: Final review rejected the world-writable RPM socket and full Wasmtime development tree. The RPM socket now uses
bearer:bearermode0660. Both packages contain only the Wasmtime shared library and license files. - 2026-09-12: The extracted package binary started its help path with the packaged Wasmtime shared library.
- 2026-09-12: Commit
f2c2d65is pushed toorigin/main. No server received the package.