Repository navigation
EN Bridge Multi Tenant
Français · Type: how-to · Audience: admin · Context: Reality Bridge · Status: ready · Applies from: 4.2.5
The Reality Bridge,
distributedprofile (Postgres) · contract: experimental · verified by CI (support matrix of 4.4.0, 2026-10-23): Postgres 16 in CI; The qualification profile: HTTPS, three instances (ops/qualify/) · automated checks: jobsbridge-postgres,deployment-smoke; CI planreality; 1 test file · people's passes:bridge-postgres-httpsnot run (#77) · known limits:bridge-tenants-demo-webhooks,bridge-tenants-shared-process
How to serve several games, or one game in several environments, from one Bridge deployment, and how to run several instances of it on one store. A tenant is one operator's game in one environment: its own folder, its own Biscuit root, event key, operator token, quotas, rotation and revocations. What isolates them, and where that stops: Guarantees.
One serve (or several identical ones) holding several tenants on one SQL store, each reached by its own host name,
each signing WorldSignalV2 signals that name their tenant, with connector tokens bound to their tenant.
- A Bridge, from 4.1.10 ("Constellation", ADR 0009, ADR 0010); this page applies from 4.2.5 (the
quest-n-click-bridgenames). - Several tenants need a SQL store: SQLite for one machine, Postgres for several instances (the
distributedprofile, experimental). -
Verified on: not replayed for this page. The same layout (two tenants, three instances, one Postgres) is what
npm run ops:qualifybrings up and checks (The reference deployment).
- A running single Bridge is understood first: Install and run the Bridge.
- One host name per tenant (
bridge.a.example,bridge.b.example) pointing at the deployment, or a proxy that setsX-Web-Scumm-Tenant. - For several instances: Postgres, and
pginstalled beside the Bridge.
On the deployment's machine (or each instance's), with one folder per tenant, for example /srv/bridge/a and
/srv/bridge/b. npm run bridge -- … in the engine repository, npx quest-n-click-bridge … with the package (then
pass --manifest= to init).
-
Make each tenant's folder, with its id, its environment and its host names:
# on the deployment's machine, in the engine repository npm run bridge -- init --dir=/srv/bridge/a --tenant=a --environment=prod --hosts=bridge.a.example --no-demo-webhooks --origin=https://game-a.example npm run bridge -- init --dir=/srv/bridge/b --tenant=b --environment=staging --hosts=bridge.b.example --no-demo-webhooks --origin=https://game-b.example--environmentisprod,stagingordev(prodby default); it is named in every signal and in the keys the tenant lists.
-
Serve them together on one SQL store:
# on the deployment's machine, in the engine repository BRIDGE_STORE=postgres://… npm run bridge -- serve --tenants=/srv/bridge/a,/srv/bridge/b [--tenant-header]A request is routed by its
Host(each tenant'shosts), or byX-Web-Scumm-Tenantwith--tenant-header, before anything is read; no tenant, a 404. Two folders that configure the same tenant are refused at start, and so is a journal (several tenants share a SQL store:--store=sqlite:<file>,BRIDGE_STORE=postgres://…orBRIDGE_STORE_FILE).
-
Grant each tenant's connectors from that tenant's folder:
grantadds the tenant to the token, so no other tenant accepts it.# on the deployment's machine, in the engine repository npm run bridge -- grant --dir=/srv/bridge/a --connector=mail-a --source=mail --signals=mail.answer.correct --pair > mail-a.token
- For more capacity, start as many identical
serveas needed on the same store, with no sticky sessions, behind a load balancer. Instances are stateless.
-
GET /healthzon any instance says"tenants": 2and the store's kind. -
npm run bridge -- doctor --dir=/srv/bridge/a(with the sameBRIDGE_STORE) lists every tenant of the store, with its players, signals, gaps and quarantined rows. - A request with an unknown
Hostgets 404{"error": "tenant"}.
- Sequences, deduplication and acknowledgements are decided in one database transaction; delivery is at least once and applied once (D20).
- A signal accepted by one instance reaches a stream held by another, which reads the store when woken: Postgres
NOTIFY, a 250 ms poll on SQLite, and a pass every 5 s should a wake-up be lost. - Every row of the store carries its tenant and every query filters on it. A tenant of a shared deployment signs
WorldSignalV2(the signal names its tenant, environment, origin, link and key), so neither a token nor a signal of one tenant is accepted by another, even when two of them were (wrongly) given one key. - Each instance bounds its open streams (
streamsPerInstance, 10 000; then 429) and its per-connector minute: with N instances a connector may propose N times its quota. - A stored row that no longer verifies is quarantined, never delivered, and
doctorlists it.
Limit ·
bridge-tenants-demo-webhooksOne server keeps one map of demonstration webhooks, by source, across all its tenants: two tenants with a webhook of the same source collide. Give the tenants of a shared server--no-demo-webhooksand onegrantper connector.
Limit ·
bridge-tenants-shared-processThe tenants of one server share its process, its CORS list (every tenant's--origintogether) and its database. The isolation is the Bridge's code; there is no row-level security per tenant in Postgres, and a compromised instance holds every tenant's keys.
| Message | Cause | Fix |
|---|---|---|
✖ two directories configure the same tenant (a, a) |
Two folders with the same --tenant
|
One folder per tenant |
✖ several tenants share a SQL store: --store=sqlite:<file>, BRIDGE_STORE=postgres://… or BRIDGE_STORE_FILE |
The first tenant's configuration names the journal | Name a SQL store |
404 {"error":"tenant","message":"no tenant here"}
|
The Host is none of the tenants' hosts, and no allowed header |
Add the host to the tenant's hosts in config.json, or --tenant-header behind a proxy that sets it |
403 on POST /v1/signals
|
The connector's token belongs to another tenant |
grant from the right tenant's folder |
BRIDGE_STORE_FILE: … does not exist / … is empty
|
The secret file is missing or empty | Mount it; an empty one is refused rather than falling back to a journal |
One folder per tenant (config.json, root.key, admin-token); the shared store, where every row carries its
tenant.
- One tenant's rows, out of a shared store:
tenant export --tenant=<id> --out=<file>; deleted:tenant delete --tenant=<id> --yes(Backup and restore). - A tenant's key or root compromised, or an instance: Security. The other tenants are untouched by a tenant's rotation.
- The routing:
bridge/src/server.ts; one tenant's configuration:bridge/src/config.ts; the stores:bridge/src/store-async.ts. -
ADR 0009, ADR 0010, the threat
model
docs/dev/threat-models/constellation.md. - Tested by
tests/bridge-tenancy.test.tsandtests/bridge-fanout.test.ts.
Generated publication · publication générée — current documentation · documentation courante: quest'n'click 4.4.0 r1, documentation revision · révision de la documentation 8dc717c69acb62c4742b69c54a7e7dfb620f75d8.
Earlier versions and permalinks · versions précédentes et liens permanents: https://wanoo.github.io/quest-n-click/docs/
An edit made in this wiki is overwritten at the next publication · une modification faite dans ce wiki est écrasée à la publication suivante.
Edit the source · Modifier la source · Report an error · Signaler une erreur
Index (6)
Start (6)
Play (9)
Install (17)
- Requirements
- Install from the release archive
- Install from npm, once published
- Install from the repository to work on the engine
- doctor: checking your machine
- Image toolchain
- Audio toolchain: ffmpeg, fluidsynth, Furnace, uv
- Upgrade
- Upgrade notes: 4.4
- Upgrade notes: 4.3
- Upgrade notes: 4.2
- Upgrade notes: 4.1
- Upgrade notes: v3
- Upgrade notes: v2 to v3
- Coming from web-scumm
- Package reference
- Install troubleshooting
Create a game (55)
- Your first game
- Layout of a created project and of the engine repository
- The working loop
- Content principles and the identity contract
- Rooms
- Geometry: placement, walk zones, masks, layers, camera
- Something is visible but unreachable
- Reactions
- Game commands
- Conditions
- Flags, variables and events: which to use
- Custom code
- Characters
- Items and inventory
- World map
- Dialogues
- Scripts and events
- Moving characters: patrols and walks
- Exits
- Chapters and objectives
- State and saves: persistent or temporary, renaming an id, migrations
- Staging: wide rooms and animations
- The stage: lights, particles, floors
- Skin and fonts
- Title and credits
- Heroes: several characters and hero choice
- Built-in minigames
- A custom minigame
- Translations
- Music in stems
- Sound effects
- Voices: per language and per hero
- Images: prompts, cutting sheets, transparency, scale
- Asset provenance
- The storyboard, source of truth
- Puzzle design
- Classic mechanics
- Review pages
- DSL reference
- Checking your game
- What the solver proves
- Solver options
- Playtests
- Remix
- Speedrun for authors
- The sealed ending
- Production template
- Example games
- Working with an AI
- Build and release a game
- Publish on GitHub Pages
- The static game on Clever Cloud
- Other static hosts
- Sub-path, cache and service worker, incomplete deploys, going back
- Testing on a phone over the LAN
Local Studio (24)
- The local Studio: overview and launch
- Edit a room
- Placement and stage
- Preview, apply, undo
- Storyboard
- Assets and cutting
- Check: validator, solver, critical path, heat, health, coverage
- Before and after captures
- Semantic diff
- Play and replay a session
- Rule explainer
- Language and objectives
- Voices and the heroes × languages matrix
- Map
- Notes
- Remix in the Studio
- Music
- The Assistant: bring your own key
- Demo mode and studio-apply
- Local and LAN security
- Studio API
- Local MCP: setting up each client
- MCP tools
- Studio troubleshooting
Team Studio (21)
- What runs where
- Concepts: revision, transaction, span, lease, preview, build
- Starting as an invited dev
- Working together day to day
- Roles and actions: the full matrix
- Invitations
- Managing members
- Write refused on the hosted Studio: stale base revision (409)
- Write refused on the hosted Studio: span locked (423)
- Recovering after a lost lease, a disconnection or a stale preview
- Comments
- Map and semantic diff
- Publishing builds
- Remote MCP
- The game in Git
- Upgrading the engine of a hosted game
- Hosted assets
- The server's command line
- Health and metrics routes
- Trying it locally with compose.yml
- Known limits
Clever Cloud (23)
- Clever Cloud: overview, cost and prerequisites
- Apps and add-ons
- Domains and TLS
- Keycloak
- Generic OIDC and GitLab
- Configuration
- First deployment
- Backups
- RPO and RTO
- Restore the Studio on a fresh installation
- Redeploys
- Upgrading the server and checking state after a migration
- Limits of going back
- Monitoring
- Security
- Rotating keys
- Recovering admin access
- Changing domain or OIDC provider
- Worker, PostgreSQL or Cellar down
- Exporting the game and leaving the installation
- Retention
- Clever Cloud troubleshooting
- Costs and teardown
Reality Bridge and connectors (16)
- The Reality Bridge: what it is
- Quick start
- Guarantees
- Install and run the Bridge
- Backup and restore
- Several tenants
- Signals and the manifest
- The Bridge's command line
- Connectors overview
- Email connector
- Telnet connector
- SSH connector
- Open Badges connector
- The connector SDK
- Security: Biscuit and signatures
- Bridge and connector troubleshooting
Contribute (25)
- Welcome
- Developer setup
- The dev loop
- Before a pull request
- Conventions
- Writing documentation
- Architecture
- Code tour
- Import boundaries
- Which tests run when
- Mutation testing
- The coverage ratchet
- The quality baseline
- CI explained
- Field passes
- Benchmarks
- Releasing
- npm packages
- Decisions and ADRs
- Governance
- Bot pull requests
- Contributing with AI agents
- Security policy
- Code of conduct
- Licences and credits