Skip to content

Spike: settle image, TLS, port and engine unknowns for the DIY browser wizard #4548

Done

Description

@pithead-architect

What's the problem

Part of #4464 (spike first). #4464 adds a browser-or-terminal interface choice to DIY ./pithead setup and reuses the appliance firstboot browser wizard for DIY. Four facts must be settled before the browser leg can be built: (1) whether the dashboard image exists when setup starts on DIY; (2) how the wizard page gets TLS on a non-appliance host (the appliance mints it via lib/pithead/26-appliance-tls-provisioning.sh); (3) which port the page uses on shared hosts (dashboard.port exists for co-hosting; wizard_start_page binds host 80/443); (4) whether a container engine is present before dependencies are installed. This chunk settles them; no behavior ships.

What it impacts

Only the design of the #4464 browser leg: image source, TLS posture, port choice, and where the interface choice gates on engine presence. No user-visible change.

How I found it

The four unknowns were recorded on #3577 and carried to #4464 by the owner. Starting points read on develop-v2.1.0 at 190234b on 2026-11-26: setup() is lib/pithead/38-setup-command.sh; container_engine() is lib/pithead/05-doctor-checks.sh:54; the appliance page starts only via firstboot_wizard() (lib/pithead/12-firstboot-wizard.sh) calling wizard_start_page() (lib/pithead/12a-wizard-page.sh: -p 80:8000 -p 443:8443, WIZARD_TOKEN, WIZARD_TLS_CERT/KEY set only with a cert fingerprint); lib/pithead/11-baked-images.sh is the appliance's image story.

How important is it

High for #4464: the operator held the interface-choice prompt back so no dead option ships, and #4464 requires these facts settled before the browser leg is built. Not a release emergency; no user is affected until the browser leg lands.

Acceptance criteria

  • Each unknown gets a recorded answer with file:line evidence (one unedited bench-ci evidence block from a single targeted job only where reading cannot settle it): image presence at setup start on DIY; TLS source on a non-appliance host; the port to use when 80/443 are taken and how dashboard.port interacts; engine presence before dependency install and where the browser leg should gate on it.
  • A recorded design decision: reuse firstboot_wizard/wizard_start_page vs a short-lived container started by setup; DIY TLS posture (LAN HTTP vs self-signed); the port-selection rule; the exact setup point where the browser leg is offered and where it falls back with a reason.
  • The decision is posted as a comment on DIY setup: browser wizard behind a CLI or browser interface choice (spike first) #4464 and on this issue (DIY setup: browser wizard behind a CLI or browser interface choice (spike first) #4464's acceptance allows a documented decision in the issue). If a doc page lands instead, tiers 1 to 3 prove it.
  • No behavior change, no new explanatory code comments.

Possible solutions

  • Read the paths above end to end; avoid tier-4 unless a probe is unavoidable (options.mode: check proves nothing; use targeted if anything).
  • Record decisions as issue comments; a short docs/dev note is optional.

Parent: #4464

Worker brief: Test tier: tiers 1 to 3 (docs/decision only); submit a bench job only if code reading cannot settle an unknown, then tier4-e2e targeted with --base develop-v2.1.0 and quote its evidence block unedited. Base: develop-v2.1.0. Answer the four #4464 unknowns — dashboard image existence when setup starts on DIY; wizard TLS on non-appliance hosts; port on shared hosts vs dashboard.port; container engine presence before dependency install — with file:line evidence (start at lib/pithead/38-setup-command.sh, 05-doctor-checks.sh container_engine, 12-firstboot-wizard.sh, 12a-wizard-page.sh, 11-baked-images.sh, 26-appliance-tls-provisioning.sh, 33-render-env.sh dashboard.port). Then record the design decision (reuse firstboot_wizard/wizard_start_page vs short-lived container; TLS posture; port rule; fallback point) as a comment on #4464 and on your issue. No code or behavior change.

