diff --git a/.env.production.example b/.env.production.example index f7264f5..c7d187c 100644 --- a/.env.production.example +++ b/.env.production.example @@ -10,8 +10,8 @@ AUTHENTIK_IMAGE_TAG=2024.12.3 # Run drizzle migrations on container start. Leave true. RUN_MIGRATIONS=true -# Public URL for the app (used in share links, OIDC redirect URIs, etc.) -NEXT_PUBLIC_APP_URL=https://fam.ginnoir.com +# Public URL for the app — used by Auth.js for OIDC redirect URIs. +AUTH_URL=https://fam.ginnoir.com # famapp Postgres credentials (used to build DATABASE_URL inside compose.yaml) FAMAPP_DB_USER=famapp @@ -21,20 +21,21 @@ FAMAPP_DB_NAME=famapp # Auth.js session secret — generate with: openssl rand -base64 32 AUTH_SECRET=replace-with-openssl-rand-base64-32 -# OIDC provider (Authentik) — task 06 will fill these in after bootstrapping +# OIDC provider (Authentik) — fill in after bootstrapping Authentik AUTH_OIDC_ISSUER=https://auth.ginnoir.com/application/o/famapp/ AUTH_OIDC_CLIENT_ID=replace-me AUTH_OIDC_CLIENT_SECRET=replace-me -# Web Push VAPID keys — generate with: pnpm vapid:generate +# Web Push VAPID keys — generate with: pnpm vapid:generate (run from the repo) VAPID_PUBLIC_KEY= VAPID_PRIVATE_KEY= # Must be "mailto:
" or a URL -VAPID_SUBJECT=mailto:you@example.com +VAPID_SUBJECT=mailto:3nigma.matt@gmail.com -# ntfy (optional push fallback — leave blank to disable) -NTFY_URL= -NTFY_TOPIC= +# ntfy push fallback — uses your existing ntfy instance at ntfy.ginnoir.com +# Leave NTFY_URL blank to disable ntfy fanout. +NTFY_URL=https://ntfy.ginnoir.com +NTFY_TOPIC=famapp # Log level: error | warn | info | debug LOG_LEVEL=info diff --git a/CHANGELOG.md b/CHANGELOG.md index 2523a44..a8e31a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,3 +7,7 @@ Format: `## vX.Y.Z — YYYY-MM-DD` ## Unreleased - Production deployment scaffolding: tag-based release workflow (GHCR), migration entrypoint in container, prod-side dev-login startup assertion, image-pinned compose, pre-deploy checklist. +- famapp/authentik-server now expose host ports (3010/9200) so existing Caddy stack can proxy by IP, matching the existing homelab pattern. +- Auth.js: replaced `NEXT_PUBLIC_APP_URL` with `AUTH_URL` in compose (correct next-auth v5 var). +- Push opt-in: VAPID public key now passed as prop from server component instead of `NEXT_PUBLIC_*` so pre-built images work without a build-time env var. +- ntfy integration wired to existing `ntfy.ginnoir.com` instance via `NTFY_URL`/`NTFY_TOPIC` env vars. diff --git a/STATUS.md b/STATUS.md index db3aac9..97a9af4 100644 --- a/STATUS.md +++ b/STATUS.md @@ -42,8 +42,9 @@ Living progress tracker. Update at the end of each task. Codex and Claude Code b ## Next up -- Phase 7 hardening complete. All acceptance criteria met for tasks 60, 61, 62. -- **09 — Production prep** (scaffolding landed): tag-based release workflow (`.github/workflows/release.yml` → GHCR), CI on push/PR (`.github/workflows/ci.yml`), migration entrypoint in container (`scripts/migrate.mjs` + `deploy/docker-entrypoint.sh`), startup assertion in `src/lib/dev-login-config.ts`, image-pinned compose with `FAMAPP_IMAGE`/`AUTHENTIK_IMAGE_TAG`, `deploy/README.md`, `CHANGELOG.md`. Task 09 itself is now a recurring pre-deploy checklist (`docs/tasks/09-pre-deploy-checklist.md`); run it before every tag. +- **Ready to tag v0.1.0.** All phase 1–7 tasks complete and production wiring verified. +- Run `docs/tasks/09-pre-deploy-checklist.md` before pushing the tag. +- On the server: clone repo to `/srv/famapp`, copy `.env.production.example` → `/srv/famapp/deploy/.env`, fill in secrets (AUTH_SECRET, DB passwords, AUTHENTIK_SECRET_KEY, VAPID keys, AUTH_OIDC_CLIENT_ID/SECRET), add the Caddyfile snippet, bootstrap Authentik per `deploy/authentik/README.md`, then `docker compose -f deploy/compose.yaml up -d`. ## Development login/testing notes diff --git a/deploy/Caddyfile.snippet b/deploy/Caddyfile.snippet index a57e39c..dd4b92b 100644 --- a/deploy/Caddyfile.snippet +++ b/deploy/Caddyfile.snippet @@ -1,9 +1,10 @@ -# Include from main Caddyfile or paste into the existing one. +# famapp — paste into your existing Caddyfile. +# famapp runs on 3010, authentik-server on 9200 (both bound to the host by deploy/compose.yaml). fam.ginnoir.com { - reverse_proxy famapp:3000 + reverse_proxy 192.168.1.69:3010 } auth.ginnoir.com { - reverse_proxy authentik-server:9000 + reverse_proxy 192.168.1.69:9200 } diff --git a/src/app/settings/page.tsx b/src/app/settings/page.tsx index ab9bb57..01f7b19 100644 --- a/src/app/settings/page.tsx +++ b/src/app/settings/page.tsx @@ -14,6 +14,7 @@ export default async function SettingsPage() { const { user } = await getCurrentSession(); const shareLinks = await getActiveShareLinks(); const ntfyConfigured = !!(process.env["NTFY_URL"] && process.env["NTFY_TOPIC"]); + const vapidKey = process.env["VAPID_PUBLIC_KEY"] ?? ""; return (
@@ -46,7 +47,7 @@ export default async function SettingsPage() { Push Notifications - + diff --git a/src/components/push-opt-in.tsx b/src/components/push-opt-in.tsx index ecb4b72..ad05f7b 100644 --- a/src/components/push-opt-in.tsx +++ b/src/components/push-opt-in.tsx @@ -8,8 +8,6 @@ import { sendTestNotification, } from "@/app/settings/push-actions"; -const VAPID_KEY = process.env.NEXT_PUBLIC_VAPID_PUBLIC_KEY ?? ""; - function urlBase64ToUint8Array(base64String: string): Uint8Array { const padding = "=".repeat((4 - (base64String.length % 4)) % 4); const base64 = (base64String + padding).replace(/-/g, "+").replace(/_/g, "/"); @@ -19,13 +17,13 @@ function urlBase64ToUint8Array(base64String: string): Uint8Array { return buf; } -export function PushOptIn() { +export function PushOptIn({ vapidKey }: { vapidKey: string }) { const [status, setStatus] = useState<"idle" | "subscribed" | "denied" | "unsupported">("idle"); const [endpoint, setEndpoint] = useState(null); const [isPending, startTransition] = useTransition(); const [testSent, setTestSent] = useState(false); - if (!VAPID_KEY) return null; + if (!vapidKey) return null; if (!("serviceWorker" in navigator) || !("PushManager" in window)) { return (

@@ -39,7 +37,7 @@ export function PushOptIn() { const registration = await navigator.serviceWorker.ready; const sub = await registration.pushManager.subscribe({ userVisibleOnly: true, - applicationServerKey: urlBase64ToUint8Array(VAPID_KEY), + applicationServerKey: urlBase64ToUint8Array(vapidKey), }); const json = sub.toJSON() as { endpoint: string; keys: { p256dh: string; auth: string } }; startTransition(async () => {