Fixes Atrium#53 run 2, points 3 and 5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
165 lines
12 KiB
Bash
165 lines
12 KiB
Bash
# ─────────────────────────────────────────────────────────────────────────────
|
|
# Atrium — copy to .env and edit. On Windows write it WITHOUT a BOM:
|
|
# [System.IO.File]::WriteAllText("$PWD\.env", (Get-Content .env.example -Raw))
|
|
# (PowerShell's Out-File -Encoding utf8 adds a BOM, which pydantic-settings then
|
|
# folds into the first key name and you get a baffling "field required" error.)
|
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
|
|
# Core. Defaults fail closed: production hides error detail (500s) and logs at INFO. The session
|
|
# cookie's Secure flag follows the request scheme unless SESSION_COOKIE_SECURE forces it (below).
|
|
# Set development explicitly for local debugging (500 detail, DEBUG logs).
|
|
APP_ENV=production
|
|
|
|
# Where this app is served from. The image's front door mounts Atrium at /atrium itself, so leave it
|
|
# empty (or set exactly /atrium; anything else refuses start-up). Empty is also right for
|
|
# `uvicorn app.main:app` in dev, where Atrium owns the root.
|
|
ROOT_PATH=
|
|
|
|
# The platform's front door (the image's CMD, app.frontdoor:outer) serves Atrium at /atrium itself and
|
|
# 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,insider=http://insider-backend:8000,arbiter=http://arbiter-backend:8000,lexicon=http://lexicon-backend:8000,agora=http://agora-backend:8000,parafa=http://parafa-backend:8000,scribe=http://scribe-backend:8000,workflow=http://workflow-backend:8000
|
|
FRONTDOOR_UPSTREAMS=
|
|
|
|
# ── Database ─────────────────────────────────────────────────────────────────
|
|
# Runtime uses the least-privilege `app` role; Alembic uses `migrator`.
|
|
POSTGRES_DB=atrium
|
|
POSTGRES_PASSWORD=change_me_super
|
|
DB_APP_PASSWORD=change_me_app
|
|
DB_MIGRATOR_PASSWORD=change_me_migrator
|
|
|
|
DATABASE_URL=postgresql+pg8000://app:change_me_app@postgres:5432/atrium
|
|
MIGRATION_DATABASE_URL=postgresql+pg8000://migrator:change_me_migrator@postgres:5432/atrium
|
|
# The runtime role's name (the user in DATABASE_URL); the runtime-grants migration grants to it.
|
|
DB_APP_ROLE=app
|
|
# The backend's connection pool: at most DB_POOL_SIZE + DB_MAX_OVERFLOW connections.
|
|
DB_POOL_SIZE=5
|
|
DB_MAX_OVERFLOW=10
|
|
|
|
# Hosts the family's TLS rule treats as local, on top of "", localhost, 127.0.0.1, ::1 and postgres
|
|
# (the compose service): comma-separated, optional. Every other database host must be reached with
|
|
# sslmode=verify-full, or the app refuses to start. List only a private host that needs no TLS.
|
|
DB_LOCAL_HOSTS=
|
|
|
|
# ── Database on a managed PostgreSQL provider (the family's shared database, instead of the local postgres) ──
|
|
# Runbook: db/managed/README.md (Atrium's part, and the project-wide steps for any provider). All four
|
|
# apps share ONE database; Atrium lives in schema atrium, as roles atrium_migrator and atrium_app.
|
|
# Provision Atrium once, then replace the Database settings above with these, delete the
|
|
# POSTGRES_PASSWORD and DB_*_PASSWORD lines (unused there), and start with BOTH compose files:
|
|
# docker compose -f docker-compose.yml -f docker-compose.managed-db.yml up -d --build
|
|
# - Host: the provider's SESSION-mode pooler or its direct connection, on port 5432 — never a
|
|
# transaction-mode pooler (commonly port 6543).
|
|
# - User: the plain <role>, or <role>.<tenant> where the provider's pooler needs the tenant in the user
|
|
# name (its dashboard shows the exact form). Never the platform admin (postgres).
|
|
# - TLS: sslmode=verify-full against the provider's root CA file (download it from its dashboard),
|
|
# which the override mounts at /run/certs/db-ca.crt from MANAGED_DB_CA_FILE. Any host that is not
|
|
# local is refused without verify-full; sslmode=prefer/allow/disable are refused everywhere.
|
|
# - Passwords: percent-encode every character outside A-Z a-z 0-9 - . _ ~ (e.g. @ -> %40, % -> %25).
|
|
# - Roles: exactly atrium_app (DATABASE_URL, DB_APP_ROLE) and atrium_migrator; deploy_check refuses others.
|
|
# - Pool: the four apps and the provider's own services share one connection limit; keep the apps'
|
|
# total within about 80% of it. The defaults below take 4 x (15 + 1) = 64 across the family; on a
|
|
# small plan set DB_POOL_SIZE=3 and DB_MAX_OVERFLOW=2 in EVERY app (4 x (5 + 1) = 24). A pooler's
|
|
# own per-user pool size must be at least DB_POOL_SIZE + DB_MAX_OVERFLOW + 1.
|
|
# MANAGED_DB_CA_FILE=./certs/db-ca.crt
|
|
# DATABASE_URL=postgresql+pg8000://atrium_app.<tenant>:<atrium-app-password>@<pooler-host>:5432/postgres?sslmode=verify-full&sslrootcert=/run/certs/db-ca.crt
|
|
# MIGRATION_DATABASE_URL=postgresql+pg8000://atrium_migrator.<tenant>:<atrium-migrator-password>@<pooler-host>:5432/postgres?sslmode=verify-full&sslrootcert=/run/certs/db-ca.crt
|
|
# DB_APP_ROLE=atrium_app
|
|
# DB_POOL_SIZE=5
|
|
# DB_MAX_OVERFLOW=10
|
|
|
|
# ── Auth / sessions ──────────────────────────────────────────────────────────
|
|
SESSION_TTL_HOURS=12
|
|
LOGIN_MAX_ATTEMPTS=5
|
|
LOGIN_LOCKOUT_MINUTES=15
|
|
# Empty = auto-detect from the request scheme (Secure over HTTPS only). Never key
|
|
# this off APP_ENV — a Secure cookie over plain HTTP is dropped and login "doesn't stick".
|
|
SESSION_COOKIE_SECURE=
|
|
|
|
# ── one platform, one account ────────────────────────────────────────────────
|
|
# Empty (the default) is the STANDALONE deployment: Atrium owns app_user, session and
|
|
# module_permission in its own schema, signs its own users in, and nothing below applies.
|
|
#
|
|
# Set IDENTITY_SCHEMA and those three tables live in a neutral schema that every module reads, so a
|
|
# person has ONE account across the platform and signs in once, here. It is a name rather than a
|
|
# flag because three things must agree on it: the revision that creates the tables there, the
|
|
# start-up assertion that they really resolve there (a shadow copy in this app's own schema has no
|
|
# other symptom), and the per-module permissions, which are meaningless without a platform.
|
|
#
|
|
# The schema itself, its owner and the roles' search_path are PROVISIONING, not migration — a
|
|
# migrator holds no CREATE on the database and cannot ALTER ROLE another role. See
|
|
# db/managed/provision.sql and deploy/RUNBOOK-one-account.md.
|
|
IDENTITY_SCHEMA=
|
|
# The module roles that READ the shared schema, comma-separated: each module's runtime role, and
|
|
# each module's migrator (which needs REFERENCES to point its own foreign keys at the shared
|
|
# app_user). Atrium's own two are never listed — its runtime role is the writer and its migrator
|
|
# owns the schema. Naming them here keeps the modules' names out of this app's source.
|
|
IDENTITY_READER_ROLES=
|
|
IDENTITY_MIGRATOR_ROLES=
|
|
# The shared model providers (dredd-core 0.15.0, revision 0009), in the same identity schema. Every
|
|
# role in IDENTITY_READER_ROLES reads the list and the policy; these two name the modules that need
|
|
# more, and each takes effect only for a role that is also in the matching identity list above.
|
|
# key readers: runtime roles that may READ THE API KEYS (a module that calls a model itself,
|
|
# e.g. arbiter_app); removing one here and migrating revokes it
|
|
# migrators: migrators that may REFERENCE model_provider from their own tables (e.g.
|
|
# arbiter_migrator); the first is also the one the one-shot import door is opened for
|
|
# Empty standalone. The deploy kit's env/atrium.env.example names Arbiter's two.
|
|
MODEL_PROVIDER_KEY_READER_ROLES=
|
|
MODEL_PROVIDER_MIGRATOR_ROLES=
|
|
# The modules' runtime roles that take part in the shared event log `module_event` (dredd-core
|
|
# 0.20.0, revision 0011): SELECT + INSERT under row-level security, each only once it is also in
|
|
# IDENTITY_READER_ROLES. The hub's own runtime role always takes part. Empty standalone.
|
|
MODULE_EVENT_EMITTER_ROLES=
|
|
# The READER tier (dredd-core 0.23.0): runtime roles that may only SELECT the log (a module that
|
|
# reports on it and says nothing). A role is an emitter or a reader, never both. Empty standalone.
|
|
MODULE_EVENT_READER_ROLES=
|
|
# The shared counterparty register (dredd-core 0.21.0, revision 0012): the modules' runtime roles
|
|
# that WRITE it (Sygna, Galena), the ones that only READ it (Agora, Parafa), and the migrators that move their own counterparties in (import door) and point foreign keys
|
|
# at it. Each only once also joined (IDENTITY_READER_ROLES / IDENTITY_MIGRATOR_ROLES). The hub's own
|
|
# runtime role holds nothing there. Empty standalone.
|
|
COUNTERPARTY_WRITER_ROLES=
|
|
COUNTERPARTY_READER_ROLES=
|
|
COUNTERPARTY_MIGRATOR_ROLES=
|
|
# The platform's model-provider secret: provider API keys are encrypted under a key derived from it,
|
|
# by the hub and by every opted-in module alike, so it must be IDENTICAL in the opted-in modules' env. Never in
|
|
# the database, never logged; never regenerate it once keys are stored (they become unreadable).
|
|
# Generate with: python -c "import secrets; print(secrets.token_urlsafe(48))"
|
|
MODEL_PROVIDER_SECRET=
|
|
# This app's slug on the platform, and the hub's own: module_permission(user, 'atrium') is refused —
|
|
# every account may open the launcher, so a 'user' row would say nothing, and the hub has
|
|
# administrators whose job is not delegable one module at a time.
|
|
MODULE_SLUG=atrium
|
|
# One account means one cookie. At the cutover every app in the family is set to
|
|
# SESSION_COOKIE_NAME=dredd_session, and because the family runs at ONE origin that is all there is
|
|
# to it — no Domain attribute, no signed assertion. The default keeps a standalone Atrium on its own
|
|
# name; deps reads the old one for a single request so the cutover cannot sign you out mid-change.
|
|
SESSION_COOKIE_NAME=atrium_session
|
|
|
|
# CORS — empty by default (same-origin design). Comma-separated origins for a
|
|
# separately-served console in dev.
|
|
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, Insider, Arbiter, Lexicon, Agora, Parafa, Scribe, Workflow) into the module
|
|
# catalog — once per instance, without addresses; add those under Administration → Modules.
|
|
|
|
# ── App tokens ───────────────────────────────────────────────────────────────
|
|
# Named, revocable credentials for desktop/CLI clients, so they never store a password.
|
|
# The window is an IDLE timeout: every use slides it forward, so a token in regular use keeps
|
|
# working while one that is exfiltrated and parked expires on its own.
|
|
APP_TOKENS_ENABLED=true
|
|
APP_TOKEN_IDLE_DAYS=30
|
|
APP_TOKEN_MAX_IDLE_DAYS=365
|
|
APP_TOKEN_RENEW_AFTER_HOURS=12
|
|
|
|
# ── OpenTelemetry (opt-in) ───────────────────────────────────────────────────
|
|
OTEL_ENABLED=false
|
|
OTEL_SERVICE_NAME=atrium-backend
|
|
OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
|
|
|
|
# The Archive's technical account (Atrium#53): the fixed id the seed creates it under, to
|
|
# be granted user access in Parafa, Workflow, Agora and Arbiter only. Keep the default.
|
|
ARCHIVE_READER_ID=a2c41e00-0000-4000-8000-000000000053
|