Activity

  1. added this to the v2.1.0 milestone on Nov 27, 2026
  2. added
    setup
    needs-triage
    size:S
    on Nov 27, 2026
  3. pithead-developer commented on Dec 4, 2026

    @pithead-developer
    Contributor

    Decision: DIY browser wizard (spike #4548, parent #4464)

    Read at develop-v2.1.0 190234b0. Reading settled all four unknowns, so no bench job was submitted and nothing changed in the repo.

    The four answers

    1. Dashboard image at setup start on DIY: absent.

      • setup_confirmed (lib/pithead/38-setup-command.sh:20-60) calls load_baked_images only when is_appliance (:23), and is_appliance needs the RAUC config and pithead-install (10-installer-preseed.sh:165-170). The archive load in 11-baked-images.sh:33 is never reached on DIY.
      • On DIY the image tag is decided by export_build_provenance (19-small-utilities.sh:147-157). A source checkout gets pithead-dashboard:dev, built by compose. A release bundle gets :vX.Y.Z, pulled from the registry.
      • Nothing before the final prompt builds or pulls it. provision_tor only brings up tor (32-onion-provisioning.sh:20, --pull policy from resolve_pull_policy, 01-lifecycle.sh:53-59). The dashboard comes up in stack_up, after prompt_start_stack (38-setup-command.sh:60).
      • A release install also cosign-verifies the images before pulling them (verify_release_images, 03-release-verify.sh:93, called from stack_up 01-lifecycle.sh:228). The browser leg must not pull the dashboard image outside that path.
    2. TLS on a non-appliance host: the mint code already works there.

      • stage_wizard_spool → wizard_mint_cert → appliance_mint_cert (11a-wizard-spool.sh:178, 26-appliance-tls-provisioning.sh:292,320) needs only openssl. It writes a self-signed RSA-2048 pair under appliance_tls_dir ($PWD/data/tls, :44) and copies it into the spool.
      • The SAN list comes from appliance_site_names (:86). On DIY, is_appliance is false, so it holds only $HOST_IP or hostname (:60-68). The hostname -I address expansion (:90-97) and the <host>.local name run only on the appliance. A DIY cert therefore does not cover the LAN IP or mDNS name the operator types.
      • The container serves HTTPS only when both cert and key files exist (dashboard/mining_dashboard/wizard/server.py:642-650). Otherwise it serves plain HTTP, so a failed mint silently drops TLS. The existing banner already prints the right scheme (12a-wizard-addresses.sh:35-48).
    3. Port on a shared host: the wizard's 80/443 publish is hard-coded and dashboard.port does not apply.

      • wizard_start_page publishes -p 80:8000 -p 443:8443 (12a-wizard-page.sh:9). If either is taken, run fails and error stops setup (:14-18), so there is no fallback today.
      • dashboard.port is HOST_PORT, read in parse_and_validate_config (28-parse-and-validate-config.sh:284) and used only to render Caddy's site address (35-caddyfile-and-auth-helpers.sh:88-100). No config exists yet when the browser leg would start, because the wizard is what writes it (ensure_config_exists, 38-setup-command.sh:25). So the setup page cannot honor dashboard.port.
      • The container's own binds are fixed at 8000/8443 (server.py:21-22) and the host side of each publish is free to change.
    4. Engine before dependency install: not guaranteed.

      • check_prerequisites (38-setup-command.sh:24, 23-setup-and-credentials.sh:36-94) is where docker is detected, offered through apt, and then proven reachable (docker info, :89).
      • container_engine (05-doctor-checks.sh:54-66) returns docker when nothing is installed, so its answer is not evidence that an engine exists.
      • --skip-deps skips all of this (:37-40).

    Design decision

    • Reuse the existing pieces; no short-lived container written for setup. Call stage_wizard_spool, wizard_start_page and the spool-consume loop, because they already do the token gate, the TLS fallback and the host-side validation. Starting a second container would duplicate that trust shape. Reuse needs three DIY adjustments:
      • wizard_start_page takes the host ports as parameters instead of the fixed 80/443.
      • wizard_host_addresses needs a path that does not depend on agetty and /run/issue.d (12a-wizard-addresses.sh). Those are console-only, and on DIY the URL and token go to the terminal.
      • Spool and restore dirs need DIY-writable locations. restore_submission_dir defaults to /run/pithead-restore-submit (09a-restore-volatile.sh:8).
    • Where the choice is offered. After check_prerequisites and before ensure_config_exists, so between 38-setup-command.sh:24 and :25. The engine is proven there, and nothing has been written yet.
      • With --skip-deps, run "$(container_engine)" info first and fall back to the terminal if it fails.
      • Not interactive ([ ! -t 0 ]): terminal path only. The browser option is never offered.
    • Image. Use the image stack_up would use.
      • Source checkout: docker compose build dashboard, or fall back to the terminal if docker image inspect pithead-dashboard:dev is missing and the build fails.
      • Release bundle: pull through the same cosign-verified path as verify_release_images. If the pull or the verify fails, fall back to the terminal with the reason.
      • Never run an unverified pulled image.
    • TLS posture: self-signed, same as the appliance. The page carries payout address, node passwords and the dashboard password, so plain HTTP is not acceptable (see the comment at server.py:645-648).
      • Mint with the existing code, and make the DIY SAN list include every address the banner prints.
      • If the mint fails, do not serve plain HTTP on DIY. Fall back to the terminal with the reason. This is stricter than the appliance, which warns and serves HTTP (12-firstboot-wizard.sh:104).
      • Print the SHA-256 fingerprint in the terminal, as the appliance banner does.
    • Port rule. Try 443 then 80 only if both are free. Otherwise pick the first free high port from a fixed list (8443, 8444, …, bounded) for HTTPS and publish the redirect port only if free.
      • Probe with a bind test before run, not by parsing the engine's error.
      • Print the final URL with the chosen port.
      • Later, when dashboard.port is already set in an existing config.json (re-run), prefer it as the first candidate. A fresh DIY has no value to read.
    • Fallback with a reason. Every browser-leg failure (no engine, image unavailable, no free port, cert mint failed, container did not start) prints one line naming the cause and continues into the existing terminal wizard (ensure_config_exists) at the same point, with no state left behind (pithead-wizard container removed, spool cleared).

    What is not settled by reading

    Whether a DIY host's real LAN addresses all reach the container through the engine's port publish, and rootless Docker or podman edge cases. The first browser-leg PR should prove these with a tier4-e2e targeted job.

  4. pithead-developer commented on Dec 4, 2026

    @pithead-developer
    Contributor

    Questions before work continues (answer here, then remove the question label):

    The worker reported done but no PR exists for branch agent/4548-spike-settle-image-tls-port-and-engine-u. I read the code and answered the four unknowns with file:line evidence. I posted the decision as comments on #4464 and #4548, and no PR was opened. Branch HEAD equals origin/develop-v2.1.0, so nothing was committed, which is what the acceptance criteria allow for a decision-only spike. No bench job was submitted because reading settled every unknown. (1) On DIY the dashboard image is absent when setup starts. (2) The existing TLS mint needs only openssl, but on a non-appliance host the cert's names do not cover the LAN IP or mDNS name. (3) The wizard's 80/443 publish is hard-coded and dashboard.port does not apply, because no config exists yet at that point. (4) An engine is not guaranteed before check_prerequisites. The decision reuses firstboot_wizard and wizard_start_page with parameterised ports and a DIY spool, offers the browser leg between check_prerequisites and ensure_config_exists, uses a self-signed cert with no plain-HTTP fallback, and falls back to the terminal with a stated reason on any failure. Still unproven: whether all LAN addresses reach the container through the engine's port publish, and rootless docker/podman cases. The first browser-leg PR should prove these with a tier4-e2e targeted job.

  5. added
    question
    on Dec 4, 2026
  6. pithead-architect commented on Dec 4, 2026

    @pithead-architect
    Author

    Ruling: Accepted as done. This is a decision-only spike, and its acceptance criteria allow that: each of the four unknowns has a file:line answer, and the design decision is posted on #4464 and on this issue. Reading settled everything, so skipping a bench job is correct. No PR is needed and the empty branch is fine. Do not open one. Carry the two unproven items forward by name, so #4464's first browser-leg PR cannot skip them. They are (a) whether every LAN address reaches the wizard container through the engine's port publish, and (b) rootless docker and podman. That PR needs a tier4-e2e job on its head, because it touches the wizard, setup and port-publish paths. The decision that follows from the spike is to reuse firstboot_wizard and wizard_start_page with parameterised ports and a DIY spool. It offers the browser leg between check_prerequisites and ensure_config_exists. It uses a self-signed cert with no plain-HTTP fallback, and any failure falls back to the terminal with a stated reason. It does not remove or narrow the terminal path, so the clearnet-by-choice and no-removed-choice rulings are not touched. The owner can redirect on #4464 before the browser leg is built. Clear the question label and return done.

  7. removed
    question
    on Dec 4, 2026
  8. pithead-developer commented on Dec 4, 2026

    @pithead-developer
    Contributor

    Questions before work continues (answer here, then remove the question label):

    The worker reported done but no PR exists for branch agent/4548-spike-settle-image-tls-port-and-engine-u. Decision-only spike, accepted by the operator. No PR was opened and the branch has no changes. The four-unknown answers and the design decision are on #4548 and #4464. I added a comment on #4464 naming the two unproven items the first browser-leg PR must prove: (a) whether every LAN address reaches the wizard container through the engine's port publish, and (b) rootless docker and podman. That comment also says the PR needs a tier4-e2e job on its head. I ran the label-removal command for question on #4548 and it returned no error. I did not check the label list afterwards.

  9. added
    question
    on Dec 4, 2026
  10. pithead-architect commented on Dec 4, 2026

    @pithead-architect
    Author

    Ruling: Done. The spike's acceptance criteria allow a decision-only result. Each of the four unknowns has a file:line answer, the design decision is on #4464 and #4548, and reading settled every unknown, so no bench job was needed. Do not open a PR or push anything: an empty branch is correct. Return done and ask nothing further. The two unproven items, every LAN address reaching the wizard container through the engine's port publish and rootless docker and podman, are already named on #4464. That issue's first browser-leg PR must prove both and carry a tier4-e2e job on its head. The question label is still on this issue. Your removal call returned no error but did not take effect. The runner clears it when it records done, so do not retry it by hand.

  11. removed
    question
    on Dec 4, 2026
  12. pithead-developer commented on Dec 4, 2026

    @pithead-developer
    Contributor

    Questions before work continues (answer here, then remove the question label):

    The worker reported done but no PR exists for branch agent/4548-spike-settle-image-tls-port-and-engine-u. Decision-only spike, done. No PR was opened and nothing was pushed. The four-unknown answers and the design decision are on #4548 and #4464. #4464 also names the two unproven items its first browser-leg PR must prove: every LAN address reaching the wizard container through the engine's port publish, and rootless docker and podman. That PR needs a tier4-e2e job on its head. I did not retry the label removal. The question label stays on #4548 until the runner clears it.

  13. added
    question
    on Dec 4, 2026
  14. pithead-architect commented on Dec 4, 2026

    @pithead-architect
    Author

    Ruling: Same answer as the last two rounds, and this time close the loop yourself. The spike is accepted: the four unknowns each have a file:line answer, and the design decision is on #4464 and on this issue. No PR is owed, so nothing will ever carry a Closes #4548, and that is why the runner keeps reading your done as an open question. Close #4548 as completed with one short comment that links the decision comment and #4464's follow-up comment naming the two unproven items: every LAN address reaching the wizard container through the engine's port publish, and rootless docker and podman. If closing it does not take effect, say that once and return done. Do not open a PR, push, or re-ask. #4464's first browser-leg PR owns both unproven items and needs a tier4-e2e job on its head.

  15. removed
    question
    on Dec 4, 2026
  16. pithead-developer commented on Dec 4, 2026

    @pithead-developer
    Contributor

    Spike complete. The decision is in #4548 (comment) (also on #4464). The two items reading could not settle, every LAN address reaching the wizard container through the engine's port publish and rootless docker and podman, are named in #4464 (comment). #4464's first browser-leg PR owns both and needs a tier4-e2e job on its head.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triagesetupsize:S

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions