Skip to content

DIY setup: browser wizard behind a CLI or browser interface choice (spike first) #4464

Backlog
1 of 3 issues completed

Description

@pithead-developer

What's the problem

Part of #3557, split from #3577. ./pithead setup now asks three questions on the CLI (Monero wallet, Tari wallet, profile), but DIY users still cannot choose between the browser wizard and the terminal at setup. The browser wizard exists only for the appliance first boot (firstboot_wizard in lib/pithead/12-firstboot-wizard.sh, token-gated, served from the dashboard image in a pithead-wizard container). Four facts must be settled in a spike before the DIY 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 26-appliance-tls-provisioning.sh).
  3. Which port the page uses on shared hosts (dashboard.port exists for co-hosting).
  4. Whether a container engine is present before dependencies are installed.

What it impacts

Every new DIY user who prefers the browser to the terminal, ./pithead setup, docs/getting-started.md, and the tests that pin the setup prompts. Existing installs are not asked anything. The appliance first boot is unchanged.

How I found it

Split out of #3577 by the owner's ruling on that issue: its PR ships the CLI side and holds the interface-choice prompt back so no dead option ships. The four unknowns above are copied from #3577's "How I found it". Nothing here has been run.

How important is it

High: "DIY must be as easy as the appliance" (ruling 1 on #3577) depends on it. It follows the CLI three-question change and does not block it.

Acceptance criteria

  • Tier-1 (stubbed container engine): on a tty ./pithead setup offers the choice; --cli and no tty skip it (as ensure_config_exists refuses non-interactive today, 24-config-wizard.sh:18-20); if the browser leg cannot be served it falls back to the terminal and prints the reason.
  • Tier-1 (stubbed container engine): the browser leg prints one URL and a one-time setup token, and the wizard endpoint rejects a request without the token.
  • The interface choice joins the pinned ordered prompt list in tests/stack/test-wizard-setup.sh (interface choice, Monero wallet, Tari wallet, profile; consents listed separately), so adding any prompt fails the test.
  • A spike PR (or a documented decision in this issue) settles the four unknowns above before the browser leg is built.
  • docs/getting-started.md becomes the single path from deployment choice to first accepted share (closes Guide new users from deployment choice to their first accepted mining work #3182); this line is carried here because Ask three questions at setup on the CLI and in the browser wizard #3577's PR does not complete it.
  • No new explanatory code comments.

Possible solutions

  • Reuse firstboot_wizard for DIY behind the choice prompt, with the spike deciding image and TLS handling.
  • Browser wizard served by a short-lived container started by setup only after dependencies and the image are present; fall back to the terminal otherwise.
  • One shared builder (Python, called from bash) so the CLI stops carrying its own jq assembly; larger change, removes the parity risk. Otherwise keep three builders and rely on the parity test (tests/stack/fixtures/wizard-parity/three-answers.golden.json).

Sub-issues

Sub-issues

1 of 3 Issues completed
Loading 3 sub-issues

Activity

  1. added this to the v2.1.0 milestone on Nov 24, 2026
  2. added
    enhancement
    setup
    on Nov 24, 2026
  3. added
    tracker
    on Nov 27, 2026
  4. pithead-architect commented on Nov 27, 2026

    @pithead-architect

    A local session judged this too big for one local session (Too big for one local session: #4464 carries a spike, a wizard-behavior change, a container-serving browser leg and a docs completion, and its build leg sits on the three-question rewrite PR #4465 (#3577) that is still an open CONFLICTING draft. I read the issue, #3557, #3577 (incl. #4465's body and). The runner filed 3 chunks as sub-issues and marked this issue a tracker, so it is not picked again:

  5. pithead-developer commented on Dec 4, 2026

    @pithead-developer
    ContributorAuthor

    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.

  6. pithead-developer commented on Dec 4, 2026

    @pithead-developer
    ContributorAuthor

    Carry-forward for the first browser-leg PR (from spike #4548)

    The operator accepted the spike decision above. Two items were not settled by reading and the first browser-leg PR must prove both:

    • (a) Whether every LAN address of a DIY host reaches the wizard container through the engine's port publish.
    • (b) Rootless docker and podman behavior for the wizard container, its port publish and its spool.

    That PR touches the wizard, setup and port-publish paths, so it needs a tier4-e2e job on its head, targeted at those paths. The terminal path stays as it is: any browser-leg failure falls back to it with a stated reason.

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

    enhancementsetuptracker

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions