M2-M4: Lexicon, Agora and Panorama join the platform (eighth to tenth modules)
- Submodules deploy/modules/{lexicon,agora,panorama} (each on main).
- compose: <slug>-migrate / <slug>-backend under profiles lexicon/agora/panorama,
networks 172.30.17-19.0/24 + db 172.30.27-29.0/24, FRAME_ANCESTORS 'self', no
ports, <slug>-data volumes, /healthz healthchecks; Lexicon gets
host.docker.internal; managed-db overlay follows; front door routes all three.
- Hub: dredd-core v0.23.0; MODULE_EVENT_READER_ROLES (event_grants_sql
reader_roles) for panorama_app; agora_app joins MODULE_EVENT_EMITTER_ROLES,
lexicon_app MODEL_PROVIDER_KEY_READER_ROLES.
- init.sh writes the env files and --add puts each in its tier; push.sh checks
each with its own evidence lists (--model-provider-keys / --events /
--events-reader) and refuses an unlisted tier up front.
- max_connections 170 for ten apps; catalogue tiles; RUNBOOK-m2-m4.md; tests.
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
|
||||
# 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=
|
||||
|
||||
# ── 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) into the module
|
||||
# The seed also puts the Dredd family (Galena, Sygna, Counsel Scorecard, Compass, Insider, Arbiter, Lexicon, Agora, Panorama) into the module
|
||||
# catalog — once per instance, without addresses; add those under Administration → Modules.
|
||||
|
||||
# ── App tokens ───────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -13,3 +13,12 @@
|
||||
[submodule "deploy/modules/insider"]
|
||||
path = deploy/modules/insider
|
||||
url = https://github.com/Alpaq92/Insider.git
|
||||
[submodule "deploy/modules/lexicon"]
|
||||
path = deploy/modules/lexicon
|
||||
url = https://github.com/Alpaq92/Lexicon
|
||||
[submodule "deploy/modules/agora"]
|
||||
path = deploy/modules/agora
|
||||
url = https://github.com/Alpaq92/Agora
|
||||
[submodule "deploy/modules/panorama"]
|
||||
path = deploy/modules/panorama
|
||||
url = https://github.com/Alpaq92/Panorama
|
||||
|
||||
@@ -125,6 +125,11 @@ class Settings(BaseSettings):
|
||||
# nothing in the log — which is what its `managed check` without `--events` proves. Removing a
|
||||
# role here and migrating revokes it.
|
||||
module_event_emitter_roles: str = ""
|
||||
# The READER tier (dredd-core 0.23.0): runtime roles that may SELECT the log and nothing else
|
||||
# (`panorama_app`, whose trends aggregate it and which says nothing itself). Same rules: only
|
||||
# once also in IDENTITY_READER_ROLES, removed = revoked on the next migrate, and a role is an
|
||||
# emitter or a reader, never both (the grant block refuses the overlap).
|
||||
module_event_reader_roles: str = ""
|
||||
# ── counterparties (dredd-core 0.21.0) ──────────────────────────────────────────
|
||||
# The shared counterparty register (`counterparty`, `counterparty_alias`, `counterparty_contact`)
|
||||
# lives in the identity schema (revision 0012, re-applied by `app.identity_grants` on every
|
||||
@@ -283,6 +288,10 @@ class Settings(BaseSettings):
|
||||
def module_event_emitter_roles_list(self) -> list[str]:
|
||||
return [r.strip() for r in self.module_event_emitter_roles.split(",") if r.strip()]
|
||||
|
||||
@property
|
||||
def module_event_reader_roles_list(self) -> list[str]:
|
||||
return [r.strip() for r in self.module_event_reader_roles.split(",") if r.strip()]
|
||||
|
||||
@property
|
||||
def counterparty_writer_roles_list(self) -> list[str]:
|
||||
return [r.strip() for r in self.counterparty_writer_roles.split(",") if r.strip()]
|
||||
|
||||
@@ -53,7 +53,7 @@ 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")
|
||||
MODULES = ("galena", "sygna", "counsel", "compass", "insider", "arbiter", "lexicon", "agora", "panorama")
|
||||
SLUGS = (ATRIUM, *MODULES)
|
||||
|
||||
#: Uploads above this are refused: 413 up front on a declared Content-Length, or as soon as a chunked
|
||||
@@ -63,8 +63,8 @@ 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"and /arbiter.")
|
||||
NOT_FOUND = (b"Not found. This server serves /atrium, /galena, /sygna, /counsel, /compass, /insider, "
|
||||
b"/arbiter, /lexicon, /agora and /panorama.")
|
||||
|
||||
# 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.
|
||||
|
||||
@@ -32,7 +32,8 @@ already in the identity lists), and the one-shot import door is opened or droppe
|
||||
**The module events** (dredd-core 0.20.0, revision ``0011``) ride along the same way: once the
|
||||
shared ``module_event`` exists, its row-level security (``event_policies_sql``) and its grant block
|
||||
(``event_grants_sql``) are re-applied, the emitters being the hub's own runtime role plus every role
|
||||
in ``MODULE_EVENT_EMITTER_ROLES`` that is also an identity reader (:func:`event_emitters`). Both blocks
|
||||
in ``MODULE_EVENT_EMITTER_ROLES`` that is also an identity reader (:func:`event_emitters`), the
|
||||
readers (dredd-core 0.23.0: ``SELECT`` only) every such role in ``MODULE_EVENT_READER_ROLES``. Both blocks
|
||||
are authoritative (a stray policy is dropped, a privilege nobody listed is revoked), so a module
|
||||
added to the list later gets its tier on its first deploy and one removed loses it on the next.
|
||||
|
||||
@@ -218,8 +219,16 @@ def event_emitters(settings: Settings) -> dict[str, list[str]]:
|
||||
readers = settings.identity_reader_roles_list
|
||||
wanted = settings.module_event_emitter_roles_list
|
||||
modules = [r for r in wanted if r in readers and r != settings.db_app_role]
|
||||
# The reader tier (dredd-core 0.23.0): SELECT only, for a module that reports on the log and emits
|
||||
# nothing (Panorama). Joined the same way; a role listed in both tiers is passed through to
|
||||
# event_grants_sql, which refuses the overlap by name rather than this guessing a tier.
|
||||
log_readers = [r for r in settings.module_event_reader_roles_list
|
||||
if r in readers and r != settings.db_app_role]
|
||||
return {"emitters": [settings.db_app_role, *dict.fromkeys(modules)],
|
||||
"pending": [r for r in wanted if r not in readers and r != settings.db_app_role]}
|
||||
"readers": list(dict.fromkeys(log_readers)),
|
||||
"pending": [r for r in wanted if r not in readers and r != settings.db_app_role]
|
||||
+ [r for r in settings.module_event_reader_roles_list
|
||||
if r not in readers and r != settings.db_app_role]}
|
||||
|
||||
|
||||
def event_table_exists(conn, schema: str) -> bool:
|
||||
@@ -243,13 +252,15 @@ def event_statements(settings: Settings, owner: str, conn) -> list[str]:
|
||||
return []
|
||||
from dredd_core import events
|
||||
|
||||
tiers = event_emitters(settings)
|
||||
try:
|
||||
return [events.event_policies_sql(schema),
|
||||
events.event_grants_sql(schema, owner_role=owner,
|
||||
emitter_roles=event_emitters(settings)["emitters"])]
|
||||
emitter_roles=tiers["emitters"],
|
||||
reader_roles=tiers["readers"])]
|
||||
except ValueError as exc:
|
||||
raise GrantsRefused(f"module event grants: {exc} (MODULE_EVENT_EMITTER_ROLES in "
|
||||
"env/atrium.env)") from None
|
||||
raise GrantsRefused(f"module event grants: {exc} (MODULE_EVENT_EMITTER_ROLES / "
|
||||
"MODULE_EVENT_READER_ROLES in env/atrium.env)") from None
|
||||
|
||||
|
||||
# ── counterparties (dredd-core 0.21.0) ──────────────────────────────────────────
|
||||
@@ -370,9 +381,10 @@ def apply(settings: Settings) -> bool:
|
||||
",".join(tiers["pending"]))
|
||||
if event_sql:
|
||||
tiers = event_emitters(settings)
|
||||
log.info("module event grants re-applied: emitters=%s", ",".join(tiers["emitters"]))
|
||||
log.info("module event grants re-applied: emitters=%s readers=%s", ",".join(tiers["emitters"]),
|
||||
",".join(tiers["readers"]) or "-")
|
||||
if tiers["pending"]:
|
||||
log.info("module event emitters waiting for their module to join the identity lists: %s",
|
||||
log.info("module event roles waiting for their module to join the identity lists: %s",
|
||||
",".join(tiers["pending"]))
|
||||
if counterparty_sql:
|
||||
tiers = counterparty_tiers(settings)
|
||||
|
||||
+36
-1
@@ -36,7 +36,7 @@ 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")
|
||||
ADDED_AFTER_FIRST_SEED: tuple[str, ...] = ("insider", "arbiter", "lexicon", "agora", "panorama")
|
||||
|
||||
|
||||
def _marker(slug: str) -> str:
|
||||
@@ -131,6 +131,41 @@ FAMILY: list[dict] = [
|
||||
"przez prawnika i zamrożona karta umowy jako dowód."
|
||||
),
|
||||
},
|
||||
{
|
||||
# The clause and standards library (the split plan's M2). Green is Lexicon's own brand colour
|
||||
# (Open Color green, its CLAUDE.md). In English the tagline reads "The clause library and
|
||||
# standards". The slug is its path (/lexicon), schema, roles and MODULE_SLUG.
|
||||
"slug": "lexicon", "name": "Lexicon", "hue": "green", "glyph": "file", "sort_order": 70,
|
||||
"category": "Umowy",
|
||||
"tagline": "Biblioteka klauzul i standardów.",
|
||||
"description": (
|
||||
"Lexicon tnie wzory umów na klauzule, indeksuje je do wyszukiwania pełnotekstowego, "
|
||||
"porządkuje według typów i przechowuje standardy (reguła, wzorcowe brzmienie, "
|
||||
"stanowisko rezerwowe), według których Arbiter sprawdza umowy."
|
||||
),
|
||||
},
|
||||
{
|
||||
# Contract negotiations (the split plan's M3). Red is Agora's own brand colour (Open Color
|
||||
# red, its CLAUDE.md). In English the tagline reads "Contract negotiation rooms".
|
||||
"slug": "agora", "name": "Agora", "hue": "red", "glyph": "users", "sort_order": 80,
|
||||
"category": "Umowy",
|
||||
"tagline": "Pokoje negocjacji umów.",
|
||||
"description": (
|
||||
"Agora prowadzi negocjacje umowy: pokój na jednym dokumencie, rundy obu stron zapisywane "
|
||||
"jako kolejne wersje w Galenie, porównanie dwóch rund i wewnętrzne komentarze zespołu."
|
||||
),
|
||||
},
|
||||
{
|
||||
# The platform's dashboard (the split plan's M4). Pink is Panorama's own brand colour (Open
|
||||
# Color pink, its CLAUDE.md). In English the tagline reads "The platform dashboard".
|
||||
"slug": "panorama", "name": "Panorama", "hue": "pink", "glyph": "chart", "sort_order": 90,
|
||||
"category": "Pulpit",
|
||||
"tagline": "Pulpit platformy.",
|
||||
"description": (
|
||||
"Panorama zbiera bieżące liczby z modułów platformy, każdą z uprawnieniami oglądającej "
|
||||
"osoby, i pokazuje trendy z dziennika zdarzeń."
|
||||
),
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
# v0.21.0 adds the counterparty register: the three shared tables the hub creates and grants in its
|
||||
# identity schema (`alembic/versions/0012_counterparties.py`, re-applied by `app.identity_grants`),
|
||||
# and the import door modules move their own counterparties in through. The hub holds no tier on them.
|
||||
dredd-core @ git+https://github.com/Alpaq92/dredd-core@v0.21.0
|
||||
dredd-core @ git+https://github.com/Alpaq92/dredd-core@v0.23.0
|
||||
|
||||
# Web framework
|
||||
fastapi==0.115.6
|
||||
|
||||
@@ -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)" in push
|
||||
assert "case $slug in galena|compass|agora)" 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
|
||||
|
||||
@@ -40,6 +40,6 @@ def test_homes_model_calls_resolve_the_host():
|
||||
|
||||
def test_no_other_service_is_given_the_host():
|
||||
asking = sorted(name for name, svc in _services().items()
|
||||
if name not in ("compass-backend", "arbiter-backend", "atrium-backend")
|
||||
if name not in ("compass-backend", "arbiter-backend", "lexicon-backend", "atrium-backend")
|
||||
and svc.get("extra_hosts"))
|
||||
assert asking == []
|
||||
|
||||
@@ -143,7 +143,7 @@ class TestAFreshInitIsOneAccount:
|
||||
assert compass["MODEL_PROVIDER_SECRET"] == hub["MODEL_PROVIDER_SECRET"]
|
||||
assert compass["SECRET_KEY"] != hub["MODEL_PROVIDER_SECRET"]
|
||||
# Arbiter (M1d) calls the models too; Compass stays first among the migrators (import door).
|
||||
assert hub["MODEL_PROVIDER_KEY_READER_ROLES"] == "compass_app,arbiter_app"
|
||||
assert hub["MODEL_PROVIDER_KEY_READER_ROLES"] == "compass_app,arbiter_app,lexicon_app"
|
||||
assert hub["MODEL_PROVIDER_MIGRATOR_ROLES"] == "compass_migrator,arbiter_migrator"
|
||||
arbiter = _values(fresh / "env" / "arbiter.env")
|
||||
assert arbiter["MODEL_PROVIDER_SECRET"] == hub["MODEL_PROVIDER_SECRET"]
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
"""deploy/push.sh checks Lexicon, Agora and Panorama (the split plan's M2-M4) 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: an evidence table a module adds later must not deploy unchecked.
|
||||
|
||||
The tiers: Lexicon calls the models (a model-provider KEY reader), Agora writes the event log (an
|
||||
EMITTER), Panorama reads it and writes nothing (dredd-core 0.23.0's READER tier). The hub's template
|
||||
and init.sh list each in exactly its own tier.
|
||||
"""
|
||||
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"
|
||||
ATRIUM_ENV = ROOT / "deploy" / "env" / "atrium.env.example"
|
||||
MODULES = ("lexicon", "agora", "panorama")
|
||||
|
||||
|
||||
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_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 panorama) IDENTITY_CHECK_ARGS="$IDENTITY_CHECK_ARGS --events-reader" ;; esac' in push
|
||||
|
||||
|
||||
def test_the_hub_template_lists_each_in_exactly_its_tier():
|
||||
keys, emitters, readers = (_list("MODEL_PROVIDER_KEY_READER_ROLES"), _list("MODULE_EVENT_EMITTER_ROLES"),
|
||||
_list("MODULE_EVENT_READER_ROLES"))
|
||||
assert "lexicon_app" in keys and "lexicon_migrator" not in _list("MODEL_PROVIDER_MIGRATOR_ROLES")
|
||||
assert "agora_app" in emitters and "agora_app" not in readers
|
||||
assert readers == ["panorama_app"] and "panorama_app" not in emitters
|
||||
# Compass first among the model-provider migrators: the hub's import door opens for the first.
|
||||
assert _list("MODEL_PROVIDER_MIGRATOR_ROLES")[0] == "compass_migrator"
|
||||
|
||||
|
||||
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 '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
|
||||
|
||||
|
||||
def test_atrium_pins_the_core_with_the_event_reader_tier():
|
||||
"""event_grants_sql(reader_roles=...) and `managed check --events-reader` are dredd-core 0.23.0."""
|
||||
req = (ROOT / "backend" / "requirements.txt").read_text(encoding="utf-8")
|
||||
pin = re.search(r"^dredd-core @ .*@v(\d+)\.(\d+)\.(\d+)", req, re.M)
|
||||
assert pin and tuple(int(p) for p in pin.groups()) >= (0, 23, 0)
|
||||
@@ -40,7 +40,8 @@ ATRIUM = pathlib.Path(__file__).resolve().parents[2]
|
||||
PUSH = DEPLOY / "push.sh"
|
||||
PREFLIGHT = DEPLOY / "preflight.sh"
|
||||
ENVFILE_LIB = DEPLOY / "lib" / "envfile.sh"
|
||||
FAMILY = ("atrium", "galena", "sygna", "counsel", "compass", "insider", "arbiter")
|
||||
FAMILY = ("atrium", "galena", "sygna", "counsel", "compass", "insider", "arbiter", "lexicon", "agora",
|
||||
"panorama")
|
||||
#: 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
|
||||
@@ -143,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\n")
|
||||
_write(root / ".env", base_env + "COMPOSE_PROFILES=compass,insider,arbiter,lexicon,agora,panorama\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')
|
||||
@@ -159,7 +160,10 @@ 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",
|
||||
"MODULE_EVENT_EMITTER_ROLES": "galena_app,compass_app,agora_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",
|
||||
# The shared counterparty register (dredd-core 0.21.0), init.sh's default: Sygna writes, Compass
|
||||
# reads, both migrators move their own rows in through the hub's import door.
|
||||
"COUNTERPARTY_WRITER_ROLES": "sygna_app",
|
||||
@@ -368,7 +372,8 @@ class TestTheHalfDoneShapesOfOneAccountAreRefused:
|
||||
"""Atrium strips each comma-separated name, so a space after a comma is a valid list there
|
||||
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"}})
|
||||
"IDENTITY_READER_ROLES": "galena_app, sygna_app, counsel_app, compass_app, insider_app, arbiter_app, "
|
||||
"lexicon_app, agora_app, panorama_app"}})
|
||||
assert done.returncode == 0, done.stdout + done.stderr
|
||||
|
||||
@pytest.mark.parametrize("cookie, shown", [("galena_session", "galena_session"),
|
||||
@@ -659,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+7 apps x", on.stdout), on.stdout
|
||||
assert re.search(r"budget\s+10 apps x", on.stdout), on.stdout
|
||||
assert re.search(r"budget\s+4 apps x", off.stdout), off.stdout
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ from app import identity_grants
|
||||
from app.config import Settings
|
||||
|
||||
_AMBIENT = ("IDENTITY_SCHEMA", "IDENTITY_READER_ROLES", "IDENTITY_MIGRATOR_ROLES", "DB_APP_ROLE",
|
||||
"MODULE_EVENT_EMITTER_ROLES", "COUNTERPARTY_WRITER_ROLES", "COUNTERPARTY_READER_ROLES",
|
||||
"MODULE_EVENT_EMITTER_ROLES", "MODULE_EVENT_READER_ROLES", "COUNTERPARTY_WRITER_ROLES", "COUNTERPARTY_READER_ROLES",
|
||||
"COUNTERPARTY_MIGRATOR_ROLES",
|
||||
"DATABASE_URL", "MIGRATION_DATABASE_URL")
|
||||
|
||||
@@ -299,7 +299,7 @@ class TestEventEmitters:
|
||||
tiers = identity_grants.event_emitters(_platform(
|
||||
identity_reader_roles="galena_app",
|
||||
module_event_emitter_roles="galena_app, compass_app"))
|
||||
assert tiers == {"emitters": ["atrium_app", "galena_app"], "pending": ["compass_app"]}
|
||||
assert tiers == {"emitters": ["atrium_app", "galena_app"], "readers": [], "pending": ["compass_app"]}
|
||||
|
||||
def test_a_reader_not_listed_reaches_nothing(self):
|
||||
tiers = identity_grants.event_emitters(_platform(
|
||||
@@ -310,7 +310,31 @@ class TestEventEmitters:
|
||||
|
||||
def test_the_hub_listed_again_is_not_a_second_grantee(self):
|
||||
tiers = identity_grants.event_emitters(_platform(module_event_emitter_roles="atrium_app"))
|
||||
assert tiers == {"emitters": ["atrium_app"], "pending": []}
|
||||
assert tiers == {"emitters": ["atrium_app"], "readers": [], "pending": []}
|
||||
|
||||
def test_the_reader_tier_once_joined(self):
|
||||
"""dredd-core 0.23.0: MODULE_EVENT_READER_ROLES (Panorama) is SELECT only, joined like an
|
||||
emitter, and never added to the emitters."""
|
||||
tiers = identity_grants.event_emitters(_platform(
|
||||
identity_reader_roles="galena_app,agora_app,panorama_app",
|
||||
module_event_emitter_roles="galena_app,agora_app",
|
||||
module_event_reader_roles="panorama_app, lexicon_app"))
|
||||
assert tiers == {"emitters": ["atrium_app", "galena_app", "agora_app"],
|
||||
"readers": ["panorama_app"], "pending": ["lexicon_app"]}
|
||||
|
||||
def test_the_readers_reach_the_grant_block(self, monkeypatch):
|
||||
monkeypatch.setattr(identity_grants, "event_table_exists", lambda conn, s: True)
|
||||
sql = identity_grants.event_statements(_platform(
|
||||
identity_reader_roles="panorama_app", module_event_reader_roles="panorama_app"),
|
||||
"atrium_migrator", object())
|
||||
assert len(sql) == 2 and "panorama_app" in sql[1]
|
||||
|
||||
def test_a_role_in_both_tiers_is_refused(self, monkeypatch):
|
||||
monkeypatch.setattr(identity_grants, "event_table_exists", lambda conn, s: True)
|
||||
with pytest.raises(identity_grants.GrantsRefused, match="MODULE_EVENT_READER_ROLES"):
|
||||
identity_grants.event_statements(_platform(
|
||||
identity_reader_roles="panorama_app", module_event_emitter_roles="panorama_app",
|
||||
module_event_reader_roles="panorama_app"), "atrium_migrator", object())
|
||||
|
||||
def test_standalone_renders_nothing(self):
|
||||
assert identity_grants.event_statements(_settings(), "atrium_migrator", None) == []
|
||||
|
||||
+3
-1
@@ -39,7 +39,9 @@ MODULES_DIR=./modules
|
||||
# its optional OCR worker is a second profile, `ocr`, which only means something with `insider` on.
|
||||
# Arbiter (contract analysis, built from the compass submodule's apps/arbiter) ships switched off too,
|
||||
# under the `arbiter` profile (deploy/RUNBOOK-arbiter.md).
|
||||
# COMPOSE_PROFILES=compass,insider,arbiter
|
||||
# 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
|
||||
|
||||
# ── Option A (the default): this box's own PostgreSQL, the `postgres` service ─────────────────────
|
||||
# The superuser's password. init.sh generates it; by hand:
|
||||
|
||||
+7
-2
@@ -59,13 +59,18 @@ deployment, and the kit in this directory does the per-app work for all four app
|
||||
| Compass (off by default) | `compass` | `compass_migrator`, `compass_app` | `pgcrypto` | `audit_log`, `analysis_signoff`, `agent_version`, `frozen_card` append-only; `analysis` never deleted |
|
||||
| Insider (off by default) | `insider` | `insider_migrator`, `insider_app` | none | `audit_log` append-only |
|
||||
| Arbiter (off by default) | `arbiter` | `arbiter_migrator`, `arbiter_app` | none | `audit_log`, `analysis_signoff`, `agent_version`, `frozen_card` append-only; `analysis` never deleted |
|
||||
| Lexicon (off by default) | `lexicon` | `lexicon_migrator`, `lexicon_app` | none | `audit_log` append-only |
|
||||
| Agora (off by default) | `agora` | `agora_migrator`, `agora_app` | none | `audit_log`, `module_event`, `module_event_receipt` append-only; `negotiation_room`, `negotiation_round`, `negotiation_comment` never deleted |
|
||||
| Panorama (off by default) | `panorama` | `panorama_migrator`, `panorama_app` | none | `audit_log` append-only |
|
||||
|
||||
**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
|
||||
`/insider/mcp`), ships switched off the same way (profile `insider`, with an optional OCR worker under a
|
||||
second profile, `ocr`); bringing it in is [`RUNBOOK-insider.md`](RUNBOOK-insider.md). **Arbiter, the seventh** (contract analysis, split out of
|
||||
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). **Licences:** Atrium, Galena, Sygna and Counsel
|
||||
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
|
||||
Scorecard each run a CI licence gate that refuses GPL, AGPL and SSPL. Compass's image is the
|
||||
exception: its analysis engine reads PDFs with PyMuPDF, **AGPL-3.0**, in a separate process, and the
|
||||
Compass module offers that engine's source — which is why its image must be built with
|
||||
@@ -138,7 +143,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`; `/` redirects to `/atrium/` and a
|
||||
`<site>/galena`, `<site>/sygna`, `<site>/counsel`, `<site>/compass`, `<site>/insider`, `<site>/arbiter`, `<site>/lexicon`, `<site>/agora`, `<site>/panorama`; `/` 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,122 @@
|
||||
# Runbook: Lexicon, Agora and Panorama onto a running platform
|
||||
|
||||
The eighth to tenth modules, split out of Compass (the split plan's M2, M3 and M4). 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.
|
||||
|
||||
| Module | Path / profile | Repository | Network / db network | Opt-ins in `env/atrium.env` | Evidence (push.sh check) |
|
||||
|---|---|---|---|---|---|
|
||||
| Lexicon (clause and standards library) | `/lexicon` | `Alpaq92/Lexicon` | 172.30.17.0/24 / 172.30.27.0/24 | `MODEL_PROVIDER_KEY_READER_ROLES` += `lexicon_app` | `--append-only audit_log --model-provider-keys` |
|
||||
| Agora (negotiation rooms) | `/agora` | `Alpaq92/Agora` | 172.30.18.0/24 / 172.30.28.0/24 | `MODULE_EVENT_EMITTER_ROLES` += `agora_app` | `--append-only audit_log module_event module_event_receipt --no-delete negotiation_room negotiation_round negotiation_comment --events` |
|
||||
| Panorama (dashboard) | `/panorama` | `Alpaq92/Panorama` | 172.30.19.0/24 / 172.30.29.0/24 | `MODULE_EVENT_READER_ROLES` += `panorama_app` | `--append-only audit_log --events-reader` |
|
||||
|
||||
What the kit carries for each: `<slug>-migrate` / `<slug>-backend` in `compose.yaml`
|
||||
(`FORWARDED_ALLOW_IPS` = its own subnet, `FRAME_ANCESTORS='self'`, no published port, volume
|
||||
`<slug>-data`, health at `/healthz`), the front door's `<slug>=http://<slug>-backend:8000`,
|
||||
`env/<slug>.env.example` + `env/<slug>.migrate.env.example`, `./init.sh --add <slug>`, and push.sh's
|
||||
provision, migrate and check. The catalogue tiles (Lexicon green `file`, Agora red `users`, Panorama
|
||||
pink `chart`) are offered once to an already-seeded Atrium by its seed (`ADDED_AFTER_FIRST_SEED`).
|
||||
|
||||
**What each needs from the others.**
|
||||
|
||||
- **Lexicon** calls the models itself (the catalog's typing): `lexicon_app` is a model-provider KEY
|
||||
reader and `env/lexicon.env` carries the hub's `MODEL_PROVIDER_SECRET` (`--add lexicon` copies it).
|
||||
No table of its references `model_provider`, so its migrator is not in
|
||||
`MODEL_PROVIDER_MIGRATOR_ROLES`. `GALENA_BASE_URL` (hairpin) lets a source be pinned from Galena.
|
||||
Its image installs `compass-ingestion` from the private `compass-contract-hub` at a pinned SHA, so
|
||||
the build token must reach that repository as well as dredd-core (it already does if Compass builds
|
||||
on this box).
|
||||
- **Agora** writes `negotiation.round_received` to the hub's event log when the other side sends a
|
||||
round: `agora_app` must be an event EMITTER before Agora goes live, or every such round fails.
|
||||
`GALENA_BASE_URL` (hairpin) makes a Galena room's rounds new versions of its document.
|
||||
- **Panorama** reads every other module's `GET /api/v1/stats` with the viewer's own token (the
|
||||
`*_BASE_URL` hairpins in `env/panorama.env`, all written by init) and the event log as a READER
|
||||
only (dredd-core 0.23.0's reader tier). The hub grants that tier only from this Atrium release on:
|
||||
Atrium pins dredd-core **v0.23.0** and passes `MODULE_EVENT_READER_ROLES` to `event_grants_sql`; the
|
||||
push's check (`--events-reader`) runs with Atrium's dredd-core too.
|
||||
|
||||
**Rules for the whole sitting.** Run everything from `/srv/atrium/deploy` (Option A). Never
|
||||
`./init.sh --force` and never `docker compose down -v`. Pass `-T` to every `docker compose run`/`exec`
|
||||
whose output you read. **The one ordering rule:** from `--add` (step 3) until the push (step 5) run
|
||||
nothing that starts `atrium-migrate` — Atrium's migrate grants the shared schema to the roles listed
|
||||
in `env/atrium.env` and refuses a listed role that does not exist.
|
||||
|
||||
---
|
||||
|
||||
## Step 0 — Before the box
|
||||
|
||||
- This Atrium release is merged and pushed; its submodule pins are commits on each module's `main`.
|
||||
- The deploy token reaches `Lexicon`, `Agora`, `Panorama`, `dredd-core` and `compass-contract-hub`.
|
||||
|
||||
## 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-m2m4.dump"
|
||||
```
|
||||
|
||||
## Step 2 — Pull the release and the submodules
|
||||
|
||||
```bash
|
||||
git -C .. pull --ff-only
|
||||
git -C .. submodule update --init deploy/modules/lexicon deploy/modules/agora deploy/modules/panorama
|
||||
```
|
||||
|
||||
## Step 3 — Write their settings
|
||||
|
||||
```bash
|
||||
./init.sh --add lexicon
|
||||
./init.sh --add agora
|
||||
./init.sh --add panorama
|
||||
```
|
||||
|
||||
Each 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 its opt-in (table above) in
|
||||
`env/atrium.env`, and `<slug>` to `COMPOSE_PROFILES` in `.env`. A box whose `env/atrium.env` predates
|
||||
`MODULE_EVENT_READER_ROLES` gets the key appended. Check that `panorama_app` is in no emitter list.
|
||||
|
||||
**Connections.** Ten apps at 4 / 8 are 130 connections. `compose.yaml` now sets `max_connections=170`
|
||||
(136 at 80%); if `db.env` sets `LOCAL_DB_MAX_CONNECTIONS` explicitly (120 after Arbiter), raise it to
|
||||
170 too, then `docker compose up -d postgres` (a restart of the database). Or set `DB_POOL_SIZE=3` /
|
||||
`DB_MAX_OVERFLOW=6` in every `env/<app>.env` and `db.env` (10 x 10 = 100 of 96 at 120: still too many).
|
||||
|
||||
## Step 4 — Build
|
||||
|
||||
```bash
|
||||
read -rs DREDD_CORE_TOKEN && export DREDD_CORE_TOKEN
|
||||
docker compose build atrium-backend lexicon-backend agora-backend panorama-backend && unset DREDD_CORE_TOKEN
|
||||
```
|
||||
|
||||
`atrium-backend` is rebuilt for dredd-core 0.23.0 (the event reader tier).
|
||||
|
||||
## Step 5 — Push
|
||||
|
||||
```bash
|
||||
./push.sh --dry-run atrium lexicon agora panorama # complete, the three in the plan, budget fits
|
||||
./push.sh atrium lexicon agora panorama
|
||||
```
|
||||
|
||||
Order: all four provisioned, Atrium migrates and re-applies the identity, model-provider and event
|
||||
tiers to the new roles (`emitters=...,agora_app readers=panorama_app` in its log), then each module's
|
||||
own revisions, then the checks.
|
||||
|
||||
## Step 6 — Start
|
||||
|
||||
```bash
|
||||
docker compose up -d atrium-backend lexicon-backend agora-backend panorama-backend
|
||||
for slug in lexicon agora panorama; 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. Panorama's tiles for a module someone has no row for stay empty.
|
||||
|
||||
## Local models (Lexicon)
|
||||
|
||||
A `local` provider at `host.docker.internal` (LM Studio on this box) is reached from 172.30.17.0/24:
|
||||
admit that subnet to the model server's port in the host firewall, as for Compass and Arbiter.
|
||||
|
||||
## 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).
|
||||
@@ -108,6 +108,30 @@ services:
|
||||
volumes:
|
||||
- *db_ca
|
||||
|
||||
lexicon-migrate:
|
||||
networks:
|
||||
lexicon-db: !reset null
|
||||
depends_on:
|
||||
postgres: !reset null
|
||||
volumes:
|
||||
- *db_ca
|
||||
|
||||
agora-migrate:
|
||||
networks:
|
||||
agora-db: !reset null
|
||||
depends_on:
|
||||
postgres: !reset null
|
||||
volumes:
|
||||
- *db_ca
|
||||
|
||||
panorama-migrate:
|
||||
networks:
|
||||
panorama-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:
|
||||
@@ -165,6 +189,30 @@ services:
|
||||
volumes:
|
||||
- *db_ca
|
||||
|
||||
lexicon-backend:
|
||||
networks:
|
||||
lexicon-db: !reset null
|
||||
depends_on:
|
||||
postgres: !reset null
|
||||
volumes:
|
||||
- *db_ca
|
||||
|
||||
agora-backend:
|
||||
networks:
|
||||
agora-db: !reset null
|
||||
depends_on:
|
||||
postgres: !reset null
|
||||
volumes:
|
||||
- *db_ca
|
||||
|
||||
panorama-backend:
|
||||
networks:
|
||||
panorama-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:
|
||||
|
||||
+251
-9
@@ -21,7 +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 and /arbiter to the backends named in
|
||||
# itself under /atrium, and streams /galena, /sygna, /counsel, /compass, /insider, /arbiter, /lexicon, /agora and
|
||||
# /panorama 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
|
||||
@@ -35,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 and /insider: the git submodules under ./modules
|
||||
# ${MODULES_DIR}/galena, /sygna, /counsel, /compass, /insider, /lexicon, /agora and /panorama: 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).
|
||||
@@ -54,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
|
||||
# seven separate `<app>-db` networks, one per app, so `<app>-migrate` and `<app>-backend` reach the
|
||||
# ten 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
|
||||
@@ -82,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 seven apps (7 x 13 = 91 of 96), and the push budgets 80% of it
|
||||
# raised from postgres:17's default of 100 for ten apps (10 x 13 = 130 of 136), 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=120"]
|
||||
command: ["postgres", "-c", "max_connections=170"]
|
||||
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
|
||||
@@ -123,7 +124,8 @@ services:
|
||||
timeout: 5s
|
||||
retries: 20
|
||||
start_period: 30s
|
||||
networks: [atrium-db, galena-db, sygna-db, counsel-db, compass-db, insider-db, arbiter-db]
|
||||
networks: [atrium-db, galena-db, sygna-db, counsel-db, compass-db, insider-db, arbiter-db, lexicon-db,
|
||||
agora-db, panorama-db]
|
||||
logging: *logging
|
||||
|
||||
# ── Atrium, the hub ────────────────────────────────────────────────────────────
|
||||
@@ -165,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 or Arbiter while its profile is off) answers 502 at its path. Each name resolves on that module's own
|
||||
# Insider, Arbiter, Lexicon, Agora or Panorama 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"
|
||||
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"
|
||||
# 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:
|
||||
@@ -189,6 +191,9 @@ services:
|
||||
compass: {}
|
||||
insider: {}
|
||||
arbiter: {}
|
||||
lexicon: {}
|
||||
agora: {}
|
||||
panorama: {}
|
||||
depends_on:
|
||||
atrium-migrate: { condition: service_completed_successfully }
|
||||
postgres: { condition: service_healthy }
|
||||
@@ -706,6 +711,227 @@ services:
|
||||
retries: 10
|
||||
logging: *logging
|
||||
|
||||
# ── Lexicon (repository Alpaq92/Lexicon): the clause and standards library (M2) ──────────────────────────────────────────
|
||||
# SWITCHED OFF until deploy/.env names `lexicon` in COMPOSE_PROFILES, exactly like Compass, Insider and
|
||||
# Arbiter (deploy/RUNBOOK-m2-m4.md).
|
||||
# Lexicon cuts model contracts into clauses and has a model type them, so it calls the models itself
|
||||
# (a model-provider KEY reader, env/atrium.env). Its image also installs compass-ingestion from the
|
||||
# private compass-contract-hub repository, so the DREDD_CORE_TOKEN build secret must reach that
|
||||
# repository too (deploy/RUNBOOK-m2-m4.md, "Build").
|
||||
lexicon-migrate:
|
||||
profiles: ["lexicon"]
|
||||
build:
|
||||
context: ${MODULES_DIR:-./modules}/lexicon/backend
|
||||
# The module's console ships in its image (its Dockerfile: COPY --from=frontend).
|
||||
additional_contexts:
|
||||
frontend: ${MODULES_DIR:-./modules}/lexicon/frontend
|
||||
secrets: [dredd_core_token]
|
||||
image: dredd-family/lexicon-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}/lexicon.env
|
||||
required: false
|
||||
- path: ${DEPLOY_ENV_DIR:-./env}/lexicon.migrate.env
|
||||
required: false
|
||||
command: ["sh", "-c", "alembic upgrade head && python -m app.seed"]
|
||||
restart: "no"
|
||||
volumes:
|
||||
- lexicon-data:/data
|
||||
networks:
|
||||
lexicon-db: {}
|
||||
depends_on:
|
||||
# Identity and the model providers are shared and Atrium's migration is what creates them (see
|
||||
# compass-migrate): Lexicon's 0005 drops its empty local model-provider copies on the platform.
|
||||
atrium-migrate: { condition: service_completed_successfully }
|
||||
postgres: { condition: service_healthy }
|
||||
logging: *logging
|
||||
|
||||
lexicon-backend:
|
||||
profiles: ["lexicon"]
|
||||
build:
|
||||
context: ${MODULES_DIR:-./modules}/lexicon/backend
|
||||
# The module's console ships in its image (its Dockerfile: COPY --from=frontend).
|
||||
additional_contexts:
|
||||
frontend: ${MODULES_DIR:-./modules}/lexicon/frontend
|
||||
secrets: [dredd_core_token]
|
||||
image: dredd-family/lexicon-backend:local
|
||||
env_file:
|
||||
- path: ${DEPLOY_ENV_DIR:-./env}/lexicon.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.17.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:
|
||||
- lexicon-data:/data
|
||||
networks:
|
||||
lexicon: {}
|
||||
lexicon-db: {}
|
||||
# A `local` model provider (LM Studio on this box) is reached at host.docker.internal, as
|
||||
# Compass's and Arbiter's are; the host's firewall must admit this service's subnet,
|
||||
# 172.30.17.0/24, to the model server's port.
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
depends_on:
|
||||
lexicon-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
|
||||
|
||||
# ── Agora (repository Alpaq92/Agora): contract negotiation rooms (M3) ──────────────────────────────────────────
|
||||
# SWITCHED OFF until deploy/.env names `agora` in COMPOSE_PROFILES, exactly like Compass, Insider and
|
||||
# Arbiter (deploy/RUNBOOK-m2-m4.md).
|
||||
# A round from the other side writes `negotiation.round_received` to the hub's shared event log, so
|
||||
# agora_app must be an event EMITTER (MODULE_EVENT_EMITTER_ROLES in env/atrium.env) before it goes live.
|
||||
agora-migrate:
|
||||
profiles: ["agora"]
|
||||
build:
|
||||
context: ${MODULES_DIR:-./modules}/agora/backend
|
||||
# The module's console ships in its image (its Dockerfile: COPY --from=frontend).
|
||||
additional_contexts:
|
||||
frontend: ${MODULES_DIR:-./modules}/agora/frontend
|
||||
secrets: [dredd_core_token]
|
||||
image: dredd-family/agora-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}/agora.env
|
||||
required: false
|
||||
- path: ${DEPLOY_ENV_DIR:-./env}/agora.migrate.env
|
||||
required: false
|
||||
command: ["sh", "-c", "alembic upgrade head && python -m app.seed"]
|
||||
restart: "no"
|
||||
volumes:
|
||||
- agora-data:/data
|
||||
networks:
|
||||
agora-db: {}
|
||||
depends_on:
|
||||
# Identity and the event log are shared and Atrium's migration is what creates them (and grants
|
||||
# agora_app the log through MODULE_EVENT_EMITTER_ROLES).
|
||||
atrium-migrate: { condition: service_completed_successfully }
|
||||
postgres: { condition: service_healthy }
|
||||
logging: *logging
|
||||
|
||||
agora-backend:
|
||||
profiles: ["agora"]
|
||||
build:
|
||||
context: ${MODULES_DIR:-./modules}/agora/backend
|
||||
# The module's console ships in its image (its Dockerfile: COPY --from=frontend).
|
||||
additional_contexts:
|
||||
frontend: ${MODULES_DIR:-./modules}/agora/frontend
|
||||
secrets: [dredd_core_token]
|
||||
image: dredd-family/agora-backend:local
|
||||
env_file:
|
||||
- path: ${DEPLOY_ENV_DIR:-./env}/agora.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.18.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:
|
||||
- agora-data:/data
|
||||
networks:
|
||||
agora: {}
|
||||
agora-db: {}
|
||||
depends_on:
|
||||
agora-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
|
||||
|
||||
# ── Panorama (repository Alpaq92/Panorama): the platform dashboard (M4) ──────────────────────────────────────────
|
||||
# SWITCHED OFF until deploy/.env names `panorama` in COMPOSE_PROFILES, exactly like Compass, Insider and
|
||||
# Arbiter (deploy/RUNBOOK-m2-m4.md).
|
||||
# It reads every other module's /api/v1/stats with the viewer's own token (a hairpin through the
|
||||
# front door, the *_BASE_URL settings in env/panorama.env) and the hub's event log as a READER only
|
||||
# (MODULE_EVENT_READER_ROLES in env/atrium.env, dredd-core 0.23.0's reader tier).
|
||||
panorama-migrate:
|
||||
profiles: ["panorama"]
|
||||
build:
|
||||
context: ${MODULES_DIR:-./modules}/panorama/backend
|
||||
# The module's console ships in its image (its Dockerfile: COPY --from=frontend).
|
||||
additional_contexts:
|
||||
frontend: ${MODULES_DIR:-./modules}/panorama/frontend
|
||||
secrets: [dredd_core_token]
|
||||
image: dredd-family/panorama-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}/panorama.env
|
||||
required: false
|
||||
- path: ${DEPLOY_ENV_DIR:-./env}/panorama.migrate.env
|
||||
required: false
|
||||
command: ["sh", "-c", "alembic upgrade head && python -m app.seed"]
|
||||
restart: "no"
|
||||
volumes:
|
||||
- panorama-data:/data
|
||||
networks:
|
||||
panorama-db: {}
|
||||
depends_on:
|
||||
# Identity and the event log are shared and Atrium's migration is what creates them (and grants
|
||||
# panorama_app SELECT on the log through MODULE_EVENT_READER_ROLES).
|
||||
atrium-migrate: { condition: service_completed_successfully }
|
||||
postgres: { condition: service_healthy }
|
||||
logging: *logging
|
||||
|
||||
panorama-backend:
|
||||
profiles: ["panorama"]
|
||||
build:
|
||||
context: ${MODULES_DIR:-./modules}/panorama/backend
|
||||
# The module's console ships in its image (its Dockerfile: COPY --from=frontend).
|
||||
additional_contexts:
|
||||
frontend: ${MODULES_DIR:-./modules}/panorama/frontend
|
||||
secrets: [dredd_core_token]
|
||||
image: dredd-family/panorama-backend:local
|
||||
env_file:
|
||||
- path: ${DEPLOY_ENV_DIR:-./env}/panorama.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.19.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:
|
||||
- panorama-data:/data
|
||||
networks:
|
||||
panorama: {}
|
||||
panorama-db: {}
|
||||
depends_on:
|
||||
panorama-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.
|
||||
@@ -740,12 +966,25 @@ networks:
|
||||
ipam: { config: [{ subnet: 172.30.16.0/24 }] }
|
||||
arbiter-db:
|
||||
ipam: { config: [{ subnet: 172.30.26.0/24 }] }
|
||||
lexicon:
|
||||
ipam: { config: [{ subnet: 172.30.17.0/24 }] }
|
||||
lexicon-db:
|
||||
ipam: { config: [{ subnet: 172.30.27.0/24 }] }
|
||||
agora:
|
||||
ipam: { config: [{ subnet: 172.30.18.0/24 }] }
|
||||
agora-db:
|
||||
ipam: { config: [{ subnet: 172.30.28.0/24 }] }
|
||||
panorama:
|
||||
ipam: { config: [{ subnet: 172.30.19.0/24 }] }
|
||||
panorama-db:
|
||||
ipam: { config: [{ subnet: 172.30.29.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.
|
||||
# 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).
|
||||
# `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.
|
||||
@@ -755,6 +994,9 @@ volumes:
|
||||
compass-data:
|
||||
insider-data:
|
||||
arbiter-data:
|
||||
lexicon-data:
|
||||
agora-data:
|
||||
panorama-data:
|
||||
|
||||
secrets:
|
||||
# Used only by each image's build stage (one `pip install` of the private dredd-core); no running
|
||||
|
||||
+17
-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 120 (postgres:17 ships 100), and the push plans the budget against 80% of it.
|
||||
# The server's max_connections; compose.yaml sets 170 (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=120
|
||||
# LOCAL_DB_MAX_CONNECTIONS=170
|
||||
|
||||
# ── 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.
|
||||
@@ -105,6 +105,9 @@ PLATFORM_IDENTITY_SCHEMA=dredd
|
||||
# With Arbiter switched on as well, seven apps: 7 x 13 = 91 does NOT fit 80 — raise max_connections
|
||||
# (compose.yaml) and LOCAL_DB_MAX_CONNECTIONS to 120 (91 of 96), or use 3 / 6 -> 7 x 10 = 70 of 80.
|
||||
# Option B with seven: 3 / 5 -> 7 x 9 = 63 of 72 at 90; with 60, 2 / 2 -> 7 x 5 = 35 of 48.
|
||||
# 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.
|
||||
#
|
||||
# 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`
|
||||
@@ -135,6 +138,12 @@ INSIDER_MIGRATOR_PASSWORD=
|
||||
INSIDER_APP_PASSWORD=
|
||||
ARBITER_MIGRATOR_PASSWORD=
|
||||
ARBITER_APP_PASSWORD=
|
||||
LEXICON_MIGRATOR_PASSWORD=
|
||||
LEXICON_APP_PASSWORD=
|
||||
AGORA_MIGRATOR_PASSWORD=
|
||||
AGORA_APP_PASSWORD=
|
||||
PANORAMA_MIGRATOR_PASSWORD=
|
||||
PANORAMA_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
|
||||
@@ -153,6 +162,12 @@ ARBITER_APP_PASSWORD=
|
||||
# INSIDER_APP_ROLE=insider_app
|
||||
# ARBITER_MIGRATOR_ROLE=arbiter_migrator
|
||||
# ARBITER_APP_ROLE=arbiter_app
|
||||
# LEXICON_MIGRATOR_ROLE=lexicon_migrator
|
||||
# LEXICON_APP_ROLE=lexicon_app
|
||||
# AGORA_MIGRATOR_ROLE=agora_migrator
|
||||
# AGORA_APP_ROLE=agora_app
|
||||
# PANORAMA_MIGRATOR_ROLE=panorama_migrator
|
||||
# PANORAMA_APP_ROLE=panorama_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
+78
@@ -0,0 +1,78 @@
|
||||
# deploy/env/agora.env — Agora's backend, on the platform.
|
||||
#
|
||||
# Copy to agora.env (init.sh writes it; `./init.sh --add agora` on a box that predates Agora) and
|
||||
# fill in. Read by agora-backend and agora-migrate; the migrator's URL lives in agora.migrate.env,
|
||||
# which only the one-shot reads.
|
||||
#
|
||||
# The app's own template is modules/agora/.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 Agora 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 /agora 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.18.0/24).
|
||||
ROOT_PATH=/agora
|
||||
APP_BASE_URL=http://<site>/agora
|
||||
|
||||
# ── 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 Agora 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 Agora on also means
|
||||
# listing agora_app / agora_migrator in env/atrium.env's IDENTITY_*_ROLES (the push refuses
|
||||
# without them; `./init.sh --add agora` does both, and the event emitter list (a round from the other side writes 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=agora
|
||||
# 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 agora_app on this box's own PostgreSQL — plain role
|
||||
# name, the compose service `postgres`, LOCAL_DB_NAME from deploy/.env, NO sslmode / sslrootcert.
|
||||
# Password: AGORA_APP_PASSWORD from db.env, percent-encoded.
|
||||
DATABASE_URL=postgresql+pg8000://agora_app:<percent-encoded-password>@postgres:5432/dredd
|
||||
# Must be DATABASE_URL's role (Agora refuses to start otherwise).
|
||||
DB_APP_ROLE=agora_app
|
||||
# Option B: a managed PostgreSQL provider's database (deploy/README.md, "Option B").
|
||||
# DATABASE_URL=postgresql+pg8000://agora_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 round on a Galena room is a new
|
||||
# version of its document, saved with the person's own token. Empty: Galena
|
||||
# off for this module.
|
||||
GALENA_BASE_URL=http://<site>/galena
|
||||
|
||||
# ── 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 (agora_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=agora-backend
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
# Agora's one-shot settings: loaded ONLY by agora-migrate (together with agora.env), never by the
|
||||
# long-running backend. Alembic runs as the migrator; the seed after it runs as the runtime role
|
||||
# (agora_app, agora.env's DATABASE_URL). init.sh writes env/agora.migrate.env from this template
|
||||
# (git-ignored); on a deployment that already exists, `./init.sh --add agora` does.
|
||||
|
||||
# ── Option A (the default): the migrator agora_migrator on this box's own PostgreSQL ──────────
|
||||
# Plain role name, the `postgres` service, LOCAL_DB_NAME from deploy/.env, no TLS parameters (see
|
||||
# agora.env). Password: AGORA_MIGRATOR_PASSWORD, percent-encoded.
|
||||
MIGRATION_DATABASE_URL=postgresql+pg8000://agora_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 agora.env.
|
||||
# MIGRATION_DATABASE_URL=postgresql+pg8000://agora_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
+13
-6
@@ -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`).
|
||||
# (`./init.sh --add arbiter`). Lexicon, Agora and Panorama 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
|
||||
@@ -70,18 +70,25 @@ IDENTITY_MIGRATOR_ROLES=galena_migrator,sygna_migrator,counsel_migrator
|
||||
# IDENTITY_READER_ROLES reads the list and the policy; these two name the modules that need more,
|
||||
# and each takes effect only once its role is also in the identity list above (so Compass, switched
|
||||
# off, is named here already and gets its tier on the deploy that adds it; Arbiter likewise: its runner
|
||||
# and agent runs call the models, and its 0005 points analysis.model_provider_id at the shared table).
|
||||
# and agent runs call the models, and its 0005 points analysis.model_provider_id at the shared table;
|
||||
# Lexicon's typing calls the models too, but no table of its references model_provider, so it is a key
|
||||
# reader and not a migrator here).
|
||||
# Re-applied on every migrate by `python -m app.identity_grants`: taking a role out here revokes it.
|
||||
# key readers: runtime roles that may READ THE API KEYS (a module that calls a model itself)
|
||||
# migrators: migrators that may REFERENCE model_provider (the first is also the one the one-shot
|
||||
# import door is opened for while that module still holds providers of its own)
|
||||
MODEL_PROVIDER_KEY_READER_ROLES=compass_app,arbiter_app
|
||||
MODEL_PROVIDER_KEY_READER_ROLES=compass_app,arbiter_app,lexicon_app
|
||||
MODEL_PROVIDER_MIGRATOR_ROLES=compass_migrator,arbiter_migrator
|
||||
# The shared event log (dredd-core 0.20.0, revision 0011), in the same schema: the modules' runtime
|
||||
# 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).
|
||||
MODULE_EVENT_EMITTER_ROLES=galena_app,compass_app
|
||||
# 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
|
||||
# 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.
|
||||
MODULE_EVENT_READER_ROLES=panorama_app
|
||||
# The shared counterparty register (dredd-core 0.21.0, revision 0012), in the same schema. Writers:
|
||||
# SELECT, INSERT, UPDATE, never DELETE a counterparty (Sygna; on a box without Sygna, Compass moves to
|
||||
# the writer list). Readers: SELECT only. Migrators: SELECT + REFERENCES, and the import door while
|
||||
@@ -92,8 +99,8 @@ COUNTERPARTY_WRITER_ROLES=sygna_app
|
||||
COUNTERPARTY_READER_ROLES=compass_app
|
||||
COUNTERPARTY_MIGRATOR_ROLES=sygna_migrator,compass_migrator
|
||||
# The platform's model-provider secret: provider API keys are encrypted under a key derived from it,
|
||||
# by the hub, Compass and Arbiter alike, so it must be IDENTICAL in env/compass.env and
|
||||
# env/arbiter.env. init.sh generates it once and writes it into all three. Never in the database, never logged; keep it in the secret store with
|
||||
# by the hub, Compass, Arbiter and Lexicon alike, so it must be IDENTICAL in env/compass.env,
|
||||
# env/arbiter.env and env/lexicon.env. init.sh generates it once and writes it into all four. Never in the database, never logged; keep it in the secret store with
|
||||
# Galena's ENCRYPTION_MASTER_KEY, and never regenerate it on a box that has keys stored.
|
||||
MODEL_PROVIDER_SECRET=
|
||||
# This app's slug on the platform, which is also the HUB's slug: `module_permission(user, 'atrium')`
|
||||
|
||||
Vendored
+95
@@ -0,0 +1,95 @@
|
||||
# deploy/env/lexicon.env — Lexicon's backend, on the platform.
|
||||
#
|
||||
# Copy to lexicon.env (init.sh writes it; `./init.sh --add lexicon` on a box that predates Lexicon) and
|
||||
# fill in. Read by lexicon-backend and lexicon-migrate; the migrator's URL lives in lexicon.migrate.env,
|
||||
# which only the one-shot reads.
|
||||
#
|
||||
# The app's own template is modules/lexicon/.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 Lexicon 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 /lexicon 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.17.0/24).
|
||||
ROOT_PATH=/lexicon
|
||||
APP_BASE_URL=http://<site>/lexicon
|
||||
|
||||
# ── 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 Lexicon 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 Lexicon on also means
|
||||
# listing lexicon_app / lexicon_migrator in env/atrium.env's IDENTITY_*_ROLES (the push refuses
|
||||
# without them; `./init.sh --add lexicon` does both, and the model-provider key reader list below). 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=lexicon
|
||||
# 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 lexicon_app on this box's own PostgreSQL — plain role
|
||||
# name, the compose service `postgres`, LOCAL_DB_NAME from deploy/.env, NO sslmode / sslrootcert.
|
||||
# Password: LEXICON_APP_PASSWORD from db.env, percent-encoded.
|
||||
DATABASE_URL=postgresql+pg8000://lexicon_app:<percent-encoded-password>@postgres:5432/dredd
|
||||
# Must be DATABASE_URL's role (Lexicon refuses to start otherwise).
|
||||
DB_APP_ROLE=lexicon_app
|
||||
# Option B: a managed PostgreSQL provider's database (deploy/README.md, "Option B").
|
||||
# DATABASE_URL=postgresql+pg8000://lexicon_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 source pinned from Galena
|
||||
# is read with the person's own token. Empty: Galena
|
||||
# off for this module.
|
||||
GALENA_BASE_URL=http://<site>/galena
|
||||
|
||||
# ── the catalog's model (typing clauses) ───────────────────────────────────────────────────────
|
||||
# The typing thread asks a model (the CATALOG_MODEL setting, chosen in the console from the hub's
|
||||
# providers). Lexicon reads the provider API keys only because env/atrium.env lists lexicon_app in
|
||||
# MODEL_PROVIDER_KEY_READER_ROLES (push.sh checks it with --model-provider-keys).
|
||||
TYPING_ENABLED=true
|
||||
# LM Studio on this box seeds a provider only standalone; on the platform the hub owns the list.
|
||||
LMSTUDIO_URL=
|
||||
|
||||
# ── secrets at rest ────────────────────────────────────────────────────────────────────────────
|
||||
# The platform's model-provider secret (dredd-core 0.15.0): ONE value, identical in env/atrium.env,
|
||||
# env/compass.env and env/arbiter.env. init.sh writes them all from one value, and `--add lexicon`
|
||||
# copies the hub's. Without it Lexicon can read no provider key.
|
||||
MODEL_PROVIDER_SECRET=
|
||||
# Lexicon's own installation key: used only standalone (a provider key Lexicon stores itself).
|
||||
# init.sh generates it. Keep it across restores.
|
||||
SECRET_KEY=
|
||||
|
||||
# ── 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 (lexicon_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=lexicon-backend
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
# Lexicon's one-shot settings: loaded ONLY by lexicon-migrate (together with lexicon.env), never by the
|
||||
# long-running backend. Alembic runs as the migrator; the seed after it runs as the runtime role
|
||||
# (lexicon_app, lexicon.env's DATABASE_URL). init.sh writes env/lexicon.migrate.env from this template
|
||||
# (git-ignored); on a deployment that already exists, `./init.sh --add lexicon` does.
|
||||
|
||||
# ── Option A (the default): the migrator lexicon_migrator on this box's own PostgreSQL ──────────
|
||||
# Plain role name, the `postgres` service, LOCAL_DB_NAME from deploy/.env, no TLS parameters (see
|
||||
# lexicon.env). Password: LEXICON_MIGRATOR_PASSWORD, percent-encoded.
|
||||
MIGRATION_DATABASE_URL=postgresql+pg8000://lexicon_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 lexicon.env.
|
||||
# MIGRATION_DATABASE_URL=postgresql+pg8000://lexicon_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
+92
@@ -0,0 +1,92 @@
|
||||
# deploy/env/panorama.env — Panorama's backend, on the platform.
|
||||
#
|
||||
# Copy to panorama.env (init.sh writes it; `./init.sh --add panorama` on a box that predates Panorama) and
|
||||
# fill in. Read by panorama-backend and panorama-migrate; the migrator's URL lives in panorama.migrate.env,
|
||||
# which only the one-shot reads.
|
||||
#
|
||||
# The app's own template is modules/panorama/.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 Panorama 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 /panorama 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.19.0/24).
|
||||
ROOT_PATH=/panorama
|
||||
APP_BASE_URL=http://<site>/panorama
|
||||
|
||||
# ── 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 Panorama 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 Panorama on also means
|
||||
# listing panorama_app / panorama_migrator in env/atrium.env's IDENTITY_*_ROLES (the push refuses
|
||||
# without them; `./init.sh --add panorama` does both, and the event READER list (Panorama's trends read the hub's event log, SELECT only)). 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=panorama
|
||||
# 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 panorama_app on this box's own PostgreSQL — plain role
|
||||
# name, the compose service `postgres`, LOCAL_DB_NAME from deploy/.env, NO sslmode / sslrootcert.
|
||||
# Password: PANORAMA_APP_PASSWORD from db.env, percent-encoded.
|
||||
DATABASE_URL=postgresql+pg8000://panorama_app:<percent-encoded-password>@postgres:5432/dredd
|
||||
# Must be DATABASE_URL's role (Panorama refuses to start otherwise).
|
||||
DB_APP_ROLE=panorama_app
|
||||
# Option B: a managed PostgreSQL provider's database (deploy/README.md, "Option B").
|
||||
# DATABASE_URL=postgresql+pg8000://panorama_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
|
||||
|
||||
# ── the modules it reports on ──────────────────────────────────────────────────────────────────
|
||||
# Each module's PUBLIC address, a hairpin back through the front door (no module shares a network with
|
||||
# another). Panorama asks each one's GET /api/v1/stats with the viewer's own token and never reads
|
||||
# another module's tables. Empty: that tile is off. A module whose profile is off answers 502 at its
|
||||
# path, which the dashboard shows as unavailable; blank its line here to hide it instead.
|
||||
GALENA_BASE_URL=http://<site>/galena
|
||||
SYGNA_BASE_URL=http://<site>/sygna
|
||||
COUNSEL_BASE_URL=http://<site>/counsel
|
||||
COMPASS_BASE_URL=http://<site>/compass
|
||||
ARBITER_BASE_URL=http://<site>/arbiter
|
||||
LEXICON_BASE_URL=http://<site>/lexicon
|
||||
AGORA_BASE_URL=http://<site>/agora
|
||||
INSIDER_BASE_URL=http://<site>/insider
|
||||
# Seconds per module call; the calls run in parallel.
|
||||
STATS_TIMEOUT_SECONDS=3
|
||||
# Who sees the trends (aggregates over the shared event log, never per person): moderators or
|
||||
# everyone. The log is readable only because env/atrium.env lists panorama_app in
|
||||
# MODULE_EVENT_READER_ROLES (push.sh checks it with --events-reader).
|
||||
TRENDS_AUDIENCE=moderators
|
||||
|
||||
# ── 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 (panorama_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=panorama-backend
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
# Panorama's one-shot settings: loaded ONLY by panorama-migrate (together with panorama.env), never by the
|
||||
# long-running backend. Alembic runs as the migrator; the seed after it runs as the runtime role
|
||||
# (panorama_app, panorama.env's DATABASE_URL). init.sh writes env/panorama.migrate.env from this template
|
||||
# (git-ignored); on a deployment that already exists, `./init.sh --add panorama` does.
|
||||
|
||||
# ── Option A (the default): the migrator panorama_migrator on this box's own PostgreSQL ──────────
|
||||
# Plain role name, the `postgres` service, LOCAL_DB_NAME from deploy/.env, no TLS parameters (see
|
||||
# panorama.env). Password: PANORAMA_MIGRATOR_PASSWORD, percent-encoded.
|
||||
MIGRATION_DATABASE_URL=postgresql+pg8000://panorama_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 panorama.env.
|
||||
# MIGRATION_DATABASE_URL=postgresql+pg8000://panorama_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=
|
||||
+51
-10
@@ -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, and / goes to Atrium (atrium-backend is the front door, compose.yaml) — so what this asks for is ONE
|
||||
# /insider, /arbiter, /lexicon, /agora, /panorama, 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 ...
|
||||
@@ -19,11 +19,14 @@
|
||||
# ./init.sh --add compass # ONE app joins a deployment that already exists (deploy/, or --into)
|
||||
# ./init.sh --add insider # (the same for Insider: deploy/RUNBOOK-insider.md)
|
||||
# ./init.sh --add arbiter # (and for Arbiter: deploy/RUNBOOK-arbiter.md)
|
||||
# ./init.sh --add lexicon # (Lexicon, Agora and Panorama: deploy/RUNBOOK-m2-m4.md)
|
||||
# ./init.sh --add agora
|
||||
# ./init.sh --add panorama
|
||||
#
|
||||
# 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 and Arbiter ship switched off, so
|
||||
# IDENTITY_MIGRATOR_ROLES: Galena's, Sygna's and Counsel's — Compass, Insider, Arbiter, Lexicon, Agora and Panorama 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
|
||||
@@ -35,7 +38,8 @@
|
||||
# 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), and for compass, insider or arbiter it adds
|
||||
# model-provider key reader and migrator lists, for lexicon the key reader list, for agora 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
|
||||
# written standalone (its identity lines commented out). It refuses when APP's files exist, when
|
||||
@@ -94,9 +98,9 @@
|
||||
set -euo pipefail
|
||||
|
||||
DEPLOY_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
FAMILY="atrium galena sygna counsel compass insider arbiter"
|
||||
FAMILY="atrium galena sygna counsel compass insider arbiter lexicon agora panorama"
|
||||
# The modules that ship switched off, each under a compose profile of its own name (compose.yaml).
|
||||
PROFILED="compass insider arbiter"
|
||||
PROFILED="compass insider arbiter lexicon agora panorama"
|
||||
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\}//'; }
|
||||
|
||||
@@ -193,6 +197,7 @@ if [ -n "$ADD" ]; then
|
||||
"db.env:${ADD_UPPER}_MIGRATOR_PASSWORD" "env/atrium.env:IDENTITY_READER_ROLES" \
|
||||
"env/atrium.env:IDENTITY_MIGRATOR_ROLES" "env/atrium.env:MODEL_PROVIDER_SECRET" \
|
||||
"env/atrium.env:MODULE_EVENT_EMITTER_ROLES" "env/atrium.env:COUNTERPARTY_READER_ROLES" \
|
||||
"env/atrium.env:MODULE_EVENT_READER_ROLES" \
|
||||
"env/atrium.env:MODEL_PROVIDER_KEY_READER_ROLES" "env/atrium.env:MODEL_PROVIDER_MIGRATOR_ROLES" \
|
||||
"env/atrium.env:COUNTERPARTY_WRITER_ROLES" "env/atrium.env:COUNTERPARTY_MIGRATOR_ROLES"; do
|
||||
[ "$(grep -c "^${pair#*:}=" "$HAVE/${pair%%:*}" || true)" -le 1 ] \
|
||||
@@ -327,13 +332,15 @@ INSIDER_CURSOR_SECRET=$(token 32)
|
||||
# runs standalone (on the platform the keys are the hub's, under MODEL_PROVIDER_SECRET), and a key that
|
||||
# protects one app's secrets has no business protecting another's.
|
||||
ARBITER_SECRET_KEY=$(token 48)
|
||||
# Lexicon's, for the same reason (standalone provider keys only).
|
||||
LEXICON_SECRET_KEY=$(token 48)
|
||||
for app in $FAMILY; do
|
||||
upper=$(printf '%s' "$app" | tr '[:lower:]' '[:upper:]')
|
||||
printf -v "${upper}_APP_PASSWORD" '%s' "$(token 32)"
|
||||
printf -v "${upper}_MIGRATOR_PASSWORD" '%s' "$(token 32)"
|
||||
printf -v "${upper}_ADMIN_PASSWORD" '%s' "$(token 18)"
|
||||
done
|
||||
for value in "$POSTGRES_PASSWORD" "$SECRET_KEY" "$COMPASS_SECRET_KEY" "$MODEL_PROVIDER_SECRET" "$INSIDER_CURSOR_SECRET" "$ARBITER_SECRET_KEY" "$ATRIUM_APP_PASSWORD" "$COUNSEL_ADMIN_PASSWORD"; do
|
||||
for value in "$POSTGRES_PASSWORD" "$SECRET_KEY" "$COMPASS_SECRET_KEY" "$MODEL_PROVIDER_SECRET" "$INSIDER_CURSOR_SECRET" "$ARBITER_SECRET_KEY" "$LEXICON_SECRET_KEY" "$ATRIUM_APP_PASSWORD" "$COUNSEL_ADMIN_PASSWORD"; do
|
||||
[ ${#value} -ge 16 ] || refuse "the random generator returned something too short: check python3 / openssl"
|
||||
done
|
||||
|
||||
@@ -415,11 +422,15 @@ write_app_files() {
|
||||
# Compass and Arbiter call the models themselves, and Arbiter's 0005 points its analysis foreign
|
||||
# key at the hub's model_provider (REFERENCES). Compass stays FIRST among the migrators: the first
|
||||
# is the one the hub's one-shot import door opens for. Each takes effect once joined.
|
||||
set_key "$runtime" MODEL_PROVIDER_KEY_READER_ROLES "$ROLE_PREFIX"compass_app,"$ROLE_PREFIX"arbiter_app
|
||||
# Lexicon's typing calls the models too, but nothing of its references model_provider: a key
|
||||
# reader, not a migrator.
|
||||
set_key "$runtime" MODEL_PROVIDER_KEY_READER_ROLES "$ROLE_PREFIX"compass_app,"$ROLE_PREFIX"arbiter_app,"$ROLE_PREFIX"lexicon_app
|
||||
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.
|
||||
set_key "$runtime" MODULE_EVENT_EMITTER_ROLES "$ROLE_PREFIX"galena_app,"$ROLE_PREFIX"compass_app
|
||||
# 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
|
||||
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.
|
||||
set_key "$runtime" COUNTERPARTY_WRITER_ROLES "$ROLE_PREFIX"sygna_app
|
||||
@@ -462,6 +473,23 @@ write_app_files() {
|
||||
# Galena's PUBLIC address, a hairpin back through the front door (as Sygna's): an order fetches
|
||||
# its subject's bytes from Galena with the orderer's own token.
|
||||
set_key "$runtime" GALENA_BASE_URL "$PUBLIC/galena" ;;
|
||||
lexicon)
|
||||
set_key "$runtime" APP_BASE_URL "$PUBLIC/lexicon"
|
||||
set_key "$runtime" SECRET_KEY "$LEXICON_SECRET_KEY"
|
||||
# The hub's, never a second one (env/lexicon.env.example).
|
||||
set_key "$runtime" MODEL_PROVIDER_SECRET "$MODEL_PROVIDER_SECRET"
|
||||
set_key "$runtime" GALENA_BASE_URL "$PUBLIC/galena" ;;
|
||||
agora)
|
||||
set_key "$runtime" APP_BASE_URL "$PUBLIC/agora"
|
||||
# A round on a Galena room is a new version of its document, saved with the person's own token.
|
||||
set_key "$runtime" GALENA_BASE_URL "$PUBLIC/galena" ;;
|
||||
panorama)
|
||||
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
|
||||
set_key "$runtime" "$(printf '%s' "$other" | tr '[:lower:]' '[:upper:]')_BASE_URL" "$PUBLIC/$other"
|
||||
done ;;
|
||||
esac
|
||||
WRITTEN="$WRITTEN $runtime $migrate"
|
||||
}
|
||||
@@ -469,7 +497,7 @@ WRITTEN=""
|
||||
|
||||
if [ -n "$ADD" ]; then
|
||||
CHANGED=""
|
||||
if [ "$ADD" = compass ] || [ "$ADD" = arbiter ]; then
|
||||
if [ "$ADD" = compass ] || [ "$ADD" = arbiter ] || [ "$ADD" = lexicon ]; then
|
||||
# The model-provider secret is the hub's: reuse it. A box whose env/atrium.env predates it gets
|
||||
# the fresh value generated above in BOTH files, so the two can never start out different.
|
||||
env_file_value "$OUT/env/atrium.env" MODEL_PROVIDER_SECRET
|
||||
@@ -499,10 +527,20 @@ 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)
|
||||
case $ADD in galena|compass|agora)
|
||||
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
|
||||
# Panorama reads the event log and writes nothing (dredd-core 0.23.0's reader tier; --events-reader).
|
||||
case $ADD in panorama)
|
||||
add_to_list "$OUT/env/atrium.env" MODULE_EVENT_READER_ROLES "$ROLE_PREFIX${ADD}_app"
|
||||
CHANGED="$CHANGED\n env/atrium.env MODULE_EVENT_READER_ROLES += $ROLE_PREFIX${ADD}_app" ;;
|
||||
esac
|
||||
# Lexicon's typing calls the models (a key reader); no table of its references model_provider.
|
||||
case $ADD in lexicon)
|
||||
add_to_list "$OUT/env/atrium.env" MODEL_PROVIDER_KEY_READER_ROLES "$ROLE_PREFIX${ADD}_app"
|
||||
CHANGED="$CHANGED\n env/atrium.env MODEL_PROVIDER_KEY_READER_ROLES += $ROLE_PREFIX${ADD}_app" ;;
|
||||
esac
|
||||
# Compass and Arbiter call the models themselves (push.sh checks them with --model-provider-keys),
|
||||
# and their migrators reference the hub's model_provider. A box whose env/atrium.env predates
|
||||
# Arbiter lists Compass alone; add_to_list appends, so Compass stays first among the migrators.
|
||||
@@ -528,6 +566,9 @@ if [ -n "$ADD" ]; then
|
||||
printf '%b\n' "${CHANGED#\\n}"
|
||||
[ -z "$IDENTITY" ] || printf ' identity IDENTITY_SCHEMA=%s, SESSION_COOKIE_NAME=%s in env/%s.env\n' "$IDENTITY" "$COOKIE" "$ADD"
|
||||
[ -z "$ADMIN_EMAIL" ] || printf ' first administrator %s (the hub'"'"'s), in env/%s.migrate.env\n' "$ADMIN_EMAIL" "$ADD"
|
||||
[ "$ADD" != lexicon ] || printf 'secret MODEL_PROVIDER_SECRET (the same in env/atrium.env and env/lexicon.env) encrypts the model-provider API
|
||||
keys; keep it in the secret store, and never regenerate it on this box
|
||||
'
|
||||
[ "$ADD" != arbiter ] || printf 'secret MODEL_PROVIDER_SECRET (the same in env/atrium.env and env/arbiter.env) encrypts the model-provider API
|
||||
keys; keep it in the secret store, and never regenerate it on this box
|
||||
'
|
||||
|
||||
@@ -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 fifteen services: postgres, and <app>-migrate and <app>-backend for the seven apps (Insider's
|
||||
- the twenty-one services: postgres, and <app>-migrate and <app>-backend for the ten apps (Insider's
|
||||
optional OCR worker is under its own `ocr` profile, which the preflight does not activate)
|
||||
- postgres on all seven `<app>-db` networks; each module backend on its `<app>` + `<app>-db` networks,
|
||||
- postgres on all ten `<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,13 @@ 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 fourteen services are there
|
||||
other twenty 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 fourteen app services mount the provider's CA read-only at /run/certs/db-ca.crt; Galena's,
|
||||
Sygna's, Insider's and Arbiter's data volumes survived the merge
|
||||
- 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
|
||||
|
||||
Standard library only. Exit 0 = every property holds, 1 = a property failed (each one printed),
|
||||
2 = the model could not be read.
|
||||
@@ -58,12 +58,13 @@ import json
|
||||
import sys
|
||||
|
||||
HUB = "atrium"
|
||||
MODULES = ("galena", "sygna", "counsel", "compass", "insider", "arbiter")
|
||||
MODULES = ("galena", "sygna", "counsel", "compass", "insider", "arbiter", "lexicon", "agora", "panorama")
|
||||
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"}
|
||||
DATA_VOLUMES = {"galena": "/data", "sygna": "/data", "insider": "/data", "arbiter": "/data",
|
||||
"lexicon": "/data", "agora": "/data", "panorama": "/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,7 +47,7 @@ _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) and is switched on per box.
|
||||
# COMPOSE_PROFILES is how a module ships in the kit switched off (Compass, Insider, Arbiter, Lexicon, Agora, Panorama) and is switched on per box.
|
||||
# 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"
|
||||
|
||||
@@ -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`),
|
||||
`${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`),
|
||||
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).
|
||||
|
||||
Submodule
+1
Submodule deploy/modules/agora added at a343a1fe06
Submodule
+1
Submodule deploy/modules/lexicon added at aff115b7bb
Submodule
+1
Submodule deploy/modules/panorama added at 8fb0c9f1bb
+39
-18
@@ -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; do
|
||||
for slug in galena sygna counsel compass insider arbiter lexicon agora panorama; 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; do
|
||||
for slug in galena sygna counsel compass insider arbiter lexicon agora panorama; do
|
||||
sub=$(module_subdir "$slug")
|
||||
root=$tmp/modules/$(module_checkout "$slug")${sub:+/$sub}
|
||||
mkdir -p "$root/backend" "$root/frontend" "$root/db/managed"
|
||||
@@ -170,7 +170,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; do
|
||||
for upper in ATRIUM GALENA SYGNA COUNSEL COMPASS INSIDER ARBITER LEXICON AGORA PANORAMA; do
|
||||
for suffix in MIGRATOR_PASSWORD APP_PASSWORD MIGRATOR_ROLE APP_ROLE PYTHON; do
|
||||
CLEAN_KEYS="$CLEAN_KEYS ${upper}_$suffix"
|
||||
done
|
||||
@@ -181,11 +181,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 compass --profile insider --profile arbiter --profile lexicon --profile agora --profile panorama "$@"
|
||||
}
|
||||
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 "$@"
|
||||
-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 "$@"
|
||||
}
|
||||
# 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
|
||||
@@ -206,7 +206,7 @@ elif ! compose config -q; then
|
||||
else
|
||||
ok "compose.yaml is valid"
|
||||
services=$(compose config --services | sort | tr '\n' ' ') || services="(failed)"
|
||||
expected="arbiter-backend arbiter-migrate atrium-backend atrium-migrate compass-backend compass-migrate counsel-backend counsel-migrate galena-backend galena-migrate insider-backend insider-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 postgres 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
|
||||
@@ -226,7 +226,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="arbiter-backend arbiter-migrate atrium-backend atrium-migrate compass-backend compass-migrate counsel-backend counsel-migrate galena-backend galena-migrate insider-backend insider-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 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
|
||||
@@ -236,7 +236,7 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
step "2c. a box that has not deployed Compass, Insider or Arbiter: the kit loads, and all three stay off"
|
||||
step "2c. a box that has not deployed the switched-off modules: the kit loads, and all of them stay off"
|
||||
# The hazard this guards against is not hypothetical. compose.yaml names Compass's env files, and Compose
|
||||
# refuses to load a whole PROJECT when one is missing - so a bare `git pull` onto a box that has
|
||||
# not set Compass up used to make every compose command fail, Galena's restarts included. The env files
|
||||
@@ -246,19 +246,22 @@ if [ "$HAVE_DOCKER" = 0 ]; then
|
||||
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-aside/"
|
||||
"$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/"
|
||||
if ! compose_off config -q 2> "$tmp/compose-off.err"; then
|
||||
sed 's/^/ | /' "$tmp/compose-off.err"
|
||||
bad "without Compass's, Insider's and Arbiter's 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"
|
||||
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-"*) bad "Compass's, Insider's or Arbiter's services are active without the profile: $services" ;;
|
||||
*) ok "Compass's, Insider's and Arbiter's env files absent and their profiles off: the kit loads, and up -d would start none of them" ;;
|
||||
*" compass-"*|*" insider-"*|*" arbiter-"*|*" lexicon-"*|*" agora-"*|*" panorama-"*) 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/"
|
||||
"$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/"
|
||||
fi
|
||||
|
||||
step "2d. optional TLS: compose.tls.yaml merged, with TLS=on example settings"
|
||||
@@ -279,7 +282,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 \
|
||||
if ! clean docker compose --project-directory "$DEPLOY_DIR" "${files[@]}" --env-file "$envf" --profile compass --profile insider --profile arbiter --profile lexicon --profile agora --profile panorama \
|
||||
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
|
||||
@@ -309,7 +312,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; do
|
||||
for slug in galena sygna counsel compass insider arbiter lexicon agora panorama; do
|
||||
sub=$(module_subdir "$slug")
|
||||
app=$modules/$(module_checkout "$slug")${sub:+/$sub}/backend/app
|
||||
if [ ! -d "$app" ]; then
|
||||
@@ -408,8 +411,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 six apps, plus .env and db.env.
|
||||
if [ "$written" = 14 ]; then ok "14 files written"; else bad "$written files written, expected 14"; fi
|
||||
# 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
|
||||
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
|
||||
@@ -456,7 +459,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; do
|
||||
for slug in atrium galena sygna counsel compass insider arbiter lexicon agora panorama; 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
|
||||
@@ -538,6 +541,24 @@ 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/' \
|
||||
"$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 \
|
||||
&& grep -q "^Dry run: the inputs are complete.$" "$tmp/dry-run.init.m2m4.log" \
|
||||
&& 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"
|
||||
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"
|
||||
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" \
|
||||
--into "$tmp/init-standalone" > "$tmp/init.standalone.log" 2>&1 \
|
||||
|
||||
+54
-13
@@ -7,11 +7,12 @@
|
||||
# ./push.sh [--dry-run] [--local] [--managed-db] [--reset-passwords | --skip-provision]
|
||||
# [--stop-backend] [--lock-timeout DURATION]
|
||||
# [--db-env FILE] [--compose-env FILE] [--env-dir DIR]
|
||||
# [atrium] [galena] [sygna] [counsel] [compass] [insider] [arbiter]
|
||||
# [atrium] [galena] [sygna] [counsel] [compass] [insider] [arbiter] [lexicon] [agora]
|
||||
# [panorama]
|
||||
#
|
||||
# No app named = every DEPLOYED app: all four, plus compass, insider and arbiter when COMPOSE_PROFILES
|
||||
# names them (deploy/.env). Apps always run in the family order (atrium, galena, sygna, counsel, compass,
|
||||
# insider, arbiter).
|
||||
# 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).
|
||||
#
|
||||
# 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
|
||||
@@ -115,9 +116,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"
|
||||
FAMILY="atrium galena sygna counsel compass insider arbiter lexicon agora panorama"
|
||||
# The modules that ship in the kit switched OFF, each under a compose profile of its own name.
|
||||
PROFILED="compass insider arbiter"
|
||||
PROFILED="compass insider arbiter lexicon agora panorama"
|
||||
# The Compose service every step of the platform admin runs in.
|
||||
PROVISIONER=atrium-migrate
|
||||
ORIG_ARGS=("$@")
|
||||
@@ -154,7 +155,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) SELECTED="$SELECTED $1" ;;
|
||||
atrium|galena|sygna|counsel|compass|insider|arbiter|lexicon|agora|panorama) SELECTED="$SELECTED $1" ;;
|
||||
*) refuse "unknown argument: $1 (see --help)" ;;
|
||||
esac
|
||||
shift
|
||||
@@ -199,7 +200,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_*)
|
||||
ATRIUM_*|GALENA_*|SYGNA_*|COUNSEL_*|COMPASS_*|INSIDER_*|ARBITER_*|LEXICON_*|AGORA_*|PANORAMA_*)
|
||||
case ${1#*_} in MIGRATOR_PASSWORD|APP_PASSWORD|MIGRATOR_ROLE|APP_ROLE|PYTHON) return 0 ;; esac ;;
|
||||
esac
|
||||
return 1
|
||||
@@ -304,7 +305,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 and Arbiter ship in the kit switched OFF: compose.yaml puts their services under a profile
|
||||
# Compass, Insider, Arbiter, Lexicon, Agora and Panorama 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.
|
||||
@@ -358,6 +359,9 @@ module_repo() {
|
||||
insider) printf 'https://github.com/Alpaq92/Insider' ;;
|
||||
# Arbiter has no repository of its own yet: it is apps/arbiter in Compass's.
|
||||
arbiter) printf 'https://github.com/Alpaq92/compass-contract-hub' ;;
|
||||
lexicon) printf 'https://github.com/Alpaq92/Lexicon' ;;
|
||||
agora) printf 'https://github.com/Alpaq92/Agora' ;;
|
||||
panorama) printf 'https://github.com/Alpaq92/Panorama' ;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -404,6 +408,16 @@ app_setup() { # sets the per-app globals for $1
|
||||
arbiter) UP=ARBITER; EXTENSIONS=""
|
||||
CHECK_EXTRA="--append-only audit_log analysis_signoff agent_version frozen_card --no-delete analysis"
|
||||
SUBDIR=apps/arbiter ;;
|
||||
# Lexicon, Agora and Panorama (the split plan's M2, M3, M4): each app.models APPEND_ONLY_TABLES /
|
||||
# NO_DELETE_TABLES, the lists their 0002 grants from and their CI's managed check passes
|
||||
# (test_deploy_m2_m4_check_args.py compares them). Each 0001 runs CREATE EXTENSION IF NOT EXISTS
|
||||
# "pgcrypto", which Galena's provisioning has already put in the database, and each committed
|
||||
# provision.sql declares no extension — Insider's case, so none is asked for here. Agora's event
|
||||
# tables are Galena's case: standalone its own, on the platform the hub's (the --events rule).
|
||||
lexicon) UP=LEXICON; EXTENSIONS=""; CHECK_EXTRA="--append-only audit_log" ;;
|
||||
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" ;;
|
||||
esac
|
||||
SCHEMA=$slug
|
||||
local var tier
|
||||
@@ -446,6 +460,8 @@ app_setup() { # sets the per-app globals for $1
|
||||
# Arbiter calls the models itself too (its engine runner and agent runs), so it is the second key
|
||||
# reader (init.sh lists arbiter_app there from the first init) and is checked the same way.
|
||||
case $slug in compass|arbiter) IDENTITY_CHECK_ARGS="$IDENTITY_CHECK_ARGS --model-provider-keys" ;; esac
|
||||
# Lexicon's typing calls the models too (a key reader; init.sh lists lexicon_app from the first init).
|
||||
case $slug in lexicon) IDENTITY_CHECK_ARGS="$IDENTITY_CHECK_ARGS --model-provider-keys" ;; esac
|
||||
# The shared event log (dredd-core 0.20.0): Galena and Compass take part (the hub grants them
|
||||
# through MODULE_EVENT_EMITTER_ROLES, which the preflight requires), so their check must prove
|
||||
# each can INSERT + SELECT it and nothing more; every other module is checked without the flag,
|
||||
@@ -453,10 +469,15 @@ 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).
|
||||
case $slug in galena|compass)
|
||||
# Agora emits too (a round from the other side; it pins 0.22.0, so always --events).
|
||||
case $slug in galena|compass|agora)
|
||||
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
|
||||
# Panorama READS the log and writes nothing (dredd-core 0.23.0's reader tier, MODULE_EVENT_READER_ROLES):
|
||||
# its check proves SELECT and nothing more. The flag is new in 0.23.0, and the check runs with
|
||||
# Atrium's dredd-core (pinned 0.23.0 for exactly this).
|
||||
case $slug in panorama) IDENTITY_CHECK_ARGS="$IDENTITY_CHECK_ARGS --events-reader" ;; esac
|
||||
# The shared counterparty register (dredd-core 0.21.0): the module's tier is the one the hub
|
||||
# grants it (COUNTERPARTY_WRITER_ROLES / COUNTERPARTY_READER_ROLES in env/atrium.env; a role in
|
||||
# both is a writer, as app.identity_grants decides), so the check proves exactly that tier; a
|
||||
@@ -551,9 +572,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 120). Raise
|
||||
# This box's own PostgreSQL: the limit is the server's max_connections (compose.yaml sets 170). Raise
|
||||
# LOCAL_DB_MAX_CONNECTIONS with the server's setting if you change it.
|
||||
MAX_CONNECTIONS=${LOCAL_DB_MAX_CONNECTIONS:-120}
|
||||
MAX_CONNECTIONS=${LOCAL_DB_MAX_CONNECTIONS:-170}
|
||||
BUDGET_LIMIT_LABEL="the server's max_connections"
|
||||
fi
|
||||
is_number() { case $1 in ''|*[!0-9]*) return 1 ;; esac; }
|
||||
@@ -639,6 +660,7 @@ fi
|
||||
# where the shared schema is CREATED from (Atrium's revision 0004), where its cookie is named, and where
|
||||
# the module roles it grants that schema to are listed.
|
||||
HUB_ENV_FILE=$ENV_DIR/atrium.env HUB_COOKIE="" HUB_READERS="" HUB_MIGRATORS="" HUB_EMITTERS="" PUSHED_ROLES=""
|
||||
HUB_EVENT_READERS="" HUB_KEY_READERS=""
|
||||
HUB_CP_WRITERS="" HUB_CP_READERS="" HUB_CP_MIGRATORS=""
|
||||
if [ -n "$IDENTITY_SCHEMA_NAME" ] && [ -f "$HUB_ENV_FILE" ]; then
|
||||
env_file_value "$HUB_ENV_FILE" IDENTITY_SCHEMA
|
||||
@@ -651,6 +673,8 @@ if [ -n "$IDENTITY_SCHEMA_NAME" ] && [ -f "$HUB_ENV_FILE" ]; then
|
||||
env_file_value "$HUB_ENV_FILE" IDENTITY_READER_ROLES; HUB_READERS=${ENVFILE_VALUE// /}
|
||||
env_file_value "$HUB_ENV_FILE" IDENTITY_MIGRATOR_ROLES; HUB_MIGRATORS=${ENVFILE_VALUE// /}
|
||||
env_file_value "$HUB_ENV_FILE" MODULE_EVENT_EMITTER_ROLES; HUB_EMITTERS=${ENVFILE_VALUE// /}
|
||||
env_file_value "$HUB_ENV_FILE" MODULE_EVENT_READER_ROLES; HUB_EVENT_READERS=${ENVFILE_VALUE// /}
|
||||
env_file_value "$HUB_ENV_FILE" MODEL_PROVIDER_KEY_READER_ROLES; HUB_KEY_READERS=${ENVFILE_VALUE// /}
|
||||
env_file_value "$HUB_ENV_FILE" COUNTERPARTY_WRITER_ROLES; HUB_CP_WRITERS=${ENVFILE_VALUE// /}
|
||||
env_file_value "$HUB_ENV_FILE" COUNTERPARTY_READER_ROLES; HUB_CP_READERS=${ENVFILE_VALUE// /}
|
||||
env_file_value "$HUB_ENV_FILE" COUNTERPARTY_MIGRATOR_ROLES; HUB_CP_MIGRATORS=${ENVFILE_VALUE// /}
|
||||
@@ -701,6 +725,23 @@ for app in $APPS; do
|
||||
problem "$slug: $HUB_ENV_FILE does not list $APP_ROLE in MODULE_EVENT_EMITTER_ROLES: $slug takes part in the shared event log (dredd-core 0.20.0) and its check proves it can write it, but Atrium grants the log only to the roles listed there. Add it (comma-separated) and push atrium too (or before): atrium-migrate re-applies the event grants on every run (python -m app.identity_grants)" ;;
|
||||
esac ;;
|
||||
esac
|
||||
# The reader tier's twin (dredd-core 0.23.0): checked with --events-reader, granted only to the roles
|
||||
# in MODULE_EVENT_READER_ROLES — and never to one that is also an emitter (the grant block refuses).
|
||||
case "$IDENTITY_CHECK_ARGS " in *" --events-reader "*)
|
||||
case ",$HUB_EVENT_READERS," in *",$APP_ROLE,"*) ;; *)
|
||||
problem "$slug: $HUB_ENV_FILE does not list $APP_ROLE in MODULE_EVENT_READER_ROLES: $slug reads the shared event log (dredd-core 0.23.0's reader tier) and its check proves it can SELECT it, but Atrium grants the log only to the roles listed there. Add it (comma-separated) and push atrium too (or before)" ;;
|
||||
esac
|
||||
case ",$HUB_EMITTERS," in *",$APP_ROLE,"*)
|
||||
problem "$slug: $HUB_ENV_FILE lists $APP_ROLE in MODULE_EVENT_EMITTER_ROLES, but $slug only reads the event log: take it out there (MODULE_EVENT_READER_ROLES is its tier; a role in both is refused by Atrium's grants)" ;;
|
||||
esac ;;
|
||||
esac
|
||||
# A module checked with --model-provider-keys that the hub does not list as a key reader: its check
|
||||
# would fail after a migrate that did nothing wrong.
|
||||
case "$IDENTITY_CHECK_ARGS " in *" --model-provider-keys "*)
|
||||
case ",$HUB_KEY_READERS," in *",$APP_ROLE,"*) ;; *)
|
||||
problem "$slug: $HUB_ENV_FILE does not list $APP_ROLE in MODEL_PROVIDER_KEY_READER_ROLES: $slug calls the models itself and its check proves it can read the provider keys, but Atrium grants them only to the roles listed there. Add it (comma-separated) and push atrium too (or before)" ;;
|
||||
esac ;;
|
||||
esac
|
||||
# A module on dredd-core 0.21.0+ whose own revision moves its counterparties into the shared
|
||||
# register: without a tier its runtime cannot read the register, and without the migrator in
|
||||
# COUNTERPARTY_MIGRATOR_ROLES its revision finds no import door and stops mid-deploy.
|
||||
@@ -847,7 +888,7 @@ else
|
||||
say " identity none: standalone apps, each with its own accounts (PLATFORM_IDENTITY_SCHEMA is empty)"
|
||||
fi
|
||||
if [ "$NUMBERS_OK" = 1 ]; then
|
||||
# Compass and Insider run only when COMPOSE_PROFILES names them, whatever this push selects: that,
|
||||
# The profiled modules run only when COMPOSE_PROFILES names them, whatever this push selects: that,
|
||||
# not $APPS, is what decides how many backends hold a pool at once.
|
||||
running=4
|
||||
for profiled in $PROFILED; do
|
||||
|
||||
Reference in New Issue
Block a user