fix(supabase): db:trial database logs no statement from its first start

The image's init (migrate.sh) sent the supabase_admin password as SQL text
while its postgresql.conf logged DDL, so the password reached the container
log. The server now starts with -c log_statement=none, which the entrypoint
also hands to the init server; a harness check pins it, and DEPLOY.md makes
the post-init log scan a production prerequisite.
This commit is contained in:
bchanot committed 2026-11-11 19:53:56 +01:00
1 parent c6c984b954
commit 5f63d2229c
4 files changed
+15 -2

No files matched your search

+1
View File
@@ -723,6 +723,7 @@ check "create: gateway refuses GoTrue's admin API" log_has 'location /auth/v1/ad
check "create: gateway names itself on /__faunosteo_stack" log_has 'location = /__faunosteo_stack { default_type text/plain; return 200 "faunosteo_trial\n"; }'
check "create: the database init turns statement logging on errors off first" log_has 'set log_min_error_statement = panic;'
check "create: the database init silences statement logging and verbose errors, in order, before the first ALTER" lines_before_first "$(run_line faunosteo_trial_db | sed 's/\\n/\n/g')" '^ALTER ' '\set VERBOSITY terse' "set log_statement = 'none';" 'set log_min_duration_statement = -1;' 'set log_min_error_statement = panic;' "set pgaudit.log = 'none';" 'set pg_stat_statements.track_utility = off;'
check "create: statement logging off on the server command line, so the image's init server (its migrate.sh ALTER USER ... PASSWORD) logs no statement" grep -qE 'exec docker-entrypoint\.sh postgres( [^ ]+)* -c log_statement=none( |$)' <(run_line faunosteo_trial_db | sed 's/\\n/\n/g')
check "create: migrations through the CLI on the trial URL only" log_has 'supabase --workdir . migration up --db-url postgresql://postgres@127.0.0.1:58432/postgres?sslmode=disable PGPASSWORD=set'
check "create: equine_draft.sql loaded" stdin_has "-- Official equine anatomical sheet"
check "create: seed.sql never loaded" stdin_lacks faunosteo.local
+6 -1
View File
@@ -426,8 +426,13 @@ sb_psql() {
# rotate-secrets can renew every password through it. A failing ALTER would log its statement,
# password included, at the default log_min_error_statement: the session turns statement logging
# and verbose errors off first (psql sends the literal password, the server would log it).
# The image's own init (migrate.sh) sends the supabase_admin password as SQL text on its init temp
# server, and its postgresql.conf logs DDL: -c log_statement=none on the command line reaches that
# temp server (the entrypoint passes every argument after postgres to it) and the final server, so
# no statement is logged from the first start. The session set lines stay for the schema file itself
# (errors, pgaudit, pg_stat_statements).
# shellcheck disable=SC2016
DB_INIT='cat <<'"'"'EOF'"'"' > /etc/postgresql.schema.sql && exec docker-entrypoint.sh postgres -D /etc/postgresql -c shared_buffers=128MB
DB_INIT='cat <<'"'"'EOF'"'"' > /etc/postgresql.schema.sql && exec docker-entrypoint.sh postgres -D /etc/postgresql -c shared_buffers=128MB -c log_statement=none
\set VERBOSITY terse
set log_statement = '"'"'none'"'"';
set log_min_duration_statement = -1;