Files

95 KiB
Raw Permalink Blame History

The Dredd family on one server, with one database

This is the family runbook. It covers running Atrium (the hub), Galena, Sygna and Counsel Scorecard (its modules) on one server, with Docker Compose, against one database that all four share — a schema and two least-privilege roles each, never public.

Where this is. The family IS one platform: one origin with one module per path (/atrium, /galena, /sygna, /counsel), one account, one admin pane. Both halves have landed, and both are what a fresh install gets. The address half is ONE site address, Atrium's backend — the front door — serving the apps as paths on it, and / going to Atrium. The identity half is a shared dredd schema that the hub writes and the modules read: ./init.sh writes it into every file by default (One account), so the first push already builds one account per person and a single sign-in at /atrium. RUNBOOK-one-account.md is only for an existing standalone box — one installed before this default, or with --standalone — whose accounts must be merged. Don't re-derive "separate deployments, separate logins, no single sign-on" from anything here: the database isolation stays exactly as described (a schema and two least-privilege roles per app, no app's role reaching into another's); identity is what is not duplicated. Four admin@example.com rows is a defect, not a design — and no longer a default.

There are two ways to get that database, and the rest of the kit is the same either way:

  • Option A, PostgreSQL 17 in a container on the same box (the default): one more service in the same docker compose, no account anywhere, nothing to pay beyond the server. ./init.sh writes every setting and secret in one go. You own the backups. This is the way to try the family out, and it is enough for a small deployment.
  • Option B, a managed PostgreSQL provider: one database (PostgreSQL 16 or 17) on a provider that hosts only the database — the apps still run on your server (Galena needs the git binary, a disk and a scheduler). You get the provider's backups and, usually, point-in-time recovery; you pay for them. The same four schemas, the same eight roles, the same provisioning and the same checks.

Nothing here names a provider. What providers do differently is written as it applies to any of them: the root CA they hand out, the form their pooler wants the user name in, the auto-generated API some of them put in front of a database, what their restores keep. Each app's own runbook, db/managed/README.md in its repository, explains its schema, its roles and its checks in depth; this page is the whole deployment, and the kit in this directory does the per-app work for all four apps at once.

