Skip to content

TailscaleServeService

Defined in: src/tailscale.ts:88

Dynamically (un)registers per-slot tailscale serve mappings as preview listeners bind/tear down. ALL mutations run through ONE sequential queue because tailscale serve read-modify-writes shared config — concurrent execs race and lose entries (see serveRange history / removed eager path).

new TailscaleServeService(opts): TailscaleServeService

Defined in: src/tailscale.ts:92

TailscaleServeOpts

TailscaleServeService

reconcileStartup(): Promise<void>

Defined in: src/tailscale.ts:150

Clear the whole preview range at boot (recover stale mappings from a crashed prior run). One queued op running the offs sequentially; tolerates per-port failure. NOTE: this also removes any pre-existing MANUAL tailscale serve mappings in the range — by design, since with SHEPHERD_PREVIEW_AUTO_SERVE on (default) Shepherd owns the range and registers slots dynamically. The startup log below makes that explicit so the ownership transfer isn’t silent for operators upgrading from a manual setup.

Promise<void>


register(id, port): Promise<void>

Defined in: src/tailscale.ts:112

string

number

Promise<void>


snapshot(): Record<string, ServeState>

Defined in: src/tailscale.ts:190

Record<string, ServeState>


stopAll(): void

Defined in: src/tailscale.ts:177

Synchronous shutdown teardown (process exit/SIGTERM): off only the slots we registered (≤ active previews, capped at count). Worst-case wall time is registered-slots × SYNC_TIMEOUT_MS (≤ 16 × 1.5s = 24s) and only approaches that if tailscaled is hung; a healthy daemon offs each slot in well under a second. Best-effort: any slot that errors/times out is skipped and self-heals on the next boot’s reconcileStartup (which clears the whole range), so we never block exit on it.

void


unregister(id): Promise<void>

Defined in: src/tailscale.ts:127

string

Promise<void>