1
0
Fork 0
Commit Graph

5 Commits

Author SHA1 Message Date
Jonny 5b3d4404ca chore: Master-Stack-Web auf Port 3001
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 08:36:12 +02:00
Jonny 26f7a70b54 chore: env-Doku und docker-compose fuer WhatsApp-Benachrichtigung, rebuild-master-stack-Hinweis 2026-09-04 00:08:05 +02:00
Jonny 8db31c72a8 feat: add Supabase admin client and service-role-key wiring 2026-07-14 21:56:15 +02:00
Jonny 2f508ea5dd feat: containerize the Next.js app and wire it into docker-compose
Adds web/Dockerfile (multi-stage node:22-alpine build, standalone output)
and web/.dockerignore, and wires a `web` service into docker-compose.yaml
so the whole stack (self-hosted Supabase + Next.js) starts with a single
`docker compose up -d`.

Networking fix: Next.js inlines NEXT_PUBLIC_* env vars at build time into
every compiled bundle, including server-side ones (Server Actions, Server
Components, Middleware) - not just the browser bundle. Since
NEXT_PUBLIC_SUPABASE_URL must point at the externally-reachable
http://localhost:8000 for the browser, the server-side Supabase clients in
lib/supabase/server.ts and lib/supabase/middleware.ts got that same literal
baked in - which resolves to the web container itself (not kong) once
running in Docker, causing ECONNREFUSED on any server-side Supabase call
(most visibly signInWithPassword in the login server action).

Fix: introduce SUPABASE_INTERNAL_URL, a server-only env var without the
NEXT_PUBLIC_ prefix, so it's read at actual runtime rather than inlined at
build time. It points at http://kong:8000 in docker-compose.yaml (same
pattern already used by the studio service's internal SUPABASE_URL) and at
http://localhost:8000 in web/.env.local(.example) for non-Docker local dev,
where there's no container networking boundary. lib/supabase/client.ts
(browser-only) is untouched and keeps reading NEXT_PUBLIC_SUPABASE_URL.

Considered extra_hosts: ["localhost:host-gateway"] instead, but rejected it:
overriding what the literal string "localhost" resolves to inside a
container is unreliable (glibc's resolver typically still prioritizes the
container's own loopback), and is the kind of workaround that looks fixed
in a quick check and quietly breaks later.

Verified end-to-end against the running container via curl (unauth redirect,
real signInWithPassword through the login server action, authenticated
dashboard content, logout) with zero ECONNREFUSED in `docker compose logs
web` afterward, plus a local `npm run dev` smoke test to confirm non-Docker
development still works unchanged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-05 00:25:01 +02:00
Jonny e0a3e756d8 feat: add self-hosted Supabase stack via Docker Compose
Produktions-Stack (db, auth, rest, storage, meta, studio, kong) getrennt
vom lokalen CLI-Dev-Stack. Migrationen aus Task 2/3 wurden erfolgreich
angewendet und ein erster Admin-Nutzer angelegt.

Abweichungen vom urspruenglichen Plan (alle beim Testen des laufenden
Stacks gefunden und verifiziert):
- generate-secrets.js: POSTGRES_PASSWORD nutzt base64url statt base64,
  da "/" in base64-Passwoertern die Postgres-Connection-URI-Parser von
  gotrue/storage-api bricht.
- volumes/db/init/99-roles.sql(.template): das supabase/postgres-Image
  setzt POSTGRES_PASSWORD nur fuer die Rolle supabase_admin automatisch;
  authenticator/supabase_auth_admin/supabase_storage_admin blieben ohne
  Passwort. Zusaetzliches Init-Skript setzt sie explizit.
- volumes/api/kong.yml(.template): Kong 3.9.1 substituiert KEINE
  Umgebungsvariablen ($ANON_KEY/$SERVICE_ROLE_KEY) im deklarativen
  Config-Format (_transform ist ein Config-Migrations-Flag, kein
  Env-Templating) - alle echten Keys wurden mit 401 abgelehnt. Die
  Kong-Config wird jetzt lokal aus dem Template mit echten Werten
  gerendert (gitignored), analog zu roles.sql.
- storage-Healthcheck: "localhost" statt "127.0.0.1" loeste im Container
  zuerst zu ::1 auf, worauf storage-api nicht lauscht.
- studio: HOSTNAME=0.0.0.0 gesetzt, da Docker HOSTNAME sonst auf die
  Container-ID setzt und das Next.js-Standalone-Image daran bindet statt
  an alle Interfaces (bricht den eingebauten Image-Healthcheck).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-04 12:35:08 +02:00