The admin panel

sg panel runs a small web UI and a JSON API on your machine. It calls the same code as the CLI, so anything you do there is planned, confirmed and recorded the same way.

Start it

Run it from your project directory. It opens ./.sg/state.db relative to where you launch it.

cd ~/estates/lab
sg panel                          # http://127.0.0.1:7070, in the foreground
sg panel --listen 127.0.0.1:8080
sg panel --listen tailnet:7070    # this host's own verified tailnet address

Ctrl-C shuts it down gracefully. Active runs are finished and recorded before the ledger closes.

Where it may listen

Only loopback (IPv4 or IPv6) and the host's own verified tailnet address are accepted. tailnet:<port> must resolve to exactly one observed tailnet address, so it needs the tailscale CLI and refuses if it finds none or several. Wildcard (0.0.0.0), public, LAN, link-local, multicast and hostname binds are all refused before a socket opens.

How it behaves

  • Reads never open SSH. Pages show the last observed snapshot with an observed-at or stale marker. Only Refresh (POST /api/v1/probe) and plan or apply actions contact hosts.
  • No background polling. The UI refreshes when you act, and opens one live event stream per active run, with a Stop button straight away.
  • One run at a time. A second apply gets 409 sg:run-active.

Plan-bound approval

Every apply needs the hash of the plan you approved:

{"confirm": {"plan_hash": "<hash from the plan route>"}}

The server prepares a fresh plan. If its hash doesn't match what you approved, the request refuses with 409 sg:plan-stale and changes nothing. Destroy routes also need "confirm_word" set exactly to the cluster or application name.

The API

Success responses are {"data": …}. Errors look like this, and always name the matching CLI command:

{"error": {"code": "sg:plan-stale", "message": "…", "hint": "…",
           "cli_equivalent": "sg application deploy", "run_id": "…"}}

Request bodies are strict JSON: unknown fields return 400 sg:invalid-request before anything runs.

MethodPathDoesCLI equivalent
GET/api/v1/overviewEstate overview (last snapshot)
POST/api/v1/probeRefresh: observe hosts now
GET/api/v1/clustersList clusters
POST/api/v1/clustersWrite a new cluster.yaml (never overwrites)(panel only)
GET/api/v1/clusters/{name}/eligible-membersMachines that can join
POST/api/v1/clusters/{name}/planPlan formation or teardown, returns plan_hash
POST/api/v1/clusters/{name}/createForm the cluster (plan-bound)sg cluster create
POST/api/v1/clusters/{name}/destroyTear down (plan-bound + confirm_word); with_machines is refused heresg cluster destroy
GET/api/v1/applicationsList applications
POST/api/v1/applicationsRegister {"spec_path": "<file in project dir>"}sg application init
GET/api/v1/applications/{name}Groups, instances, volume safety, observationsg application status
POST/api/v1/applications/{name}/planRead-only plan + plan_hashsg application plan
POST/api/v1/applications/{name}/deployDeploy (plan-bound)sg application deploy
POST/api/v1/applications/{name}/destroyDestroy (plan-bound + confirm_word)sg application destroy
GET/api/v1/applications/{name}/generationsGeneration history, newest first
POST/api/v1/applications/{name}/rollback{} previews, {"confirm": …} executessg application rollback
POST/api/v1/applications/{name}/restartPreview or execute {"selector": …}sg application restart
POST/api/v1/applications/{name}/scale{"group", "count", "placements"} preview or executesg application scale
POST/api/v1/applications/{name}/upgrade{"group", "image"} preview or executesg application upgrade --image
GET/api/v1/runsRun history
GET/api/v1/runs/{id}/eventsLive run events (Server-Sent Events)
POST/api/v1/runs/{id}/stopCancel an active runCtrl-C

A few panel-specific limits: it registers specs only by a file name directly in the project directory; its upgrade takes an image only; and cluster destroy with machines is CLI-only.

Try it

curl -s http://127.0.0.1:7070/api/v1/overview | jq .
curl -s -X POST http://127.0.0.1:7070/api/v1/applications/hello/plan \
  -H 'content-type: application/json' -d '{}' | jq .   # the response carries the plan_hash to approve