Files
collective-lists/infra/db-init/00-role-passwords.sh
Oier Bravo Urtasun 973f9e413c Fase 0: scaffold monorepo, SvelteKit skeleton, and dev infrastructure
- Turborepo + pnpm workspaces with apps/web and packages/types
- SvelteKit app: Tailwind, Paraglide i18n (en/es), keycloak-js, Supabase client,
  auth/collective stores, PWA service worker skeleton, all route placeholders
- packages/types: domain types (User, Collective, ShoppingList, etc.) and
  database.ts placeholder for generated types
- Justfile with dev, db-*, kc-*, build, backup, restore, deploy recipes
- infra/docker-compose.dev.yml: Postgres 15, GoTrue, PostgREST, Realtime v2.83,
  Storage, Kong (port 8001), Studio, Keycloak 24
- infra/docker-compose.prod.yml, kong.yml, db-init scripts, backup/deploy scripts
- keycloak/realm-export.json with colectivo realm and 5 dev test users
- supabase/config.toml and seed.sql with sample collective and items
- GitHub Actions: ci.yml (lint+typecheck+build) and deploy.yml (GHCR + SSH)
- .env.example documenting all required variables
- Fixed docker-compose issues: Studio image tag, Kong port conflict (8001),
  internal role passwords init script, Realtime METRICS_JWT_SECRET/APP_NAME

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-12 14:37:51 +02:00

27 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# Runs once on first container start (docker-entrypoint-initdb.d).
# Sets Supabase internal role passwords to POSTGRES_PASSWORD and creates
# required schemas with correct grants.
set -e
PASS="${POSTGRES_PASSWORD:-postgres}"
psql -v ON_ERROR_STOP=1 --username supabase_admin --dbname postgres <<-EOSQL
-- Set passwords for all Supabase internal roles.
-- The supabase/postgres image creates them with hardcoded defaults;
-- this overrides them so services connect with POSTGRES_PASSWORD.
ALTER ROLE authenticator WITH PASSWORD '${PASS}';
ALTER ROLE supabase_auth_admin WITH PASSWORD '${PASS}';
ALTER ROLE supabase_replication_admin WITH PASSWORD '${PASS}';
ALTER ROLE supabase_storage_admin WITH PASSWORD '${PASS}';
ALTER ROLE pgbouncer WITH PASSWORD '${PASS}';
-- Create the _realtime schema required by supabase/realtime
CREATE SCHEMA IF NOT EXISTS _realtime;
GRANT ALL ON SCHEMA _realtime TO supabase_replication_admin;
ALTER ROLE supabase_replication_admin SET search_path TO _realtime;
EOSQL
echo "==> db-init: role passwords and schemas configured"