docs(supabase): sandbox role prerequisite for the DEV restore check

This commit is contained in:
bchanot committed 2026-10-27 13:52:05 +01:00
1 parent 545a161f69
commit 6c36e2f22d
3 files changed
+29

No files matched your search

+20
View File
@@ -334,6 +334,16 @@ tar -tvf "$B/dev-before-v1-1-storage.tar" | grep -c '^-' # the volume's file c
# 3b. The dump restores, on the isolated stack (never on the DEV server), with exit status 0: a scratch
# database of the sandbox, restored in one transaction that stops at the first error, compared with
# step 2, then dropped. `restore_check_v1_1` is the only database created or dropped here.
# Prerequisite, sandbox only: DEV owns the cluster role `supabase_functions_admin` (schema
# `supabase_functions`), a fresh sandbox does not, and the dump's ACL entries name it. Create
# it once there, NOLOGIN with no global privilege (what a no-owner replay needs); never on DEV:
docker exec -i faunosteo_dbsandbox_db sh -c 'PGPASSWORD="$POSTGRES_PASSWORD" psql -X -q -v ON_ERROR_STOP=1 -h 127.0.0.1 -U postgres -d postgres' <<'SQL'
do $$ begin
if not exists (select 1 from pg_roles where rolname = 'supabase_functions_admin') then
create role supabase_functions_admin nologin nosuperuser nocreaterole nocreatedb noreplication nobypassrls noinherit;
end if;
end $$;
SQL
# The restore leaves out the D + 8 TOC entries `postgres` may not replay; the dump file itself stays
# complete and unchanged (the list is a copy of its table of contents):
# - D « DEFAULT ACL … supabase_admin | supabase_auth_admin »: default privileges for objects those
@@ -392,6 +402,16 @@ data (2026-10-26, a 156 MB dump of the sandbox's `postgres` database at M3,
- the filtered list with `--single-transaction --exit-on-error`: exit 0, empty
log, the 28 lines and the 15 privilege lines identical. Retained.
First run on the real DEV dump (2026-10-27): the 29 expected entries were
left out (D = 21), and the restore stopped with exit 1 on
`GRANT USAGE ON SCHEMA supabase_functions TO postgres`: role
`supabase_functions_admin` missing from the sandbox (DEV: LOGIN, CREATEROLE,
`search_path=supabase_functions`, owns the `supabase_functions` objects).
With the NOLOGIN role above and nothing else changed: exit 0, empty log, the
28 and 15 lines identical, schema `supabase_functions` restored with its 2
tables. The DEV role's login, CREATEROLE and password are not copied: no
privilege is exercised by a `--no-owner` replay.
A table whose stored ACL is the explicit owner-only one comes back with no
ACL, the same privileges (pg_dump leaves out an ACL equal to the default):
`privs.sql` therefore compares effective ACLs (`acldefault`). DEV differs