Files
famapp/deploy
ginnoirandClaude Sonnet 4.6 1185f5ab50 Production-ready wiring: VAPID prop fix, port mappings, AUTH_URL
- PushOptIn now accepts vapidKey as a prop from its server-component
  parent (settings page reads VAPID_PUBLIC_KEY at runtime) — eliminates
  the NEXT_PUBLIC_* build-time dependency so pre-built GHCR images work
  without a build arg.
- deploy/compose.yaml: famapp exposes 3010:3000, authentik-server exposes
  9200:9000 so the existing Caddy stack can proxy by IP, matching every
  other service in the homelab.  NEXT_PUBLIC_APP_URL replaced by AUTH_URL
  (correct next-auth v5 var).
- deploy/Caddyfile.snippet: updated to 192.168.1.69:3010 / :9200.
- .env.production.example: AUTH_URL, ntfy pre-wired to ntfy.ginnoir.com,
  VAPID_SUBJECT prefilled with real email.
- typecheck and pnpm build both pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 18:32:08 -05:00
..
2026-05-06 17:37:37 -05:00
2026-05-06 17:37:37 -05:00
2026-05-06 17:37:37 -05:00

Deploying famapp

Trunk-based: main is always green. Production deploys only from version tags (vX.Y.Z). The dev-login flow is retained for local development behind a double gate (NODE_ENV !== "production" and ENABLE_DEV_LOGIN=true); a startup assertion in src/lib/dev-login-config.ts makes a misconfigured prod fail loud instead of silently exposing it.

One-time host setup

  1. Install Docker + Compose plugin on the host.
  2. git clone this repo to e.g. /srv/famapp.
  3. Copy .env.production.example/srv/famapp/deploy/.env and fill in real values.
    • openssl rand -base64 32 for AUTH_SECRET.
    • openssl rand -base64 60 for AUTHENTIK_SECRET_KEY.
    • pnpm vapid:generate (locally) for the three VAPID lines.
  4. Bootstrap Authentik per deploy/authentik/README.md. Save the OIDC client id/secret into .env.
  5. Wire Caddy with deploy/Caddyfile.snippet.

Cutting a release

# from your dev machine, on main, with a clean working tree
git tag v0.1.0
git push origin v0.1.0

.github/workflows/release.yml builds + pushes ghcr.io/ginnoir/famapp:v0.1.0, :0.1, and :latest to GHCR.

Deploying a release on the host

cd /srv/famapp/deploy
# pin to the tag you just cut
echo 'FAMAPP_IMAGE=ghcr.io/ginnoir/famapp:v0.1.0' >> .env  # or edit in place
docker compose pull famapp
docker compose up -d famapp
docker compose logs -f famapp   # watch migrations + boot

The container's entrypoint runs node scripts/migrate.mjs before starting the server. To skip migrations on a given start (rare — e.g. emergency rollback to an older schema-compatible image), set RUN_MIGRATIONS=false.

Rollback

Edit .env to point FAMAPP_IMAGE at the previous tag, then docker compose up -d famapp. If the rollback target predates a migration that's already applied, restore from backup (deploy/backups/README.md) before bringing the older image up.

Pre-deploy checklist

Run docs/tasks/09-pre-deploy-checklist.md before every deploy.