[docs] API: curl examples end to end on loopback, §8.4 reload answer with load numbers, UI contract deviations
This commit is contained in:
@@ -434,3 +434,69 @@ Not reachable (any host, shared or not; the main screen points to it):
|
||||
| G17 | A reverted attempt is a commit plus a revert in git, but the UI shows one entry, and "Edit and try again" needs what was tried. | Control groups them into one history entry and keeps `attempted_host` for each reverted or failed change. |
|
||||
| G18 | Engine switch: §1.6 and §3/§4 disagree (handover b). | `overview.engine` now, read only. The switch call waits on Mark's answer. |
|
||||
| G19 | `websockets` defaults to true [C], so a "Websockets" chip would show on almost every row. | The UI shows a chip only when websockets are off ("No websockets"); the API needs no change. |
|
||||
|
||||
## 6. Where the Phase 2 API differs from this contract
|
||||
|
||||
Recorded by the Phase 2 implementation (branch `control/phase-2`). docs/api.md has curl
|
||||
examples; `GET /api/v1/openapi.json` has every shape. Everything not listed here is built as
|
||||
written above.
|
||||
|
||||
**Not built in Phase 2 (Phase 3 items):**
|
||||
- G7: share links work only while Pingora serves. The Caddy JSON ignores `share_links`, so
|
||||
under the fallback a share visitor gets the normal sign-in (fails closed). `share.engine_caddy`
|
||||
is not emitted yet.
|
||||
- G12, G13, G15 (clicks, device certificates and their downloads); §1.7, §1.8 and §3.6 (PKI).
|
||||
- G14: control authenticates with API tokens only and trusts no `Remote-*` header; the UI in
|
||||
Phase 3 needs the G14 mechanism (or a token) to call it.
|
||||
- G18: `overview.engine` is read-only (`running: "pingora"`, `state: "running" | "stopped"`,
|
||||
`fallback_ready: null`); no `POST /engine`.
|
||||
- The "This site is not reachable right now" page (§4): edge still answers an unreachable
|
||||
upstream with an empty `502`, exactly like Caddy, so the differential suite stays exact.
|
||||
Serving the page needs the same page from Caddy's `handle_errors`.
|
||||
- `overview.intermediate` is always `null`.
|
||||
|
||||
**Shapes and behaviour that differ:**
|
||||
- Apply states: there is no `interrupted` state. An apply cut off by a control restart ends as
|
||||
`reverted` with `reason.code = "apply.interrupted"`; one that was still queued ends as
|
||||
`failed` with `apply.interrupted.queued`; a cancelled one as `failed` with `apply.cancelled`.
|
||||
- A change identical to what is live is refused with `409 change.unchanged` instead of
|
||||
becoming a no-op apply.
|
||||
- `reason` is `{code, message, hostname, upstream, field, count, of, detail, params}`; an
|
||||
apply also carries `errors[]`, the full `commit`, `effect` (undo), `actor` (token name) and
|
||||
`attempted_host`. `push` is present only on kept applies; with no remote configured the
|
||||
`push` step is `skipped`.
|
||||
- `apply.kept` says "Health checks passed for {seconds} s." only; the push result is in
|
||||
`push` / `repo`, not in that sentence. Extra codes: `apply.kept.no_watch` (host without a
|
||||
health check), `apply.kept.removed`, `apply.kept.no_edge` (dev mode without a proxy),
|
||||
`apply.reverted.no_answer`, `apply.reverted.edge_lost` (edge restarted or vanished during
|
||||
the watch), `apply.failed.edge_unreachable`.
|
||||
- The watch: touched hosts are probed every `watch_every_secs` (5 s by default). A touched host
|
||||
is reverted when every one of its upstreams failed its last 3 checks, or none passed its
|
||||
last check at the end; hosts that were already `down` before the change are not judged.
|
||||
- `undo.blocked = undo.watching` only while an Undo itself is running; any other running apply
|
||||
just queues the Undo.
|
||||
- `GET /tokens` lists `id`; the id is the non-secret first part of the token
|
||||
(`ian_<id>_<secret>`), so it is a prefix of the token string, but reveals nothing of the
|
||||
secret. `POST /tokens` takes `{name?, expires_in_days?, never_expires?}`.
|
||||
- `GET /history` entries have `reason_short` as the last word of the reason code (e.g.
|
||||
"server error"), and paging uses `before=<change_id>` with `next_before` in the answer.
|
||||
`GET /history/{id}` returns the full apply.
|
||||
- `GET /history/{id}/restore-preview` field keys are `hostname`, `upstreams`, `tls`, `auth`,
|
||||
`websockets`, `share_links`, `access_log`, `health_check.path`,
|
||||
`health_check.interval_secs` and `headers`; it also has `blocked` (`restore.same`,
|
||||
`restore.not_kept`).
|
||||
- Share-link mint answers include `warning` (`host.share.no_signin`) for a host without
|
||||
sign-in. The token is in `?share=`; edge only takes values starting `ish1.`, so an
|
||||
upstream's own `share` parameter still works. The password page's "too many tries" answer
|
||||
is `429`. For a password link the expired page is decided from the token's (unproven) date,
|
||||
because nothing in the token can be proven before the password is given.
|
||||
- `overview.site.acme_configured` is always `true` (Let's Encrypt is the default issuer);
|
||||
extra fields `overview.rev`, `overview.health_error` and `site.share_links_available`.
|
||||
- Health: one admin Unix socket (mode 0660) carries both the read-only `GET /v1/status` and
|
||||
control's reload/trial calls, instead of a separate read-only socket. Edge keeps the last 5
|
||||
results per upstream; `health.since` is tracked by control and restarts with it.
|
||||
- `Idempotency-Key`s are remembered in memory for 24 h; a control restart forgets them.
|
||||
- Extra error codes: `change.unchanged`, `host.hostname.mismatch`, `host.upstream.host_name`,
|
||||
`request.*`, `repo.unexpected_file`, `repo.no_remote`, `share.unavailable`,
|
||||
`share.not_found`, `share.replaces`, `share.password_long`, `token.not_found`, `token.name`,
|
||||
`token.expiry`, `file.*`, `site.*` (problems in `ianitor.toml`).
|
||||
|
||||
Reference in New Issue
Block a user