Phase 13, part 9: running at scale, and the proof

The multi-tenant edition starts. compose.multi.yaml runs several copies
behind Caddy, with the managed Postgres and Garage outside. A test walks
every page and fragment, with ids filled in, and every MCP tool, as one
team, and none shows another team's data or changes it; another has three
copies share six teams' work, each team's turn once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 12:46:01 -07:00
co-authored by Claude Opus 5.5
parent b8a64e258a
commit f4c31c9fa3
13 changed files with 453 additions and 14 deletions
+27
View File
@@ -266,6 +266,33 @@ computer.
Hermes and the CRM bridge use the local edition's socket; on a server, agents
come with their own keys (Phase 11 in PLAN.md).
## The multi-tenant edition
Many teams at one address, each working on one website domain, with its
data in its own Postgres schema and its own database role. People sign up
at `/signup`, belong to as many teams as they like, and switch between them
from the sidebar. A team proves its domain (a DNS record, a file on the
site, or its Search Console property) before Supermarket crawls, reads or
publishes to the site.
`compose.multi.yaml` runs several copies of the app (3 by default) behind
Caddy; the cloud's managed Postgres and the object storage (Garage) are
outside it, named in `multi.env` (the file's top lists what it holds). The
database user needs `CREATEROLE`, to give each team its role. Everything a
request needs is in Postgres and the files are in the object storage, so
any copy answers any request; background work is shared between the copies
team by team.
Connection pooling: each team has a small pool of its own (4 connections,
idle ones closed after a minute). A PgBouncer in front must use session
pooling, since each connection carries its team's role and search path.
The people running the service, listed in `SUPERMARKET_PLATFORM_ADMINS`,
see every team at `/platform` (with two-factor sign-in): their size, people
and what failed lately; they can suspend a team, resend its invitations,
release a domain, and *view as* a team with a reason, for at most an hour,
recorded in the team's own log.
## Development
Requires Go (see `go.mod`).