You have a registry project that passes
bregctl check --production, and you want it serving. This page takes you from an empty
PostgreSQL server to a breg process that serves the project’s first
package and answers GET /ready. The examples use the
facility template that bregctl init --template facility-registry facility creates.
Two roles take part. The author prepares a package from the project. The operator, holding the
migration credential, activates the package and runs the server. One person may hold both in a
small deployment; the commands stay the same. A package carries no signature: the migration credential is
what authorises an activation, and the database records every activation in its own ledger.
Deployment commands take absolute paths with no .. component and no symbolic link anywhere in
them. That covers --runtime-config, --credentials, --test-receipt, --package, the test
receipt’s --output, and the directories the runtime file names. When an output path such as the
test receipt’s --output is refused for a symbolic link, the diagnostic names the linked component
and the target it resolves to. If the linked component is an ancestor, choose an unused final name
under its real directory. If the final component is itself a symbolic link, that final name is
occupied by the link; choose another unused, non-symbolic-link name under the real parent.
PostgreSQL 17 or newer, reached over TLS, with two login roles: a migration role that owns
the schema and applies packages, and a runtime role the serving process uses. A project with a
crs84-polygon field always needs PostGIS 3.5 or newer. A crs84-point field needs PostGIS only
when an access profile grants bbox queries. Your administrator creates the roles, schemas, and
extensions. The product never creates any of them. SQLite is not a target.
Ubuntu 24.04 ships PostgreSQL 16 and Debian 12 ships PostgreSQL 15, both too old: install 17
from the PostgreSQL project’s apt repository (PGDG), or run the postgres:17 image
(postgis/postgis at PostgreSQL 17 when the project requires PostGIS).
A host for one process. The runtime is a single binary that verifies one package and serves
its REST API against one database, on the platforms in
platform support.
HTTPS in front of it. The process trusts no host or forwarded header. Your reverse proxy or
ingress terminates TLS, and generated links use the public origin you configure as
listener.publicOrigin.
A token issuer. The registry verifies bearer access tokens from one OpenID Connect issuer and
issues none. Human login, account lifecycle, and multifactor authentication stay with your
identity provider.
A backup of the database before every activation. The product restores nothing itself. A
destructive change is refused unless you name the backup its reviewed migration requires, as
Change an active registry describes.
Records, their history, Proposals, and the outbox of undelivered events all live in PostgreSQL.
Webhook delivery runs inside the process from that outbox, so there is no message broker and no
cache. The audit journal goes to a local file per process or to standard output. Attachments use
PostgreSQL unless you bind S3-compatible storage. A standalone registry needs no other Registry
Stack service; a composition adds only the services it uses, such as a Review provider for reviewed
Proposals. Authoring commands open no database, so an author works on a laptop until the project
is ready to test.
What stays your job once it runs:
Secrets. Two database credentials, the audit hash key, the cursor secret, one key per webhook
destination, and the issuer’s key set when you pin one. The runtime file names each by reference
and refuses a value written inline.
Every production change. A one-line access change takes the same path as a new registry:
check, test against a schema-test database with real tokens, package, plan, and activate under
the migration credential in each environment.
The audit journal. Ship each process’s stream to append-only storage and confirm delivery
before local retention expires. The product does not provide tamper evidence.
Retention and erasure. Erasing a record’s history is an operator command with no undo; see
Retain, erase, and audit.
Rate limits. The runtime applies none of its own, so put the registry behind one.
No throughput or latency figure is committed. The product bounds what it can by construction:
every request, lock, and migration runs under an operator-set timeout, the connection pool has a
maximum size, and spatial responses refuse rather than truncate. A load-test harness ships in
products/breg/loadtest; run it on a representative Linux host before you cite a number.
Base Registry Engine (BReg) is pre-1.0. A minor release may break APIs, package formats, or
deployment contracts, and each break carries a BREAKING: entry in products/breg/CHANGELOG.md at
the release tag you run. Security fixes land only in the latest release; see
API stability and the
support window. A deployment meets three conditions: run breg under
a supervisor that restarts it, treat the holder of the migration credential as the activation gate,
and stay inside the verified deployment profile, which leaves out Kubernetes.
The installer checks every binary against the release SHA256SUMS before anything reaches the
install directory, and installs breg and bregctl together or not at all. It does not verify who
published the release; for that, follow the
release verification procedure
and rerun the installer with BREG_ASSET_DIR naming the verified directory. BREG_INSTALL_DIR
selects the install directory (default ~/.local/bin). To pin a release, run that release’s
breg-<tag>-install.sh from https://github.com/registrystack/registry-stack/releases/download/<tag>/.
Binaries are published for linux-amd64, linux-arm64, and macos-arm64.
Test, package, activate, and serve with the same release of both binaries.
Each release also publishes the container image ghcr.io/registrystack/breg:<tag> for
linux/amd64. The release manifest beside the binaries,
registry-stack-<tag>-release-manifest.json, records the image digest; pin that digest rather than
the tag. Serve the container image shows how to run it.
Two separate roles are the split role mode, which production uses. The serving process then cannot
write the activation ledger or registry state, and apply and startup both refuse a runtime role
that could, naming the grant, ownership, membership, or trigger to remove. Keep the migration
credential off the serving host when no activation is in progress.
Create two databases with the same shape: the serving database and the schema-test database. In
each, as the administrator (this is the serving database, registry):
CREATEDATABASEregistry;
REVOKE ALL ONDATABASE registry FROM PUBLIC;
REVOKECREATEONDATABASE registry FROM registry_migration, registry_runtime;
GRANTCONNECTONDATABASE registry TO registry_migration, registry_runtime;
REVOKE ALL ONSCHEMA registry_internal, registry_data, registry_source,
registry_derived, registry_context FROM PUBLIC;
The package creates every table, function, and policy inside those five schemas. A missing
prerequisite surfaces at test or apply, never at runtime.
The migration role owns only those five schemas. It must not own the database (for example through
CREATE DATABASE registry OWNER registry_migration) and must not hold CREATE on it, because an
owner holds CREATE implicitly. test and apply check this before changing anything and refuse
with migration role has database-level administrative authority, which is also the refusal for a
role that is a superuser or has BYPASSRLS, CREATEDB, or CREATEROLE. If a managed PostgreSQL
service created the database for you, check its owner and its grants first.
For a project with polygon storage or bbox queries, install PostGIS in a schema neither registry
role owns. If the project grants bbox queries, also add a bounding-box role named after the runtime
role with the suffix __spatial_bbox:
REVOKECREATEONDATABASE registry FROM PUBLIC, registry_migration, registry_runtime;
REVOKE ALL ONSCHEMA registry_spatial_ext FROM PUBLIC;
GRANT USAGE ONSCHEMA registry_spatial_ext
TO registry_migration, registry_runtime, registry_runtime__spatial_bbox;
A package that stores polygons and grants no bbox queries omits the bbox role, its membership, and
its name from the final GRANT USAGE. Keep the PostGIS schema, extension, and grants to the
migration and runtime roles.
Size connections, timeouts, and statement statistics once the registry serves; see
Set a PostgreSQL baseline.
The runtime file binds one package to one database, one token issuer, and one listener. It is a
deployment artifact: keep it with the operator, outside the project, and never put a credential in
it. Every credential is a reference such as secret:file/<name>, which resolves to a file under the
secret root.
identity names the database this file may serve. The first activation records
databaseId in the database, and every later plan, apply, and startup refuses a file that
names another. instanceId stamps every webhook event this runtime captures, so keep it stable
while deliveries are pending.
database names the two connection URLs and the two roles. The runtime requires TLS on both
connections and verifies the server’s certificate and host name. caBundleRef
names PEM root certificates to trust in place of the platform roots, for a server whose
certificate a private authority issued; omit it when a public authority issued it.
package.root is the package directory package published. Once you have the package,
you may add package.expectedDigest with the reported package digest, and startup then refuses
any other package at that path.
authentication.oidc.allowedClients lists the OAuth clients whose tokens the registry
accepts, or unrestricted. A project that names clients itself, for example in a profile’s
requesterClients, needs each of them listed, so unrestricted does not start with such a
project.
authentication.oidc.issuer must be https; plain http is accepted only on an IPv4
loopback host. The key set comes from the issuer’s discovery document unless jwksSource
names a URI or pins a static document.
Three optional sections matter only for some projects. taskGrantStatus pins, per task-grant
issuer such as Casework or a chat assistant’s task authority, the endpoint and the registry’s own credentials it uses to check that a task grant is still
current. wasmExecution sets the backend and the module and guest-memory ceilings for WASM
handlers. authentication.oidc.assertionIssuers lists, per client, the assertion authorities
that client may exchange a subject token from; once written, a client it does not list may
exchange from none. Webhook destinations are bound in Bind webhook receivers, field
encryption in Field encryption for restricted fields, and
the metrics listener in Scrape metrics.
Create the files as the user that runs breg and the operator commands, because the resolver
refuses a file owned by anyone else. Each must be a regular file with mode 0400 or 0600, with
no other hard link and no symbolic link to it. A name starts with a lowercase letter and uses
lowercase letters, digits, ., _, and -. The bytes are used exactly as written, so write them
without a trailing newline:
The audit key and the cursor secret each need at least 32 bytes. Percent-encode a password that
carries reserved characters. The user in each URL must equal the role the file names under
database.roles. The URL needs no sslmode parameter: the runtime requires TLS itself.
In a container platform that injects secrets as environment variables, declare
secretProviders.environment and write secret:env/<NAME> instead.
The registry verifies a bearer access token before it reads any claim. Configure the issuer so
that every token for this deployment satisfies the table. Fixture claims from journeys.yaml are
never accepted by a running server.
Token part
Requirement
alg, typ, kid headers
alg equals allowedAlgorithm; typ matches accessTokenType case-insensitively, and at+jwt and application/at+jwt are accepted for each other; kid is in the key set and absent from revokedKeyIds.
iss
Equals issuer.
aud
A string equal to audience, or an array of 1 to 16 distinct strings that contains it.
exp, iat, nbf
The lifetime is at most maximumTokenLifetimeSeconds (at most 7200); clock skew up to leewayMilliseconds (whole seconds, at most 300000) is tolerated.
azp or client_id
Listed in allowedClients, unless that is unrestricted.
scope
The one claim named by scopeClaim covers every required permission: a string split on scopeSeparator, or an array of strings. Permissions from several claims are not merged.
principal claim
The claim named by authorityClaims.principal carries the identity recorded in audit and workflow decisions. It must match each profile’s principalClaim.
purpose claim
The claim named by authorityClaims.purpose is required when the profile lists requiredPurposes.
registry_actor_kind
A direct token must carry the configured actor-kind claim as human, agent, or service. A profile that declares actorKind requires an exact match; one that omits it accepts any verified direct kind. A verified trusted-actor exchange is always treated as agent and requires actorKind: agent, regardless of the copied subject claim.
assignment claims
Each row boundary or claim-backed lookup names its own claim. An equals boundary needs a scalar; an in boundary needs an array.
Use a resource audience dedicated to this registry API, distinct from your application’s login
client. An ID token issued to the login client is not an API credential. A longer token lifetime
extends how long an issued token may carry permissions you have since withdrawn.
Choose the principal claim deliberately. sub works when both the runtime file and the profiles
select it, and the server never falls back to another claim when the selected one is missing. An
issuer’s sub usually belongs to that issuer alone, so if you may ever change issuer, prefer an
institutional identifier both issuers carry in a custom claim, and name who guarantees it is unique
and never reassigned. The registry treats the value as opaque and links no accounts across issuers;
changing it changes who is recognised as a submitter or a previous reviewer.
Use the same principal claim in an ownership row boundary when a record’s owner field stores that
identifier, and separate claims for district, tenant, or team membership. Have the issuer derive
these claims from trusted assignments, never from values the caller supplies. A client-credentials
token represents a service, not a person signing in.
These three commands turn the project into a package the database can activate. Run check with
the runtime file you will serve, so it also checks that file against the project:
Production check passed; registry revision sha256:4877be0dd9ded0447278206d829445780bf93a6cee356bc1526773003acad158.
Warnings follow the success line; read each one.
test compiles the project, applies it to an empty schema-test database, measures the schema it
produces, runs every journey in tests/journeys.yaml over real HTTP with real tokens, and writes a
receipt that package binds to. It needs three inputs:
A test runtime file: a copy of the serving file whose database URLs name the schema-test
database and whose package.root is an empty directory.
A real access token from your issuer for each journey principal, stored as a secret file.
A credentials document of kind: BRegSchemaTestCredentials whose bindings list gives, for
each journey step, its journeyId, its stepId, and a credential of type: bearer whose
tokenRef names that token’s secret file
(keys).
test leaves its objects in the schema-test database, and a second run refuses with
schema-test database is not clean. Drop and recreate that database before every run. A token that
has expired fails a step as the fixture request could not be constructed; mint fresh tokens and
rerun.
package builds the BReg deployment package from the candidate and binds it to the receipt:
The package directory is build-1/package. package refuses a receipt taken for other sources,
and refuses an output directory that already holds a package, so give each candidate its own build
directory. Never edit files inside a published package; build another one.
verify checks the package files against their sums and, when set, package.expectedDigest, and re-derives
every generated artifact, without opening the database:
doctor opens every startup dependency without binding the listener, stops at the first one that
refuses, and otherwise lists them all, then its advisories. These include the PostgreSQL advisories
and the authentication.insecure-http warning when the runtime file sets
authentication.oidc.allowInsecureHttp: true. Advisories never change the exit status:
Startup refuses a package the ledger does not name as active, and logs the role mode it serves in.
Check readiness before admitting traffic:
Terminal window
curl-fsShttp://127.0.0.1:8080/ready
{"status":"ready"}
GET /health and GET /healthz report liveness only. Neither probe reflects the background
workers that deliver webhooks and advance reviews: when one stops, breg exits with status 1, so
run it under a supervisor that restarts it.
Watch the background workers covers what to alert
on.
Each activation, the initial one included, is one row in registry_internal.registry_migrations, keyed by a UUID activation id and ordered by apply order.
A row names the package digest, the predecessor package digest, the registry revision, the plan kind (initial or successor), the role mode, any backups a destructive migration was bound to, and the keyed hash of --operator-reference.
apply accepts a successor only when its predecessor digest is the active package, and refuses the active package again and any older package.
The migration credential authorises an activation, and every activation is audited as breg-activation-audit/v1.
With separate migration and runtime roles, the runtime role cannot write the ledger, so it cannot change which package the runtime serves.
With one role for both, the ledger check catches mistakes but not someone holding that credential.
Authoring and migration authority are separate.
An author or coding agent can edit configuration, inspect a diff, and run checks, and those commands cannot obtain the production migration credential.
A runtime configuration without that credential is refused before initial production control-plane state or DDL is created.
One package is the unit you promote: plan and apply the same package directory, with the same package digest and registry revision, in each environment.
Only the runtime file’s identity and database values differ.
The first successor on a database with the legacy 1,024-statement ledger bound widens that constraint when maintenance begins.
This engine catalog change remains if a later precondition or migration step fails.
Correct the cause and retry the exact pinned target; if it cannot complete and reconciliation reports unresolvable, restore the pre-activation backup.
A role change re-applies the active package and leaves the ledger bound as that package declares it.
Removing or narrowing an access profile removes its obsolete compiled row-security policies during apply.
Activation still requires the exact candidate catalog, and unexpected policies remain catalog drift that BReg does not delete.
A compiled policy whose expression was altered in place while it kept its definition comment is also refused as drift, and the activation fails.
Apply keeps a policy whose comment matches, so it does not repair one.
A database administrator recovers by clearing that policy’s comment and applying the exact target package again, which replaces the policy with its compiled definition:
OIDC key resolution is deployment configuration, not governed package content.
If authentication.oidc.jwksSource is omitted, BReg uses discovery.
Name the key set location directly with type: uri and an httpsuri (plain http only on an IPv4 loopback host), which the verifier fetches and refreshes the way it does a discovered key set.
Or pin a static document through a protected secret reference:
authentication:
oidc:
jwksSource:
type: static
documentRef: secret:file/oidc-jwks
The static document must be a bounded, duplicate-free set of public keys that matches the configured algorithm, signature use, verification operation, key identifier policy, and key shape.
BReg resolves it once when the verifier is constructed, so rotation requires a reviewed configuration change and a process restart.
The top-level logLevel accepts error, warn, or info and defaults to info.
The BREG_LOG environment variable overrides the authored value for process-local operation.
An unknown value in either source refuses startup, and neither source accepts filter directives or enables dependency logging.
The generated JSON Schema for runtime files documents bounded defaults for operational tuning while keeping package, database, authority, role, and secret-reference fields explicit, so you can use it for editor validation.
An active Record can reference only an active target Record.
Create and patch, including batch and import writes, refuse a missing or tombstoned target.
Tombstoning a target refuses while another active Record references it, even when that referencing Record is outside the caller’s read permissions.
These refusals use the generic 409 mutation.conflict response and disclose no referencing Record IDs or values.
Action and Proposal target admission continues to require its independently granted current authority.
A writer authorised to submit a known target ID can still infer whether that target is lifecycle-eligible from success versus conflict, even without target read authority.
The conflict does not distinguish a missing target from a tombstoned one or disclose target fields.
Clear an optional reference, point it at an active replacement, or tombstone the referencing Record before you tombstone its target.
Tombstoned Records and retained history keep their original reference IDs.
A self-reference does not prevent tombstoning that same Record; active references from other Records do.
There is no automatic cascade or clearing of references.
A registry activated by a package built before this release cannot be upgraded in place. Create a fresh database, rebuild the package with this release, and run bregctl apply --package DIR --initial. Later successor packages built with the deployed package as --baseline-package receive these constraints.
Use bregctl plan to check the activation prerequisites.
Before live maintenance, apply the successor to a representative restored-data copy to validate existing links.
If that apply finds an active Record that references a tombstoned target, repair its reference or tombstone that Record through the current package, refresh the restored-data copy, and repeat the validation before you activate the successor in production.
Plan a maintenance window for this upgrade.
Adding the stored generated lifecycle column rewrites each reference source table.
Adding the target’s unique lifecycle key and temporarily changing FORCE ROW LEVEL SECURITY on the source and target take ACCESS EXCLUSIVE locks, and PostgreSQL holds the locks from the force changes while it validates existing links.
An additive activation runs its compiler DDL, runtime grants, and exact target catalog verification in one transaction, so a validation or fingerprint refusal rolls that DDL back.
Maintenance still pins the exact target for recovery, and the check runs during apply, not in a successor plan before maintenance.
A reviewed activation commits compiler and authored steps at durable checkpoints.
A later reference validation refusal leaves those earlier checkpoints in place and pins maintenance as failed, so follow the exact-target retry, reconciliation, or backup-restore procedure in Change an active registry.
Projects that grant Record timers add an operator surface for inspecting, pausing, resuming, and
retrying timer work. It uses the runtime configuration and its companion audit journal, not the
migration credential used for package activation. Read Schedule Actions with Record timers before upgrading an active Registry or changing timer state. It covers the package compatibility step, live status and pagination limits, audit recovery, replicas, and restores.
The image runs breg --runtime-config /etc/breg/runtime.yaml as the non-root user UID 65532,
exposes port 8080, and carries the matching bregctl at /usr/local/bin/bregctl. It has no shell,
no writable directory, and no health check of its own.
The container serves only a package that activation already recorded. Write a second runtime file
for it, changing exactly four things from the host’s: listener.bind (to 0.0.0.0:8080),
secretProviders.file.root (to /etc/breg/secrets), package.root (to /var/lib/breg/package),
and the database host name in the connection URLs, because the container mounts its own paths and
reaches the database over its own network.
UID 65532 must own the secrets directory, every secret file in it, and the audit directory, with
mode 0700 on each directory. The mounted package need only be readable by it.
Startup refuses the runtime file unless it and every directory above it, as the container sees
them, are owned by root or the runtime user (UID 65532 in the images) and not writable by group or
others. A symbolic link anywhere in the path is refused. The mount below places one file under
directories the image owns, so only the file itself needs changing:
Startup refuses an audit directory or audit file owned by anyone else, including a directory Docker
created as root for a missing mount and one a host-run breg or bregctl left behind. Once the
container owns /var/log/breg and the runtime file, a host-run bregctl is refused them in turn,
so plan and apply from the image.
Then mount the inputs read-only and the audit directory writable:
BREG_IMAGE is the image digest from the release manifest. Run bregctl verify and
bregctl doctor from the image against this exact runtime file before you rely on its
GET /ready. A fault that recurs on every start makes the container restart repeatedly; the
restart policy’s backoff bounds how often.
You can plan, apply, and read the ledger from the same image you serve, without installing
bregctl on an operator host. Override the entrypoint and pass the arguments
Activate and serve uses, with the container’s paths:
Run apply and status the same way. These commands connect with the migration credential, so
mount a secret directory that holds it, and keep that credential out of the serving container’s
secret directory. Give UID 65532 that directory and its files the same way as the serving
container’s. apply writes audit entries beside audit.path, which is why the audit directory is
writable here too.
Kubernetes is outside the verified deployment profile. A ConfigMap or Secret volume mounted the
default way presents each key as a symbolic link, which the runtime refuses for both the runtime
file and secret files; inject secrets through secret:env/<NAME> instead.
You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.