M6-M7: Parafa and Scribe join the platform (eleventh and twelfth modules)
- compose: parafa-/scribe-migrate and -backend under profiles parafa/scribe,
networks 172.30.30-31.0/24 + db 172.30.40-41.0/24, FRAME_ANCESTORS 'self',
<slug>-data volumes, /healthz; Parafa mounts PARAFA_SIGNER_DIR read-only at
/run/parafa-signer (empty = 409 signing_unconfigured); managed-db overlay
follows; front door routes /parafa and /scribe.
- parafa_app joins MODULE_EVENT_EMITTER_ROLES (document.signed); Scribe is in
no opt-in tier. push.sh checks parafa with --events and its evidence lists
(signing_request never deleted), scribe with draft_export never deleted.
- init.sh writes both env files (GALENA_BASE_URL; LEXICON_URL/GALENA_URL) and
Panorama's PARAFA_/SCRIBE_BASE_URL; max_connections 200 for twelve apps.
- Catalogue tiles (live, Dokumenty): Parafa yellow key, Scribe lime file;
yellow joins the tile hues. RUNBOOK-m6-m7.md; tests.
- Submodules deploy/modules/{parafa,scribe} still to be added once the
repositories exist.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+2
-2
@@ -19,7 +19,7 @@ ROOT_PATH=
|
||||
# streams every other module to its backend. This is that FIXED map, slug=http://service:port,
|
||||
# comma-separated; the upstream never comes from a request. A slug left out answers 404. Empty for
|
||||
# the standalone stack in docker-compose.yml (Atrium alone, at /atrium).
|
||||
# FRONTDOOR_UPSTREAMS=galena=http://galena-backend:8000,sygna=http://sygna-backend:8000,counsel=http://counsel-backend:8000,compass=http://compass-backend:8000,insider=http://insider-backend:8000,arbiter=http://arbiter-backend:8000,lexicon=http://lexicon-backend:8000,agora=http://agora-backend:8000,panorama=http://panorama-backend:8000
|
||||
# FRONTDOOR_UPSTREAMS=galena=http://galena-backend:8000,sygna=http://sygna-backend:8000,counsel=http://counsel-backend:8000,compass=http://compass-backend:8000,insider=http://insider-backend:8000,arbiter=http://arbiter-backend:8000,lexicon=http://lexicon-backend:8000,agora=http://agora-backend:8000,panorama=http://panorama-backend:8000,parafa=http://parafa-backend:8000,scribe=http://scribe-backend:8000
|
||||
FRONTDOOR_UPSTREAMS=
|
||||
|
||||
# ── Database ─────────────────────────────────────────────────────────────────
|
||||
@@ -140,7 +140,7 @@ CORS_ALLOW_ORIGINS=
|
||||
# ── Bootstrap admin (seed) ───────────────────────────────────────────────────
|
||||
BOOTSTRAP_ADMIN_EMAIL=admin@example.com
|
||||
BOOTSTRAP_ADMIN_PASSWORD=admin12345
|
||||
# The seed also puts the Dredd family (Galena, Sygna, Counsel Scorecard, Compass, Insider, Arbiter, Lexicon, Agora, Panorama) into the module
|
||||
# The seed also puts the Dredd family (Galena, Sygna, Counsel Scorecard, Compass, Insider, Arbiter, Lexicon, Agora, Panorama, Parafa, Scribe) into the module
|
||||
# catalog — once per instance, without addresses; add those under Administration → Modules.
|
||||
|
||||
# ── App tokens ───────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -16,3 +16,5 @@ certs/
|
||||
# The family deploy kit: real inputs and env files hold secrets (their *.example templates are tracked).
|
||||
deploy/db.env
|
||||
deploy/env/*.env
|
||||
# Parafa's signer (PKCS#12 + passphrase), mounted read-only into parafa-backend: never committed.
|
||||
deploy/parafa-signer/
|
||||
|
||||
@@ -53,7 +53,8 @@ Send = Callable[[dict], Awaitable[None]]
|
||||
#: Atrium is served in-process; these are the modules it may proxy to. A slug outside this set can
|
||||
#: never be configured, so a typo in FRONTDOOR_UPSTREAMS refuses start-up.
|
||||
ATRIUM = "atrium"
|
||||
MODULES = ("galena", "sygna", "counsel", "compass", "insider", "arbiter", "lexicon", "agora", "panorama")
|
||||
MODULES = ("galena", "sygna", "counsel", "compass", "insider", "arbiter", "lexicon", "agora", "panorama",
|
||||
"parafa", "scribe")
|
||||
SLUGS = (ATRIUM, *MODULES)
|
||||
|
||||
#: Uploads above this are refused: 413 up front on a declared Content-Length, or as soon as a chunked
|
||||
@@ -64,7 +65,7 @@ MAX_BODY = 100 * 1024 * 1024
|
||||
TIMEOUT = httpx.Timeout(connect=5.0, read=300.0, write=300.0, pool=10.0)
|
||||
|
||||
NOT_FOUND = (b"Not found. This server serves /atrium, /galena, /sygna, /counsel, /compass, /insider, "
|
||||
b"/arbiter, /lexicon, /agora and /panorama.")
|
||||
b"/arbiter, /lexicon, /agora, /panorama, /parafa and /scribe.")
|
||||
|
||||
# RFC 9110 7.6.1, plus the two non-standard ones still seen in the wild. Never forwarded either way,
|
||||
# together with every header a `Connection` header names.
|
||||
|
||||
+28
-1
@@ -36,7 +36,8 @@ CATALOG_SEEDED = "_seed.catalog"
|
||||
# the marker exists the entry is never offered again, so deleting it afterwards sticks. A fresh
|
||||
# install gets these with the rest of FAMILY and sets their markers then. The next module that
|
||||
# joins appends its slug here; nothing ever leaves this tuple.
|
||||
ADDED_AFTER_FIRST_SEED: tuple[str, ...] = ("insider", "arbiter", "lexicon", "agora", "panorama")
|
||||
ADDED_AFTER_FIRST_SEED: tuple[str, ...] = ("insider", "arbiter", "lexicon", "agora", "panorama",
|
||||
"parafa", "scribe")
|
||||
|
||||
|
||||
def _marker(slug: str) -> str:
|
||||
@@ -171,6 +172,32 @@ FAMILY: list[dict] = [
|
||||
"osoby, i pokazuje trendy z dziennika zdarzeń."
|
||||
),
|
||||
},
|
||||
{
|
||||
# Electronic signing of PDFs (the split plan's M6): PAdES signatures through pyHanko, on an
|
||||
# uploaded file or a Galena document. Yellow is Parafa's own brand colour (Open Color yellow,
|
||||
# its CLAUDE.md). In English the tagline reads "Electronic signing of PDF documents". The slug
|
||||
# is its path (/parafa), schema, roles and MODULE_SLUG.
|
||||
"slug": "parafa", "name": "Parafa", "hue": "yellow", "glyph": "key", "sort_order": 100,
|
||||
"category": "Dokumenty", "status": ModuleStatus.live.value,
|
||||
"tagline": "Podpisywanie dokumentów PDF podpisem elektronicznym.",
|
||||
"description": (
|
||||
"Parafa przyjmuje prośby o podpis dokumentu PDF — pliku przesłanego do modułu albo "
|
||||
"dokumentu z Galeny — podpisuje go podpisem PAdES, zapisuje podpisaną wersję z powrotem "
|
||||
"i sprawdza podpisy w dokumentach, które przychodzą z zewnątrz."
|
||||
),
|
||||
},
|
||||
{
|
||||
# Drafting from templates and clauses (the split plan's M7). Lime is Scribe's own brand colour
|
||||
# (Open Color lime, its CLAUDE.md). In English the tagline reads "Drafting documents from
|
||||
# templates and clauses". The slug is its path (/scribe), schema, roles and MODULE_SLUG.
|
||||
"slug": "scribe", "name": "Scribe", "hue": "lime", "glyph": "file", "sort_order": 110,
|
||||
"category": "Dokumenty", "status": ModuleStatus.live.value,
|
||||
"tagline": "Tworzenie dokumentów z szablonów i klauzul.",
|
||||
"description": (
|
||||
"Scribe składa dokument z szablonu i klauzul z biblioteki Lexicon, sprawdza go regułami "
|
||||
"zapisanymi w kodzie i eksportuje gotowy projekt do Galeny jako nowy dokument."
|
||||
),
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ _log = logging.getLogger("atrium.marketplace")
|
||||
|
||||
# The console draws these; keep them in step with the `.mi.h-<hue>` classes in frontend/app.css
|
||||
# and `HUES`/`GLYPH` in frontend/app.js (tests/test_marketplace_unit.py fails when they drift).
|
||||
HUES = ("grape", "violet", "indigo", "blue", "cyan", "teal", "green", "lime",
|
||||
HUES = ("grape", "violet", "indigo", "blue", "cyan", "teal", "green", "lime", "yellow",
|
||||
"orange", "red", "pink", "gray")
|
||||
GLYPHS = ("galena", "sygna", "percent", "compass", "scale", "folder", "file", "users", "shield",
|
||||
"chart", "clock", "lock", "star", "bell", "plug", "grid", "key")
|
||||
|
||||
@@ -55,7 +55,7 @@ def test_push_checks_galena_and_compass_as_taking_part_in_events():
|
||||
check carries `--events` (Compass's own `EVENTS_CHECK_ARGS`) and the preflight requires the hub
|
||||
to grant them through MODULE_EVENT_EMITTER_ROLES; every other module is checked without it."""
|
||||
push = PUSH.read_text(encoding="utf-8")
|
||||
assert "case $slug in galena|compass|agora)" in push # Agora (M3) emits too
|
||||
assert "case $slug in galena|compass|agora|parafa)" in push # Agora (M3) emits too
|
||||
# Gated on the module's own pin: an older core's `managed check` has no --events flag.
|
||||
assert 'case $pin in 0.[0-9].*|0.1[0-9].*) ;; *) IDENTITY_CHECK_ARGS="$IDENTITY_CHECK_ARGS --events" ;; esac' in push
|
||||
assert "MODULE_EVENT_EMITTER_ROLES" in push
|
||||
|
||||
@@ -57,7 +57,7 @@ def test_push_checks_each_module_with_its_own_lists(slug):
|
||||
def test_each_module_is_checked_in_its_own_tier():
|
||||
push = PUSH.read_text(encoding="utf-8")
|
||||
assert 'case $slug in lexicon) IDENTITY_CHECK_ARGS="$IDENTITY_CHECK_ARGS --model-provider-keys" ;; esac' in push
|
||||
assert "case $slug in galena|compass|agora)" in push
|
||||
assert "case $slug in galena|compass|agora|parafa)" in push
|
||||
assert 'case $slug in panorama) IDENTITY_CHECK_ARGS="$IDENTITY_CHECK_ARGS --events-reader" ;; esac' in push
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ def test_the_hub_template_lists_each_in_exactly_its_tier():
|
||||
|
||||
def test_init_add_puts_each_module_in_its_tier():
|
||||
init = INIT.read_text(encoding="utf-8")
|
||||
assert "case $ADD in galena|compass|agora)" in init
|
||||
assert "case $ADD in galena|compass|agora|parafa)" in init
|
||||
assert 'add_to_list "$OUT/env/atrium.env" MODULE_EVENT_READER_ROLES "$ROLE_PREFIX${ADD}_app"' in init
|
||||
assert '"env/atrium.env:MODULE_EVENT_READER_ROLES"' in init
|
||||
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
"""deploy/push.sh checks Parafa and Scribe (the split plan's M6, M7) with exactly the lists each declares,
|
||||
and with the platform tier each is granted.
|
||||
|
||||
Each module's evidence lists are `app.models.APPEND_ONLY_TABLES` / `NO_DELETE_TABLES`, which its 0002
|
||||
grants from and its CI's managed check passes, so push.sh's CHECK_EXTRA is compared with them wherever
|
||||
the submodule is checked out (skipped where it is not).
|
||||
|
||||
The tiers: Parafa writes the event log (`document.signed`, an EMITTER, like Agora); Scribe takes no
|
||||
part in it and calls no model, so it is in no opt-in list at all.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import pathlib
|
||||
import re
|
||||
|
||||
import pytest
|
||||
|
||||
ROOT = pathlib.Path(__file__).resolve().parents[2]
|
||||
PUSH = ROOT / "deploy" / "push.sh"
|
||||
INIT = ROOT / "deploy" / "init.sh"
|
||||
COMPOSE = ROOT / "deploy" / "compose.yaml"
|
||||
ATRIUM_ENV = ROOT / "deploy" / "env" / "atrium.env.example"
|
||||
MODULES = ("parafa", "scribe")
|
||||
OPT_INS = ("MODEL_PROVIDER_KEY_READER_ROLES", "MODEL_PROVIDER_MIGRATOR_ROLES", "MODULE_EVENT_EMITTER_ROLES",
|
||||
"MODULE_EVENT_READER_ROLES", "COUNTERPARTY_WRITER_ROLES", "COUNTERPARTY_READER_ROLES",
|
||||
"COUNTERPARTY_MIGRATOR_ROLES")
|
||||
|
||||
|
||||
def _tuple(src: str, name: str) -> list[str]:
|
||||
body = re.search(rf"^{name}(?:: [^=]+)? = \(([^)]*)\)", src, re.M)
|
||||
assert body, name
|
||||
return re.findall(r'"([a-z_]+)"', body.group(1))
|
||||
|
||||
|
||||
def _check_extra(slug: str) -> str:
|
||||
actual = re.search(rf'^ {slug}\)\s+UP={slug.upper()};.*?CHECK_EXTRA="([^"]*)"',
|
||||
PUSH.read_text(encoding="utf-8"), re.S | re.M)
|
||||
assert actual, f"push.sh has no {slug} branch in app_setup"
|
||||
return actual.group(1)
|
||||
|
||||
|
||||
def _list(key: str) -> list[str]:
|
||||
found = re.search(rf"^{key}=(.*)$", ATRIUM_ENV.read_text(encoding="utf-8"), re.M)
|
||||
assert found, key
|
||||
return [r.strip() for r in found.group(1).split(",") if r.strip()]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("slug", MODULES)
|
||||
def test_push_checks_each_module_with_its_own_lists(slug):
|
||||
models = ROOT / "deploy" / "modules" / slug / "backend" / "app" / "models" / "__init__.py"
|
||||
if not models.exists():
|
||||
pytest.skip(f"deploy/modules/{slug} is not checked out")
|
||||
src = models.read_text(encoding="utf-8")
|
||||
append_only, no_delete = _tuple(src, "APPEND_ONLY_TABLES"), _tuple(src, "NO_DELETE_TABLES")
|
||||
expected = " ".join([f"--append-only {' '.join(append_only)}",
|
||||
*([f"--no-delete {' '.join(no_delete)}"] if no_delete else [])])
|
||||
assert _check_extra(slug) == expected
|
||||
|
||||
|
||||
def test_the_evidence_lists_as_shipped():
|
||||
"""Without the submodules (CI), at least the lists the modules shipped with at their first pin."""
|
||||
assert _check_extra("parafa") == ("--append-only audit_log module_event module_event_receipt "
|
||||
"--no-delete signing_request")
|
||||
assert _check_extra("scribe") == "--append-only audit_log --no-delete draft_export"
|
||||
|
||||
|
||||
def test_parafa_is_an_emitter_and_scribe_is_in_no_tier():
|
||||
push, init = PUSH.read_text(encoding="utf-8"), INIT.read_text(encoding="utf-8")
|
||||
assert "case $slug in galena|compass|agora|parafa)" in push
|
||||
assert "case $ADD in galena|compass|agora|parafa)" in init
|
||||
assert "parafa_app" in _list("MODULE_EVENT_EMITTER_ROLES")
|
||||
assert "parafa_app" not in _list("MODULE_EVENT_READER_ROLES")
|
||||
for key in OPT_INS:
|
||||
assert not any(r.startswith("scribe_") for r in _list(key)), key
|
||||
|
||||
|
||||
def test_parafa_mounts_its_signer_read_only():
|
||||
compose = COMPOSE.read_text(encoding="utf-8")
|
||||
assert "- ${PARAFA_SIGNER_DIR:-./parafa-signer}:/run/parafa-signer:ro" in compose
|
||||
assert "PARAFA_SIGNER_DIR" in (ROOT / "deploy" / "lib" / "envfile.sh").read_text(encoding="utf-8")
|
||||
@@ -41,7 +41,7 @@ PUSH = DEPLOY / "push.sh"
|
||||
PREFLIGHT = DEPLOY / "preflight.sh"
|
||||
ENVFILE_LIB = DEPLOY / "lib" / "envfile.sh"
|
||||
FAMILY = ("atrium", "galena", "sygna", "counsel", "compass", "insider", "arbiter", "lexicon", "agora",
|
||||
"panorama")
|
||||
"panorama", "parafa", "scribe")
|
||||
#: Where an app's tree sits inside its checkout — push.sh's SUBDIR and preflight.sh's. Compass's
|
||||
#: repository is the analysis engine's and carries the application in a subdirectory; every other
|
||||
#: app's repository is the application. The fixture has to lay the scratch tree out the same way, or
|
||||
@@ -144,7 +144,7 @@ def rig(tmp_path_factory):
|
||||
base_env = f"MODULES_DIR={root / 'modules'}\nDEPLOY_ENV_DIR={root / 'env'}\n"
|
||||
# The rig is a box with every module deployed, Compass and Insider included, so the tests above mean
|
||||
# "all of them" without each having to say so. .env.off is the same box before either was switched on.
|
||||
_write(root / ".env", base_env + "COMPOSE_PROFILES=compass,insider,arbiter,lexicon,agora,panorama\n")
|
||||
_write(root / ".env", base_env + "COMPOSE_PROFILES=compass,insider,arbiter,lexicon,agora,panorama,parafa,scribe\n")
|
||||
_write(root / ".env.off", base_env)
|
||||
# Records the command line and succeeds, so the push walks all five steps without a database.
|
||||
_write(root / "recorder.sh", '#!/usr/bin/env bash\nprintf \'%s\\n\' "$*" >> "$PUSH_TRACE"\nexit 0\n')
|
||||
@@ -160,7 +160,7 @@ HUB_ON_THE_PLATFORM = {
|
||||
"IDENTITY_READER_ROLES": ",".join(f"{app}_app" for app in FAMILY[1:]),
|
||||
"IDENTITY_MIGRATOR_ROLES": ",".join(f"{app}_migrator" for app in FAMILY[1:]),
|
||||
# The modules taking part in the shared event log (dredd-core 0.20.0), init.sh's default.
|
||||
"MODULE_EVENT_EMITTER_ROLES": "galena_app,compass_app,agora_app",
|
||||
"MODULE_EVENT_EMITTER_ROLES": "galena_app,compass_app,agora_app,parafa_app",
|
||||
# The event log's reader tier (dredd-core 0.23.0) and the model-provider key readers.
|
||||
"MODULE_EVENT_READER_ROLES": "panorama_app",
|
||||
"MODEL_PROVIDER_KEY_READER_ROLES": "compass_app,arbiter_app,lexicon_app",
|
||||
@@ -373,7 +373,7 @@ class TestTheHalfDoneShapesOfOneAccountAreRefused:
|
||||
and must not be a refusal here."""
|
||||
done, _ = _push(rig, platform=True, trace="spaces", settings={"atrium": {
|
||||
"IDENTITY_READER_ROLES": "galena_app, sygna_app, counsel_app, compass_app, insider_app, arbiter_app, "
|
||||
"lexicon_app, agora_app, panorama_app"}})
|
||||
"lexicon_app, agora_app, panorama_app, parafa_app, scribe_app"}})
|
||||
assert done.returncode == 0, done.stdout + done.stderr
|
||||
|
||||
@pytest.mark.parametrize("cookie, shown", [("galena_session", "galena_session"),
|
||||
@@ -664,7 +664,7 @@ class TestEveryAppIsProvisionedBeforeAnyMigrates:
|
||||
def test_the_budget_counts_compass_only_when_it_runs(self, rig):
|
||||
on, _ = _push(rig, "--dry-run", platform=False, trace="budget-on")
|
||||
off, _ = _push(rig, "--dry-run", platform=False, trace="budget-off", compose_env=".env.off")
|
||||
assert re.search(r"budget\s+10 apps x", on.stdout), on.stdout
|
||||
assert re.search(r"budget\s+12 apps x", on.stdout), on.stdout
|
||||
assert re.search(r"budget\s+4 apps x", off.stdout), off.stdout
|
||||
|
||||
|
||||
|
||||
+6
-2
@@ -40,8 +40,12 @@ MODULES_DIR=./modules
|
||||
# Arbiter (contract analysis, built from the compass submodule's apps/arbiter) ships switched off too,
|
||||
# under the `arbiter` profile (deploy/RUNBOOK-arbiter.md).
|
||||
# Lexicon, Agora and Panorama (the split plan's M2-M4) the same, each under a profile of its own name
|
||||
# (deploy/RUNBOOK-m2-m4.md).
|
||||
# COMPOSE_PROFILES=compass,insider,arbiter,lexicon,agora,panorama
|
||||
# (deploy/RUNBOOK-m2-m4.md); Parafa and Scribe (M6, M7) likewise (deploy/RUNBOOK-m6-m7.md).
|
||||
# COMPOSE_PROFILES=compass,insider,arbiter,lexicon,agora,panorama,parafa,scribe
|
||||
# Parafa's signer: a directory holding the operator's PKCS#12 signing file and its passphrase file,
|
||||
# mounted READ-ONLY into parafa-backend at /run/parafa-signer (env/parafa.env names the files).
|
||||
# Relative to this directory; empty or missing = signing unconfigured (409 signing_unconfigured).
|
||||
# PARAFA_SIGNER_DIR=./parafa-signer
|
||||
|
||||
# ── Option A (the default): this box's own PostgreSQL, the `postgres` service ─────────────────────
|
||||
# The superuser's password. init.sh generates it; by hand:
|
||||
|
||||
+6
-2
@@ -62,6 +62,8 @@ deployment, and the kit in this directory does the per-app work for all four app
|
||||
| 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 |
|
||||
| Panorama (off by default) | `panorama` | `panorama_migrator`, `panorama_app` | none | `audit_log` append-only |
|
||||
| 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 |
|
||||
|
||||
**Compass, the fifth module, ships switched off** (Compose profile `compass`); bringing it in is
|
||||
[`ONBOARDING-compass.md`](ONBOARDING-compass.md). **Insider, the sixth** (legal acts and case law, REST + MCP at
|
||||
@@ -70,7 +72,9 @@ second profile, `ocr`); bringing it in is [`RUNBOOK-insider.md`](RUNBOOK-insider
|
||||
Compass; built from the compass submodule's `apps/arbiter`), ships switched off under the profile `arbiter`;
|
||||
bringing it in is [`RUNBOOK-arbiter.md`](RUNBOOK-arbiter.md). **Lexicon, Agora and Panorama, the eighth to tenth**
|
||||
(the clause library, negotiation rooms and the dashboard, the split plan's M2-M4) ship switched off the same way,
|
||||
each under a profile of its own name; bringing them in is [`RUNBOOK-m2-m4.md`](RUNBOOK-m2-m4.md). **Licences:** Atrium, Galena, Sygna and Counsel
|
||||
each under a profile of its own name; bringing them in is [`RUNBOOK-m2-m4.md`](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`](RUNBOOK-m6-m7.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: Workflow (codename `compass`) dropped its AGPL analysis engine in its revision 0030,
|
||||
and Arbiter's image carries none either. See [`../CREDITS.md`](../CREDITS.md#the-platform-kit-deploy).
|
||||
@@ -141,7 +145,7 @@ 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>/compass`, `<site>/insider`, `<site>/arbiter`, `<site>/lexicon`, `<site>/agora`, `<site>/panorama`; `/` redirects to `/atrium/` and a
|
||||
`<site>/galena`, `<site>/sygna`, `<site>/counsel`, `<site>/compass`, `<site>/insider`, `<site>/arbiter`, `<site>/lexicon`, `<site>/agora`, `<site>/panorama`, `<site>/parafa`, `<site>/scribe`; `/` 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
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
# Runbook: Parafa and Scribe onto a running platform
|
||||
|
||||
The eleventh and twelfth modules, split out of Compass (the split plan's M6 and M7). Each is a
|
||||
dredd-core app in simple tenancy with its own repository, its own submodule under
|
||||
`deploy/modules/<slug>`, its own schema and roles, `MODULE_SLUG=<slug>`, one account through Atrium,
|
||||
and each ships **switched off** under a Compose profile of its own name — exactly like Lexicon, Agora
|
||||
and Panorama ([`RUNBOOK-m2-m4.md`](RUNBOOK-m2-m4.md), whose rules for the sitting apply unchanged).
|
||||
|
||||
| Module | Path / profile | Repository | Network / db network | Opt-ins in `env/atrium.env` | Evidence (push.sh check) |
|
||||
|---|---|---|---|---|---|
|
||||
| Parafa (PAdES signing of PDFs) | `/parafa` | `Alpaq92/Parafa` | 172.30.30.0/24 / 172.30.40.0/24 | `MODULE_EVENT_EMITTER_ROLES` += `parafa_app` | `--append-only audit_log module_event module_event_receipt --no-delete signing_request --events` |
|
||||
| Scribe (drafting from templates and clauses) | `/scribe` | `Alpaq92/Scribe` | 172.30.31.0/24 / 172.30.41.0/24 | none | `--append-only audit_log --no-delete draft_export` |
|
||||
|
||||
Both pin dredd-core v0.23.0, and both commit the **platform** rendering of `db/managed/provision.sql`
|
||||
(`--identity-schema dredd --identity-owner atrium_migrator`), which is what push.sh compares.
|
||||
The catalogue tiles (Parafa yellow `key`, Scribe lime `file`, both `live`, category "Dokumenty") are
|
||||
offered once to an already-seeded Atrium by its seed (`ADDED_AFTER_FIRST_SEED`); `yellow` is a new
|
||||
tile hue in this release.
|
||||
|
||||
**What each needs from the others.**
|
||||
|
||||
- **Parafa** writes `document.signed` to the hub's event log when a PDF is signed: `parafa_app` must be
|
||||
an event EMITTER before Parafa goes live (`--add parafa` lists it). `GALENA_BASE_URL` (hairpin) lets
|
||||
a request sign a Galena document and save the signed PDF back as a new version of it. **The signer**
|
||||
is the operator's, never in the repository or the image: `compose.yaml` mounts `PARAFA_SIGNER_DIR`
|
||||
(deploy/.env, default `./parafa-signer`, i.e. `/srv/atrium/deploy/parafa-signer`) READ-ONLY at
|
||||
`/run/parafa-signer`. Put the PKCS#12 file (certificate + key) and a file holding only its passphrase
|
||||
there, readable by the container's user, and name them in `env/parafa.env`:
|
||||
`SIGNING_PKCS12_PATH=/run/parafa-signer/signer.p12`,
|
||||
`SIGNING_PKCS12_PASSPHRASE_FILE=/run/parafa-signer/passphrase`; optionally `SIGNING_TRUST_ROOTS`
|
||||
(a PEM bundle in the same directory) and `SIGNING_LOCATION`. With the directory empty Parafa runs:
|
||||
requests and verification work, and signing answers 409 `signing_unconfigured`.
|
||||
- **Scribe** takes clauses from Lexicon and exports drafts into Galena, each call with the person's
|
||||
own token: `LEXICON_URL` / `GALENA_URL` in `env/scribe.env` (hairpins, written by init),
|
||||
`MODULE_CALL_TIMEOUT` (seconds, default 15). It takes no part in the event log.
|
||||
- **Panorama** shows a card for each once `PARAFA_BASE_URL` / `SCRIBE_BASE_URL` are set in
|
||||
`env/panorama.env`. A fresh init writes them; on a box whose Panorama predates them, add the two
|
||||
lines by hand (`http://<site>/parafa`, `http://<site>/scribe`) and repin Panorama (it learnt the two
|
||||
slugs in its feat/parafa-scribe commit).
|
||||
|
||||
---
|
||||
|
||||
## Step 0 — Before the box
|
||||
|
||||
- This Atrium release is merged and pushed, with the two submodules added and pinned to commits on
|
||||
each module's `main`; the deploy token reaches `Parafa`, `Scribe` and `dredd-core`.
|
||||
|
||||
## Step 1 — A dump
|
||||
|
||||
```bash
|
||||
cd /srv/atrium/deploy
|
||||
docker compose exec -T postgres sh -c 'pg_dump -U postgres -d "$POSTGRES_DB" -Fc' > "$HOME/dredd-pre-m6m7.dump"
|
||||
```
|
||||
|
||||
## Step 2 — Pull the release and the submodules
|
||||
|
||||
```bash
|
||||
git -C .. pull --ff-only
|
||||
git -C .. submodule update --init deploy/modules/parafa deploy/modules/scribe deploy/modules/panorama
|
||||
```
|
||||
|
||||
## Step 3 — Write their settings, and the signer
|
||||
|
||||
```bash
|
||||
./init.sh --add parafa
|
||||
./init.sh --add scribe
|
||||
install -d -m 750 parafa-signer # then copy signer.p12 + passphrase in, and edit env/parafa.env
|
||||
```
|
||||
|
||||
Each `--add` writes `env/<slug>.env` / `env/<slug>.migrate.env` (mode 600), puts `<SLUG>_*_PASSWORD`
|
||||
in `db.env`, adds `<slug>_app` / `<slug>_migrator` to `IDENTITY_*_ROLES` (and, for Parafa,
|
||||
`parafa_app` to `MODULE_EVENT_EMITTER_ROLES`) in `env/atrium.env`, and `<slug>` to `COMPOSE_PROFILES`
|
||||
in `.env`. Add `PARAFA_BASE_URL` / `SCRIBE_BASE_URL` to `env/panorama.env` (above).
|
||||
|
||||
**Connections.** Twelve apps at 4 / 8 are 156 connections. `compose.yaml` now sets
|
||||
`max_connections=200` (160 at 80%); if `db.env` sets `LOCAL_DB_MAX_CONNECTIONS` explicitly, raise it
|
||||
to 200 too, then `docker compose up -d postgres` (a restart of the database — every backend
|
||||
reconnects). Or set `DB_POOL_SIZE=3` / `DB_MAX_OVERFLOW=6` in every `env/<app>.env` and `db.env`
|
||||
(12 x 10 = 120 of 136 at 170).
|
||||
|
||||
## Step 4 — Build
|
||||
|
||||
```bash
|
||||
read -rs DREDD_CORE_TOKEN && export DREDD_CORE_TOKEN
|
||||
docker compose build atrium-backend parafa-backend scribe-backend panorama-backend && unset DREDD_CORE_TOKEN
|
||||
```
|
||||
|
||||
`atrium-backend` is rebuilt for the front door's two new paths, the catalogue tiles and the `yellow`
|
||||
tile hue.
|
||||
|
||||
## Step 5 — Push
|
||||
|
||||
```bash
|
||||
./push.sh --dry-run atrium parafa scribe panorama # complete, both in the plan, budget fits
|
||||
./push.sh atrium parafa scribe panorama
|
||||
```
|
||||
|
||||
Atrium migrates first and re-applies the event tiers (`emitters=...,parafa_app` in its log), then each
|
||||
module's own revisions, then the checks.
|
||||
|
||||
## Step 6 — Start
|
||||
|
||||
```bash
|
||||
docker compose up -d atrium-backend parafa-backend scribe-backend panorama-backend
|
||||
for slug in parafa scribe; do curl -fsS "$SITE/$slug/healthz"; done
|
||||
```
|
||||
|
||||
Then, in Atrium as the administrator: give people a `user` or `moderator` row for each (Administration
|
||||
→ Modules); no row is no access.
|
||||
|
||||
## Rollback
|
||||
|
||||
`COMPOSE_PROFILES` without the slug, `docker compose stop <slug>-backend`; the schema stays. The roles
|
||||
stay listed in `env/atrium.env` (harmless while they exist).
|
||||
@@ -132,6 +132,22 @@ services:
|
||||
volumes:
|
||||
- *db_ca
|
||||
|
||||
parafa-migrate:
|
||||
networks:
|
||||
parafa-db: !reset null
|
||||
depends_on:
|
||||
postgres: !reset null
|
||||
volumes:
|
||||
- *db_ca
|
||||
|
||||
scribe-migrate:
|
||||
networks:
|
||||
scribe-db: !reset null
|
||||
depends_on:
|
||||
postgres: !reset null
|
||||
volumes:
|
||||
- *db_ca
|
||||
|
||||
# ── the backends: their networks with the front door (compose.yaml) and their own migrate, plus the CA ──
|
||||
atrium-backend:
|
||||
networks:
|
||||
@@ -213,6 +229,22 @@ services:
|
||||
volumes:
|
||||
- *db_ca
|
||||
|
||||
parafa-backend:
|
||||
networks:
|
||||
parafa-db: !reset null
|
||||
depends_on:
|
||||
postgres: !reset null
|
||||
volumes:
|
||||
- *db_ca
|
||||
|
||||
scribe-backend:
|
||||
networks:
|
||||
scribe-db: !reset null
|
||||
depends_on:
|
||||
postgres: !reset null
|
||||
volumes:
|
||||
- *db_ca
|
||||
|
||||
# Insider's optional OCR worker (profiles `insider` + `ocr`): like a one-shot, it listens on nothing,
|
||||
# so without its database network it lands on the project's default network.
|
||||
insider-ocr:
|
||||
|
||||
+169
-10
@@ -21,8 +21,8 @@
|
||||
#
|
||||
# ONE ADDRESS, ONE MODULE PER PATH, AND ATRIUM IS THE FRONT DOOR. There is no reverse proxy: Atrium's
|
||||
# backend (backend/app/frontdoor.py) redirects `/` to /atrium/ and `/<slug>` to `/<slug>/`, serves Atrium
|
||||
# itself under /atrium, and streams /galena, /sygna, /counsel, /compass, /insider, /arbiter, /lexicon, /agora and
|
||||
# /panorama to the backends named in
|
||||
# itself under /atrium, and streams /galena, /sygna, /counsel, /compass, /insider, /arbiter, /lexicon, /agora,
|
||||
# /panorama, /parafa and /scribe to the backends named in
|
||||
# FRONTDOOR_UPSTREAMS below — a FIXED map; no target ever comes from a request. It strips the prefix on
|
||||
# the way, and each module's ROOT_PATH (env/<app>.env, handed to uvicorn as --root-path by its image's
|
||||
# CMD) puts it back on every URL that module generates. Both halves or neither: change one without the
|
||||
@@ -36,7 +36,7 @@
|
||||
# The consoles are COPIED into the images at build time, from the second build context `frontend`.
|
||||
#
|
||||
# Where the code comes from: Atrium is this repository (../backend, ../frontend); the modules are
|
||||
# ${MODULES_DIR}/galena, /sygna, /counsel, /compass, /insider, /lexicon, /agora and /panorama: the git submodules under ./modules
|
||||
# ${MODULES_DIR}/galena, /sygna, /counsel, /compass, /insider, /lexicon, /agora, /panorama, /parafa and /scribe: the git submodules under ./modules
|
||||
# (Arbiter is not a submodule of its own: it lives in the compass submodule, at apps/arbiter)
|
||||
# (MODULES_DIR=./modules in .env.example), or sibling checkouts next to this repository (MODULES_DIR=../..;
|
||||
# modules/README.md).
|
||||
@@ -55,7 +55,7 @@
|
||||
# reach another module's HTTP; atrium-backend is on all of them because it is the front door. Each
|
||||
# module trusts X-Forwarded-For only from its own `<app>` subnet, where atrium-backend is the one other
|
||||
# member. The database is the one shared thing, and it is shared one app at a time: `postgres` joins
|
||||
# ten separate `<app>-db` networks, one per app, so `<app>-migrate` and `<app>-backend` reach the
|
||||
# twelve separate `<app>-db` networks, one per app, so `<app>-migrate` and `<app>-backend` reach the
|
||||
# database and nothing else, and no two apps share a database network.
|
||||
# Every address one module holds for another — Sygna's GALENA_BASE_URL, Atrium's module health
|
||||
# addresses — is still the PUBLIC one, a hairpin out through the server's own address and back in
|
||||
@@ -83,11 +83,11 @@ services:
|
||||
# verify-full. Rename it and every app refuses to start.
|
||||
image: postgres:17
|
||||
# The server settings that are not initdb's, and the one hook for changing them. max_connections is
|
||||
# raised from postgres:17's default of 100 for ten apps (10 x 13 = 130 of 136), and the push budgets 80% of it
|
||||
# raised from postgres:17's default of 100 for twelve apps (12 x 13 = 156 of 160), and the push budgets 80% of it
|
||||
# (README, Option A, "Sizing"): raise it here and LOCAL_DB_MAX_CONNECTIONS in db.env together, then
|
||||
# `docker compose up -d postgres`. `postgres` must stay the first word — the image's entrypoint only
|
||||
# does its setup when the command is the server itself.
|
||||
command: ["postgres", "-c", "max_connections=170"]
|
||||
command: ["postgres", "-c", "max_connections=200"]
|
||||
environment:
|
||||
# Generated by init.sh into deploy/.env (README, Option A). It is the superuser's password: only
|
||||
# push.sh uses it, in LOCAL_DB_ADMIN_URL. Not `:?`-required, because Option B interpolates this file
|
||||
@@ -125,7 +125,7 @@ services:
|
||||
retries: 20
|
||||
start_period: 30s
|
||||
networks: [atrium-db, galena-db, sygna-db, counsel-db, compass-db, insider-db, arbiter-db, lexicon-db,
|
||||
agora-db, panorama-db]
|
||||
agora-db, panorama-db, parafa-db, scribe-db]
|
||||
logging: *logging
|
||||
|
||||
# ── Atrium, the hub ────────────────────────────────────────────────────────────
|
||||
@@ -167,10 +167,10 @@ services:
|
||||
MIGRATION_DATABASE_URL: ""
|
||||
# THE FRONT DOOR's fixed routing table (backend/app/frontdoor.py): slug=backend, nothing else. A slug
|
||||
# outside the family refuses start-up; a module listed here whose backend is not running (Compass,
|
||||
# Insider, Arbiter, Lexicon, Agora or Panorama while its profile is off) answers 502 at its path. Each name resolves on that module's own
|
||||
# Insider, Arbiter, Lexicon, Agora, Panorama, Parafa or Scribe while its profile is off) answers 502 at its path. Each name resolves on that module's own
|
||||
# network below. No FORWARDED_ALLOW_IPS: nothing stands in front of this process, so its image runs
|
||||
# uvicorn with --no-proxy-headers and the peer address IS the client (the audit log's IP).
|
||||
FRONTDOOR_UPSTREAMS: "galena=http://galena-backend:8000,sygna=http://sygna-backend:8000,counsel=http://counsel-backend:8000,compass=http://compass-backend:8000,insider=http://insider-backend:8000,arbiter=http://arbiter-backend:8000,lexicon=http://lexicon-backend:8000,agora=http://agora-backend:8000,panorama=http://panorama-backend:8000"
|
||||
FRONTDOOR_UPSTREAMS: "galena=http://galena-backend:8000,sygna=http://sygna-backend:8000,counsel=http://counsel-backend:8000,compass=http://compass-backend:8000,insider=http://insider-backend:8000,arbiter=http://arbiter-backend:8000,lexicon=http://lexicon-backend:8000,agora=http://agora-backend:8000,panorama=http://panorama-backend:8000,parafa=http://parafa-backend:8000,scribe=http://scribe-backend:8000"
|
||||
# The ONE published port of the whole stack: plain HTTP. TLS is optional and off by default:
|
||||
# compose.tls.yaml (switched on in deploy/.env, RUNBOOK-tls.md) adds :443 here and the certbot sidecar.
|
||||
ports:
|
||||
@@ -194,6 +194,8 @@ services:
|
||||
lexicon: {}
|
||||
agora: {}
|
||||
panorama: {}
|
||||
parafa: {}
|
||||
scribe: {}
|
||||
depends_on:
|
||||
atrium-migrate: { condition: service_completed_successfully }
|
||||
postgres: { condition: service_healthy }
|
||||
@@ -898,6 +900,152 @@ services:
|
||||
retries: 10
|
||||
logging: *logging
|
||||
|
||||
# ── Parafa (repository Alpaq92/Parafa): PAdES signing of PDFs (M6) ──────────────────────────────────────────
|
||||
# SWITCHED OFF until deploy/.env names `parafa` in COMPOSE_PROFILES, exactly like the modules above
|
||||
# (deploy/RUNBOOK-m6-m7.md).
|
||||
# A signed PDF writes `document.signed` to the hub's shared event log, so parafa_app must be an event
|
||||
# EMITTER (MODULE_EVENT_EMITTER_ROLES in env/atrium.env) before it goes live. The operator's signing
|
||||
# certificate is NOT in the image or the repo: PARAFA_SIGNER_DIR (deploy/.env) is mounted read-only at
|
||||
# /run/parafa-signer, and env/parafa.env names the PKCS#12 file and its passphrase file there. An
|
||||
# empty directory is fine: requests and verification work, and signing answers 409 signing_unconfigured.
|
||||
parafa-migrate:
|
||||
profiles: ["parafa"]
|
||||
build:
|
||||
context: ${MODULES_DIR:-./modules}/parafa/backend
|
||||
# The module's console ships in its image (its Dockerfile: COPY --from=frontend).
|
||||
additional_contexts:
|
||||
frontend: ${MODULES_DIR:-./modules}/parafa/frontend
|
||||
secrets: [dredd_core_token]
|
||||
image: dredd-family/parafa-backend:local
|
||||
# `required: false` for Compass's reason: a missing env_file breaks the whole PROJECT, and the
|
||||
# profile keeps the service off until the files exist (push.sh refuses a missing one by name).
|
||||
env_file:
|
||||
- path: ${DEPLOY_ENV_DIR:-./env}/parafa.env
|
||||
required: false
|
||||
- path: ${DEPLOY_ENV_DIR:-./env}/parafa.migrate.env
|
||||
required: false
|
||||
command: ["sh", "-c", "alembic upgrade head && python -m app.seed"]
|
||||
restart: "no"
|
||||
volumes:
|
||||
- parafa-data:/data
|
||||
networks:
|
||||
parafa-db: {}
|
||||
depends_on:
|
||||
# Identity and the event log are shared and Atrium's migration is what creates them (and grants
|
||||
# parafa_app the log through MODULE_EVENT_EMITTER_ROLES).
|
||||
atrium-migrate: { condition: service_completed_successfully }
|
||||
postgres: { condition: service_healthy }
|
||||
logging: *logging
|
||||
|
||||
parafa-backend:
|
||||
profiles: ["parafa"]
|
||||
build:
|
||||
context: ${MODULES_DIR:-./modules}/parafa/backend
|
||||
# The module's console ships in its image (its Dockerfile: COPY --from=frontend).
|
||||
additional_contexts:
|
||||
frontend: ${MODULES_DIR:-./modules}/parafa/frontend
|
||||
secrets: [dredd_core_token]
|
||||
image: dredd-family/parafa-backend:local
|
||||
env_file:
|
||||
- path: ${DEPLOY_ENV_DIR:-./env}/parafa.env
|
||||
required: false
|
||||
environment:
|
||||
MIGRATION_DATABASE_URL: ""
|
||||
# Trust X-Forwarded-* only from this module's own network, where atrium-backend (the front door) is
|
||||
# the one other member; change it together with the subnet at the bottom of this file.
|
||||
FORWARDED_ALLOW_IPS: "172.30.30.0/24"
|
||||
# Atrium frames this module's console at the one origin: SAMEORIGIN / frame-ancestors 'self'
|
||||
# (the module's own default is 'none' / DENY). Set here, not in env/, so no env file can undo it.
|
||||
FRAME_ANCESTORS: "'self'"
|
||||
expose: ["8000"]
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- parafa-data:/data
|
||||
# The operator's signer (PKCS#12 + passphrase file), read-only; never baked into the image.
|
||||
- ${PARAFA_SIGNER_DIR:-./parafa-signer}:/run/parafa-signer:ro
|
||||
networks:
|
||||
parafa: {}
|
||||
parafa-db: {}
|
||||
depends_on:
|
||||
parafa-migrate: { condition: service_completed_successfully }
|
||||
postgres: { condition: service_healthy }
|
||||
healthcheck:
|
||||
test: ["CMD", "python", "-c", "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://localhost:8000/healthz').status==200 else 1)"]
|
||||
interval: 15s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
logging: *logging
|
||||
|
||||
# ── Scribe (repository Alpaq92/Scribe): drafting from templates and clauses (M7) ──────────────────────────────────────────
|
||||
# SWITCHED OFF until deploy/.env names `scribe` in COMPOSE_PROFILES, exactly like the modules above
|
||||
# (deploy/RUNBOOK-m6-m7.md).
|
||||
# It takes clauses from Lexicon and exports drafts into Galena with the person's own token (hairpins
|
||||
# through the front door, LEXICON_URL / GALENA_URL in env/scribe.env); it takes no part in the event log.
|
||||
scribe-migrate:
|
||||
profiles: ["scribe"]
|
||||
build:
|
||||
context: ${MODULES_DIR:-./modules}/scribe/backend
|
||||
# The module's console ships in its image (its Dockerfile: COPY --from=frontend).
|
||||
additional_contexts:
|
||||
frontend: ${MODULES_DIR:-./modules}/scribe/frontend
|
||||
secrets: [dredd_core_token]
|
||||
image: dredd-family/scribe-backend:local
|
||||
# `required: false` for Compass's reason: a missing env_file breaks the whole PROJECT, and the
|
||||
# profile keeps the service off until the files exist (push.sh refuses a missing one by name).
|
||||
env_file:
|
||||
- path: ${DEPLOY_ENV_DIR:-./env}/scribe.env
|
||||
required: false
|
||||
- path: ${DEPLOY_ENV_DIR:-./env}/scribe.migrate.env
|
||||
required: false
|
||||
command: ["sh", "-c", "alembic upgrade head && python -m app.seed"]
|
||||
restart: "no"
|
||||
volumes:
|
||||
- scribe-data:/data
|
||||
networks:
|
||||
scribe-db: {}
|
||||
depends_on:
|
||||
# Identity is shared and Atrium's migration is what creates it (see compass-migrate).
|
||||
atrium-migrate: { condition: service_completed_successfully }
|
||||
postgres: { condition: service_healthy }
|
||||
logging: *logging
|
||||
|
||||
scribe-backend:
|
||||
profiles: ["scribe"]
|
||||
build:
|
||||
context: ${MODULES_DIR:-./modules}/scribe/backend
|
||||
# The module's console ships in its image (its Dockerfile: COPY --from=frontend).
|
||||
additional_contexts:
|
||||
frontend: ${MODULES_DIR:-./modules}/scribe/frontend
|
||||
secrets: [dredd_core_token]
|
||||
image: dredd-family/scribe-backend:local
|
||||
env_file:
|
||||
- path: ${DEPLOY_ENV_DIR:-./env}/scribe.env
|
||||
required: false
|
||||
environment:
|
||||
MIGRATION_DATABASE_URL: ""
|
||||
# Trust X-Forwarded-* only from this module's own network, where atrium-backend (the front door) is
|
||||
# the one other member; change it together with the subnet at the bottom of this file.
|
||||
FORWARDED_ALLOW_IPS: "172.30.31.0/24"
|
||||
# Atrium frames this module's console at the one origin: SAMEORIGIN / frame-ancestors 'self'
|
||||
# (the module's own default is 'none' / DENY). Set here, not in env/, so no env file can undo it.
|
||||
FRAME_ANCESTORS: "'self'"
|
||||
expose: ["8000"]
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- scribe-data:/data
|
||||
networks:
|
||||
scribe: {}
|
||||
scribe-db: {}
|
||||
depends_on:
|
||||
scribe-migrate: { condition: service_completed_successfully }
|
||||
postgres: { condition: service_healthy }
|
||||
healthcheck:
|
||||
test: ["CMD", "python", "-c", "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://localhost:8000/healthz').status==200 else 1)"]
|
||||
interval: 15s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
logging: *logging
|
||||
|
||||
# One network per module backend, shared only with atrium-backend (the front door): a module cannot reach
|
||||
# another module's backend directly, and each trusts X-Forwarded-For from exactly its own subnet. If a
|
||||
# subnet collides with an existing network on the host, change it here AND in that FORWARDED_ALLOW_IPS.
|
||||
@@ -944,13 +1092,22 @@ networks:
|
||||
ipam: { config: [{ subnet: 172.30.19.0/24 }] }
|
||||
panorama-db:
|
||||
ipam: { config: [{ subnet: 172.30.29.0/24 }] }
|
||||
parafa:
|
||||
ipam: { config: [{ subnet: 172.30.30.0/24 }] }
|
||||
parafa-db:
|
||||
ipam: { config: [{ subnet: 172.30.40.0/24 }] }
|
||||
scribe:
|
||||
ipam: { config: [{ subnet: 172.30.31.0/24 }] }
|
||||
scribe-db:
|
||||
ipam: { config: [{ subnet: 172.30.41.0/24 }] }
|
||||
|
||||
volumes:
|
||||
# NEVER `docker compose down -v`. It deletes all of these at once, and they hold the only copy of
|
||||
# something: pgdata is the whole family's database (Option A), galena-data is Galena's git
|
||||
# repositories, which are not in the database at all, sygna-data / compass-data hold uploads, and
|
||||
# insider-data is Insider's DATA_DIR (shared with its optional OCR worker), arbiter-data Arbiter's,
|
||||
# and lexicon-data / agora-data / panorama-data theirs (Lexicon's sources, Agora's plain-file rounds).
|
||||
# and lexicon-data / agora-data / panorama-data theirs (Lexicon's sources, Agora's plain-file rounds),
|
||||
# parafa-data / scribe-data Parafa's uploaded and signed PDFs and Scribe's exports.
|
||||
# `down` without -v keeps them; to stop the stack, use `docker compose down` or `stop`. Back them up
|
||||
# (README, Option A, "Backups", and §9). A box that ran the Caddy release still has caddy_data and
|
||||
# caddy_config volumes: nothing uses them any more, and removing them is the operator's call.
|
||||
@@ -963,6 +1120,8 @@ volumes:
|
||||
lexicon-data:
|
||||
agora-data:
|
||||
panorama-data:
|
||||
parafa-data:
|
||||
scribe-data:
|
||||
|
||||
secrets:
|
||||
# Used only by each image's build stage (one `pip install` of the private dredd-core); no running
|
||||
|
||||
+14
-2
@@ -34,9 +34,9 @@ LOCAL_DB_ADMIN_URL=postgresql://postgres:<percent-encoded-POSTGRES_PASSWORD>@pos
|
||||
# LOCAL_DB_HOST=postgres
|
||||
# LOCAL_DB_PORT=5432
|
||||
#
|
||||
# The server's max_connections; compose.yaml sets 170 (postgres:17 ships 100), and the push plans the budget against 80% of it.
|
||||
# The server's max_connections; compose.yaml sets 200 (postgres:17 ships 100), and the push plans the budget against 80% of it.
|
||||
# Raise both together if you raise the server's (compose.yaml, the postgres service's command).
|
||||
# LOCAL_DB_MAX_CONNECTIONS=170
|
||||
# LOCAL_DB_MAX_CONNECTIONS=200
|
||||
|
||||
# ── Option B: a managed PostgreSQL provider (--managed-db) ─────────────────────────────────────
|
||||
# Read ONLY with --managed-db, and then the LOCAL_DB_* block above is read not at all.
|
||||
@@ -108,6 +108,10 @@ PLATFORM_IDENTITY_SCHEMA=dredd
|
||||
# With Lexicon, Agora and Panorama too, ten apps: 10 x 13 = 130 — compose.yaml now sets max_connections
|
||||
# to 170 (130 of 136; LOCAL_DB_MAX_CONNECTIONS defaults to the same 170), or use 3 / 6 -> 10 x 10 = 100.
|
||||
# Option B with ten: 2 / 4 -> 10 x 7 = 70 of 72 at 90 (tight); with 60, 1 / 2 -> 10 x 4 = 40 of 48.
|
||||
# With Parafa and Scribe too, twelve apps: 12 x 13 = 156 — compose.yaml now sets max_connections to
|
||||
# 200 (156 of 160; LOCAL_DB_MAX_CONNECTIONS defaults to the same 200), or use 3 / 6 -> 12 x 10 = 120.
|
||||
# Option B with twelve: 1 / 4 -> 12 x 6 = 72 of 72 at 90 (no headroom: prefer 1 / 3 -> 60); with 60,
|
||||
# 1 / 1 -> 12 x 3 = 36 of 48.
|
||||
#
|
||||
# Sized for FIVE modules, not four (2026-10-03). At the old 5 / 10 a fifth app made it 5 x 16 = 80 of
|
||||
# 80 — the budget met exactly, with nothing left for a `psql`, a `docker compose run --rm <app>-migrate`
|
||||
@@ -144,6 +148,10 @@ AGORA_MIGRATOR_PASSWORD=
|
||||
AGORA_APP_PASSWORD=
|
||||
PANORAMA_MIGRATOR_PASSWORD=
|
||||
PANORAMA_APP_PASSWORD=
|
||||
PARAFA_MIGRATOR_PASSWORD=
|
||||
PARAFA_APP_PASSWORD=
|
||||
SCRIBE_MIGRATOR_PASSWORD=
|
||||
SCRIBE_APP_PASSWORD=
|
||||
|
||||
# ── Role names: leave them on a real deployment ────────────────────────────────────────────────
|
||||
# Role names are cluster-wide, so each carries its app's name. Override only on a test cluster
|
||||
@@ -168,6 +176,10 @@ PANORAMA_APP_PASSWORD=
|
||||
# AGORA_APP_ROLE=agora_app
|
||||
# PANORAMA_MIGRATOR_ROLE=panorama_migrator
|
||||
# PANORAMA_APP_ROLE=panorama_app
|
||||
# PARAFA_MIGRATOR_ROLE=parafa_migrator
|
||||
# PARAFA_APP_ROLE=parafa_app
|
||||
# SCRIBE_MIGRATOR_ROLE=scribe_migrator
|
||||
# SCRIBE_APP_ROLE=scribe_app
|
||||
|
||||
# ── --local only (no Docker on this machine) ───────────────────────────────────────────────────
|
||||
# The module checkouts and the CA come from deploy/.env (or --compose-env FILE) as for Compose.
|
||||
|
||||
Vendored
+4
-3
@@ -59,7 +59,7 @@ IDENTITY_SCHEMA=dredd
|
||||
# the first push. Insider, also switched off by default, joins the same way: insider_app /
|
||||
# insider_migrator here with `insider` in COMPOSE_PROFILES (`./init.sh --add insider` writes both).
|
||||
# Arbiter, the seventh, the same: arbiter_app / arbiter_migrator with `arbiter` in COMPOSE_PROFILES
|
||||
# (`./init.sh --add arbiter`). Lexicon, Agora and Panorama likewise (`./init.sh --add lexicon` etc.).
|
||||
# (`./init.sh --add arbiter`). Lexicon, Agora, Panorama, Parafa and Scribe likewise (`./init.sh --add lexicon` etc.).
|
||||
# Insider is a reader of the shared model providers like every listed module, never a key reader. Atrium's own two roles are never listed — its runtime role IS the writer tier
|
||||
# (DB_APP_ROLE) and its migrator owns the schema. The grants are applied by Atrium's revisions, once
|
||||
# each: after the last one has run, a module joining later also needs a revision that re-applies them
|
||||
@@ -83,8 +83,9 @@ MODEL_PROVIDER_MIGRATOR_ROLES=compass_migrator,arbiter_migrator
|
||||
# roles that take part (SELECT + INSERT, append-only, inserting only as themselves). The hub's own
|
||||
# runtime role always does. Each takes effect once its role is in IDENTITY_READER_ROLES too; a module
|
||||
# not listed reaches nothing in the log. Re-applied on every migrate (python -m app.identity_grants).
|
||||
# Agora writes `negotiation.round_received` when the other side sends a round, so agora_app is listed.
|
||||
MODULE_EVENT_EMITTER_ROLES=galena_app,compass_app,agora_app
|
||||
# Agora writes `negotiation.round_received` when the other side sends a round, so agora_app is listed;
|
||||
# Parafa writes `document.signed` when a PDF is signed, so parafa_app is listed too.
|
||||
MODULE_EVENT_EMITTER_ROLES=galena_app,compass_app,agora_app,parafa_app
|
||||
# The event log's READER tier (dredd-core 0.23.0): SELECT and nothing else, for a module that reports
|
||||
# on the log and says nothing itself — Panorama's trends. Joined the same way; a role is an emitter or
|
||||
# a reader, never both (the grant block refuses the overlap). push.sh checks it with --events-reader.
|
||||
|
||||
Vendored
+2
@@ -69,6 +69,8 @@ COMPASS_BASE_URL=http://<site>/compass
|
||||
ARBITER_BASE_URL=http://<site>/arbiter
|
||||
LEXICON_BASE_URL=http://<site>/lexicon
|
||||
AGORA_BASE_URL=http://<site>/agora
|
||||
PARAFA_BASE_URL=http://<site>/parafa
|
||||
SCRIBE_BASE_URL=http://<site>/scribe
|
||||
INSIDER_BASE_URL=http://<site>/insider
|
||||
# Seconds per module call; the calls run in parallel.
|
||||
STATS_TIMEOUT_SECONDS=3
|
||||
|
||||
Vendored
+94
@@ -0,0 +1,94 @@
|
||||
# deploy/env/parafa.env — Parafa's backend, on the platform.
|
||||
#
|
||||
# Copy to parafa.env (init.sh writes it; `./init.sh --add parafa` on a box that predates Parafa) and
|
||||
# fill in. Read by parafa-backend and parafa-migrate; the migrator's URL lives in parafa.migrate.env,
|
||||
# which only the one-shot reads.
|
||||
#
|
||||
# The app's own template is modules/parafa/.env.example, and it is the authority on every key below
|
||||
# that is not about this platform. Where the two differ, that one wins: this file exists to say what
|
||||
# changes when Parafa is a module rather than a standalone stack. Leave out POSTGRES_DB /
|
||||
# DB_*_PASSWORD (the kit's postgres service is configured in deploy/.env).
|
||||
|
||||
APP_ENV=production
|
||||
|
||||
# The front door (atrium-backend) strips /parafa before the request arrives; this puts it back on
|
||||
# every URL the app generates (the image's CMD hands it to uvicorn as --root-path). The two are one
|
||||
# decision — see compose.yaml's header. FORWARDED_ALLOW_IPS and FRAME_ANCESTORS='self' are set by
|
||||
# compose.yaml, not here: the first names the subnet the front door forwards from (172.30.30.0/24).
|
||||
ROOT_PATH=/parafa
|
||||
APP_BASE_URL=http://<site>/parafa
|
||||
|
||||
# ── one account (the default) ──────────────────────────────────────────────────────────────────
|
||||
# The shared identity schema. Set, this app reads the platform's accounts and never writes them;
|
||||
# empty, it is a standalone Parafa with its own sign-in. It must equal PLATFORM_IDENTITY_SCHEMA in
|
||||
# deploy/db.env — push.sh refuses the half-done combination by name. Switching Parafa on also means
|
||||
# listing parafa_app / parafa_migrator in env/atrium.env's IDENTITY_*_ROLES (the push refuses
|
||||
# without them; `./init.sh --add parafa` does both, and the event emitter list (a signed document writes `document.signed` to the hub's event log)). STANDALONE (`./init.sh --standalone`):
|
||||
# both lines commented out, with every other app's identity settings blanked to match.
|
||||
#
|
||||
# SESSION_COOKIE_NAME must match every other app's: one origin plus one cookie plus one session row
|
||||
# IS the single sign-on, and there is no handoff protocol to configure.
|
||||
IDENTITY_SCHEMA=dredd
|
||||
SESSION_COOKIE_NAME=dredd_session
|
||||
# The name this module answers to, and the slug Atrium's catalogue uses for it: a permission row and
|
||||
# an app token are both addressed by it, and two spellings fail silently.
|
||||
MODULE_SLUG=parafa
|
||||
# Where the console sends somebody who is not signed in. Blank is correct here: the hub is a sibling
|
||||
# path at the same origin.
|
||||
IDENTITY_HUB_URL=
|
||||
|
||||
# ── database ───────────────────────────────────────────────────────────────────────────────────
|
||||
# Option A (the default): the runtime role parafa_app on this box's own PostgreSQL — plain role
|
||||
# name, the compose service `postgres`, LOCAL_DB_NAME from deploy/.env, NO sslmode / sslrootcert.
|
||||
# Password: PARAFA_APP_PASSWORD from db.env, percent-encoded.
|
||||
DATABASE_URL=postgresql+pg8000://parafa_app:<percent-encoded-password>@postgres:5432/dredd
|
||||
# Must be DATABASE_URL's role (Parafa refuses to start otherwise).
|
||||
DB_APP_ROLE=parafa_app
|
||||
# Option B: a managed PostgreSQL provider's database (deploy/README.md, "Option B").
|
||||
# DATABASE_URL=postgresql+pg8000://parafa_app.<tenant>:<percent-encoded-password>@<host>:5432/postgres?sslmode=verify-full&sslrootcert=/run/certs/db-ca.crt
|
||||
# Every app shares one connection limit (db.env.example, "Connection budget"). Do not raise these for
|
||||
# one app without redoing that arithmetic.
|
||||
DB_POOL_SIZE=4
|
||||
DB_MAX_OVERFLOW=8
|
||||
|
||||
CORS_ALLOW_ORIGINS=
|
||||
|
||||
DATA_DIR=/data
|
||||
# A production module seeds no demo content: the platform's people and documents are real.
|
||||
SEED_DEMO=false
|
||||
|
||||
# Galena's PUBLIC address, a hairpin back through the front door: no module shares a network with
|
||||
# another module (compose.yaml), so `galena-backend` does not resolve from here. A signing request on
|
||||
# a Galena document reads it and writes the signed PDF back as a new version of it, with the acting
|
||||
# person's own token. Empty: Galena off for this module (requests on plain uploaded files only).
|
||||
GALENA_BASE_URL=http://<site>/galena
|
||||
|
||||
# ── the signer (PAdES, pyHanko) ────────────────────────────────────────────────────────────────
|
||||
# compose.yaml mounts PARAFA_SIGNER_DIR (deploy/.env, default ./parafa-signer next to compose.yaml)
|
||||
# READ-ONLY at /run/parafa-signer. Put the operator's signing certificate + key there as ONE PKCS#12
|
||||
# file and its passphrase in a second file, then uncomment the two lines below. Never in the repo,
|
||||
# never in the image, never the passphrase in this file. Left empty, requests can still be created and
|
||||
# verified, and "Podpisz" answers 409 `signing_unconfigured`.
|
||||
# SIGNING_PKCS12_PATH=/run/parafa-signer/signer.p12
|
||||
# SIGNING_PKCS12_PASSPHRASE_FILE=/run/parafa-signer/passphrase
|
||||
SIGNING_PKCS12_PATH=
|
||||
SIGNING_PKCS12_PASSPHRASE_FILE=
|
||||
# PEM bundle of CA certificates a signature is VALIDATED against (optional; e.g.
|
||||
# /run/parafa-signer/trust-roots.pem). Empty: a signature can still be reported intact.
|
||||
SIGNING_TRUST_ROOTS=
|
||||
# What the signature dictionary says as /Location (optional), e.g. Warszawa.
|
||||
SIGNING_LOCATION=
|
||||
|
||||
# ── auth ───────────────────────────────────────────────────────────────────────────────────────
|
||||
SESSION_TTL_HOURS=12
|
||||
LOGIN_MAX_ATTEMPTS=5
|
||||
LOGIN_LOCKOUT_MINUTES=15
|
||||
# Empty = auto-detect from the request scheme (Secure over HTTPS only).
|
||||
SESSION_COOKIE_SECURE=
|
||||
# App tokens (parafa_pat_...) stay listable and revocable here; on the platform they are minted at
|
||||
# the hub.
|
||||
APP_TOKENS_ENABLED=true
|
||||
|
||||
OTEL_ENABLED=false
|
||||
OTEL_SERVICE_NAME=parafa-backend
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
# Parafa's one-shot settings: loaded ONLY by parafa-migrate (together with parafa.env), never by the
|
||||
# long-running backend. Alembic runs as the migrator; the seed after it runs as the runtime role
|
||||
# (parafa_app, parafa.env's DATABASE_URL). init.sh writes env/parafa.migrate.env from this template
|
||||
# (git-ignored); on a deployment that already exists, `./init.sh --add parafa` does.
|
||||
|
||||
# ── Option A (the default): the migrator parafa_migrator on this box's own PostgreSQL ──────────
|
||||
# Plain role name, the `postgres` service, LOCAL_DB_NAME from deploy/.env, no TLS parameters (see
|
||||
# parafa.env). Password: PARAFA_MIGRATOR_PASSWORD, percent-encoded.
|
||||
MIGRATION_DATABASE_URL=postgresql+pg8000://parafa_migrator:<percent-encoded-password>@postgres:5432/dredd
|
||||
|
||||
# ── Option B: a managed PostgreSQL provider's database (deploy/README.md, "Option B") ───────────
|
||||
# Comment MIGRATION_DATABASE_URL above and uncomment this one, together with DATABASE_URL in parafa.env.
|
||||
# MIGRATION_DATABASE_URL=postgresql+pg8000://parafa_migrator.<tenant>:<percent-encoded-password>@<host>:5432/postgres?sslmode=verify-full&sslrootcert=/run/certs/db-ca.crt
|
||||
|
||||
# One account (the default): nobody is created here — Atrium is the one place accounts are made, and
|
||||
# this module holds no INSERT on the shared `app_user` — so the EMAIL names the hub's first
|
||||
# administrator, whom the seed looks up. The PASSWORD is inert on the platform, but push.sh's
|
||||
# preflight refuses an empty, default or short one (12+ characters), so it stays set; init.sh
|
||||
# generates it. Standalone (`./init.sh --standalone`): the seed creates this module's own first
|
||||
# administrator with them when no user has the EMAIL.
|
||||
BOOTSTRAP_ADMIN_EMAIL=admin@example.com
|
||||
BOOTSTRAP_ADMIN_PASSWORD=
|
||||
Vendored
+82
@@ -0,0 +1,82 @@
|
||||
# deploy/env/scribe.env — Scribe's backend, on the platform.
|
||||
#
|
||||
# Copy to scribe.env (init.sh writes it; `./init.sh --add scribe` on a box that predates Scribe) and
|
||||
# fill in. Read by scribe-backend and scribe-migrate; the migrator's URL lives in scribe.migrate.env,
|
||||
# which only the one-shot reads.
|
||||
#
|
||||
# The app's own template is modules/scribe/.env.example, and it is the authority on every key below
|
||||
# that is not about this platform. Where the two differ, that one wins: this file exists to say what
|
||||
# changes when Scribe is a module rather than a standalone stack. Leave out POSTGRES_DB /
|
||||
# DB_*_PASSWORD (the kit's postgres service is configured in deploy/.env).
|
||||
|
||||
APP_ENV=production
|
||||
|
||||
# The front door (atrium-backend) strips /scribe before the request arrives; this puts it back on
|
||||
# every URL the app generates (the image's CMD hands it to uvicorn as --root-path). The two are one
|
||||
# decision — see compose.yaml's header. FORWARDED_ALLOW_IPS and FRAME_ANCESTORS='self' are set by
|
||||
# compose.yaml, not here: the first names the subnet the front door forwards from (172.30.31.0/24).
|
||||
ROOT_PATH=/scribe
|
||||
APP_BASE_URL=http://<site>/scribe
|
||||
|
||||
# ── one account (the default) ──────────────────────────────────────────────────────────────────
|
||||
# The shared identity schema. Set, this app reads the platform's accounts and never writes them;
|
||||
# empty, it is a standalone Scribe with its own sign-in. It must equal PLATFORM_IDENTITY_SCHEMA in
|
||||
# deploy/db.env — push.sh refuses the half-done combination by name. Switching Scribe on also means
|
||||
# listing scribe_app / scribe_migrator in env/atrium.env's IDENTITY_*_ROLES (the push refuses
|
||||
# without them; `./init.sh --add scribe` does both). STANDALONE (`./init.sh --standalone`):
|
||||
# both lines commented out, with every other app's identity settings blanked to match.
|
||||
#
|
||||
# SESSION_COOKIE_NAME must match every other app's: one origin plus one cookie plus one session row
|
||||
# IS the single sign-on, and there is no handoff protocol to configure.
|
||||
IDENTITY_SCHEMA=dredd
|
||||
SESSION_COOKIE_NAME=dredd_session
|
||||
# The name this module answers to, and the slug Atrium's catalogue uses for it: a permission row and
|
||||
# an app token are both addressed by it, and two spellings fail silently.
|
||||
MODULE_SLUG=scribe
|
||||
# Where the console sends somebody who is not signed in. Blank is correct here: the hub is a sibling
|
||||
# path at the same origin.
|
||||
IDENTITY_HUB_URL=
|
||||
|
||||
# ── database ───────────────────────────────────────────────────────────────────────────────────
|
||||
# Option A (the default): the runtime role scribe_app on this box's own PostgreSQL — plain role
|
||||
# name, the compose service `postgres`, LOCAL_DB_NAME from deploy/.env, NO sslmode / sslrootcert.
|
||||
# Password: SCRIBE_APP_PASSWORD from db.env, percent-encoded.
|
||||
DATABASE_URL=postgresql+pg8000://scribe_app:<percent-encoded-password>@postgres:5432/dredd
|
||||
# Must be DATABASE_URL's role (Scribe refuses to start otherwise).
|
||||
DB_APP_ROLE=scribe_app
|
||||
# Option B: a managed PostgreSQL provider's database (deploy/README.md, "Option B").
|
||||
# DATABASE_URL=postgresql+pg8000://scribe_app.<tenant>:<percent-encoded-password>@<host>:5432/postgres?sslmode=verify-full&sslrootcert=/run/certs/db-ca.crt
|
||||
# Every app shares one connection limit (db.env.example, "Connection budget"). Do not raise these for
|
||||
# one app without redoing that arithmetic.
|
||||
DB_POOL_SIZE=4
|
||||
DB_MAX_OVERFLOW=8
|
||||
|
||||
CORS_ALLOW_ORIGINS=
|
||||
|
||||
DATA_DIR=/data
|
||||
# A production module seeds no demo content: the platform's people and documents are real.
|
||||
SEED_DEMO=false
|
||||
|
||||
# Lexicon's and Galena's PUBLIC addresses, hairpins back through the front door: no module shares a
|
||||
# network with another module (compose.yaml), so `lexicon-backend` does not resolve from here. A draft
|
||||
# takes its clauses from Lexicon and exports into Galena, each call with the acting person's own
|
||||
# token (there is no service account). Empty: that sibling is off for this module (clauses from the
|
||||
# local library only, exports as plain files).
|
||||
LEXICON_URL=http://<site>/lexicon
|
||||
GALENA_URL=http://<site>/galena
|
||||
# Seconds a call to a sibling may take.
|
||||
MODULE_CALL_TIMEOUT=15
|
||||
|
||||
# ── auth ───────────────────────────────────────────────────────────────────────────────────────
|
||||
SESSION_TTL_HOURS=12
|
||||
LOGIN_MAX_ATTEMPTS=5
|
||||
LOGIN_LOCKOUT_MINUTES=15
|
||||
# Empty = auto-detect from the request scheme (Secure over HTTPS only).
|
||||
SESSION_COOKIE_SECURE=
|
||||
# App tokens (scribe_pat_...) stay listable and revocable here; on the platform they are minted at
|
||||
# the hub.
|
||||
APP_TOKENS_ENABLED=true
|
||||
|
||||
OTEL_ENABLED=false
|
||||
OTEL_SERVICE_NAME=scribe-backend
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
# Scribe's one-shot settings: loaded ONLY by scribe-migrate (together with scribe.env), never by the
|
||||
# long-running backend. Alembic runs as the migrator; the seed after it runs as the runtime role
|
||||
# (scribe_app, scribe.env's DATABASE_URL). init.sh writes env/scribe.migrate.env from this template
|
||||
# (git-ignored); on a deployment that already exists, `./init.sh --add scribe` does.
|
||||
|
||||
# ── Option A (the default): the migrator scribe_migrator on this box's own PostgreSQL ──────────
|
||||
# Plain role name, the `postgres` service, LOCAL_DB_NAME from deploy/.env, no TLS parameters (see
|
||||
# scribe.env). Password: SCRIBE_MIGRATOR_PASSWORD, percent-encoded.
|
||||
MIGRATION_DATABASE_URL=postgresql+pg8000://scribe_migrator:<percent-encoded-password>@postgres:5432/dredd
|
||||
|
||||
# ── Option B: a managed PostgreSQL provider's database (deploy/README.md, "Option B") ───────────
|
||||
# Comment MIGRATION_DATABASE_URL above and uncomment this one, together with DATABASE_URL in scribe.env.
|
||||
# MIGRATION_DATABASE_URL=postgresql+pg8000://scribe_migrator.<tenant>:<percent-encoded-password>@<host>:5432/postgres?sslmode=verify-full&sslrootcert=/run/certs/db-ca.crt
|
||||
|
||||
# One account (the default): nobody is created here — Atrium is the one place accounts are made, and
|
||||
# this module holds no INSERT on the shared `app_user` — so the EMAIL names the hub's first
|
||||
# administrator, whom the seed looks up. The PASSWORD is inert on the platform, but push.sh's
|
||||
# preflight refuses an empty, default or short one (12+ characters), so it stays set; init.sh
|
||||
# generates it. Standalone (`./init.sh --standalone`): the seed creates this module's own first
|
||||
# administrator with them when no user has the EMAIL.
|
||||
BOOTSTRAP_ADMIN_EMAIL=admin@example.com
|
||||
BOOTSTRAP_ADMIN_PASSWORD=
|
||||
+22
-9
@@ -3,7 +3,7 @@
|
||||
# its own PostgreSQL (deploy/README.md, "Option A"): every setting, every secret, every file, mode 600.
|
||||
#
|
||||
# The family is ONE SITE with one module per path — <site>/atrium, /galena, /sygna, /counsel, /compass,
|
||||
# /insider, /arbiter, /lexicon, /agora, /panorama, and / goes to Atrium (atrium-backend is the front door, compose.yaml) — so what this asks for is ONE
|
||||
# /insider, /arbiter, /lexicon, /agora, /panorama, /parafa, /scribe, and / goes to Atrium (atrium-backend is the front door, compose.yaml) — so what this asks for is ONE
|
||||
# address:
|
||||
#
|
||||
# ./init.sh --ip 1.2.3.4 # a plain-HTTP trial: http://dredd.1.2.3.4.sslip.io/atrium ...
|
||||
@@ -22,11 +22,13 @@
|
||||
# ./init.sh --add lexicon # (Lexicon, Agora and Panorama: deploy/RUNBOOK-m2-m4.md)
|
||||
# ./init.sh --add agora
|
||||
# ./init.sh --add panorama
|
||||
# ./init.sh --add parafa # (Parafa and Scribe: deploy/RUNBOOK-m6-m7.md)
|
||||
# ./init.sh --add scribe
|
||||
#
|
||||
# ONE ACCOUNT FOR THE WHOLE PLATFORM is what it writes by default: PLATFORM_IDENTITY_SCHEMA=dredd in
|
||||
# db.env, IDENTITY_SCHEMA=dredd and SESSION_COOKIE_NAME=dredd_session in every env/<app>.env, and in
|
||||
# env/atrium.env the module roles Atrium's migration grants the shared schema to (IDENTITY_READER_ROLES /
|
||||
# IDENTITY_MIGRATOR_ROLES: Galena's, Sygna's and Counsel's — Compass, Insider, Arbiter, Lexicon, Agora and Panorama ship switched off, so
|
||||
# IDENTITY_MIGRATOR_ROLES: Galena's, Sygna's and Counsel's — Compass, Insider, Arbiter, Lexicon, Agora, Panorama, Parafa and Scribe ship switched off, so
|
||||
# their roles join the lists when they do). People sign in once, at /atrium, as the one first administrator in
|
||||
# env/atrium.migrate.env. --standalone writes the opt-out instead, all of it at once: those keys blank
|
||||
# (and each module's commented out, so each app keeps its own cookie name), four apps with four sets
|
||||
@@ -38,7 +40,7 @@
|
||||
# regenerated. When db.env sets PLATFORM_IDENTITY_SCHEMA (the one-account platform) it also sets the
|
||||
# app's IDENTITY_SCHEMA and SESSION_COOKIE_NAME to the platform's and adds the app's two roles to
|
||||
# env/atrium.env's IDENTITY_READER_ROLES / IDENTITY_MIGRATOR_ROLES (for compass and arbiter also the
|
||||
# model-provider key reader and migrator lists, for lexicon the key reader list, for agora the event
|
||||
# model-provider key reader and migrator lists, for lexicon the key reader list, for agora and parafa the event
|
||||
# emitters, for panorama the event readers), and for every module that ships switched off it adds
|
||||
# the app's own profile to COMPOSE_PROFILES in .env: Atrium's identity grants will name the new roles, so the next push must
|
||||
# provision them, and it does only for an app that is switched on. When db.env does not, the app is
|
||||
@@ -98,9 +100,9 @@
|
||||
set -euo pipefail
|
||||
|
||||
DEPLOY_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
FAMILY="atrium galena sygna counsel compass insider arbiter lexicon agora panorama"
|
||||
FAMILY="atrium galena sygna counsel compass insider arbiter lexicon agora panorama parafa scribe"
|
||||
# The modules that ship switched off, each under a compose profile of its own name (compose.yaml).
|
||||
PROFILED="compass insider arbiter lexicon agora panorama"
|
||||
PROFILED="compass insider arbiter lexicon agora panorama parafa scribe"
|
||||
refuse() { printf 'init: %s\n' "$*" >&2; exit 2; }
|
||||
usage() { sed -n '2,/^set -euo pipefail$/p' "${BASH_SOURCE[0]}" | sed -e '$d' -e 's/^# \{0,1\}//'; }
|
||||
|
||||
@@ -428,8 +430,9 @@ write_app_files() {
|
||||
set_key "$runtime" MODEL_PROVIDER_MIGRATOR_ROLES "$ROLE_PREFIX"compass_migrator,"$ROLE_PREFIX"arbiter_migrator
|
||||
# The modules that take part in the shared event log (dredd-core 0.20.0, revision 0011); like
|
||||
# the opt-ins above, each takes effect once its role is also an identity reader.
|
||||
# Agora emits (a round from the other side); Panorama only reads (dredd-core 0.23.0's reader tier).
|
||||
set_key "$runtime" MODULE_EVENT_EMITTER_ROLES "$ROLE_PREFIX"galena_app,"$ROLE_PREFIX"compass_app,"$ROLE_PREFIX"agora_app
|
||||
# Agora emits (a round from the other side), Parafa too (document.signed); Panorama only reads
|
||||
# (dredd-core 0.23.0's reader tier).
|
||||
set_key "$runtime" MODULE_EVENT_EMITTER_ROLES "$ROLE_PREFIX"galena_app,"$ROLE_PREFIX"compass_app,"$ROLE_PREFIX"agora_app,"$ROLE_PREFIX"parafa_app
|
||||
set_key "$runtime" MODULE_EVENT_READER_ROLES "$ROLE_PREFIX"panorama_app
|
||||
# The shared counterparty register (dredd-core 0.21.0, revision 0012): Sygna writes, Compass
|
||||
# reads, both migrators move their own counterparties in. Each takes effect once joined.
|
||||
@@ -487,9 +490,19 @@ write_app_files() {
|
||||
set_key "$runtime" APP_BASE_URL "$PUBLIC/panorama"
|
||||
# Every module's PUBLIC address (hairpins through the front door): Panorama asks each one's
|
||||
# /api/v1/stats with the viewer's own token.
|
||||
for other in galena sygna counsel compass arbiter lexicon agora insider; do
|
||||
for other in galena sygna counsel compass arbiter lexicon agora parafa scribe insider; do
|
||||
set_key "$runtime" "$(printf '%s' "$other" | tr '[:lower:]' '[:upper:]')_BASE_URL" "$PUBLIC/$other"
|
||||
done ;;
|
||||
parafa)
|
||||
set_key "$runtime" APP_BASE_URL "$PUBLIC/parafa"
|
||||
# A request on a Galena document reads it and writes the signed PDF back as a new version,
|
||||
# with the person's own token. The signer's files are the operator's (PARAFA_SIGNER_DIR).
|
||||
set_key "$runtime" GALENA_BASE_URL "$PUBLIC/galena" ;;
|
||||
scribe)
|
||||
set_key "$runtime" APP_BASE_URL "$PUBLIC/scribe"
|
||||
# Clauses come from Lexicon and exports go to Galena, each with the person's own token.
|
||||
set_key "$runtime" LEXICON_URL "$PUBLIC/lexicon"
|
||||
set_key "$runtime" GALENA_URL "$PUBLIC/galena" ;;
|
||||
esac
|
||||
WRITTEN="$WRITTEN $runtime $migrate"
|
||||
}
|
||||
@@ -527,7 +540,7 @@ if [ -n "$ADD" ]; then
|
||||
add_to_list "$OUT/env/atrium.env" IDENTITY_MIGRATOR_ROLES "$ROLE_PREFIX${ADD}_migrator"
|
||||
CHANGED="$CHANGED\n env/atrium.env IDENTITY_READER_ROLES += $ROLE_PREFIX${ADD}_app, IDENTITY_MIGRATOR_ROLES += $ROLE_PREFIX${ADD}_migrator"
|
||||
# Galena and Compass take part in the shared event log (push.sh checks them with --events).
|
||||
case $ADD in galena|compass|agora)
|
||||
case $ADD in galena|compass|agora|parafa)
|
||||
add_to_list "$OUT/env/atrium.env" MODULE_EVENT_EMITTER_ROLES "$ROLE_PREFIX${ADD}_app"
|
||||
CHANGED="$CHANGED\n env/atrium.env MODULE_EVENT_EMITTER_ROLES += $ROLE_PREFIX${ADD}_app" ;;
|
||||
esac
|
||||
|
||||
@@ -21,9 +21,9 @@ both modes (the front door)
|
||||
- apart from the front door on each module's `<app>` network, no two apps share any network
|
||||
|
||||
local (Option A, this box's own PostgreSQL)
|
||||
- the twenty-one services: postgres, and <app>-migrate and <app>-backend for the ten apps (Insider's
|
||||
- the twenty-five services: postgres, and <app>-migrate and <app>-backend for the twelve apps (Insider's
|
||||
optional OCR worker is under its own `ocr` profile, which the preflight does not activate)
|
||||
- postgres on all ten `<app>-db` networks; each module backend on its `<app>` + `<app>-db` networks,
|
||||
- postgres on all twelve `<app>-db` networks; each module backend on its `<app>` + `<app>-db` networks,
|
||||
atrium-backend on `atrium` + `atrium-db` + every module's `<app>`; each one-shot on `<app>-db` only;
|
||||
everything that connects waits for postgres
|
||||
- postgres keeps its data in a named volume, mounts local-db/ read-only as its init directory, probes
|
||||
@@ -41,13 +41,14 @@ local (Option A, this box's own PostgreSQL)
|
||||
|
||||
managed (Option B, a managed PostgreSQL provider)
|
||||
- postgres is switched off (absent from the rendered model, or present only under a profile), the
|
||||
other twenty services are there
|
||||
other twenty-four services are there
|
||||
- no service is on any `<app>-db` network: each module backend on its `<app>` network only,
|
||||
atrium-backend on `atrium` + every module's `<app>`, each one-shot on the default network only (the
|
||||
one-shots listen on nothing and exit; that is the one network two apps' services share, and no
|
||||
backend is on it); nothing waits for postgres
|
||||
- all twenty app services mount the provider's CA read-only at /run/certs/db-ca.crt; Galena's,
|
||||
Sygna's, Insider's, Arbiter's, Lexicon's, Agora's and Panorama's data volumes survived the merge
|
||||
- all twenty-four app services mount the provider's CA read-only at /run/certs/db-ca.crt; Galena's,
|
||||
Sygna's, Insider's, Arbiter's, Lexicon's, Agora's, Panorama's,
|
||||
Parafa's and Scribe's data volumes survived the merge
|
||||
|
||||
Standard library only. Exit 0 = every property holds, 1 = a property failed (each one printed),
|
||||
2 = the model could not be read.
|
||||
@@ -58,13 +59,15 @@ import json
|
||||
import sys
|
||||
|
||||
HUB = "atrium"
|
||||
MODULES = ("galena", "sygna", "counsel", "compass", "insider", "arbiter", "lexicon", "agora", "panorama")
|
||||
MODULES = ("galena", "sygna", "counsel", "compass", "insider", "arbiter", "lexicon", "agora", "panorama",
|
||||
"parafa", "scribe")
|
||||
APPS = (HUB, *MODULES)
|
||||
FRONT_DOOR = f"{HUB}-backend"
|
||||
PG = "postgres"
|
||||
CA_TARGET = "/run/certs/db-ca.crt"
|
||||
DATA_VOLUMES = {"galena": "/data", "sygna": "/data", "insider": "/data", "arbiter": "/data",
|
||||
"lexicon": "/data", "agora": "/data", "panorama": "/data"}
|
||||
"lexicon": "/data", "agora": "/data", "panorama": "/data", "parafa": "/data",
|
||||
"scribe": "/data"}
|
||||
#: Optional workers, each under a compose profile of its own that the preflight never activates — so the
|
||||
#: rendered model leaves them out, while compose.yaml read as YAML (test_deploy_front_door_kit.py) has
|
||||
#: them. Either way they are held to the same rules: the profile, no ports, no migrator URL, and (Option
|
||||
|
||||
@@ -47,10 +47,11 @@ _envfile_value_pick() {
|
||||
}
|
||||
|
||||
# Compose's own settings (deploy/.env): the ones the kit reads besides Compose.
|
||||
# COMPOSE_PROFILES is how a module ships in the kit switched off (Compass, Insider, Arbiter, Lexicon, Agora, Panorama) and is switched on per box.
|
||||
# COMPOSE_PROFILES is how a module ships in the kit switched off (Compass, Insider, Arbiter, Lexicon, Agora, Panorama, Parafa, Scribe) and is switched on per box.
|
||||
# PARAFA_SIGNER_DIR is the host directory compose.yaml mounts read-only into parafa-backend.
|
||||
# The TLS switch (compose.tls.yaml): TLS, the site's ATRIUM_DOMAIN, ACME_EMAIL, ACME_STAGING,
|
||||
# HSTS_MAX_AGE, and COMPOSE_FILE, which is how a plain `docker compose up` finds that override.
|
||||
COMPOSE_KEYS="MODULES_DIR DB_CA_FILE DEPLOY_ENV_DIR LOCAL_DB_NAME COMPOSE_PROFILES ATRIUM_DOMAIN TLS ACME_EMAIL ACME_STAGING HSTS_MAX_AGE COMPOSE_FILE INSIDER_MEM_LIMIT"
|
||||
COMPOSE_KEYS="MODULES_DIR DB_CA_FILE DEPLOY_ENV_DIR LOCAL_DB_NAME COMPOSE_PROFILES ATRIUM_DOMAIN TLS ACME_EMAIL ACME_STAGING HSTS_MAX_AGE COMPOSE_FILE INSIDER_MEM_LIMIT PARAFA_SIGNER_DIR"
|
||||
|
||||
# compose_env_read FILE: sets COMPOSE_FILE_<KEY> for every key of COMPOSE_KEYS that FILE sets (empty when it
|
||||
# doesn't). A missing FILE sets them all empty. Other keys are ignored. Returns 1 on a malformed line.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Module checkouts
|
||||
|
||||
`deploy/compose.yaml` builds Galena, Sygna and Counsel Scorecard from `${MODULES_DIR}/galena`,
|
||||
`${MODULES_DIR}/sygna` and `${MODULES_DIR}/counsel` (and Compass from `${MODULES_DIR}/compass/apps/compass`, Arbiter from `${MODULES_DIR}/compass/apps/arbiter`, Insider from `${MODULES_DIR}/insider`, Lexicon, Agora and Panorama from `${MODULES_DIR}/lexicon`, `/agora` and `/panorama`),
|
||||
`${MODULES_DIR}/sygna` and `${MODULES_DIR}/counsel` (and Compass from `${MODULES_DIR}/compass/apps/compass`, Arbiter from `${MODULES_DIR}/compass/apps/arbiter`, Insider from `${MODULES_DIR}/insider`, Lexicon, Agora, Panorama, Parafa and Scribe from `${MODULES_DIR}/lexicon`, `/agora`, `/panorama`, `/parafa` and `/scribe`),
|
||||
each image with a second build context, `frontend`, the module's console, which the image serves itself. Atrium itself is the repository this directory is in.
|
||||
`MODULES_DIR` is set in `deploy/.env`, which Compose, `push.sh` and `preflight.sh` all read (`init.sh
|
||||
--modules-dir` writes it).
|
||||
|
||||
+28
-23
@@ -100,7 +100,7 @@ missing=""
|
||||
# Arbiter has no checkout of its own: it is a second app inside the compass checkout (module_checkout).
|
||||
module_subdir() { case $1 in compass) printf 'apps/compass' ;; arbiter) printf 'apps/arbiter' ;; *) printf '' ;; esac; }
|
||||
module_checkout() { case $1 in arbiter) printf 'compass' ;; *) printf '%s' "$1" ;; esac; }
|
||||
for slug in galena sygna counsel compass insider arbiter lexicon agora panorama; do
|
||||
for slug in galena sygna counsel compass insider arbiter lexicon agora panorama parafa scribe; do
|
||||
sub=$(module_subdir "$slug")
|
||||
[ -d "$modules/$(module_checkout "$slug")${sub:+/$sub}/backend" ] || missing="$missing $slug"
|
||||
done
|
||||
@@ -117,7 +117,7 @@ kit_modules=$modules
|
||||
if [ -n "$missing" ]; then
|
||||
kit_modules=$tmp/modules
|
||||
echo " (steps 2, 5 and 6 use empty stand-ins for every module: they check the kit's files, not the modules)"
|
||||
for slug in galena sygna counsel compass insider arbiter lexicon agora panorama; do
|
||||
for slug in galena sygna counsel compass insider arbiter lexicon agora panorama parafa scribe; do
|
||||
sub=$(module_subdir "$slug")
|
||||
root=$tmp/modules/$(module_checkout "$slug")${sub:+/$sub}
|
||||
mkdir -p "$root/backend" "$root/frontend" "$root/db/managed"
|
||||
@@ -169,7 +169,7 @@ CLEAN_KEYS="$COMPOSE_KEYS POSTGRES_PASSWORD
|
||||
MANAGED_DB_MAX_CONNECTIONS
|
||||
DB_POOL_SIZE DB_MAX_OVERFLOW CHECK_REQUIRE_TLS PLATFORM_IDENTITY_SCHEMA
|
||||
DB_HOST DB_PORT DB_NAME ROLE_PREFIX OUT"
|
||||
for upper in ATRIUM GALENA SYGNA COUNSEL COMPASS INSIDER ARBITER LEXICON AGORA PANORAMA; do
|
||||
for upper in ATRIUM GALENA SYGNA COUNSEL COMPASS INSIDER ARBITER LEXICON AGORA PANORAMA PARAFA SCRIBE; do
|
||||
for suffix in MIGRATOR_PASSWORD APP_PASSWORD MIGRATOR_ROLE APP_ROLE PYTHON; do
|
||||
CLEAN_KEYS="$CLEAN_KEYS ${upper}_$suffix"
|
||||
done
|
||||
@@ -180,11 +180,11 @@ for key in $CLEAN_KEYS; do CLEAN_ARGS+=(-u "$key"); done
|
||||
clean() { env "${CLEAN_ARGS[@]}" "$@"; }
|
||||
compose() {
|
||||
clean docker compose --project-directory "$DEPLOY_DIR" -f "$DEPLOY_DIR/compose.yaml" --env-file "$tmp/.env" \
|
||||
--profile compass --profile insider --profile arbiter --profile lexicon --profile agora --profile panorama "$@"
|
||||
--profile compass --profile insider --profile arbiter --profile lexicon --profile agora --profile panorama --profile parafa --profile scribe "$@"
|
||||
}
|
||||
compose_managed_db() {
|
||||
clean docker compose --project-directory "$DEPLOY_DIR" -f "$DEPLOY_DIR/compose.yaml" \
|
||||
-f "$DEPLOY_DIR/compose.managed-db.yaml" --env-file "$tmp/.env.managed-db" --profile compass --profile insider --profile arbiter --profile lexicon --profile agora --profile panorama "$@"
|
||||
-f "$DEPLOY_DIR/compose.managed-db.yaml" --env-file "$tmp/.env.managed-db" --profile compass --profile insider --profile arbiter --profile lexicon --profile agora --profile panorama --profile parafa --profile scribe "$@"
|
||||
}
|
||||
# Steps 2 and 2b render with every profile a module can be switched on by, so a switched-off module is
|
||||
# still checked like the others. Step 2c renders WITHOUT them, which is what a box that has not deployed
|
||||
@@ -205,7 +205,7 @@ elif ! compose config -q; then
|
||||
else
|
||||
ok "compose.yaml is valid"
|
||||
services=$(compose config --services | sort | tr '\n' ' ') || services="(failed)"
|
||||
expected="agora-backend agora-migrate arbiter-backend arbiter-migrate atrium-backend atrium-migrate compass-backend compass-migrate counsel-backend counsel-migrate galena-backend galena-migrate insider-backend insider-migrate lexicon-backend lexicon-migrate panorama-backend panorama-migrate postgres sygna-backend sygna-migrate "
|
||||
expected="agora-backend agora-migrate arbiter-backend arbiter-migrate atrium-backend atrium-migrate compass-backend compass-migrate counsel-backend counsel-migrate galena-backend galena-migrate insider-backend insider-migrate lexicon-backend lexicon-migrate panorama-backend panorama-migrate parafa-backend parafa-migrate postgres scribe-backend scribe-migrate sygna-backend sygna-migrate "
|
||||
if [ "$services" = "$expected" ]; then ok "services: $services"; else bad "services are '$services', expected '$expected'"; fi
|
||||
compose config --format json > "$tmp/compose.json" || bad "docker compose config --format json"
|
||||
if "$PYTHON" "$DEPLOY_DIR/lib/compose_checks.py" local "$tmp/compose.json"; then
|
||||
@@ -225,7 +225,7 @@ elif ! compose_managed_db config -q; then
|
||||
else
|
||||
ok "the merge is valid"
|
||||
services=$(compose_managed_db config --services | sort | tr '\n' ' ') || services="(failed)"
|
||||
expected="agora-backend agora-migrate arbiter-backend arbiter-migrate atrium-backend atrium-migrate compass-backend compass-migrate counsel-backend counsel-migrate galena-backend galena-migrate insider-backend insider-migrate lexicon-backend lexicon-migrate panorama-backend panorama-migrate sygna-backend sygna-migrate "
|
||||
expected="agora-backend agora-migrate arbiter-backend arbiter-migrate atrium-backend atrium-migrate compass-backend compass-migrate counsel-backend counsel-migrate galena-backend galena-migrate insider-backend insider-migrate lexicon-backend lexicon-migrate panorama-backend panorama-migrate parafa-backend parafa-migrate scribe-backend scribe-migrate sygna-backend sygna-migrate "
|
||||
if [ "$services" = "$expected" ]; then ok "services: $services (postgres switched off)"; else bad "services are '$services', expected '$expected'"; fi
|
||||
compose_managed_db config --format json > "$tmp/compose.managed-db.json" || bad "docker compose config --format json (merged)"
|
||||
if "$PYTHON" "$DEPLOY_DIR/lib/compose_checks.py" managed "$tmp/compose.managed-db.json"; then
|
||||
@@ -246,21 +246,23 @@ else
|
||||
mkdir -p "$tmp/env-aside"
|
||||
mv "$tmp/env/compass.env" "$tmp/env/compass.migrate.env" "$tmp/env/insider.env" "$tmp/env/insider.migrate.env" \
|
||||
"$tmp/env/arbiter.env" "$tmp/env/arbiter.migrate.env" "$tmp/env/lexicon.env" "$tmp/env/lexicon.migrate.env" \
|
||||
"$tmp/env/agora.env" "$tmp/env/agora.migrate.env" "$tmp/env/panorama.env" "$tmp/env/panorama.migrate.env" "$tmp/env-aside/"
|
||||
"$tmp/env/agora.env" "$tmp/env/agora.migrate.env" "$tmp/env/panorama.env" "$tmp/env/panorama.migrate.env" \
|
||||
"$tmp/env/parafa.env" "$tmp/env/parafa.migrate.env" "$tmp/env/scribe.env" "$tmp/env/scribe.migrate.env" "$tmp/env-aside/"
|
||||
if ! compose_off config -q 2> "$tmp/compose-off.err"; then
|
||||
sed 's/^/ | /' "$tmp/compose-off.err"
|
||||
bad "without the switched-off modules' env files and with their profiles off, docker compose config fails: a pull would break every compose command on a box that has not deployed them"
|
||||
else
|
||||
services=$(compose_off config --services | sort | tr '\n' ' ') || services="(failed)"
|
||||
case " $services " in
|
||||
*" compass-"*|*" insider-"*|*" arbiter-"*|*" lexicon-"*|*" agora-"*|*" panorama-"*) bad "a switched-off module's services are active without the profile: $services" ;;
|
||||
*" compass-"*|*" insider-"*|*" arbiter-"*|*" lexicon-"*|*" agora-"*|*" panorama-"*|*" parafa-"*|*" scribe-"*) bad "a switched-off module's services are active without the profile: $services" ;;
|
||||
*) ok "the switched-off modules' env files absent and their profiles off: the kit loads, and up -d would start none of them" ;;
|
||||
esac
|
||||
fi
|
||||
mv "$tmp/env-aside/compass.env" "$tmp/env-aside/compass.migrate.env" "$tmp/env-aside/insider.env" "$tmp/env-aside/insider.migrate.env" \
|
||||
"$tmp/env-aside/arbiter.env" "$tmp/env-aside/arbiter.migrate.env" "$tmp/env-aside/lexicon.env" \
|
||||
"$tmp/env-aside/lexicon.migrate.env" "$tmp/env-aside/agora.env" "$tmp/env-aside/agora.migrate.env" \
|
||||
"$tmp/env-aside/panorama.env" "$tmp/env-aside/panorama.migrate.env" "$tmp/env/"
|
||||
"$tmp/env-aside/panorama.env" "$tmp/env-aside/panorama.migrate.env" "$tmp/env-aside/parafa.env" \
|
||||
"$tmp/env-aside/parafa.migrate.env" "$tmp/env-aside/scribe.env" "$tmp/env-aside/scribe.migrate.env" "$tmp/env/"
|
||||
fi
|
||||
|
||||
step "2d. optional TLS: compose.tls.yaml merged, with TLS=on example settings"
|
||||
@@ -281,7 +283,7 @@ else
|
||||
files=(-f "$DEPLOY_DIR/compose.yaml" -f "$DEPLOY_DIR/compose.managed-db.yaml" -f "$DEPLOY_DIR/compose.tls.yaml")
|
||||
envf=$tmp/.env.managed-db.tls
|
||||
fi
|
||||
if ! clean docker compose --project-directory "$DEPLOY_DIR" "${files[@]}" --env-file "$envf" --profile compass --profile insider --profile arbiter --profile lexicon --profile agora --profile panorama \
|
||||
if ! clean docker compose --project-directory "$DEPLOY_DIR" "${files[@]}" --env-file "$envf" --profile compass --profile insider --profile arbiter --profile lexicon --profile agora --profile panorama --profile parafa --profile scribe \
|
||||
config --format json > "$tmp/compose.$shape.tls.json"; then
|
||||
bad "docker compose config ($shape + compose.tls.yaml)"
|
||||
elif "$PYTHON" "$DEPLOY_DIR/lib/compose_checks.py" "$shape" "$tmp/compose.$shape.tls.json" --tls; then
|
||||
@@ -311,7 +313,7 @@ step "4. header parity: each module exposes the FRAME_ANCESTORS switch the kit s
|
||||
# Atrium tab framing it would go blank with nothing in any log. So each checkout must carry the field
|
||||
# (default 'none'), the validator that refuses anything but 'none' / 'self', and the SAMEORIGIN its edge
|
||||
# stamps for 'self'. The headers' VALUES are each module's own tests' business (tests/test_edge.py there).
|
||||
for slug in galena sygna counsel compass insider arbiter lexicon agora panorama; do
|
||||
for slug in galena sygna counsel compass insider arbiter lexicon agora panorama parafa scribe; do
|
||||
sub=$(module_subdir "$slug")
|
||||
app=$modules/$(module_checkout "$slug")${sub:+/$sub}/backend/app
|
||||
if [ ! -d "$app" ]; then
|
||||
@@ -410,8 +412,8 @@ if clean bash "$DEPLOY_DIR/init.sh" --ip 203.0.113.10 --modules-dir "$kit_module
|
||||
# An active KEY=VALUE line holding a <placeholder> (the templates' comments are allowed to).
|
||||
if grep -Eq '^[A-Z_]+=.*<[a-z-]+>' "$file"; then placeholders="$placeholders ${file#"$init_out"/}"; fi
|
||||
done
|
||||
# Two per app (runtime + migrate) for ten apps, plus .env and db.env.
|
||||
if [ "$written" = 22 ]; then ok "22 files written"; else bad "$written files written, expected 22"; fi
|
||||
# Two per app (runtime + migrate) for twelve apps, plus .env and db.env.
|
||||
if [ "$written" = 26 ]; then ok "26 files written"; else bad "$written files written, expected 26"; fi
|
||||
if [ -z "$wrong_mode" ]; then ok "every file is mode 600$([ -z "$(file_mode "$init_out/.env")" ] && printf ' (not checked on this platform)')"; else bad "not mode 600:$wrong_mode"; fi
|
||||
if [ -z "$placeholders" ]; then ok "no <placeholder> left"; else bad "placeholders left in:$placeholders"; fi
|
||||
# One site, four paths: the address in ATRIUM_DOMAIN, a ROOT_PATH per app (the other half of the front
|
||||
@@ -458,7 +460,7 @@ if clean bash "$DEPLOY_DIR/init.sh" --ip 203.0.113.10 --modules-dir "$kit_module
|
||||
# app's env file, one cookie name, and the hub's grants naming the modules that ship switched on.
|
||||
one_account=1
|
||||
grep -q '^PLATFORM_IDENTITY_SCHEMA=dredd$' "$init_out/db.env" || one_account=0
|
||||
for slug in atrium galena sygna counsel compass insider arbiter lexicon agora panorama; do
|
||||
for slug in atrium galena sygna counsel compass insider arbiter lexicon agora panorama parafa scribe; do
|
||||
grep -q '^IDENTITY_SCHEMA=dredd$' "$init_out/env/$slug.env" || one_account=0
|
||||
grep -q '^SESSION_COOKIE_NAME=dredd_session$' "$init_out/env/$slug.env" || one_account=0
|
||||
done
|
||||
@@ -540,11 +542,12 @@ if clean bash "$DEPLOY_DIR/init.sh" --ip 203.0.113.10 --modules-dir "$kit_module
|
||||
sed 's/^/ | /' "$tmp/dry-run.init.arbiter.log"
|
||||
bad "push.sh --dry-run with Arbiter switched on (and listed) is not complete, or does not include arbiter"
|
||||
fi
|
||||
# Lexicon, Agora and Panorama (M2-M4) together: their opt-ins (model-provider key reader, event emitter,
|
||||
# event reader) are in env/atrium.env from the first init, so only the identity lists change here.
|
||||
all_profiles=compass,insider,arbiter,lexicon,agora,panorama
|
||||
sed -e 's/^IDENTITY_READER_ROLES=.*/&,lexicon_app,agora_app,panorama_app/' \
|
||||
-e 's/^IDENTITY_MIGRATOR_ROLES=.*/&,lexicon_migrator,agora_migrator,panorama_migrator/' \
|
||||
# Lexicon, Agora, Panorama, Parafa and Scribe (M2-M4, M6, M7) together: their opt-ins (model-provider
|
||||
# key reader, event emitters, event reader) are in env/atrium.env from the first init, so only the
|
||||
# identity lists change here.
|
||||
all_profiles=compass,insider,arbiter,lexicon,agora,panorama,parafa,scribe
|
||||
sed -e 's/^IDENTITY_READER_ROLES=.*/&,lexicon_app,agora_app,panorama_app,parafa_app,scribe_app/' \
|
||||
-e 's/^IDENTITY_MIGRATOR_ROLES=.*/&,lexicon_migrator,agora_migrator,panorama_migrator,parafa_migrator,scribe_migrator/' \
|
||||
"$init_out/env/atrium.env" > "$tmp/atrium.env.m2m4" && install -m 600 "$tmp/atrium.env.m2m4" "$init_out/env/atrium.env"
|
||||
if clean env COMPOSE_PROFILES=$all_profiles bash "$DEPLOY_DIR/push.sh" --dry-run --db-env "$init_out/db.env" \
|
||||
--compose-env "$init_out/.env" > "$tmp/dry-run.init.m2m4.log" 2>&1 \
|
||||
@@ -552,11 +555,13 @@ if clean bash "$DEPLOY_DIR/init.sh" --ip 203.0.113.10 --modules-dir "$kit_module
|
||||
&& grep -q "^\[lexicon\] schema lexicon, roles " "$tmp/dry-run.init.m2m4.log" \
|
||||
&& grep -q "^\[agora\] schema agora, roles " "$tmp/dry-run.init.m2m4.log" \
|
||||
&& grep -q "^\[panorama\] schema panorama, roles " "$tmp/dry-run.init.m2m4.log" \
|
||||
&& grep -q "^ budget 10 apps" "$tmp/dry-run.init.m2m4.log"; then
|
||||
ok "with every profile on and every module's roles listed the files are complete, the plan includes lexicon, agora and panorama, and the budget counts ten apps"
|
||||
&& grep -q "^\[parafa\] schema parafa, roles " "$tmp/dry-run.init.m2m4.log" \
|
||||
&& grep -q "^\[scribe\] schema scribe, roles " "$tmp/dry-run.init.m2m4.log" \
|
||||
&& grep -q "^ budget 12 apps" "$tmp/dry-run.init.m2m4.log"; then
|
||||
ok "with every profile on and every module's roles listed the files are complete, the plan includes lexicon, agora, panorama, parafa and scribe, and the budget counts twelve apps"
|
||||
else
|
||||
sed 's/^/ | /' "$tmp/dry-run.init.m2m4.log"
|
||||
bad "push.sh --dry-run with Lexicon, Agora and Panorama switched on (and listed) is not complete, or does not include them"
|
||||
bad "push.sh --dry-run with Lexicon, Agora, Panorama, Parafa and Scribe switched on (and listed) is not complete, or does not include them"
|
||||
fi
|
||||
# The opt-out: separate accounts per app, written whole, and a push that accepts it as it stands.
|
||||
if clean bash "$DEPLOY_DIR/init.sh" --ip 203.0.113.10 --standalone --modules-dir "$kit_modules" \
|
||||
|
||||
+23
-13
@@ -8,11 +8,12 @@
|
||||
# [--stop-backend] [--lock-timeout DURATION]
|
||||
# [--db-env FILE] [--compose-env FILE] [--env-dir DIR]
|
||||
# [atrium] [galena] [sygna] [counsel] [compass] [insider] [arbiter] [lexicon] [agora]
|
||||
# [panorama]
|
||||
# [panorama] [parafa] [scribe]
|
||||
#
|
||||
# No app named = every DEPLOYED app: all four, plus compass, insider, arbiter, lexicon, agora and
|
||||
# panorama when COMPOSE_PROFILES names them (deploy/.env). Apps always run in the family order
|
||||
# (atrium, galena, sygna, counsel, compass, insider, arbiter, lexicon, agora, panorama).
|
||||
# No app named = every DEPLOYED app: all four, plus compass, insider, arbiter, lexicon, agora,
|
||||
# panorama, parafa and scribe when COMPOSE_PROFILES names them (deploy/.env). Apps always run in the
|
||||
# family order (atrium, galena, sygna, counsel, compass, insider, arbiter, lexicon, agora, panorama,
|
||||
# parafa, scribe).
|
||||
#
|
||||
# 1. preflight before anything connects, for EVERY selected app: the platform admin's URL is
|
||||
# well-formed; the app's env files match deploy/db.env as its <app>-migrate AND its
|
||||
@@ -116,9 +117,9 @@ CONTAINER_CA=/run/certs/db-ca.crt
|
||||
MANAGED_DB_COMPOSE=$DEPLOY_DIR/compose.managed-db.yaml
|
||||
# The database service of compose.yaml, which is also LOCAL_DB_HOST's default.
|
||||
LOCAL_DB_SERVICE=postgres
|
||||
FAMILY="atrium galena sygna counsel compass insider arbiter lexicon agora panorama"
|
||||
FAMILY="atrium galena sygna counsel compass insider arbiter lexicon agora panorama parafa scribe"
|
||||
# The modules that ship in the kit switched OFF, each under a compose profile of its own name.
|
||||
PROFILED="compass insider arbiter lexicon agora panorama"
|
||||
PROFILED="compass insider arbiter lexicon agora panorama parafa scribe"
|
||||
# The Compose service every step of the platform admin runs in.
|
||||
PROVISIONER=atrium-migrate
|
||||
ORIG_ARGS=("$@")
|
||||
@@ -155,7 +156,7 @@ while [ $# -gt 0 ]; do
|
||||
--env-dir) [ $# -ge 2 ] || refuse "--env-dir needs a directory"; ENV_DIR_ARG=$2; shift ;;
|
||||
--env-dir=*) ENV_DIR_ARG=${1#*=} ;;
|
||||
-h|--help) usage; exit 0 ;;
|
||||
atrium|galena|sygna|counsel|compass|insider|arbiter|lexicon|agora|panorama) SELECTED="$SELECTED $1" ;;
|
||||
atrium|galena|sygna|counsel|compass|insider|arbiter|lexicon|agora|panorama|parafa|scribe) SELECTED="$SELECTED $1" ;;
|
||||
*) refuse "unknown argument: $1 (see --help)" ;;
|
||||
esac
|
||||
shift
|
||||
@@ -200,7 +201,7 @@ push_key() { # the settings deploy/db.env may carry (anything else is refused,
|
||||
# alembic and seed in --local mode, where env/<app>.env is silent about it, and the migration
|
||||
# would run with a setting the deployed backend will not have.
|
||||
PLATFORM_IDENTITY_SCHEMA) return 0 ;;
|
||||
ATRIUM_*|GALENA_*|SYGNA_*|COUNSEL_*|COMPASS_*|INSIDER_*|ARBITER_*|LEXICON_*|AGORA_*|PANORAMA_*)
|
||||
ATRIUM_*|GALENA_*|SYGNA_*|COUNSEL_*|COMPASS_*|INSIDER_*|ARBITER_*|LEXICON_*|AGORA_*|PANORAMA_*|PARAFA_*|SCRIBE_*)
|
||||
case ${1#*_} in MIGRATOR_PASSWORD|APP_PASSWORD|MIGRATOR_ROLE|APP_ROLE|PYTHON) return 0 ;; esac ;;
|
||||
esac
|
||||
return 1
|
||||
@@ -305,7 +306,7 @@ resolve_compose_key() {
|
||||
resolve_compose_key MODULES_DIR ./modules; MODULES_ROOT=$(abspath "$RESOLVED") MODULES_SOURCE=$SOURCE
|
||||
resolve_compose_key DEPLOY_ENV_DIR ./env; ENV_DIR=$(abspath "$RESOLVED") ENV_DIR_SOURCE=$SOURCE
|
||||
|
||||
# Compass, Insider, Arbiter, Lexicon, Agora and Panorama ship in the kit switched OFF: compose.yaml puts their services under a profile
|
||||
# Compass, Insider, Arbiter, Lexicon, Agora, Panorama, Parafa and Scribe ship in the kit switched OFF: compose.yaml puts their services under a profile
|
||||
# of the module's own name, so `docker compose up -d` leaves each alone until deploy/.env names it in
|
||||
# COMPOSE_PROFILES. A push with no app named follows the same switch — otherwise the four deployed apps
|
||||
# would be held up by one that is not, refused over env files and passwords nobody has written yet.
|
||||
@@ -362,6 +363,8 @@ module_repo() {
|
||||
lexicon) printf 'https://github.com/Alpaq92/Lexicon' ;;
|
||||
agora) printf 'https://github.com/Alpaq92/Agora' ;;
|
||||
panorama) printf 'https://github.com/Alpaq92/Panorama' ;;
|
||||
parafa) printf 'https://github.com/Alpaq92/Parafa' ;;
|
||||
scribe) printf 'https://github.com/Alpaq92/Scribe' ;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -418,6 +421,12 @@ app_setup() { # sets the per-app globals for $1
|
||||
agora) UP=AGORA; EXTENSIONS=""
|
||||
CHECK_EXTRA="--append-only audit_log module_event module_event_receipt --no-delete negotiation_room negotiation_round negotiation_comment" ;;
|
||||
panorama) UP=PANORAMA; EXTENSIONS=""; CHECK_EXTRA="--append-only audit_log" ;;
|
||||
# Parafa and Scribe (M6, M7): the same rule, their app.models lists (test_deploy_m6_m7_check_args.py).
|
||||
# Parafa's event tables are Agora's case (it emits document.signed: --events); a signing request is
|
||||
# evidence and is never deleted. Scribe takes no part in the event log; an export is never deleted.
|
||||
parafa) UP=PARAFA; EXTENSIONS=""
|
||||
CHECK_EXTRA="--append-only audit_log module_event module_event_receipt --no-delete signing_request" ;;
|
||||
scribe) UP=SCRIBE; EXTENSIONS=""; CHECK_EXTRA="--append-only audit_log --no-delete draft_export" ;;
|
||||
esac
|
||||
SCHEMA=$slug
|
||||
local var tier
|
||||
@@ -469,8 +478,9 @@ app_setup() { # sets the per-app globals for $1
|
||||
# db_grants EVENTS_CHECK_ARGS is this flag.
|
||||
# Only once the module itself pins dredd-core 0.20.0 or later: an older pin's `managed check` has
|
||||
# no --events flag and would refuse the whole check (Compass was held on 0.18.1 at f358ef7).
|
||||
# Agora emits too (a round from the other side; it pins 0.22.0, so always --events).
|
||||
case $slug in galena|compass|agora)
|
||||
# Agora emits too (a round from the other side; it pins 0.22.0, so always --events), and Parafa
|
||||
# (document.signed; it pins 0.23.0).
|
||||
case $slug in galena|compass|agora|parafa)
|
||||
pin=$(sed -n 's/^dredd-core @ .*@v\([0-9.]*\).*/\1/p' "$MODULE/backend/requirements.txt" 2>/dev/null | head -1 || true)
|
||||
case $pin in 0.[0-9].*|0.1[0-9].*) ;; *) IDENTITY_CHECK_ARGS="$IDENTITY_CHECK_ARGS --events" ;; esac ;;
|
||||
esac
|
||||
@@ -572,9 +582,9 @@ if [ "$MANAGED_DB" = 1 ]; then
|
||||
MAX_CONNECTIONS=${MANAGED_DB_MAX_CONNECTIONS:-}
|
||||
BUDGET_LIMIT_LABEL="the provider's connection limit"
|
||||
else
|
||||
# This box's own PostgreSQL: the limit is the server's max_connections (compose.yaml sets 170). Raise
|
||||
# This box's own PostgreSQL: the limit is the server's max_connections (compose.yaml sets 200). Raise
|
||||
# LOCAL_DB_MAX_CONNECTIONS with the server's setting if you change it.
|
||||
MAX_CONNECTIONS=${LOCAL_DB_MAX_CONNECTIONS:-170}
|
||||
MAX_CONNECTIONS=${LOCAL_DB_MAX_CONNECTIONS:-200}
|
||||
BUDGET_LIMIT_LABEL="the server's max_connections"
|
||||
fi
|
||||
is_number() { case $1 in ''|*[!0-9]*) return 1 ;; esac; }
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
.mi.h-teal { --mi-bg: #099268; --mi-fg: #e6fcf5; }
|
||||
.mi.h-green { --mi-bg: #2f9e44; --mi-fg: #ebfbee; }
|
||||
.mi.h-lime { --mi-bg: #5c940d; --mi-fg: #f4fce3; }
|
||||
.mi.h-yellow { --mi-bg: #e67700; --mi-fg: #fff9db; }
|
||||
.mi.h-orange { --mi-bg: #f76707; --mi-fg: #fff4e6; }
|
||||
.mi.h-red { --mi-bg: #e03131; --mi-fg: #fff5f5; }
|
||||
.mi.h-pink { --mi-bg: #c2255c; --mi-fg: #fff0f6; }
|
||||
|
||||
+1
-1
@@ -232,7 +232,7 @@ const GLYPH = {
|
||||
grid: _tab(ICN.grid),
|
||||
key: _tab(ICN.key),
|
||||
};
|
||||
const HUES = ['grape', 'violet', 'indigo', 'blue', 'cyan', 'teal', 'green', 'lime', 'orange', 'red', 'pink', 'gray'];
|
||||
const HUES = ['grape', 'violet', 'indigo', 'blue', 'cyan', 'teal', 'green', 'lime', 'yellow', 'orange', 'red', 'pink', 'gray'];
|
||||
|
||||
/* No size: the stylesheet sizes it (`.mi`, and per context such as `.app .mi`), so a breakpoint can
|
||||
resize it without fighting an inline style. */
|
||||
|
||||
Reference in New Issue
Block a user