fix(env): the documented Compose deploy could not boot #163
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/env-example-secret-enc-key"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The defect
.env.example— the filedocker-compose.ymlactually reads — never listedSECRET_ENC_KEY.utils/secretBox.jsresolves the key at require time and throwsSECRET_ENC_KEY must be set in production, so following README Option A exactly produces a container that crash-loops before it ever listens:It was easy to miss because the variable is documented in two places a Compose operator never opens:
server/.env.example, which is what local development copies, and the README's environment-variable reference table. Only the file the deployment reads was missing it.Reproduced, then verified
Against the published image, not a working tree:
cp .env.example .env, fill in what the README's list names,docker compose up -d→ crash loop on the error above.listening on http://0.0.0.0:3000, seeds the first admin, and/api/healthanswers{"status":"ok"}.The change
.env.examplegainsSECRET_ENC_KEYbesideJWT_SECRET, documenting what it encrypts, that production refuses to start without it, and that changing it later orphans every stored secret rather than re-encrypting them.SECRET_ENC_KEYandBOT_INTERNAL_KEY. Both are refused-at-boot in production, andBOT_INTERNAL_KEYis required even on a deployment that runs no bot — precisely the case the list omitted.No code changes; the boot-time refusal is correct behaviour and stays as it is.
How it was found
While writing the runicgateway.com installation docs (runicgateway.com#10), whose quickstart is checked against this file on every build. Merging this will turn that PR's
checkQuickstartred by design — the check fails the moment the variable appears here, so the note calling it an upstream omission cannot outlive the defect. A one-line follow-up on that branch clears it.AI-assisted: written with Claude Code (Opus 5).
🤖 Generated with Claude Code