Files
adminandClaude Opus 5.5 31ecd59ca6 Drop the retired Workflow module (compass) from the catalog
Workflow was retired 2026-11-14: remove its catalog entry, COMPASS_BASE_URL
setting, env example and README mention.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 13:29:54 +01:00

180 lines
12 KiB
Bash

# ─────────────────────────────────────────────────────────────────────────────
# Panorama — 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. The session cookie's
# Secure flag is auto-detected from the request scheme (see SESSION_COOKIE_SECURE).
APP_ENV=production
APP_BASE_URL=http://localhost
# Path prefix this deployment is mounted under. Empty = served at the origin root (this stack).
# ROOT_PATH=/panorama runs it as a module of a platform (one origin, one module per path). It is
# HALF of one decision: the front door must STRIP the prefix (Atrium forwards `/panorama/*` without it) and
# this backend re-adds it via uvicorn --root-path. Set only one of the two and you get a doubled
# prefix (404s everywhere) or server-generated URLs that escape it. The console needs nothing — it
# derives its API base from the document.
ROOT_PATH=
# ── Database ─────────────────────────────────────────────────────────────────
# Runtime uses the least-privilege `app` role; Alembic uses `migrator`.
POSTGRES_DB=panorama
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/panorama
MIGRATION_DATABASE_URL=postgresql+pg8000://migrator:change_me_migrator@postgres:5432/panorama
# 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
# TLS rule: a database host that is not local ("", localhost, 127.0.0.1, ::1 or `postgres`) must say
# sslmode=verify-full in its URL, or the backend, migrate and the seed refuse to start. A private
# database on a trusted network that truly needs no TLS is listed here instead (comma-separated).
# No other opt-out.
DB_LOCAL_HOSTS=
# ── Managed PostgreSQL (the family's shared database; replaces the local postgres) ──
# Runbook: db/managed/README.md. Every app of the family shares ONE managed database; Panorama
# lives in schema panorama, as roles panorama_migrator and panorama_app. Provision it
# 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 and port: from the provider's connection details. Through a pooler use its SESSION mode
# (transaction mode breaks prepared statements; on the poolers the family knows that is port 5432,
# never 6543), or the direct connection.
# - User: <role>, or <role>.<tenant> where the pooler wants the tenant in the user name. Never the
# platform admin (postgres).
# - TLS: sslmode=verify-full against the provider's root CA (downloaded from its dashboard), which the
# override mounts at /run/certs/db-ca.crt from MANAGED_DB_CA_FILE; leave sslrootcert out to verify
# against the system trust store instead. sslmode=prefer/allow/disable are refused, and so is a
# URL to any host that is not local without sslmode=verify-full (DB_LOCAL_HOSTS above).
# - Passwords: percent-encode every character outside A-Z a-z 0-9 - . _ ~ (e.g. @ -> %40, % -> %25).
# - DB_APP_ROLE: the role in DATABASE_URL without any .<tenant> suffix (migrate refuses otherwise).
# - Pool: count DB_POOL_SIZE + DB_MAX_OVERFLOW + 1 (a seed or check beside the backend) per app, and
# keep the total over every app in the database at or below 80% of its connection limit (the
# provider's own services use the rest): 72 of 90, 48 of 60. Five apps at the defaults take
# 5 x (15 + 1) = 80, which does NOT fit a 90-connection limit: set DB_POOL_SIZE=4 and
# DB_MAX_OVERFLOW=8 in EVERY app (5 x 13 = 65), or size the instance for more. For a 60-connection
# limit set DB_POOL_SIZE=3 and DB_MAX_OVERFLOW=2 in EVERY app (5 x 6 = 30). Through a pooler in
# session mode, its own pool size must be at least DB_POOL_SIZE + DB_MAX_OVERFLOW + 1.
# DB_POOL_SIZE >= 1 and DB_MAX_OVERFLOW >= 0 (0 / -1 would mean no limit, so they are refused).
# MANAGED_DB_CA_FILE=./certs/db-ca.crt
# DATABASE_URL=postgresql+pg8000://panorama_app.<tenant>:<app-password>@<host>:5432/postgres?sslmode=verify-full&sslrootcert=/run/certs/db-ca.crt
# MIGRATION_DATABASE_URL=postgresql+pg8000://panorama_migrator.<tenant>:<migrator-password>@<host>:5432/postgres?sslmode=verify-full&sslrootcert=/run/certs/db-ca.crt
# DB_APP_ROLE=panorama_app
# DB_POOL_SIZE=4
# DB_MAX_OVERFLOW=8
# ── Storage ──────────────────────────────────────────────────────────────────
DATA_DIR=/data
# ── The modules this dashboard reads ─────────────────────────────────────────
# Each module's PUBLIC base URL (https://<site>/galena). Panorama calls GET <url>/api/v1/stats
# with the person's own session (dredd-core's stats contract), so each module counts only what
# that person may see. Empty = not deployed here: shown as absent, never called. Standalone the
# person's Panorama session means nothing to another app, so the cards say "brak dostępu" - the
# numbers need the platform's one account.
GALENA_BASE_URL=
SYGNA_BASE_URL=
COUNSEL_BASE_URL=
ARBITER_BASE_URL=
LEXICON_BASE_URL=
AGORA_BASE_URL=
PARAFA_BASE_URL=
SCRIBE_BASE_URL=
INSIDER_BASE_URL=
# Seconds per module call; the calls run in parallel.
STATS_TIMEOUT_SECONDS=3
# Who sees the trends and durations (aggregates over the shared event log, never per person):
# moderators (this module's moderators and the administrator) or everyone.
TRENDS_AUDIENCE=moderators
# ── One platform, one account ────────────────────────────────────────────────
# The shared identity schema. Empty — this stack — is STANDALONE: Panorama owns its own
# accounts, has its own sign-in screen and its own Users administration, and the three settings
# below do nothing. That is a supported deployment for ever, not a stage to grow out of.
#
# Set IDENTITY_SCHEMA=dredd and this app becomes a MODULE of the platform: `app_user`,
# `session` and `module_permission` live in a neutral schema the hub owns and this app READS. A
# person then has ONE account for everything, signs in once at the hub, and the cookie they got
# there is the cookie this app accepts — one origin, one cookie, nothing to hand over. This app's
# sign-in form disappears (there is no password here), account creation and password changes answer
# 409 pointing at the hub, and app tokens stay listable and revocable but are minted there.
#
# It also starts REFUSING people, which standalone it never does. `module_permission` holds one row
# per person per module, and no row is no access: somebody with a platform account who has not been
# admitted to this one is turned away at the door rather than shown an empty screen. Admitting them,
# and making somebody a moderator of this app, happens in the hub — this app holds SELECT on that
# table and nothing else.
#
# Switching it on is NOT just this line. In order: the platform admin re-renders
# db/managed/provision.sql with --identity-schema / --identity-owner and runs it (the schema, USAGE
# and a search_path of `panorama, dredd, extensions` — none of which a migrator may
# do); the hub's own migration creates the tables and grants this app's two roles their tier; then
# `alembic upgrade head` here runs 0003, which merges this schema's accounts into the shared ones by
# e-mail address. Read backend/alembic/versions/0003_shared_identity.py before running it on
# anything you care about — it drops this app's local identity tables, and every session and app
# token with them. db/managed/README.md has the whole sequence.
IDENTITY_SCHEMA=
# This app's slug on the platform — the module a permission row admits somebody to. Only meaningful
# with IDENTITY_SCHEMA set, and it must match the slug the hub uses for this app, or nobody's row
# resolves and nobody but a platform administrator can open it. Note it is NOT always the same
# string as the Postgres schema (`panorama`): a module slug is a URL path segment, so the hub's
# module_permission table allows hyphens and refuses underscores, while a schema name is the other
# way round. The scaffolder derived this one from that one; change both or neither.
MODULE_SLUG=panorama
# Where people sign in when accounts are shared: the hub's address as a browser sees it, e.g.
# /atrium/. Empty is allowed — the console then says accounts live elsewhere without offering a
# link that goes nowhere.
IDENTITY_HUB_URL=
# The session cookie's name. One account means one cookie: at a cutover every app in the family is
# set to dredd_session. The old name is still read for a while, so renaming it does not sign
# everybody out the moment the container restarts.
SESSION_COOKIE_NAME=panorama_session
# ── 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=
# CORS — empty by default (same-origin design). Comma-separated origins for a
# separately-served console in dev.
CORS_ALLOW_ORIGINS=
# Who may frame Panorama: 'none' (default; X-Frame-Options DENY) or 'self' (SAMEORIGIN, what the
# platform's kit sets). Anything else refuses start-up.
FRAME_ANCESTORS='none'
# ── Bootstrap admin (seed) ───────────────────────────────────────────────────
BOOTSTRAP_ADMIN_EMAIL=admin@example.com
BOOTSTRAP_ADMIN_PASSWORD=admin12345
# Seed a small demo dataset so the app isn't empty on first run.
SEED_DEMO=true
# ── 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
# ── The edge ─────────────────────────────────────────────────────────────────
# No reverse proxy: the backend is published on :80 (plain HTTP) and is its own edge (app/edge.py).
# uvicorn trusts X-Forwarded-For only from these addresses (default 127.0.0.1). On the platform, the
# front door's address; never `*`.
FORWARDED_ALLOW_IPS=127.0.0.1
# ── OpenTelemetry (opt-in) ───────────────────────────────────────────────────
OTEL_ENABLED=false
OTEL_SERVICE_NAME=panorama-backend
OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317