infrastructure/control/README.md

3.1 KiB

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. 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.
  • /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. Schedule buttons enable or disable the D-098 daily dispatcher timer; the cadence itself (three-day OSTree interval, day-30 ISO) 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.