Skip to content

Check this computer's Tailscale before deploying a Hub - #20

Merged
DigitalPals merged 3 commits into
mainfrom
hub-setup-tailnet-check
Nov 6, 2026
Merged

DigitalPals merged 3 commits into
mainfrom
hub-setup-tailnet-check

Conversation

@DigitalPals

Copy link
Copy Markdown
Owner

Third of three stacked PRs (after #19, base hub-setup-advanced). Retarget once #19 merges.

A deployed Hub answers only on its private tailnet HTTPS name. When this computer wasn't on Tailscale, setup went through Docker install, the Hub, Tailscale login and HTTPS, and only then reported "this computer cannot reach the Hub".

Deploy Hub / Resume setup now first asks the local tailscaled for its BackendState. It sends GET /localapi/v0/status?peers=false over /run/tailscale/tailscaled.sock, falling back to /var/run/.... That is the same read-only access tailscale status has as a normal user, and it adds no dependency.

  • Connected: setup starts as before.
  • Not connected (for example NeedsLogin) or not found: Portal explains why it matters and changes nothing on the server. The button becomes Deploy anyway / Resume anyway, and that next click continues without checking again, for setups Portal can't detect (custom socket, sandbox, non-Linux).
  • The recovery record is now saved only once setup actually starts, not when a check result is pending.

The end-of-setup "cannot reach" message stays as the fallback.

Tests

  • src/hub/tailnet.rs is tested against a fake local API on a temp Unix socket: running, needs-login, 403, bad JSON, missing socket.
  • The wizard flow is tested end to end: a stale result is ignored, the warning appears once, the second click starts setup, and the record is created only on start.
  • I ran local_tailnet() once against the real tailscaled on this desktop; it returned Connected. That throwaway test is not committed.
  • cargo test --lib: 1236 passed. Clippy and fmt are clean; the deploy helper tests pass (69).

🤖 Generated with Claude Code

CybexHQ and others added 3 commits November 6, 2026 18:45
Set up on a server no longer shows the existing-Hub Connect and Sign in
steps under the Deploy button. They appear once the deployment hands the
new Hub over, to show connection progress and offer retries. The selected
setup path is highlighted.

Maintenance shows one update button, and only when there is something to
update to: an image chosen in Advanced options, otherwise the version of
this Portal. The always-visible Update Hub button did nothing unless the
image had been changed.

Docs: the Hub README links to the install paths instead of repeating
them. The manual deployment guide is the one place for running the Hub
by hand, including the legacy forced-command mode. It no longer sends
owners to /admin or asks for a web port, installs Tailscale from its own
packages and builds with -p portal-hub.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Advanced options repeated the whole setup as manual steps: check server,
a Docker checkbox, install, open Tailscale, enable HTTPS, create the owner
passkey and verify the connection. Deploy Hub / Resume setup already does
all of this, can be repeated safely and recovers interrupted runs, so
Advanced now holds only the Tailscale name, owner account name, Hub image
and local image tar, plus Refresh status, Check readiness and View
diagnostics.

Two manual steps had no other route, so they move to the main view.
Picking a saved server (or Manage server in Settings) now checks its
status right away, which shows where setup stopped or the maintenance
options; before, that needed Advanced → Refresh status. A ready Hub that
this device is not signed in to offers Connect this device, which signs
in without another SSH round trip.

Removes the manual-only state and messages (preflight, install_docker,
OpenEnrollment) and the per-phase guidance text. Installation requests
always allow adding Docker; starting setup is the consent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A deployed Hub answers only on its private tailnet HTTPS name. When this
computer was not on Tailscale, setup installed Docker, the Hub, Tailscale
login and HTTPS, and only then reported that the Hub was unreachable.

Deploy Hub and Resume setup now first ask the local tailscaled for its
state over its socket (read-only, as tailscale status does, no new
dependency). If Tailscale is missing or not connected, Portal says so and
changes nothing on the server; the next click (Deploy anyway / Resume
anyway) continues without checking again, for setups Portal cannot detect.
The recovery record is saved only once setup starts.

Tested against a fake local API and once against the real tailscaled on a
connected Linux desktop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DigitalPals
DigitalPals changed the base branch from hub-setup-advanced to main November 6, 2026 18:10
@DigitalPals
DigitalPals merged commit 67db70b into main Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants