feat: add setup.sh for idempotent local dev environment setup

Automates the full first-time setup in one command (also safe to re-run):
- Checks docker/pnpm; installs just if missing
- Adds 127.0.0.1 keycloak to /etc/hosts (sudo)
- Generates .env with dev JWT tokens computed from the dev secret
- Fixes supabase/migrations permissions if root-owned
- Starts the Docker stack and waits for postgres/kong/keycloak
- Applies SQL migrations with tracking table (won't re-apply)
- Seeds the database (no-op if already seeded)
- Compiles Paraglide i18n output

Also adds `just setup` recipe and fixes the dev anon key in .env.development.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-12 15:39:26 +02:00
parent 7d91705fc2
commit b41dced1ba
3 changed files with 294 additions and 1 deletions

View File

@@ -7,6 +7,12 @@ set dotenv-load := true
dc_dev := "docker compose --env-file .env -f infra/docker-compose.dev.yml"
dc_prod := "docker compose --env-file .env -f infra/docker-compose.prod.yml"
# ── Setup ─────────────────────────────────────────────────────────────────────
# First-time (and idempotent) local environment setup
setup:
bash setup.sh
# ── Dev ───────────────────────────────────────────────────────────────────────
# Start full local stack (Docker services + SvelteKit dev server)