Full production-ready docker-compose stack (db, kong, auth, rest, realtime, storage, imgproxy, meta, functions, studio) targeting api.caterium.ru, plus bootstrap script for a fresh Cloud Server, Caddy reverse-proxy config (HTTPS, WebSocket, upload limits), and dump/restore/verify/storage-sync scripts for moving off the managed Supabase project (cksuehzcimitsxmeloes). Does not touch public/ or any live runtime behavior — frontend cutover is documented separately in frontend-cutover.md and only applied after Etap 8 verification. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
43 lines
2.1 KiB
Bash
43 lines
2.1 KiB
Bash
#!/bin/bash
|
|
# Dumps the OLD managed Supabase project (cksuehzcimitsxmeloes). Read-only against the
|
|
# old project — nothing here modifies or disables the old Supabase in any way.
|
|
#
|
|
# Requires: Supabase CLI (npm i -g supabase, or https://github.com/supabase/cli/releases)
|
|
# Requires: OLD_DB_URL env var — the old project's DIRECT (non-pooled) Postgres connection
|
|
# string with the real password, from:
|
|
# Supabase Dashboard -> Project Settings -> Database -> Connection string -> URI
|
|
# e.g. postgres://postgres:REAL_PASSWORD@db.cksuehzcimitsxmeloes.supabase.co:5432/postgres
|
|
set -euo pipefail
|
|
|
|
: "${OLD_DB_URL:?Set OLD_DB_URL to the old project's direct Postgres connection string first}"
|
|
|
|
OUT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/dumps"
|
|
mkdir -p "$OUT_DIR"
|
|
STAMP="$(date -u +%Y%m%dT%H%M%SZ)"
|
|
|
|
command -v supabase >/dev/null 2>&1 || { echo "Install the Supabase CLI first." >&2; exit 1; }
|
|
|
|
echo "== Dumping roles =="
|
|
supabase db dump --db-url "$OLD_DB_URL" -f "$OUT_DIR/roles.sql" --role-only
|
|
|
|
echo "== Dumping schema (structure, functions, triggers, RLS policies, grants) =="
|
|
supabase db dump --db-url "$OLD_DB_URL" -f "$OUT_DIR/schema.sql"
|
|
|
|
echo "== Dumping data (COPY format, all public + auth data) =="
|
|
supabase db dump --db-url "$OLD_DB_URL" -f "$OUT_DIR/data.sql" --use-copy --data-only
|
|
|
|
echo "== Row counts in the OLD project (sanity baseline) =="
|
|
psql "$OLD_DB_URL" -Atc "
|
|
select 'auth.users', count(*) from auth.users
|
|
union all select 'sun_v17_orders', count(*) from public.sun_v17_orders
|
|
union all select 'sun_v17_order_items', count(*) from public.sun_v17_order_items
|
|
union all select 'sun_v17_clients', count(*) from public.sun_v17_clients
|
|
union all select 'sun_v17_catalog_items', count(*) from public.sun_v17_catalog_items
|
|
union all select 'storage.objects', count(*) from storage.objects
|
|
" | tee "$OUT_DIR/old-counts-$STAMP.txt"
|
|
|
|
echo ""
|
|
echo "Dumps written to $OUT_DIR (roles.sql, schema.sql, data.sql)."
|
|
echo "These contain real user data (password hashes, PII) — keep them off any public path"
|
|
echo "and delete once the migration is verified. Next: scripts/02-restore-new.sh"
|