fix(compose): fail fast on missing JWT_SECRET instead of a silent restart loop

Without JWT_SECRET the server throws at boot (config.ts) and `restart:
unless-stopped` turns that into an endless crash loop that is invisible unless
you run `docker compose logs backspace`. Guard it exactly like DOMAIN already is,
so `docker compose up` stops immediately with an actionable message. install.sh
generates the secret before bringing the stack up, so this only affects the
manual `cp .env.example .env && docker compose up` path.
This commit is contained in:
Jannis Braun
2026-07-06 01:12:14 +02:00
parent 9d3f72be75
commit 028005d487
+6
View File
@@ -27,6 +27,12 @@ services:
- NODE_ENV=production
- DB_PATH=/app/data/backspace.db
- UPLOAD_DIR=/app/data/uploads
# Fail fast with a clear message if the secret is missing/empty, instead of
# letting the container boot-crash on every `restart: unless-stopped` cycle
# (a silent loop that only shows up in `docker compose logs backspace`).
# install.sh generates this before bringing the stack up; this guard only
# bites the manual `cp .env.example .env && docker compose up` path.
- "JWT_SECRET=${JWT_SECRET:?Set JWT_SECRET in .env - generate one with: openssl rand -hex 32}"
networks:
- internal
healthcheck: