deploy: harden Docker stack and add Ubuntu production guide
CI / build (push) Has been cancelled

Make the Compose stack safe and reproducible on a fresh host: parameterize database credentials, bind Postgres to loopback by default, add an app healthcheck and log rotation, and pass Postmark/archive settings through. Document the complete Ubuntu deployment path, including bootstrap, TLS, firewall, cron, NFS, backups, updates, and troubleshooting.
This commit is contained in:
2026-11-20 05:32:28 +00:00
parent 3fd8ffb0f9
commit 8018718487
4 changed files with 351 additions and 21 deletions
+19 -1
View File
@@ -4,9 +4,24 @@
# All secrets are server-only — never prefix with NEXT_PUBLIC_.
# ---------------------------------------------------------------------------
# Database (Postgres). docker-compose sets this for the app container.
# Database (Postgres). The compose app/migrate services build their own URL from
# POSTGRES_*; this value is for host-side CLI commands (`pnpm db:*`, psql).
DATABASE_URL=postgres://media:media@localhost:5433/media
# Compose database credentials. Applied only when the pgdata volume is first
# initialized; changing them later does not change the role inside Postgres.
# For production use a URL-safe password (openssl rand -hex 24) and update
# DATABASE_URL to match.
POSTGRES_USER=media
POSTGRES_PASSWORD=media
POSTGRES_DB=media
POSTGRES_PORT=5433
POSTGRES_BIND=127.0.0.1
# Host publishing. Set APP_BIND=127.0.0.1 when a reverse proxy is in front.
APP_PORT=3000
APP_BIND=0.0.0.0
# Auth (magic-link). Generate a secret with: openssl rand -base64 32
# This value also encrypts the admin-entered Gmail app password: rotating it
# makes stored SMTP credentials undecryptable (they are then treated as unset).
@@ -59,7 +74,10 @@ UPLOAD_DIR=/tmp/uploads
# The app always writes to /archive inside the container; admins can change the
# archive subfolder in Settings → Photo archive (NFS).
ARCHIVE_DIR=/archive
ARCHIVE_FOLDER=Glenloch Media
NFS_SHARE=
# Host path bind-mounted at /archive. Leave empty to use the archive-data volume.
MEDIA_ARCHIVE_DIR=
# Observability (declared; no Sentry integration is wired yet)
SENTRY_DSN=