Status: draft (web-s2, 2026-11-22). Scope is the owner-approved list in krishiv-internal/ops/web-plan-2026-11.md section 3. Setu 0.2 is a later phase.
1. Resilience (issues #14, #15, #16) — PR #26
- #16: the control plane rebuilds its database pool after a Postgres crash instead of keeping dead connections.
- #14: the self-backup loop survives a database error and records it as
last_error. - #15: manual and scheduled self-backups take one exclusive lock (
<data_dir>/backups/setu/.lock), so no 0-byte dump.
2. Site aliases (issue #18)
A site has one canonical domain. Aliases are extra hostnames:
| mode | Caddy route | effect |
|---|---|---|
redirect | static_response 308 to https://<domain>{uri}, host matcher [alias] | the alias sends visitors to the canonical name |
serve | the alias is added to the site route's host matcher | the site answers on the alias too |
Naming the host in a matcher is what makes Caddy obtain a certificate (same as the www. route of 0.1.7 #25).
Data
- New table
site_aliases(site_id → sites ON DELETE CASCADE, host text, mode text CHECK in ('redirect','serve'), PRIMARY KEY (site_id, host)), migration0007_site_aliases.sql. A separate table, not a column onsites, so no existingquery!macro or.sqlxentry changes; the new repo functions use runtime-checkedsqlx::query. host: validated likedomain(valid_domain), lower-cased, not equal to the site's own domain, unique across all sites' domains and aliases (409 on a clash), at most 10 per site.- An alias that equals the site's
www.name replaces the automaticwww_redirectfor that name (the explicit alias wins;www_hostreturnsNonewhen an alias names it).
API
PUT /api/v1/sites/{id}/aliasesbody{"aliases":[{"host","mode"}]}replaces the list, stores it and queues theroute_updatejob in one transaction (same shape asPUT .../www-redirect: operator role, 409 with an active job or a status other than running/stopped, auditsite.aliases_set).GET /sites/{id}/aliasesreturns the list (GET /sites/{id}and the list do not carry it).openapi.jsonregenerates here;ui/src/lib/api-types.d.tsis regenerated with the UI part (web-o1), the only user of the types.- A hostname belongs to one site: a site's domain, its aliases and its automatic
www.name (www_redirecton) never overlap. Checked in the control plane, in the same transaction and under one advisory lock, in all directions: an aliasPUT, a site create and turningwww_redirecton each answer 409 on a clash. The agent also counts other sites' aliases as taken and re-applies the neighbours' routes when a host changes hands. - Both
PUTs (aliases, noindex) answer 409 when the server's agent is older than 0.1.7, and theroute_updatejob fails unless the agent'sset_routeanswer echoes the number of aliases and the noindex setting it applied.
Control plane to agent
Command::SetRoutegains#[serde(default)] aliases: Vec<Alias>; an older control plane sends none: no aliases.- The agent records
aliasesinSiteRecord(default empty, so an old state file changes nothing), reconcile rebuilds the routes from state. - Route ids: redirect alias
setu-site-<short>-alias-<n>;servealiases live in the site route itself.valid_route_idaccepts the-alias-<n>suffix. Routes of removed aliases are deleted on the nextSetRoute;RemoveRouteremoves all of them. Golden files undercrates/agent/tests/golden/for both modes. - A
servealias or a redirect alias must not shadow another site's domain (checked in the control plane and again by the agent, likewww_host).
UI
An "Aliases" field on the site page (list of host + mode, add/remove), shown on the sites list detail. Front-end part goes to web-o1 after the API is merged.
3. Per-site noindex (staging sites)
- Column
sites.noindex boolean NOT NULL DEFAULT falseis avoided for the same.sqlxreason: stored in the new tablesite_options(site_id PK, noindex bool)with runtime queries. PUT /api/v1/sites/{id}/noindex{"enabled": bool}queues aroute_updatejob.SetRoutegains#[serde(default)] noindex: bool. When on, the agent adds to the site route aheadershandler settingX-Robots-Tag: noindex, nofollowon every response, and a/robots.txthandler answeringUser-agent: *\nDisallow: /(a route placed before the reverse proxy, so the app cannot override it).- Default off: an upgrade changes no existing site.
4. Release 0.1.7
CHANGELOG entry (API-only: aliases and noindex have no UI in 0.1.7 unless web-o1 lands it), version bump, docs/OPERATIONS.md section for aliases and noindex, upgrade of the krishiv.ai host arranged by the coordinator.
5. Tests
- db: repo tests for aliases (cascade, uniqueness, clash).
- agent: route golden files, reconcile from state, shadowing refusal, noindex route; a state file without the new fields.
- proto: a
set_routewithoutaliases/noindexmeans none. - api: PUT aliases 202/400/409, role check (a viewer gets 403), every clash direction, noindex PUT, an agent older than 0.1.7 (409), an agent that does not echo (job fails).
- jobs: provision sends the stored aliases and noindex.
- The DB suite needs Docker (
scripts/test.sh); the VPS lane has none, so CI is the first run.