File What it is
init.sh One command that writes every setting and every secret for Option A, mode 600 (--ip for a plain-HTTP trial, --single-host or --domains for a name of yours), one account for the platform by default (--standalone for separate ones)
push.sh The one command that provisions, migrates, seeds and checks all four apps in the database (§6; --managed-db for Option B)
db.env.example Its inputs: the database target (LOCAL_DB_*, or MANAGED_DB_* for Option B), the admin URL, the eight role passwords, pool size, and PLATFORM_IDENTITY_SCHEMA (one account)
compose.yaml The server: the postgres service, <app>-migrate and <app>-backend for each app; atrium-backend is the front door and the one published port, :80 (§7)
compose.managed-db.yaml Option B's override: the postgres service off, no database networks, the provider's CA mounted
local-db/ What the postgres service runs once at initdb: the extensions schema and the two extensions a managed provider preinstalls
RUNBOOK-front-door.md The live box's cutover from Caddy to the front door: backup, pull, build, up -d --remove-orphans, verify, rollback
.env.example What the compose files interpolate, and the push reads too: MODULES_DIR, POSTGRES_PASSWORD, LOCAL_DB_NAME, COMPOSE_PROFILES, Option B's DB_CA_FILE; plus the site address ATRIUM_DOMAIN, which init.sh --add reads back
env/ Per-app settings: <app>.env (both services) and <app>.migrate.env (the migrate service only). Each template carries both modes' database URL, the managed one commented out
modules/ Where the module checkouts are: the git submodules under deploy/modules (the default), or sibling checkouts named by MODULES_DIR
preflight.sh Static checks of the kit, both modes, also run by .github/workflows/deploy-kit.yml
lib/ push_helper.py (the push's Python half), envfile.sh (literal env-file reading), compose_checks.py (used by the preflight)
App Schema Roles Extensions Evidence tables
Atrium atrium atrium_migrator, atrium_app none audit_log append-only
Galena galena galena_migrator, galena_app pgcrypto audit_log append-only
Sygna sygna sygna_migrator, sygna_app none audit_log append-only; conflict_check, aml_assessment never deleted
Counsel Scorecard counsel counsel_migrator, counsel_app pg_trgm audit_log append-only
Insider (off by default) insider insider_migrator, insider_app none audit_log append-only
Arbiter (off by default) arbiter arbiter_migrator, arbiter_app none audit_log, analysis_signoff, agent_version, frozen_card append-only; analysis never deleted
Lexicon (off by default) lexicon lexicon_migrator, lexicon_app none audit_log append-only
Agora (off by default) agora agora_migrator, agora_app none audit_log, module_event, module_event_receipt append-only; negotiation_room, negotiation_round, negotiation_comment never deleted
Parafa (off by default) parafa parafa_migrator, parafa_app none audit_log, module_event, module_event_receipt append-only; signing_request never deleted
Scribe (off by default) scribe scribe_migrator, scribe_app none audit_log append-only; draft_export never deleted
Workflow (off by default) workflow workflow_migrator, workflow_app pgcrypto audit_log, module_event, module_event_receipt, workflow_event append-only; workflow_run, request, workflow_template, request_type, approver_group never deleted

Workflow (codename compass) was retired on 2026-11-14 and is no longer in the kit; a box that ran it is taken down by the removal runbook kept outside the kit (dump, stop, DROP SCHEMA, DROP ROLE), and Atrium's revision 0014 removes its catalogue entry and its module_permission rows. Panorama (the dashboard, M4) was retired in Atrium#53: its trends are Atrium's home page now (GET /home/trends), Atrium's revision 0018 hides its catalogue entry, and its services, env templates and submodule are gone from the kit. On a box that ran it, docker compose up -d --remove-orphans stops its containers; its schema, roles and panorama-data volume stay until the operator drops them, and panorama_app should leave MODULE_EVENT_READER_ROLES. A box that sets FRONTDOOR_UPSTREAMS in its own env must drop panorama=… from it too: the front door refuses to start on a slug it no longer serves. Insider (legal acts and case law, REST + MCP at /insider/mcp), ships switched off the same way (profile insider, with an optional OCR worker under a second profile, ocr); bringing it in is RUNBOOK-insider.md. Arbiter (contract analysis, split out of Compass; built from the arbiter submodule's apps/arbiter, repository Alpaq92/Arbiter), ships switched off under the profile arbiter; bringing it in is RUNBOOK-arbiter.md. Lexicon and Agora, the eighth and ninth (the clause library and negotiation rooms, the split plan's M2-M3) ship switched off the same way, each under a profile of its own name; bringing them in is RUNBOOK-m2-m4.md. Parafa and Scribe, the eleventh and twelfth (PAdES signing of PDFs and drafting from templates and clauses, M6 and M7) the same; bringing them in is RUNBOOK-m6-m7.md. Workflow (Alpaq92/Workflow, slug workflow: the general approval engine, a new module, not the retired compass) the same; bringing it in is RUNBOOK-workflow.md. Licences: Atrium, Galena, Sygna and Counsel Scorecard each run a CI licence gate that refuses GPL, AGPL and SSPL, and no image in the kit ships copyleft code: Arbiter's image carries no analysis engine (orders run on a workstation). See ../CREDITS.md.

Role names are cluster-wide, so every role carries its app's name. Never create generic app or migrator roles in this database (provisioning refuses those names), and never put tables in public.

What you keep, unchanged, whichever option you choose: a schema and two least-privilege roles per app, never public; the migrator owning the DDL and the runtime role owning nothing; the append-only audit_log; the isolation proof that no app's role holds a privilege in another app's schema; no migrator credentials in any long-running backend; one front door (atrium-backend) in front of every module; Galena's and Sygna's own backups. And one TLS rule, applied by every app at start-up (dredd_core.db.require_verified_tls): a database host counts as local when it is "", localhost, 127.0.0.1, ::1, postgres or listed in that app's DB_LOCAL_HOSTS; every other host must carry sslmode=verify-full or the app refuses to start. Option A's URLs name the host postgres and carry no TLS parameters; Option B's are verify-full against the provider's CA.

The order of work (Option A): the server's checkouts (§7 step 1), ./init.sh, the images, the database, the push (§6), the rest of the stack, then Atrium's module addresses (§8). Option B adds the provider's side (§1 to §5) and switches the URLs; its own section says what changes and what does not.

Option A, this box Option B, a managed provider
The database the postgres service, on a Docker network that never leaves the box the provider's, over its session-mode pooler or direct host
TLS none: no CA, and the URLs carry no sslmode sslmode=verify-full against the provider's root CA
User names the plain role name <role>.<tenant> where the provider's pooler needs the tenant in the user name, else plain
Settings ./init.sh writes all of them the same files, the managed lines uncommented by hand
Database backups pg_dump, on your cron, to somewhere else (below) the provider's (daily snapshots, often PITR)
A wrong password nothing: the connection is just refused some providers ban the client IP for a while after a few failures in a row
Connection budget 80% of the server's max_connections (65 of 80, with the stock 100) 80% of the plan's limit (MANAGED_DB_MAX_CONNECTIONS)
Monthly cost the VM (about €8 to 16 before VAT, §12), plus object storage for the dumps the VM, plus the provider's plan (§12)

Option A: one box, its own Postgres (the default)

One server, one docker compose, and PostgreSQL 17 in it beside the four apps. No account, no CA, no pooler, no connection tier — and no managed backups: the database is on your disk and the dumps are yours to take.

Choose it when you are trying the family out, running a demo or a pilot, or running a small instance where an hour of downtime and a nightly dump are acceptable and one €10 VM is the whole bill. Choose Option B instead when you want the database on somebody else's disk with daily backups and point-in-time recovery, when the box may die without warning, or when the data is worth more than the attention you will give it.

The commands

Do §7 step 1 first (the checkouts). Then, in deploy/:

./init.sh --ip 203.0.113.10        # a plain-HTTP trial on the server's public IP (below)
#   or, with one name of yours pointed at the server (plain HTTP; TLS is optional, below):
./init.sh --single-host http://dredd.example.com
#   or HTTPS on :443 with a Let's Encrypt certificate for that name (TLS, below):
./init.sh --tls --domain dredd.example.com --acme-email ops@example.com

read -rs DREDD_CORE_TOKEN && export DREDD_CORE_TOKEN  # the shell only, never a file
docker compose build && unset DREDD_CORE_TOKEN

docker compose up -d postgres                         # the database first: the push does not start it
docker compose ps postgres                            # wait for "healthy" (about 10 seconds)

./push.sh                                             # provision + migrate + seed + check, all four
docker compose up -d                                  # the backends; atrium-backend publishes :80

Then verify as in §7 step 7, and set Atrium's module addresses as in §8.

One address, a path per module, and Atrium is the front door. There is no reverse proxy: atrium-backend publishes :80 and serves the whole family as one site — <site>/atrium, <site>/galena, <site>/sygna, <site>/counsel, <site>/insider, <site>/arbiter, <site>/lexicon, <site>/agora, <site>/parafa, <site>/scribe, <site>/workflow; / redirects to /atrium/ and a bare /<slug> to /<slug>/. It serves Atrium itself and streams every other path to that module's backend, from a fixed map in compose.yaml (FRONTDOOR_UPSTREAMS; no target ever comes from a request), refuses encoded or dot-segment path tricks, drops inbound X-Forwarded-* and sets them anew (so each module's audit log still sees the client's address), and caps a request body at 100 MB. So init.sh asks for one address and writes it into ATRIUM_DOMAIN, plus a ROOT_PATH in each env/<app>.env — the app's own path, which its uvicorn takes as --root-path. That is one decision in two places: the front door strips /<slug> and ROOT_PATH puts it back on every URL the app generates. Change one and change the other, or every route 404s (the prefix arrives twice) or every redirect leaves the module.

Each module stamps its own headers (CSP, X-Frame-Options, nosniff, Referrer-Policy, COOP, Cache-Control) and serves its own console, copied into its image at build time. One switch decides framing, FRAME_ANCESTORS: 'none' / DENY by default, and 'self' / SAMEORIGIN here, set by compose.yaml on every module so Atrium can frame them at the one origin. Atrium itself stays DENY.

TLS is optional and off by default. Off, the platform is plain HTTP on :80, so give every address an http:// scheme. On (./init.sh --tls --domain NAME --acme-email ADDRESS, or on a running box RUNBOOK-tls.md), it is one switch in deploy/.env — TLS=on, ACME_EMAIL, and COMPOSE_FILE=compose.yaml:compose.tls.yaml, the override that publishes :443 — with ATRIUM_DOMAIN a DNS name of yours (never an IP or the sslip.io trial name; the kit refuses both). Still no reverse proxy: atrium-backend runs a second uvicorn with the certificate on :443, and its :80 answers the ACME challenges and, once the certificate exists, 308s everything else to https://NAME. A pinned certbot sidecar issues in webroot mode and renews; its deploy hook drops the new pair and a reload stamp into a shared volume, and atrium-backend restarts itself on that stamp (no Docker socket anywhere). Strict-Transport-Security stays off until HSTS_MAX_AGE is set, the runbook's last step; the front door sends it over HTTPS only and drops any a module sends. push.sh and preflight.sh refuse a half-thrown switch (TLS=on without the override in COMPOSE_FILE, or the reverse), and the up command push.sh prints names the override when TLS is on.

--ip gives the site http://dredd.<ip>.sslip.io: sslip.io resolves any such name to the IP inside it, so there is no DNS to set up, and the http:// prefix is what the front door serves: plain HTTP. It also writes SESSION_COOKIE_SECURE=false into env/counsel.env, which Counsel Scorecard needs on a plain-HTTP site (its template says why). That is a trial: passwords cross the wire in the clear, so real use waits for the TLS step.

--single-host <name> takes one name, with or without a scheme (http://dredd.lan for plain HTTP on a LAN; a bare name writes https:// addresses, which are right only once TLS is on). --domains still works and means the same thing with one name; it keeps its four-name form for a future one-host-per-app layout, and refuses four different names while the front door serves a single site — three of the apps would answer 404 with nothing saying why.

The settings

init.sh writes ten files, each readable by you only (mode 600), and refuses to overwrite any of them without --force — they hold the secrets a running deployment depends on, Galena's ENCRYPTION_MASTER_KEY above all (a new one makes every encrypted document unreadable). It prints the file names and where each secret is, never a value:

Never run init.sh against a deploy/ that is already deployed, and never with --force. It regenerates ENCRYPTION_MASTER_KEY, SECRET_KEY, POSTGRES_PASSWORD, the eight role passwords and the four bootstrap-admin passwords, and rewrites all ten files. Every Galena document becomes permanently unreadable, every stored Galena token undecryptable, and every database login wrong (POSTGRES_PASSWORD was applied by initdb on the volume's first start and is not re-read). To change settings on a running deployment, edit the keys by hand (§11). To see what a fresh run would write, use --into a scratch directory, which needs no --force and touches nothing: ./init.sh --ip <ip> --into /tmp/newconf.

And never docker compose down -v. It deletes pgdata (the whole family's database), galena-data (Galena's git repositories, which are not in the database), sygna-data (a box that ran Workflow also keeps a compass-data volume until the removal runbook deletes it). docker compose down without -v keeps all of them.

  • deploy/.env — the site address (ATRIUM_DOMAIN, the one address key; Galena's GALENA_PUBLIC_URL moved to env/galena.env), MODULES_DIR, LOCAL_DB_NAME (dredd, the one database all four apps share: the postgres service's POSTGRES_DB and the database every URL connects to) and POSTGRES_PASSWORD, the superuser's, generated. initdb applies it on the first start only; changing it later is ALTER ROLE postgres PASSWORD inside the container, not an edit here. With it set, deploy/.env holds a secret: the push refuses it unless it is mode 600, and never paste docker compose config output anywhere.
  • deploy/db.env — LOCAL_DB_ADMIN_URL (the superuser, with that same password), the eight role passwords (URL-safe, 43 characters each, so they need no percent-encoding in the URLs), the pool, and PLATFORM_IDENTITY_SCHEMA=dredd (one account, below). Prefer keeping the admin URL out of the file: blank it there and read -rs LOCAL_DB_ADMIN_URL && export LOCAL_DB_ADMIN_URL for the push, which can read every app's tables. If step 2 of the push is refused with a password error, this URL and POSTGRES_PASSWORD disagree.
  • env/<app>.env and env/<app>.migrate.env — the app's own settings from its two templates, with DATABASE_URL / MIGRATION_DATABASE_URL (a plain role name, the host postgres, LOCAL_DB_NAME, no sslmode and no sslrootcert: the link is a Docker network on this box, the family's TLS rule treats the host postgres as local, and the push refuses a local URL that carries either parameter), DB_APP_ROLE, each app's public address, Galena's ENCRYPTION_MASTER_KEY, Sygna's SECRET_KEY, IDENTITY_SCHEMA=dredd and SESSION_COOKIE_NAME=dredd_session (below), and a first administrator: admin@example.com with a generated 24-character BOOTSTRAP_ADMIN_PASSWORD. Atrium's is the one that counts — the platform's first administrator, created by Atrium's seed; the modules' seeds look that same address up rather than creating anyone, so their BOOTSTRAP_ADMIN_PASSWORD lines are inert (the push still requires them, so leave them). Sign in at <site>/atrium/, change the password, then replace that line (§8). Everything else in those files is the template's default — SMTP, the pool, Sygna's SEED_DEMO=false — and is yours to edit afterwards.

One account (the default)

A fresh install is one platform with one account per person: you sign in once, at <site>/atrium/, and every module knows you; people and their access are managed in Atrium's Administration and nowhere else. Nothing about it is a later step. init.sh writes the same four things every time, together:

file key value
deploy/db.env PLATFORM_IDENTITY_SCHEMA dredd — the push provisions every app for the shared schema
env/atrium.env IDENTITY_SCHEMA, SESSION_COOKIE_NAME dredd, dredd_session
env/atrium.env IDENTITY_READER_ROLES / IDENTITY_MIGRATOR_ROLES galena_app,sygna_app,counsel_app / the three migrators — the roles Atrium's migration grants the shared schema to
env/atrium.env MODULE_EVENT_EMITTER_ROLES galena_app,agora_app,parafa_app — the modules taking part in the shared event log module_event (dredd-core 0.20.0, Atrium revision 0011); each must also be an identity reader, and push.sh checks exactly these with --events
env/atrium.env COUNTERPARTY_WRITER_ROLES / COUNTERPARTY_READER_ROLES / COUNTERPARTY_MIGRATOR_ROLES sygna_app / (empty) / sygna_migrator — the shared counterparty register (dredd-core 0.21.0, Atrium revision 0012): Sygna writes and its migrator brings its own rows in through the import door (no module reads it since Workflow was retired); push.sh checks each module with --counterparties <its tier> once it pins 0.21.0+
env/<module>.env IDENTITY_SCHEMA, SESSION_COOKIE_NAME dredd, dredd_session

How the first push builds it, from an empty database (§6 has the five steps): every app is provisioned first, Atrium first — its run creates the dredd schema owned by atrium_migrator, and each module's run grants its two roles USAGE on it and puts it on their search_path, after their own schema. Then Atrium migrates: its revision 0004 creates app_user, session and module_permission in dredd, finds no accounts to move, and grants each listed module role its tier; Atrium's seed creates the one first administrator there. Then each module migrates: its own cutover revision finds no local account and merges nothing (where its 0001 built empty local identity tables, it re-points the foreign keys at dredd.app_user and drops them), and its seed looks the administrator up. Last, every app's two managed checks measure the result, as the owner tier for Atrium and the reader tier for a module. compose.yaml keeps the same order for docker compose up (every module's migrate waits for Atrium's).

Insider ships switched off, so its roles are not in the hub's lists: a listed role whose app is not provisioned makes Atrium's first migration refuse. To run it from the start, add insider_app and insider_migrator to the two lists in env/atrium.env together with COMPOSE_PROFILES=insider in deploy/.env, before the first push; the push refuses Insider switched on without them (every other switched-off module the same, with its own roles and profile). Switching it on later is the same env edit followed by a push that includes Atrium (or Atrium first): atrium-migrate re-applies the identity grants to exactly the listed roles on every run (alembic upgrade head && python -m app.identity_grants && python -m app.seed), so no Atrium revision is needed. A listed role that does not exist yet makes that step refuse, by name, and the deploy stops.

The push refuses the half-done shapes by name, before anything connects: an app whose env file names a schema db.env does not (provisioning without the flags would take the schema off its roles), db.env naming a schema the hub does not (Atrium's 0004 would record itself applied having built nothing), a module the hub does not list, and a module whose cookie is not the hub's (signing in at /atrium would sign nobody in to it).

Separate accounts per app (standalone) is an explicit opt-out: ./init.sh --standalone writes the whole of it at once — PLATFORM_IDENTITY_SCHEMA and Atrium's IDENTITY_SCHEMA and role lists blank, SESSION_COOKIE_NAME=atrium_session, and each module's two identity lines commented out, so each app keeps its own cookie name (separate accounts at one origin must not share one). Then every app has its own first administrator and its own sign-in. Every app's committed provision.sql is the one-account rendering, so a standalone push compares it as that and says its SQL-editor path is not this deployment's. An existing standalone box — installed before this default, or with --standalone — does not become one account by editing these keys: its accounts have to be merged, and RUNBOOK-one-account.md is that procedure.

By hand instead: install -m 600 each template under its real name (.env.example → .env, db.env.example → db.env, env/<app>.env.example → env/<app>.env, and the .migrate.env ones), generate the passwords (python3 -c "import secrets; print(secrets.token_urlsafe(32))", a different one per role, at least 16 printable ASCII characters), and fill in what init.sh would have: the same password in db.env and, percent-encoded, in the URL that logs in with it. The templates name every line. The push checks that the two agree before anything connects.

Do not rename the postgres service. Every app treats exactly "", localhost, 127.0.0.1, ::1, postgres and its own DB_LOCAL_HOSTS as local, and refuses any other host that is not verify-full. The service name is the host name in every URL.

What the postgres service does

  • One postgres:17 service. Its data is the pgdata named volume; local-db/01-extensions.sql runs once, at initdb, and creates the extensions schema with pgcrypto and uuid-ossp in it — the baseline dredd_core.managed emulate defines for a managed Postgres. Provisioning refuses a database without that schema, and Atrium's, Galena's and Sygna's 0001 migrations run CREATE EXTENSION IF NOT EXISTS "pgcrypto", which is a no-op next to a pre-installed copy. Counsel's pg_trgm is not there: provisioning creates it, as the admin, per app.
  • No published port. Nothing outside the box connects. Reach it with docker compose exec postgres psql -U postgres dredd.
  • One network per app, between that app and the database. compose.yaml gives each module's backend its own network with the front door (atrium-backend) only, so no module can reach another module's HTTP; a single shared database network would have undone that. So postgres joins a separate <app>-db network per app instead: each app's two services reach the database and nothing else, and no two apps share a database network. If 172.30.20.0/24 to 172.30.23.0/24 collide with something on the host, change them in compose.yaml (they carry no FORWARDED_ALLOW_IPS, so nothing else moves with them).
  • The healthcheck probes TCP (pg_isready -h 127.0.0.1), not the unix socket: on the first start of an empty volume the image's entrypoint runs a temporary server on the socket alone while it creates the database and runs local-db/; a socket probe would report healthy then, and the four one-shots (which wait for service_healthy and are never retried) would fail against a port nothing listens on.
  • Every one-shot waits for the database to be healthy; every backend waits for its own one-shot and for the database.

./push.sh runs the five steps §6 describes, with every check. It refuses to start while the postgres service is down or not yet healthy, because every step runs with --no-deps and would not bring it up. CHECK_REQUIRE_TLS is forced to false: there is no TLS to require, so the managed check's two TLS rows warn and the run still passes. Everything else in the check is enforced exactly as on a managed provider.

Sizing

An estimate, not measured, like §7's. Four Python backends (one uvicorn process each; Atrium's also streams every module's traffic), PostgreSQL, and image builds on the same box.

vCPU RAM Disk
A trial or a demo 2 4 GB 40 GB
A small real instance 4 8 GB 80 GB
  • §7 sizes the four backends alone at 2 vCPU / 4 GB / 40 GB, and 4 vCPU / 8 GB if Galena handles large documents. Postgres on top of that is the reason to start at the second row for anything real: postgres:17 ships shared_buffers at 128 MB, but the page cache is what makes it fast, and it now competes with four Python processes for the same RAM.
  • Connections. postgres:17 ships max_connections = 100. Each backend holds up to DB_POOL_SIZE + DB_MAX_OVERFLOW, plus one for a one-shot beside it: 5 × (4 + 8 + 1) = 65 of the 80 the push budgets (80% of 100). The stock settings fit; the push prints the arithmetic and says so. To raise it, change both halves together — max_connections in the postgres service's command: in compose.yaml (that line is there to be edited), and LOCAL_DB_MAX_CONNECTIONS in db.env so the push budgets against the new number — then docker compose up -d postgres.
  • Disk is the database plus Galena's git repositories plus whatever local backups have not been copied off yet. Galena's repositories are usually the fastest-growing part.

Backups — yours

Nothing backs this database up until you do. Two independent things must be kept, and they must be kept together in time, because Galena's documents live in git repositories on disk, not in the database:

  1. The whole database, all four schemas at once. A plain pg_dump from the running container, run by cron on the host, is enough — as a script, with cron calling it in one line:

    install -d -m 700 /srv/backup
    
    cat > /usr/local/sbin/dredd-dump <<'EOF'
    #!/bin/sh
    # Every schema of the family in one dump. The database name is the container's own POSTGRES_DB,
    # which Compose set from LOCAL_DB_NAME, so it cannot drift from deploy/.env.
    set -eu
    cd /srv/dredd/atrium/deploy
    umask 077
    out=/srv/backup/dredd-$(date -u +%Y%m%dT%H%M%SZ).dump
    docker compose exec -T postgres sh -c 'pg_dump -U postgres -Fc "$POSTGRES_DB"' > "$out.part"
    mv "$out.part" "$out"          # so nothing ever copies or prunes a half-written dump
    EOF
    chmod 700 /usr/local/sbin/dredd-dump
    
    # /etc/cron.d/dredd-dump — 03:15 every day; the dumps are root-only (they hold every app's tables)
    echo '15 3 * * * root /usr/local/sbin/dredd-dump' > /etc/cron.d/dredd-dump
    

    A cron command is one physical line: crontab(5) runs "the rest of the line" and has no continuation, so a \ at the end of a cron entry hands /bin/sh a fragment and turns the next lines into entries of their own (bad minute). A script also keeps % — which cron reads as a newline and which date -u +%Y... is full of — out of the crontab entirely.

    -Fc is the custom format: pg_restore reads it, and it compresses. Keep a week or a month of them (find /srv/backup -name 'dredd-*.dump' -mtime +30 -delete), and restore one occasionally, into a scratch database, or you do not have a backup.

  2. Galena's DATA_DIR, its git repositories, and Sygna's if its files matter. Galena's own backup (Administration → Backups) already packs DATA_DIR and a dump of its own tables into one .tar.gz in the galena-data volume; Sygna's does the same. §9 says how to copy those off the host. They stay the per-app restore path (§10) in this mode too — they are unchanged by it.

Copy both off the box. A dump beside the database it came from protects against nothing but a DROP TABLE. Any object store with cheap or free egress works, so that restoring costs only the storage — with rclone at the end of that same script, after the mv:

rclone copy /srv/backup remote:dredd-backups/db --max-age 25h

Encrypt them at rest wherever they land (rclone crypt, or age), and keep Galena's ENCRYPTION_MASTER_KEY and Sygna's SECRET_KEY in the secret store, not in the archive: no backup contains them, and a restore without them leaves encrypted documents and stored tokens unreadable.

Restoring the whole database

Stop the four backends (docker compose stop atrium-backend galena-backend sygna-backend counsel-backend), pg_restore the dump into this database (--clean --if-exists) or into a fresh one, then run ./push.sh once — it re-provisions (idempotent), re-applies any migration the dump predates, and runs all eight checks — and docker compose up -d. Restore the Galena archive closest to the same moment, so its rows and its repositories match again (§10, which is unchanged in this mode).

--reset-passwords is not needed here, unlike after some providers' restores (§9). A pg_dump carries no roles at all — they belong to the cluster, not to the database — so restoring into this cluster leaves them exactly as they are, and rebuilding the box from nothing leaves none for step 2 to find, which is the case it creates them in anyway, from db.env. A rebuilt box does need local-db/01-extensions.sql to have run, which it has: initdb runs it on the first start of the new volume, before anything else.

Moving to a managed provider later

The database is the only thing that moves; the server, the images, the addresses and the consoles stay.

Provision the new database first, restore into it second. A pg_dump carries no roles — they belong to the cluster, not to the database — so restoring into an empty database would run every ALTER SCHEMA … OWNER TO atrium_migrator and GRANT … TO atrium_app against roles that do not exist yet. Those statements fail, the schemas and tables end up owned by the platform admin, and then provisioning refuses to take over a schema owned by another role and the managed check's table owners row fails on tables owned by the admin. The push is what creates the roles, so it goes first.

  1. Do §1 to §5 on the new database: the CA, the API off, SSL enforced, the network restrictions, the plan's connection limit.

  2. Fill in the MANAGED_DB_* block of deploy/db.env, and swap each env/<app>.env and env/<app>.migrate.env to its managed URL — the commented line below the local one, with the provider's host, <role>.<tenant> where its pooler needs it, and ?sslmode=verify-full&sslrootcert=/run/certs/db-ca.crt. Put the CA in DB_CA_FILE (deploy/.env). From here on every docker compose carries both files: export COMPOSE_FILE=compose.yaml:compose.managed-db.yaml.

  3. ./push.sh --managed-db once, against the still-empty database. It provisions: the eight roles, and each schema owned by its migrator. Let it migrate and seed — the restore in step 5 replaces the tables anyway, and this proves the connection, the roles and the grants before any data is involved.

  4. In the provider's SQL editor, make the platform admin a member of the four migrators for the length of the restore. Provisioning's last step is REVOKE <migrator> FROM CURRENT_USER, so the admin is no longer one — and on most providers the admin is not a superuser, so it cannot set an object's owner to a role it is not a member of:

    GRANT atrium_migrator, galena_migrator, sygna_migrator, counsel_migrator TO postgres;
    
  5. Dump the four app schemas on the box and restore them into the new database as the platform admin:

    docker compose -f compose.yaml exec -T postgres \
      sh -c 'pg_dump -U postgres -Fc -n atrium -n galena -n sygna -n counsel "$POSTGRES_DB"' > family.dump
    pg_restore --clean --if-exists -d "<the provider's direct connection URL>" family.dump
    

    The four -n flags leave the extensions schema behind on purpose: the provider has its own, owned by the platform, and a restore must not try to drop or recreate it. The tables, the owners, the ACLs and alembic_version come across as they are, which is why the shape had to match — the same schemas, the same roles, the same provisioning run it in both places.

  6. Take the membership back, in the SQL editor:

    REVOKE atrium_migrator, galena_migrator, sygna_migrator, counsel_migrator FROM postgres;
    
  7. ./push.sh --managed-db again: it re-provisions (idempotent), applies any migration the dump predates, and runs all eight checks against the new database — the table owners row is what proves the restore landed with the right ownership. --reset-passwords is not needed here: step 3 set the passwords from db.env, and a pg_dump carries no roles, so the restore left them untouched.

  8. docker compose up -d (with both files). Keep the pgdata volume until the new database has been through a restore drill (§10).

Option B: a managed PostgreSQL provider

The same family, the same kit, against a database the provider hosts. compose.managed-db.yaml is an override of compose.yaml: it switches the postgres service off (a profile nobody activates), removes the four <app>-db networks and every depends_on: postgres from the app services, and mounts the provider's root CA read-only at /run/certs/db-ca.crt in all eight services that connect. Everything else — the images, the commands, the one-shot/backend split, the blanked MIGRATION_DATABASE_URL in every backend, the front door and its one site — is compose.yaml's, unchanged. Pass both files to every command (docker compose -f compose.yaml -f compose.managed-db.yaml ...), or export COMPOSE_FILE=compose.yaml:compose.managed-db.yaml once and drop the flags. The merge uses Docker's !reset tag (merge rules), so it needs a Compose v2 release that implements them (2.24 or later); docker compose config shows the result, and preflight.sh asserts it.

Sections 1 to 5 are the provider's side, once per database, before any app is provisioned. The apps' own runbooks (db/managed/README.md, section 0) say the same things; this is the family's copy.

1. Create the database

  • Members. Keep the provider's project or organization to the few people who operate it. Anyone who can use its SQL editor runs as the platform admin, which can read every table of every app.
  • Region. Choose a specific region in the jurisdiction you need; a general region can deploy elsewhere. Ask the provider in writing where backups are stored if its terms do not say.
  • PostgreSQL 16 or 17. The family is tested on both.
  • The plan. Its connection limit is what §5 budgets against; a small instance often allows 60 to 100.
  • The platform admin's password (postgres on most providers, and not a superuser there). Generate a long random one and keep it in the ops secret store. It goes only into MANAGED_DB_ADMIN_URL for the push (§6), best exported in the shell for that run; no backend, no app env file and no module container ever holds it.
  • Default grants. Some providers give their API roles automatic privileges on new objects in public. The apps never use public, and each app's runtime-grants migration strips those roles from its own schema. Still, revoke such defaults if the provider documents them.

2. The CA certificate

  1. Download the provider's root CA certificate (a PEM file) from its dashboard — the one its connection settings hand out for verified TLS.

  2. On the server, save it as deploy/certs/db-ca.crt, or anywhere else with DB_CA_FILE pointing at it in deploy/.env (Compose and the push both read it there, so they can't use different files). One file serves the whole database. compose.managed-db.yaml mounts it read-only at /run/certs/db-ca.crt in all eight services that connect. certs/ is git-ignored.

  3. Record what you downloaded, in the ops secret store, and compare it on every machine that uses it:

    openssl x509 -in deploy/certs/db-ca.crt -noout -subject -enddate -fingerprint -sha256
    
  4. Put its expiry date in the ops calendar (the notAfter above). After that date every verify-full connection fails. Before then, download the replacement, check it the same way, replace the file and restart the stack (docker compose up -d --force-recreate).

Every URL in the family then ends in ?sslmode=verify-full&sslrootcert=/run/certs/db-ca.crt. Without sslmode, pg8000 tries TLS without verifying the server and silently falls back to plaintext; dredd_core.db.make_engine refuses prefer, allow and disable. At start-up every app refuses a non-local host without verify-full (the family's one TLS rule), and push.sh --managed-db refuses env files without it.

3. Keep the schemas out of any auto-generated API

Some providers put an auto-generated HTTP API (REST, GraphQL) in front of the database. It connects as roles such as anon, authenticated and service_role, and exposes public by default. None of the apps uses such an API: they connect as Postgres roles.

  1. Switch the API off where the provider allows it, or never add an app schema to it.
  2. Prove it. A request to that API with the provider's publishable key must not return data.
  3. Once the apps are migrated, the push's managed checks prove that anon, authenticated and service_role hold nothing in any app's schema. If the provider has a security advisor, it must show no finding about the apps' schemas.

4. Enforce SSL, restrict the network, IP bans

SSL enforcement. Where the provider offers it, refuse plaintext connections at the server. Changing it may restart the database, so do it before any app goes live. The apps refuse to start without verify-full anyway, so a plaintext-only setup fails on both sides.

Network restrictions. Until you restrict them, the database and its pooler accept connections from every IP. Allow only the server's egress addresses (IPv4 and, if connections resolve to it, IPv6), with the provider's dashboard or CLI. To run push.sh --local from another machine, allow that machine too, and remove it afterwards. The restrictions usually cover the direct connection and the pooler alike, not the HTTPS APIs (§3).

IP bans. Some providers ban a client IP for a while after a few wrong passwords in a row. All four backends share the server's IP, so one app's wrong password can lock all four out. Migrations are never retried, and push.sh stops at the first failure (one failed login per run, at most). A running backend with a wrong password does keep trying: every request connects, and Sygna's healthcheck runs SELECT 1 every 15 seconds. So stop that backend first (docker compose stop <app>-backend), fix the password, lift the ban in the provider's dashboard, then retry once.

5. Connections

Connection path.

  • Default: the provider's pooler in session mode, port 5432. Some poolers need the tenant in the user name — every role then logs in as <role>.<tenant>, exactly as the dashboard's connection string shows it; set MANAGED_DB_TENANT in db.env and use that form in the env files. Where user names are plain, leave it empty. A pooler usually works over IPv4, which is what Docker's default networks give the containers.
  • Or the direct connection, with plain role names. Some providers make it IPv6-only unless you pay for an IPv4 address, and the kit's Docker networks are IPv4-only.
  • Never a transaction-mode pooler (commonly port 6543): no prepared statements, and SET ROLE and session settings break there. The push refuses port 6543.

The budget. One database serves all four apps and the provider's own services, so they share its connection limit. Each backend holds up to DB_POOL_SIZE + DB_MAX_OVERFLOW connections. Count one more per app for a one-shot beside it (migrate, seed, restore, managed check, each using one unpooled connection). Keep the total at or below 80% of the plan's limit:

The plan's limit Every app's DB_POOL_SIZE / DB_MAX_OVERFLOW Five apps 80% of the limit
90 4 / 8 (the defaults): 4 + 8 + 1 = 13 65 72
60 3 / 2: 3 + 2 + 1 = 6 30 48
  • Set the pool in every env/<app>.env, and the same pair in db.env: the push prints this budget against MANAGED_DB_MAX_CONNECTIONS and warns when an env file differs.
  • A pooler's own per-role pool size (its dashboard) caps what it opens for each role + database in session mode, where a client keeps its connection. It must be at least the largest app's DB_POOL_SIZE + DB_MAX_OVERFLOW + 1.

The commands

Do §7 step 1 first (the checkouts), then §1 to §5 above. Then, in deploy/:

export COMPOSE_FILE=compose.yaml:compose.managed-db.yaml   # both files, every command, from here on

./init.sh --single-host http://dredd.example.com   # one address; the modules are paths on it
# then switch the database (below): db.env's MANAGED_DB_* block, the eight URLs, DB_CA_FILE in .env

read -rs DREDD_CORE_TOKEN && export DREDD_CORE_TOKEN
docker compose build && unset DREDD_CORE_TOKEN

./push.sh --managed-db --dry-run                      # the plan, and anything missing; connects nowhere
./push.sh --managed-db                                # provision + migrate + seed + check, all four
docker compose up -d

The settings

Start from what init.sh wrote (it generates the role passwords, the bootstrap administrators and the two app secrets whichever option you run), then switch the database:

  • deploy/.env — add DB_CA_FILE=./certs/db-ca.crt (the template ships it commented out). POSTGRES_PASSWORD and LOCAL_DB_NAME are then unused: leave them, or blank the password.
  • deploy/db.env — fill in the MANAGED_DB_* block: MANAGED_DB_HOST (the session pooler or the direct host), MANAGED_DB_PORT (5432), MANAGED_DB_NAME (postgres on most providers), MANAGED_DB_TENANT (empty unless the pooler wants <role>.<tenant>), MANAGED_DB_ADMIN_URL (the platform admin — prefer exporting it in the shell: read -rs MANAGED_DB_ADMIN_URL && export MANAGED_DB_ADMIN_URL), MANAGED_DB_MAX_CONNECTIONS (the plan's limit) and CHECK_REQUIRE_TLS. The LOCAL_DB_* block is then not read at all. The eight role passwords are the same ones.
  • env/<app>.env and env/<app>.migrate.env — each template carries its managed URL beside its local one, commented out: comment the local line, uncomment the other, and fill in the host, the tenant suffix and the percent-encoded password (init.sh's passwords are URL-safe, so they go in as they are). They differ in exactly three ways from the local ones — <role>.<tenant> where the pooler needs it, the provider's host, and ?sslmode=verify-full&sslrootcert=/run/certs/db-ca.crt. The push refuses a managed URL without exactly that, and every app refuses to start with a non-local host that is not verify-full.

After a provider restore

A restore or point-in-time recovery rewinds all four apps together: there is no per-schema restore. Some providers' restores also drop custom role passwords; §10 says how --reset-passwords puts them back, and the drill in §10 tells you whether your provider is one of them.

6. Push the family: push.sh

push.sh puts all four apps into the database, idempotently. Run it after init.sh (and, for Option B, §1 to §5), and again after every restore (§10) and update (§11).

Before the first push, on the server:

  1. Do §7 steps 1 to 5: the checkouts, init.sh, the images, the database.

  2. The push refuses a db.env, deploy/.env or env/*.env that group or others can read (not checked on Windows); init.sh writes them mode 600. Leave the secrets empty in db.env if you prefer to export them from the secret store for this shell only: a non-empty shell variable wins. That is the better home for the admin URL, which can read every app's tables: read -rs LOCAL_DB_ADMIN_URL && export LOCAL_DB_ADMIN_URL (MANAGED_DB_ADMIN_URL for Option B).

  3. If you generated passwords by hand: at least 16 printable ASCII characters, a different one per role. URL-safe passwords need no percent-encoding in the env files' URLs. Otherwise encode them there, reading the password from stdin so it never appears on a command line (printf is a shell builtin): printf '%s' "$PASSWORD" | python3 -c "import sys, urllib.parse; print(urllib.parse.quote(sys.stdin.read(), safe=''))".

  4. Look at the plan. It connects nowhere and lists anything missing:

    cd deploy
    ./push.sh --dry-run
    

Push:

./push.sh                       # all four apps (Option A)
./push.sh --managed-db          # the same, against the provider's database (Option B)
./push.sh galena sygna          # or a subset; apps always run in the family order

What it does:

  1. Preflight, for every selected app, before anything connects. The admin URL must parse, name the family's database and not log in as one of the family's roles (Option A: no TLS parameters; Option B: verify-full or no sslmode). Each app's settings must match db.env as both of its services will see them: the user, the host, the port, the database, the TLS parameters (none, or verify-full against /run/certs/db-ca.crt), the password, and DB_APP_ROLE. In <app>-migrate: DATABASE_URL, MIGRATION_DATABASE_URL and the bootstrap administrator (BOOTSTRAP_ADMIN_PASSWORD set, not a default, 12 characters or more). In <app>-backend: DATABASE_URL and DB_APP_ROLE (a backend without them would fall back to the app's built-in default database and still look healthy), and none of MIGRATION_DATABASE_URL, BOOTSTRAP_ADMIN_PASSWORD, ADMIN_DATABASE_URL or either admin URL. With --local it reads the two files instead, so a setting in the wrong one is named. One account is checked across the files too (One account): every app's IDENTITY_SCHEMA against db.env's PLATFORM_IDENTITY_SCHEMA, the hub naming it, every module this push provisions listed in the hub's IDENTITY_*_ROLES, and every module on the platform using the hub's cookie name. Last, the app's committed db/managed/provision.sql must be exactly what the provisioning dredd-core renders for it — with the identity flags the push provisions with — so the kit and the app agree on the schema, the roles, the extensions and the shared schema.
  2. Provision (python -m dredd_core.managed provision, as the platform admin, one transaction per app). It creates the two plain LOGIN roles if missing and refuses placeholder or shared passwords. It sends passwords as SCRAM verifiers. It creates the schema owned by the migrator, revokes everything from PUBLIC on it, grants USAGE on it to the runtime role, and grants USAGE on extensions to both roles, failing with a clear error if that grant doesn't take. It sets search_path = <schema>, dredd, extensions for both roles (<schema>, extensions standalone) and statement_timeout = 30min for the migrator, and creates the app's extensions in extensions. With one account it also creates the shared dredd schema, owned by atrium_migrator (Atrium's run, which comes first), and grants each app's two roles USAGE on it. It ends by revoking the admin's temporary memberships, then verifies the result. It never touches public.
  3. Migrate and seed: the app's own one-shot, alembic upgrade head && python -m app.seed. Alembic runs as the migrator. Atrium's, Galena's and Sygna's seeds run as the runtime role; Counsel's runs as the migrator. Everything lands in the app's schema through search_path, so another app's same-named audit_log, app_user or enum type never makes a table get skipped.
  4. Check, after every selected app is migrated, as the runtime role and then as the migrator (python -m dredd_core.managed check --expect-user --expect-schema --app-role --migrator-role, with the app's append-only / no-delete tables). It checks TLS; the logged-in role; the schema and the search_path; that the migrator owns the schema and every table; that the evidence tables can't be rewritten; that neither role holds any privilege in another app's schema; and that no API role holds any privilege in this one. It runs last so that each app's isolation is proven against every other app's schema.

Sessions that would block step 3. Before step 2 — so a refusal changes nothing — the push asks the database, for every selected app, for transactions open longer than 60 s that belong to <app>_app (its running backend) or hold a lock on a table in <app>'s schema. It lists each one (pid, role, state, age, the first 120 characters of its last query with every string literal replaced by '?') and refuses with exit 2 and the fix: --stop-backend, or docker compose stop <app>-backend, the push, then docker compose up -d --no-deps <app>-backend. It asks as the platform admin in atrium-migrate (the migrator with --skip-provision). This is the 2026-10-22 incident: Insider's backend held one session idle in transaction for three hours after pg_try_advisory_lock and another on an open server-side cursor, and its ALTER TABLE ... ADD COLUMN waited 24 minutes behind them.

Why stopping is opt-in, not the default. A backend that is merely connected blocks nothing: most releases add a table or a nullable column and run fine beside it, and stopping every pushed backend on every push would turn each of those into downtime. A push that would actually block is refused with the exact fix instead, and the lock timeout catches what the preflight could not see (a transaction that opens after it asked). A module release whose notes say its migration rewrites or locks a busy table should go out with --stop-backend from the start.

The recommended module deploy, on the server, in deploy/:

docker compose build <app>-backend          # the new image; the running backend is untouched
./push.sh --dry-run <app>                   # the plan, including "sessions", "backends" and "locks"
./push.sh <app>                             # refused (exit 2) if a session would block: then
./push.sh --stop-backend <app>              #   stopped, migrated, checked, started again, waited healthy
docker compose up -d <app>-backend          # without --stop-backend: start the new image

When step 3 fails halfway. Step 3 is alembic upgrade head then the seed, and Alembic commits first. A seed that dies (a statement timeout, SQLSTATE 57014, or a lock) leaves the schema at its new head: do not roll it back by hand; fix the cause and run the same push again — the migration is then a no-op and only the seed runs. With --stop-backend the backend stays stopped until a push passes; docker compose up -d --no-deps <app>-backend starts it anyway if you have to (the new image against the new schema, minus whatever the seed did). Without it, the old backend kept running throughout, and is running against the new schema now: start the new image after the rerun passes.

It stops at the first failure, names the step, and prints the exact command to run again, with the same flags and files. Every step is idempotent. Passwords are never printed: URLs are masked, and a mismatch names the setting, not its value. Exit status: 0 = done, 1 = a step failed, 2 = refused before anything ran.

Options.

  • --managed-db targets a managed provider's database instead of the postgres service (Option B): the same five steps and the same checks, against MANAGED_DB_ADMIN_URL, <role>.<tenant> user names where MANAGED_DB_TENANT says so, verify-full URLs, and both compose files. It is not --local, which says where the steps run rather than where the database is.
  • --reset-passwords also sets the password of roles that already exist: after a restore that dropped them (§10), or to rotate one (§11). A backend still running with the old password fails every new connection — and, on a managed provider, can get the server's IP banned — so the push refuses while a selected app's backend runs.
  • --skip-provision leaves out step 2 and needs no admin URL (the SQL editor path, below).
  • --stop-backend stops <app>-backend just before that app's step 3, and only once every step has passed starts it again (up -d --no-deps <app>-backend) and waits up to 180 s for it to report healthy. After any failure the backends it stopped stay stopped — a new image never starts on a schema whose migration did not finish — and the failure message says what to check, how to rerun and how to start them anyway. Not with --local: the backends run on the server.
  • --lock-timeout DURATION (default 30s; ms, s or min; 0 waits forever, as before) is how long step 3's migration may wait for a lock. A DDL statement that waits holds every later query on the table behind it, so a blocked migration should fail in seconds, not take the module down for half an hour. pg8000 reads no PGOPTIONS and passes no startup options, so the push sets it on the role instead: ALTER ROLE <app>_migrator IN DATABASE <db> SET lock_timeout, as the platform admin, just before the app's step 3, and RESET right after it, pass or fail (a value you configured on that role yourself is left alone). With --skip-provision there is no admin URL and no timeout. A migration that fails on it says so and names --stop-backend.
  • --db-env FILE, --compose-env FILE and --env-dir DIR replace db.env, deploy/.env and env/. MODULES_DIR, DB_CA_FILE, DEPLOY_ENV_DIR and LOCAL_DB_NAME are read from deploy/.env, the file docker compose reads, never from db.env. A shell value wins, as in Compose, but in the default mode one that differs from deploy/.env is refused: a later docker compose up in another shell would mount something else.

Where it runs.

  • Default: in containers, on the server, after docker compose build. The push builds nothing. Each app's preflight, migrate and checks run in its <app>-migrate, and its backend preflight in <app>-backend, so Compose reads the env files exactly as it will for up. The platform admin's steps (the admin URL check, the provision.sql check and step 2) run in atrium-migrate only. That image is built from this repository with the same dredd-core pin as the modules, and it is the only container that ever receives the admin URL: no module image's code sees it. Galena's seed writes its demo project's git repository into the server's galena-data volume. In Option A the postgres service must be up and healthy first: the push checks, and refuses with the command to run.
  • --local: from a checkout with Python, without Docker. Each app runs with its own interpreter (<APP>_PYTHON, else the checkout's backend/.venv), against LOCAL_DB_HOST:LOCAL_DB_PORT (Option A: 127.0.0.1 and a published port, because the container name postgres only resolves inside Compose's networks) or the provider's host with the CA at DB_CA_FILE (Option B), and provisions with its own dredd-core. The env files must still be present, since the preflight and the seeds need them. Galena's seed is skipped unless LOCAL_DATA_ROOT is set, because its repository belongs in the server's volume; docker compose up seeds it there. On a managed provider, allow this machine's IP first (§4).

Through a pooler, CHECK_REQUIRE_TLS=true can fail a correct setup (Option B). There, the check's TLS (server view) row describes the pooler's own link to Postgres. If that row is the only failure and TLS (client) is OK with verify-full, your link is verified. Set CHECK_REQUIRE_TLS=false in db.env, where that row is only a warning, and note it. Option A ignores the setting: there is no TLS, and both rows warn.

The SQL editor path (no admin URL on the server): each app's db/managed/provision.sql holds the same provisioning steps with change_me passwords; its own runbook says how to use it. Then run ./push.sh --skip-provision: it needs no admin URL, and still runs the preflight, the migrations, the seeds and every check. Keep the eight role passwords in db.env (or the shell) as usual: the preflight compares them with the env files, and the checks log in with them.

7. The server

Sizing (an estimate, not measured). Four Python backends (one uvicorn process each), and image builds: start with 2 vCPU / 4 GB RAM and 40 GB of disk, and move to 4 vCPU / 8 GB if Galena handles large documents. Option A adds PostgreSQL on the same box (its "Sizing" above). Disk grows with Galena's repositories and with local backups until you copy them off (§9). A VM like that cost about €8 to 16/mo before VAT when this was written (§12). For Option B, a host in or near the database's region keeps the round trips short: each ORM statement is about three, and a request makes 20 to 26.

DNS. With --single-host (or --domains): one A record (and AAAA if the server has IPv6) for that one name, pointing at the server, before the first up. One site, one name (and, with TLS on, one certificate) — the modules are paths on it. With --ip: nothing; sslip.io resolves the name.

Firewall.

  • Inbound: 80/tcp from anywhere (and 443/tcp with TLS on; 80 stays open then, for the ACME challenge and the redirect); SSH only from where you administer. Only atrium-backend publishes a port. Docker's published ports bypass host firewalls such as ufw, and this one is meant to be public.
  • Outbound: 443/tcp for GitHub (the builds) and S3 (backups); your SMTP port if the apps send mail; for Option B, 5432/tcp to the provider's host.
  • For Option B, give the provider this server's egress IPs (§4).

Docker. Docker Engine with the Compose v2 plugin (2.24 or later for Option B's merge tags); BuildKit is required for the build secret. docker compose version must work.

Steps.

  1. Clone Atrium with its modules (modules/README.md). Galena, Sygna and Counsel Scorecard are git submodules under deploy/modules, pinned to the commits this release was tested with (the server needs read access to the private repositories):

    git clone --recurse-submodules https://github.com/Alpaq92/Atrium /srv/dredd/atrium
    cd /srv/dredd/atrium/deploy
    

    Sibling checkouts work too (MODULES_DIR=../.., or init.sh --modules-dir); see modules/README.md.

  2. ./init.sh --ip <the server's public IP> for a trial, or ./init.sh --single-host <one name> for HTTPS (Option A, "The settings"). It writes deploy/.env, db.env and the eight env files, mode 600, with every secret generated. For Option B, switch the database afterwards (Option B, "The settings"). Some things to know about the files it wrote:

    • DATABASE_URL, DB_APP_ROLE=<app>_app and the pool are in <app>.env, which both services load.
    • ROOT_PATH=/<app> is in <app>.env too, and it is half of one decision with the front door: it strips /<app>, uvicorn puts it back on every URL the app generates (Atrium's own is /atrium, a Mount inside the front door's process). Never set one without the other. Each app's published address (APP_BASE_URL, GALENA_PUBLIC_URL, Sygna's GALENA_BASE_URL / GALENA_CONSOLE_URL) carries the same path.
    • MIGRATION_DATABASE_URL for <app>_migrator and BOOTSTRAP_ADMIN_EMAIL / BOOTSTRAP_ADMIN_PASSWORD are in <app>.migrate.env, which only <app>-migrate loads. No long-running backend holds migrator credentials: compose.yaml also blanks MIGRATION_DATABASE_URL in every backend, and the push checks each backend's environment. So Galena's and Sygna's in-app restores refuse, and you restore with the one-shot (§10).
    • One account for the platform: IDENTITY_SCHEMA=dredd and SESSION_COOKIE_NAME=dredd_session in every <app>.env, the module roles Atrium grants the shared schema to in atrium.env, and PLATFORM_IDENTITY_SCHEMA=dredd in db.env (One account). --standalone writes the opt-out instead.
    • The rest of each app's settings: its secrets (Galena's ENCRYPTION_MASTER_KEY, Sygna's SECRET_KEY: keep both in the secret store), SMTP, and Sygna's GALENA_BASE_URL. Each template names them. Never POSTGRES_* or DB_*_PASSWORD there: the kit's postgres service is configured in deploy/.env.
    • For a plain-HTTP trial (http:// site addresses), Counsel Scorecard needs SESSION_COOKIE_SECURE=false in counsel.env (its template says why); --ip writes it. Never an empty value there: Counsel refuses to start.
    • Never paste docker compose config output anywhere: it prints the env files' values, passwords included.
  3. Build the images. The dredd-core token stays in the shell, never in a file:

    read -rs DREDD_CORE_TOKEN && export DREDD_CORE_TOKEN
    docker compose build
    unset DREDD_CORE_TOKEN
    

    Each image's build stage gets the token as a BuildKit secret for one pip install. No layer and no running container has it.

  4. The database. Option A: docker compose up -d postgres, then docker compose ps postgres until it reports healthy (the first start creates the cluster and runs local-db/). Option B: §1 to §5, the CA at DB_CA_FILE.

  5. Look at the plan: ./push.sh --dry-run (--managed-db for Option B). It connects nowhere and lists anything missing.

  6. Push, then start:

    ./push.sh                    # --managed-db for Option B
    docker compose up -d
    

    up runs each <app>-migrate again (a no-op at head; the seeds are idempotent), then starts each backend once its migrate succeeded. The front door doesn't wait for the modules: it resolves each backend per request, so if one module fails to migrate the others are still served and only its own path answers 502 (as /insider does while Insider's profile is off). Atrium itself is the front door, so an Atrium migration that fails takes every path down until it is fixed. A failed migrate is not retried (§4, IP bans).

  7. Verify. The backends' healthchecks and /api/v1/health only say the process is up; they don't touch the database. So check the one-shots' exit codes and each backend's database connection too:

    docker compose ps -a --format '{{.Service}}  {{.State}}  exit={{.ExitCode}}  {{.Health}}'
    #   *-migrate: exited, exit=0;  *-backend: running, healthy;  no caddy
    #   (Option A: postgres: running, healthy)
    for app in atrium galena sygna counsel; do                     # one database login per backend
      docker compose exec -T "$app-backend" python -c 'from app.db import engine; engine.connect().close(); print("database: ok")'
    done
    SITE=https://dredd.example.com                                 # http:// for a --ip trial
    for m in atrium galena sygna counsel; do                        # through the front door, on the real paths
      curl -fsS "$SITE/$m/healthz"; echo                           # each module's own, answered by itself
    done
    curl -fsS "$SITE/sygna/healthz?deep=1"; echo                   # Sygna's readiness runs SELECT 1
    

    Then test the two things that fail silently, because nothing above catches either:

    curl -sS -o /dev/null -w '%{http_code} %{redirect_url}\n' "$SITE/galena"   # 308 .../galena/
    curl -sS -o /dev/null -w '%{http_code} %{redirect_url}\n' "$SITE/"         # 302 .../atrium/
    curl -fsS -D- -o /dev/null "$SITE/galena/static/readerjs/reader.html" | grep -i x-frame-options
    #   X-Frame-Options: SAMEORIGIN  — anything else and Galena's viewer, its Changes compare and its
    #   read-only editor view all render blank, with no error anywhere but the browser console.
    

    A bare /galena that does not redirect is the worst failure here: the console loads with the document base /, so it fetches Atrium's app.js and calls Atrium's API, and what you see is a half-working page rather than an error.

    A backend whose exec fails is running with a wrong or missing DATABASE_URL: stop it (docker compose stop <app>-backend) before it makes more failed logins (§4). Then sign in to each app (§8), and open a document in Galena (§13).

Networks. Each module's backend is on its own network together with the front door only, and trusts X-Forwarded-For only from that subnet (FORWARDED_ALLOW_IPS, set in compose.yaml). The front door trusts no forwarded header at all (--no-proxy-headers): nothing is in front of it, so the peer address is the client. If 172.30.10.0/24 to 172.30.14.0/24 collide with an existing network, change the subnet and that module's FORWARDED_ALLOW_IPS together. The front door passes the Host header through unchanged, which matters because each backend's cross-site write guard compares Origin with Host. In Option B the one-shots sit on the project's default network (they listen on nothing and exit); no backend is ever on it.

One origin changes what that guard means. A page at /sygna is now same-origin with /galena, so both of the guard's signals (Sec-Fetch-Site, and Origin against Host) pass between modules. It still refuses genuinely foreign sites; it no longer separates the modules from each other, and nothing Host-based can — per-module isolation is each module's own permission grants. Two consequences worth writing down: never add an address to any app's CORS_ALLOW_ORIGINS (a listed origin is trusted outright and skips both signals; the templates ship it empty), and an XSS in any one console can drive all four APIs with the signed-in user's cookie, which is why Galena's rule that untrusted bytes never execute in-origin — /raw forces a non-allowlisted media type to octet-stream under a sandbox CSP — is now a platform-wide guarantee rather than a Galena one.

Each module sends its own headers. Every module serves its console from its own image and stamps its security headers on every response, errors included; each module's tests/test_edge.py pins the values it sends. The kit's part is the one switch, FRAME_ANCESTORS='self' in compose.yaml, and preflight.sh step 4 checks that each pinned module still has it. Galena's ReaderJS viewer (/static/readerjs/) keeps its own SAMEORIGIN policy whatever the switch says. Galena renders its own link-preview tags from GALENA_PUBLIC_URL (env/galena.env, carrying /galena). Counsel's Strict-Transport-Security is now sent only over HTTPS. Embedding Galena in Sygna (GALENA_EMBED) is still not offered by the kit: 'self' makes it possible at one origin, but turning it on is a separate, tested change. (GALENA_FRAME_ANCESTORS is retired; Galena refuses to start with it set.)

8. Atrium: set the module addresses

Atrium's seed puts Galena, Sygna, Counsel Scorecard and the later modules in the module catalog without addresses.

  1. Sign in at <site>/atrium/ as the bootstrap administrator (admin@example.com, the BOOTSTRAP_ADMIN_PASSWORD in env/atrium.migrate.env), and change the password.

  2. In Modules → Manage, set each module's address and health address, then check it. <site> is the one address in deploy/.env (http:// on a --ip trial):

    Module Address Health address
    Galena <site>/galena <site>/galena/api/v1/health
    Sygna <site>/sygna <site>/sygna/api/v1/health
    Counsel Scorecard <site>/counsel <site>/counsel/api/v1/health

    These are ordinary absolute URLs that happen to share this origin, so nothing in Atrium's address validation changes: a module address is still http(s)://host/.... A path-only address (/galena) is a later change with its own review — don't relax the checks to get one.

    The health address stays public, not http://galena-backend:8000/...: compose.yaml gives each module one network, shared with the front door only. atrium-backend could reach the backends by name, but the public probe leaves through the server's own address and comes back in through the front door, which is what makes it test what a browser would get.

    Counsel Scorecard's catalog slug is counsel, the way the module spells itself everywhere else (the schema, both role names, the compose services and /srv/counsel). The seed shipped it once as counsel-scorecard, which silently broke the two things a slug now addresses across the platform boundary — a moderator grant, and POST /me/modules/<slug>/tokens — so the seed was corrected and revision 0005 renames the row on a box that already has the wrong one. Nothing to fix by hand. The addresses are still yours to set, and the catalog is database state, not files: set them here, or with an UPDATE, never by regenerating config — the seed writes the catalog once and never overwrites an address a human set.

  3. Choose each module's availability (everyone, selected, off).

  • The health probe is a server-side request from atrium-backend to the public address, so it goes out through the server's own public IP and back in through the front door. If it reports unreachable while the site works from outside, the host's firewall or network is blocking that loop.
  • Availability is an offer, not a lock. It decides whose launcher a module appears in. A path is guessable, so withholding an address withholds nothing: the real door is the module's own permission grants, and someone with no grants who types /galena/ reaches a console with nothing in it.
  • One account, from the first push. There is one first administrator for the whole platform — Atrium's, env/atrium.migrate.env — and a person signs in once at <site>/atrium/; every module resolves the same session (dredd_session). Accounts are created, corrected, reset and switched off in Atrium's Users pane and nowhere else, because no module's database role may write app_user at all; a module's own sign-in answers that the account lives in the hub. Who may use which module is module_permission, also granted here: no row is no access, and that is everybody's default except administrators, who reach every module without one. App tokens work the same way: a desktop or CLI client's credential is minted in Atrium under Connected apps (no module holds INSERT on session), and the <slug>_pat_ prefix says where a token was minted, not where it works — one token authenticates in every module, exactly as the shared cookie does. (A --standalone deployment has four sets of accounts instead — one administrator per app, and four sign-ins until you cut over, which RUNBOOK-one-account.md is the procedure for.)

The bootstrap passwords stay in the migrate env files. Every push and every up runs the seeds again. Atrium's seed creates the administrator when no user has BOOTSTRAP_ADMIN_EMAIL, with BOOTSTRAP_ADMIN_PASSWORD or, if that is empty, the app's built-in default (admin12345); the modules' seeds only look that address up (standalone, each creates its own the same way). So the push requires a strong value in every env/<app>.migrate.env on every run, the modules' inert ones included. No seed ever changes an existing user's password, so once the administrator has signed in and changed theirs, replace BOOTSTRAP_ADMIN_PASSWORD in env/atrium.migrate.env (and, standalone, in each app's) with a fresh random value that nobody records. Counsel's seed also updates its reference data, which is why the seeds can't simply stop running after the first push.

Galena's demo workspace comes back. Galena's seed creates the Acme / Legal / Contracts demo project whenever /acme doesn't exist, and Galena has no switch for it (Sygna's is SEED_DEMO=false, already in its template). Deleting or renaming the workspace brings a fresh one back at the next push or up. It has no access grants, so only administrators see it unless you grant access: leave it, or restrict it, until Galena's seed gets an opt-out.

9. Backups

  • The database. Option A: nothing backs it up until your own pg_dump cron does (Option A, "Backups — yours"). Option B: the provider backs up the one database, all four apps together — daily snapshots, often with point-in-time recovery as an add-on — and a restore or PITR rewinds all four apps; there is no per-schema restore. Some providers' restores do not keep custom-role passwords: reset them after a restore (§10).
  • Galena has its own backup (Administration → Backups, off by default): one .tar.gz of DATA_DIR (its git repositories) plus a database dump. That's Galena's per-app restore path. It is also the only backup of its repositories, which aren't in the database.
    • The local target writes to /data/backups in the galena-data volume, on the same server. Copy those archives off the host, for example nightly, readable by root only (they hold a full dump of Galena's tables): install -d -m 700 /srv/backup && docker run --rm -v dredd-family_galena-data:/data:ro -v /srv/backup:/out alpine sh -c 'umask 077 && cp -n /data/backups/* /out/', then ship /srv/backup elsewhere.
    • The S3 target (BACKUP_S3_* and AWS credentials in env/galena.env) needs boto3, which Galena's image doesn't install. Selecting it without boto3 fails with a clear error. Either build a derived image with boto3, which this kit doesn't do, or use the local target and copy off the host.
    • A restore needs the same schema version and the same ENCRYPTION_MASTER_KEY, which is never in a backup: keep it in the secret store.
  • Sygna has its own backup too (Administracja → Kopie zapasowe): archives in DATA_DIR/backups in the sygna-data volume. Copy them off the host the same way (dredd-family_sygna-data). Keep SECRET_KEY in the secret store: backups exclude it.
  • Atrium and Counsel Scorecard have no app-level backup. They come back only with the database.
  • Also keep db.env, env/*.env and .env in the secret store.

10. Restoring

The whole database

Option A: Option A, "Restoring the whole database". Option B, a provider restore (a snapshot or PITR):

  1. Stop the backends, so nothing writes and nothing retries passwords that are about to stop working:

    docker compose stop atrium-backend galena-backend sygna-backend counsel-backend
    
  2. Restore in the provider's dashboard, and wait for it to report done.

  3. Set the role passwords again, with the passwords already in the env files — needed where the provider's restore dropped them, harmless where it did not:

    ./push.sh --managed-db --reset-passwords
    

    It provisions again (idempotent, and it reports anything else that no longer holds), migrates (a no-op, or re-applies later migrations if the restore point predates an update), and runs every check. It refuses while any of the backends runs (step 1). If it stops part-way, run exactly the command it prints, which keeps --reset-passwords: a role still without its password fails its next login.

  4. Lift any IP ban from attempts in between (§4).

  5. Galena's repositories are not in the database. Restore the Galena backup closest to the restore point, so the rows and the repositories match again (below). Do the same for Sygna if its DATA_DIR content matters.

  6. Start: docker compose up -d, then verify as in §7 step 7.

  7. Check that the platform admin kept no standing membership in any migrator role. This must return no rows (postgres being the admin's name on most providers):

    SELECT r.rolname FROM pg_auth_members m
      JOIN pg_roles r ON r.oid = m.roleid JOIN pg_roles u ON u.oid = m.member
     WHERE u.rolname = 'postgres' AND r.rolname LIKE '%\_migrator'
       AND (m.set_option OR m.inherit_option);
    

    PostgreSQL 16+ keeps an automatic ADMIN TRUE, SET FALSE, INHERIT FALSE row for every role the admin created. That row alone gives no SET ROLE, but the admin could use it to grant itself membership again: the revoke removes the standing membership, it isn't a wall.

One app from its own backup (Galena or Sygna)

It restores that app alone, in the one-shot migrate container, which has the migrator's URL, the CA (Option B) and the data volume:

docker compose stop galena-backend
docker compose run --rm galena-migrate python -m app.restore                      # list the archives
docker compose run --rm galena-migrate python -m app.restore <archive-name> --yes
docker compose start galena-backend

The same works with sygna-backend and sygna-migrate.

The restore drill

Rehearse on a throwaway database before production (§13):

  1. Push, sign in to each app, and create a record in each.
  2. Take note of the time. Change a record, and restore to the note (PITR, or one of your dumps) or to the last snapshot.
  3. On a provider: note whether the backends' logins fail after the restore (the custom-role passwords gone) — that tells you whether step 3 above is a must for your provider.
  4. Run the steps above. Every check must pass, every app must sign in, and the records must match the restore point.
  5. Restore a Galena archive with the one-shot, and open its project.

11. Updates

An update never rewrites your env files: a template that changes (one account became the default on 2026-10-07) changes what a FRESH init.sh writes, not what a running box has. A box that is already one account stays one; a standalone box stays standalone, and its push now accepts the one-account provision.sql every app ships (§6) — moving it to one account is RUNBOOK-one-account.md, never an edit of the identity keys alone. Since the same date the push also refuses, by name, the half-done one-account shapes (One account, above); run ./push.sh --dry-run first to see whether yours is one.

  1. Read each app's release notes: new settings for its env files, new migrations, a dredd-core pin change.
  2. Fetch the code: git pull, then git submodule update --init --recursive (the modules move to the commits the new Atrium release pins). With sibling checkouts: git pull in each of the four.
  3. Run the preflight: bash preflight.sh. It fails if a pinned module lost the FRAME_ANCESTORS switch the kit sets, if the rendered compose model stops being the front-door shape (only atrium-backend publishing, each module trusting its own subnet), and if any checkout is missing where deploy/.env's MODULES_DIR points (only CI skips those).
  4. Build: read -rs DREDD_CORE_TOKEN && export DREDD_CORE_TOKEN; docker compose build; unset DREDD_CORE_TOKEN.
  5. Push: ./push.sh (--managed-db for Option B). It runs the new migrations and every check, and stops before anything restarts if an app's provision.sql no longer matches the dredd-core that provisions (re-render it in that app's repository, or align the apps' dredd-core pins).
  6. Restart: docker compose up -d. Changed services are recreated, and each backend waits for its migrate. The consoles are inside the images now, so a console change needs the build in step 4, not a restart. A postgres:17 image update (Option A) is a minor-version upgrade and safe to recreate; a major version would need a dump and restore.

The superuser's password, the role passwords and the CA outlive updates. To rotate a role password, put the new password in db.env and in that app's env files, then:

docker compose stop galena-backend              # it would keep logging in with the old password
./push.sh --reset-passwords galena              # refuses while galena-backend runs
docker compose up -d

Don't skip the stop: between the reset and the restart, every new connection the old backend opens is a failed login — harmless on the box, but on a provider that bans IPs after a few of them, enough to lock all four apps out (§4).

Turning TLS on, on a running deployment

RUNBOOK-tls.md: DNS first, then the switch in deploy/.env and the public addresses in env/, docker compose up -d (the certbot sidecar issues while :80 keeps serving the platform), verify, and HSTS last; plus the rollback. Back up the letsencrypt volume with the others: it holds the ACME account key and the certificate.

Moving a running deployment off Caddy

A box that runs the Caddy release moves to the front door in one sitting of about a minute's downtime: RUNBOOK-front-door.md — back up, pull and move the submodules, build, docker compose up -d --remove-orphans (which removes the caddy container and puts atrium-backend on :80), verify, and the rollback. It changes no password, no key and no database; the only settings it touches are a stale GALENA_FRAME_ANCESTORS (refused at start-up now) and GALENA_PUBLIC_URL, which moves from deploy/.env into env/galena.env.

A box still on the old four-hostname layout must first move to one address on the last Caddy release (that release's README §11, and RUNBOOK-one-host.md).

12. Costs

Prices as found when this was written (server prices since 2026-06-15; a managed provider's from its own price list, checked 2026-09-15):

Item Monthly
The server (a VM like the one in §7) about €8 to 16 before VAT
Option A: the VM alone (size it as that section does), plus object storage for the dumps about €8 to 16 before VAT, plus a few cents of storage
Option B: a managed provider's small instance, shared by the four apps typically $25 to 35 with daily backups; PITR is often a $100-a-month add-on
Option B, an IPv4 address for a direct connection, where the provider charges for one a few dollars

One shared database is the cheap way to run four apps on a provider, because they share one plan, one instance and one PITR. The price is the coupling: one restore rewinds all four (§9), and one wrong password can lock all four out (§4). Option A is cheaper still, and the price there is the work: the backups, the restore drill and the database's own upkeep are yours.

13. Rehearse on a throwaway database first

Run this whole runbook once on a throwaway database (a second instance on the provider, or a fresh pgdata volume), including the drill in §10, before production. These are not confirmed on a real managed provider yet:

  • As the platform admin: GRANT <migrator> TO <admin>, CREATE SCHEMA ... AUTHORIZATION <migrator> and GRANT USAGE ON SCHEMA extensions all work. Provisioning stops with a clear error if the last one doesn't take. Whether the admin owns the database.
  • CREATE EXTENSION IF NOT EXISTS pgcrypto is a no-op when the migrator runs it, and pg_trgm creates in extensions.
  • Python's host-name check accepts the certificates of the pooler host and the direct host.
  • Tables the migrators create get no API-role grants.
  • Custom roles' search_path and statement_timeout survive, and a provider's own statement cap doesn't override the migrator's 30 minutes.
  • <role>.<tenant> logins through a session-mode pooler, with four apps' pools at once. The pooler's default per-role pool size. Whether CHECK_REQUIRE_TLS=true passes through the pooler (§6).
  • Custom-role logins after a snapshot restore and after a PITR, and --reset-passwords restoring them.
  • What the API endpoint answers once it is off.
  • Whether IP bans are per database, and whether they cover the pooler and the direct connection alike.
  • The server's IPv6 egress, if you use the direct connection. Real request latency from the server to the region.
  • The kit's Docker path, from a FRESH install: docker compose build with the secret, push.sh inside the containers (including the backend preflights and provisioning from atrium-migrate) on an empty pgdata, up -d, atrium-backend taking :80, and the Atrium health probe's loop through the public IP. The production box runs this path (Option A, plain HTTP), but it was converted step by step — RUNBOOK-one-host.md, then RUNBOOK-one-account.md — not installed fresh from these templates, and a fresh one-account install has been verified without Docker only (below).
  • The path layout, on your box. Each app answering at <site>/<slug>/healthz; the bare <site>/<slug> 308 and / 302; each app's ROOT_PATH agreeing with the front door's strip (a mismatch 404s every route, or sends every redirect out of the module); the OpenAPI page at <site>/<slug>/api/v1/docs loading its own assets; and a sign-in at /atrium sticking after a reload and reaching every module, which is what a wrongly scoped or wrongly named session cookie breaks.
  • In a browser, each console through the front door, at its path, with the developer tools' console open (a CSP violation shows there):
    • Galena: open a PDF, an office document and an image (the ReaderJS viewer renders; nothing is blocked by frame-ancestors, X-Frame-Options or script-src), open Changes on a document with two versions (the compare renders), and run the OCR tool on an image (tesseract.js loads from jsDelivr and its WebAssembly compiles). The viewer is the thing the prefix breaks most quietly: it goes blank with no error outside the console.
    • Atrium: sign in, open a few screens, reload, sign out and in again. Sygna and Counsel Scorecard: open a few screens and reload — without signing in again.
    • From Atrium's Home, open each module tile: it must land inside the module, in the same tab, already signed in — one account, one sign-in. A module that asks for a password reads another cookie name or another schema (the push refuses both; check its env file and its log for Shared identity schema dredd). Signing out anywhere signs you out everywhere.

For Option A the same rehearsal applies to what is specific to it, and none of it has run under real Docker yet:

  • docker compose up -d postgres on a fresh volume: initdb runs local-db/01-extensions.sql, and the service reaches healthy.
  • Each app's two services resolve and reach the host postgres over their own <app>-db network, and cannot reach another app's backend or the database of anything else. Only atrium-backend reaches every module's backend, and it reaches postgres only on atrium-db.
  • The four <app>-migrate one-shots exit 0 under up -d, after the push already ran them.
  • The dump cron, and a pg_restore of one of its dumps into a scratch database, before you need it.

How this kit was tested

  • A fresh ONE-ACCOUNT install, end to end, against a real PostgreSQL (16.15 on 127.0.0.1, an empty database with only local-db/01-extensions.sql applied, no Docker; 2026-10-07). init.sh --ip with the test-only overrides wrote the default — one account — with no edit afterwards; push.sh --local with each app's own interpreter and the pinned checkouts passed step 1 for all four apps (every committed provision.sql current against the one-account rendering, which is where a fresh install used to stop), provisioned them with the identity flags (Atrium's run creating dredd), migrated Atrium (0004: moved 0 account(s)) and then each module (each cutover revision: nothing to merge), seeded, and ended with eight passing managed checks at the owner tier for Atrium and the reader tier for the modules. The database then held ONE admin@example.com, in dredd.app_user, no identity table in any app's schema, and Galena's, Sygna's and Counsel's seed data owned by that one account. A second run created no role and ran no migration. Each backend then booted in-process against that database (each logged Shared identity schema dredd: every identity table resolves there): one sign-in at Atrium's /auth/login set dredd_session, and that cookie alone answered 200 from Galena's, Sygna's and Counsel's /auth/me (401 without it), while each module's own sign-in refused (404 / 409). The same with Insider switched on from the start (its roles in the hub's lists, COMPOSE_PROFILES): ten passing checks, and its seed placing the demo set under the hub's administrator.
  • Option A, the whole flow, against a real PostgreSQL (16.15 on 127.0.0.1, one database, the steps run from the real checkouts with each app's own interpreter): init.sh --ip 203.0.113.10 with the test-only overrides (--db-host 127.0.0.1 --db-port 54329 --db-name ... --role-prefix ...) wrote the ten files with no placeholder left and every secret generated, in one command; push.sh --local on those files provisioned all four apps — schemas atrium, galena, sygna, counsel, roles under the prefix so the test cluster kept its own — migrated and seeded each (Galena's seed with LOCAL_DATA_ROOT), and ended with eight passing managed checks, each app's isolation proven against the other three schemas, in 70 seconds. A second identical run changed nothing (no role created, no migration run) and passed all eight again. No log contained a generated password in any encoding, and push.sh --dry-run on the same files found them complete.
  • Statically: compose.yaml passes the compose-spec JSON schema, interpolated, and so does its merge with compose.managed-db.yaml, rendered per Docker's documented merge rules (mappings merge, sequences append, volumes merge by target, !reset removes the declaration it marks). On the rendered models, lib/compose_checks.py holds for both modes (Option A also without Docker: backend/tests/test_deploy_front_door_kit.py renders compose.yaml itself and breaks it one property at a time — a reverse proxy back, a module publishing a port, the front door publishing nothing, trusting forwarded headers, losing a module or a module's network, a module trusting another subnet or *, refusing framing, losing its frontend build context, two modules sharing a network). The header values moved into each module's own tests/test_edge.py; the kit checks each pinned module still has the FRAME_ANCESTORS switch it sets. shellcheck -S style passes (0.11.0). preflight.sh steps 1, 4, 5, 5b and 6 pass here; 2, 2b and 2c report only that Docker is absent.
  • The one-address layout and one account run in production, on a box that was moved there by hand: one site behind Caddy (RUNBOOK-one-host.md), then one account, cut over on 2026-10-01 (RUNBOOK-one-account.md). That is a conversion, not this kit's fresh install, which is what the first bullet verified (without Docker).
  • Not run here: real Docker and Compose (so neither docker compose config of either mode, nor the front door in a container, nor anything in Option A that needs containers — the postgres service itself, its initdb hook, the four <app>-db networks; CI's deploy-kit job runs what it can), a browser against the consoles, PostgreSQL 17, a real managed provider, file modes (Windows has none; init.sh uses umask 077 and chmod 600), and bash 3.2 (macOS).