Skip to content

Prod and staging

You usually want staging to be a copy of prod that can’t touch prod. On Switchboard, you get that with one Namespace for each, in the same Organization: acme for prod and acme-staging for staging. Each Namespace has its own signing keys, so a Client token signed for staging can’t publish to or watch anything in prod, even when the two share relays.

Your Organization already has the Namespace you signed up with. Create the second one on the Organization’s page in the dashboard, or with the API:

curl https://app.caprid.com/v1/organizations/4/namespaces \
-H "Authorization: Bearer $SB_API_KEY" \
-d '{"namespace": "acme-staging"}'

To find your Organization’s id, call GET /v1/organizations.

Your staging deploys and CI need an API key, and it shouldn’t be one that can read prod’s signing keys. Create a key limited to staging:

curl https://app.caprid.com/v1/organizations/4/api-keys \
-H "Authorization: Bearer $SB_API_KEY" \
-d '{"label": "staging-ci", "namespaces": ["acme-staging"]}'

The response has the secret, which is shown only this once. Store it where staging reads its config. This key:

  • can create signing keys and mint Client tokens in acme-staging
  • can’t see or change anything in acme
  • can’t create API keys, enroll relays, or manage the Organization

For the details, see Limit an API key to some Namespaces.

Staging’s backend should call the /v1/namespaces/acme-staging/... routes and sign tokens with a staging signing key. Paths in its tokens start with acme-staging/, for example acme-staging/room/42.

Your players and publishers don’t change. They connect to the same relays, with whatever token your backend hands them. If you run Self-hosted relays, they already carry every Namespace in your Organization, so you don’t need a second fleet for staging.

An Owner can delete acme-staging from its settings tab in the dashboard. That deletes its signing keys. The API keys limited to it stop working, so you should revoke them too.

The name acme-staging can never be used again. If you might want staging back later, leave the Namespace in place.