herbatrium/infrastructure/auth-apps-insert.sql
Till JS 9b8560f011
Some checks are pending
CI / validate (push) Waiting to run
Auth-Integration + Production-Setup für Live-Deploy
Auth (Cards-Pattern portiert):
- lib/auth.ts: Session-Class mit JWT-Token-LocalStorage, tryRefresh
  gegen mana-auth, ensureFreshToken vor jedem API-Call, loginRedirect zu
  auth.mana.how/?app=herbatrium&redirect=... + Dev-Stub-Fallback für localhost
- lib/api.ts: Authorization: Bearer aus session.token statt X-User-Id
  (Stub bleibt als Fallback bei fehlendem Token)
- routes/auth/callback/+page.svelte: tryRefresh+loadUserFromToken+redirect
  to return_to oder /plants
- (app)/+layout.svelte: „Mit mana-Konto anmelden"-Button als Hauptpfad,
  Dev-Stub als <details>-Fallback nur auf localhost

mana-Anbindung:
- mana/services/mana-auth/src/auth/sso-origins.ts:
  +herbatrium.mana.how + herbatrium-api.mana.how (prod)
  +localhost:3101 + 3102 (dev)
- mana/services/mana-auth-web/src/lib/apps.ts: herbatrium-App-Eintrag
  mit Moos-Grün-Branding (HSL 104 29% 32%)
- infrastructure/auth-apps-insert.sql: auth.apps-Insert idempotent

Production-Setup:
- apps/api/Dockerfile: Bun + pnpm, EXPOSE 3101, HEALTHCHECK gegen /healthz
- apps/web/Dockerfile: Node 2-stage, build mit PUBLIC_API_URL +
  PUBLIC_MANA_AUTH_URL + PUBLIC_AUTH_PORTAL_URL args
- infrastructure/docker-compose.macmini.yml:
  - herbatrium-postgres (postgis/postgis:16-3.4, 127.0.0.1:5449)
  - herbatrium-api (3101, depends_on healthy postgres)
  - herbatrium-web (3102, build args setzen PUBLIC_*-Env)
  - Netzwerk manacore-monorepo_default external
- infrastructure/cloudflared-routes.snippet.yml: herbatrium.mana.how +
  herbatrium-api.mana.how routes

Web-type-check ✓ (0 errors / 0 warnings).

Live-Deploy folgt als separater Commit (rsync + docker build + db:push +
DNS+tunnel reload).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 22:17:46 +02:00

28 lines
786 B
SQL

-- Herbatrium-App-Registrierung in mana-auth.apps.
--
-- Auszuführen gegen die mana_platform-DB (Schema `auth`).
-- Idempotent durch ON CONFLICT.
--
-- Spec: mana/docs/MANA_AUTH_FEDERATION.md §`auth.apps`.
INSERT INTO auth.apps (
app_id,
display_name,
ownership_kind,
status,
activated_at,
notes
)
VALUES (
'herbatrium',
'Herbatrium',
'verein',
'active',
NOW(),
'Pflanzen-Tagebuch (Single-User-MVP 2026-05-17). Foto-First Capture mit mana-llm-Vision-Klassifikation, GBIF/FFH-Sensitivity-Worker, PostGIS-Specimen-Anker. Citizen-Science-Pfad (Public-Feed + Lizenz-Picker + Take-Down-UI) im Schema schlafend, aktivierbar ab η-4.'
)
ON CONFLICT (app_id) DO UPDATE
SET
display_name = EXCLUDED.display_name,
status = EXCLUDED.status,
notes = EXCLUDED.notes;