Secrets and Env
Secrets and Env
Migration in progress.
api.legendary-arena.comand its PostgreSQL are moving off Render onto a self-hosted DigitalOcean Ubuntu droplet fronted by Cloudflare, perdocs/PLAN.md. Until decommission, Render stays warm as the rollback target.
Summary
This page describes the environment contract for the la-server application: the full set of variables the process expects at runtime. The owning artifact infra/.env.example
holds placeholders only; the real values live in a mode-600 file at /etc/la/.env on the droplet and are never committed.
Mechanics
The owning artifact is infra/.env.example
. It lists every variable the server actually reads: the render.yaml keys for legendary-arena-server plus every process.env.* in apps/server, as of engine main 2026-10-04. Copy it to /etc/la/.env and fill in the real values there. 40-app-deploy.ps1
enforces root:root mode 600. systemd reads EnvironmentFile as root before dropping to the operator service user, so no unprivileged account needs to read it.
Grouped as in the file:
- Runtime —
NODE_ENV=production,PORT=3000(Nginx proxies to 3000; the server’s own default is 8000),WEB_CONCURRENCY=1. - Database —
DATABASE_URL=postgres://la:…@127.0.0.1:5432/la(co-located PostgreSQL). - Auth —
JWT_SECRET,HANKO_TENANT_BASE_URL,HANKO_EXPECTED_AUDIENCE,HANKO_JWKS_REFRESH_INTERVAL_MS. - Payments —
STRIPE_SECRET_KEY,STRIPE_WEBHOOK_SECRET,STRIPE_PRICE_ALLOWLIST. - AI coach —
ANTHROPIC_API_KEY,COACH_MODEL. - Public URLs, analytics, CI tokens —
PUBLIC_BASE_URL,ANALYTICS_USER_ID_SALT,SWEEP_SUBMIT_TOKEN,INSPECTION_SUBMIT_TOKEN,HANDOFF_SUBMIT_TOKEN,PAR_VERSION. - R2 (images + legends board) —
R2_ACCOUNT_ID,R2_ACCESS_KEY_ID,R2_SECRET_ACCESS_KEY,R2_BUCKET_NAME,R2_LEGENDS_BUCKET,LEGENDS_PUBLISHER_ENABLED,LEGENDS_PUBLISHER_INTERVAL_MS. - Email —
BREVO_API_KEY,BREVO_LIST_ID, and the three optionalBREVO_*_TEMPLATE_IDs. - Dashboard DR tile (optional) —
DASH_GITHUB_TOKEN,DASH_GITHUB_REPO.
Two more root-only files (600) keep operational credentials away from the app:
/etc/la/backup.env— the backup-bucket R2 keys, optional pCloud token and ping URL (Backup and Restore )./etc/la/monitor.env— the monitoring ping URL and thresholds (Monitoring ).
The sync: false values exist only in the Render dashboard (Environment tab). Copy them across at cutover; they are never in either repo.
Interactions
- Deploy Server
— provisions the box and installs the systemd unit whose
EnvironmentFile=/etc/la/.envconsumes exactly these variables. - PostgreSQL Setup
— owns the database that
DATABASE_URLaddresses atlocalhost:5432. - Systemd Service
— the
la-serverunit loads this file at process start; a missing or malformed file fails the service. infra/.env.example— the committed placeholder template that defines the contract.
Edge Cases
- The
/etc/la/.envfile must be mode 600 and owned appropriately; if it is world-readable, secrets are exposed, and if systemd cannot read it theEnvironmentFileload fails and the service will not start. - Never commit real values — only
infra/.env.examplewithREPLACE_MEplaceholders belongs in git. DATABASE_URLpoints atlocalhost; any assumption of a remote managed database is wrong and will break connectivity.- The
/etc/ladirectory is created by cloud-init during provisioning; if that step did not run, the copy target does not exist.
References
infra/.env.example— owning artifact, the environment contract.docs/PLAN.md— migration plan; source of thesync:falsesecrets moving offrender.yaml.content/app/secrets-and-env.md— operator content page this wiki entry pairs with.infra/systemd/la-server.service— the consumer that references this file viaEnvironmentFile.