infrastructure/control
2026-11-15 22:29:52 +03:00
..
app.js Pin manual builds to an immutable snapshot and keep snapshot scripts in the repo 2026-11-15 22:29:52 +03:00
index.html Pin manual builds to an immutable snapshot and keep snapshot scripts in the repo 2026-11-15 22:29:52 +03:00
README.md Pin manual builds to an immutable snapshot and keep snapshot scripts in the repo 2026-11-15 22:29:52 +03:00
server.py Pin manual builds to an immutable snapshot and keep snapshot scripts in the repo 2026-11-15 22:29:52 +03:00
style.css Pin manual builds to an immutable snapshot and keep snapshot scripts in the repo 2026-11-15 22:29:52 +03:00

Private build control portal

Standalone Python stdlib service. No ingress, reverse proxy, Docker socket or public-site route. The service binds only configured LAN/Tailscale/loopback addresses, checks the peer subnet and Host header, and requires same-origin JSON POSTs for the fixed systemd start/stop/schedule actions. It trusts users on those private networks; it is a personal control surface, not an Internet-facing app.

Terra deployment: 192.168.88.104:8099, 100.64.0.11:8099, 127.0.0.1:8099. Allowed peers: 192.168.88.0/24, 100.64.0.0/10, 127.0.0.0/8. Config /etc/archipelago/control.json includes listen, hosts (with port), allowed_networks, port, coordinator_root, worker_root, worker_source_root and optionally snapshot_dataset (default tank/archipelago/archlinux) plus snapshot_command (default /usr/local/sbin/archipelago-mirror-snapshot). Unit: deploy/archipelago-control.service. Source: /opt/archipelago/control-source, which must contain control/ and the imported pipeline/monitor.py and pipeline/release-schedule.py (deploy the pipeline/ directory with control/). LAN address changes require updating bind/Host config and restarting this service.

Monitoring contract

  • /api/status: actual systemd service/timer state, next trigger, history, source SHAs and the immutable repository snapshots (snapshots), read from the ZFS dataset.
  • /api/run?run=ID: ordered phase events, all invoked actions, complete argv, start/end times, elapsed time, exit code/error, and inventory of nested logs.
  • /api/log?run=ID&id=LOG&offset=BYTE: 256-KiB pages from any byte offset; offset -1 tails. Every byte is reachable; the UI does not equate a tail to a full log.
  • download=1: stream the complete file, without a size cap. No arbitrary path API.
  • All output is rendered as text; log content never becomes HTML or executable code.
  • Old runs expose all surviving logs but explicitly lack the new action timeline.
  • Progress is measured phases/status/duration, not an invented overall percentage.

New runs retain action-NNNN.log (stdout + stderr, no line limit), command metadata, phase events and nested CLI/build/acceptance/serial/Flatpak logs on ZFS under /opt/archipelago/data/private/pipeline-monitor/ID. Coordinator journald output is also available by invocation ID. The worker's live files are available before archive. Log history is separate from artifact-retention cleanup and is not auto-deleted. Source revisions are frozen into each run's source archive; the overview shows the next run's configured source revisions. Native executable logs retain their existing format; monitoring does not substitute human CLI output for private detailed logs.

Stopping the driver stops owned worker units, retains logs, and leaves unfinished build artifacts for diagnosis rather than starting a lengthy archive. D-098 removed the VM phases, so the portal no longer stops VM units. No command shell or arbitrary service name is accepted over HTTP.

Manual build request

POST /api/control accepts {action, mode, snapshot}: mode is iso or ostree, snapshot is latest, new or an existing YYYY-MM-DD date. Before the unit starts, the portal resolves the choice to one immutable date and writes /opt/archipelago/data/private/release-cycle/cycle-request.json; the driver consumes that file exactly once (ignoring a request older than 900 s) and binds the run to that snapshot URL. A scheduled or resumed run therefore never inherits a manual build's inputs.

new creates a snapshot through a transient systemd-run unit, because the read-only view it bind-mounts must land in the host mount namespace to be published over HTTP; a mount made inside this unit's own namespace would be invisible to the web server. Snapshot listing and validation read the ZFS dataset directly, so a view created moments ago is visible here as well. Retention keeps at most three monthly snapshots and prunes the orphaned views (deploy/mirror-snapshot*.sh).

Schedule buttons enable or disable the monthly dispatcher timer; the cadence itself (1st of the month, ISO + OSTree) is fixed by the code and is not editable from the portal.

Runtime API tests: python3 tests/control_portal.py on terra. They use a temporary fixture and fake systemd responses; they never start or stop a real build.