Skip to content

Commit 1ed9ea8

Browse files
committed
refactor(multigres): run init-scripts as supabase_admin, remove postgres-role.sql
Both init-scripts and migrations now run as supabase_admin (the pgctld cluster superuser), eliminating the need for a preamble SQL file to pre-create the postgres role.
1 parent c85a3d0 commit 1ed9ea8

3 files changed

Lines changed: 1 addition & 14 deletions

File tree

Dockerfile-multigres

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,6 @@ RUN rm -f \
5858
/home/postgres/wal_fetch.sh \
5959
/root/wal_change_ownership.sh
6060

61-
# Preamble SQL run before init-scripts: creates the postgres role and sets DB ownership.
62-
# The wrapper script then passes --pg-initdb-sql-dir to run init-scripts (as postgres)
63-
# and migrations (as supabase_admin) in sorted order.
64-
# NOTE: --pg-initdb-sql-dir is not yet implemented in pgctld (MUL-484).
65-
COPY --chown=postgres:postgres docker/pgctld/postgres-role.sql /etc/pgctld-custom/postgres-role.sql
66-
6761
# No HEALTHCHECK defined here: inherits the probe from the supabase base image.
6862
# Kubernetes ignores Docker HEALTHCHECK entirely — use readinessProbe in the Pod spec.
6963
# STOPSIGNAL inherited from supabase base image (SIGINT — smart shutdown).

docker/pgctld/pgctld

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# NOTE: --pg-initdb-sql-dir is not yet implemented in pgctld (MUL-484).
33
exec /usr/local/bin/pgctld-bin \
44
--postgres-config-template /etc/pgctld-custom/postgresql.conf.tmpl \
5-
--pg-initdb-sql-files /etc/pgctld-custom/postgres-role.sql \
6-
--pg-initdb-sql-dir postgres:/docker-entrypoint-initdb.d/init-scripts \
5+
--pg-initdb-sql-dir supabase_admin:/docker-entrypoint-initdb.d/init-scripts \
76
--pg-initdb-sql-dir supabase_admin:/docker-entrypoint-initdb.d/migrations \
87
"$@"

docker/pgctld/postgres-role.sql

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)