Skip to content

Commit a5f1e31

Browse files
committed
test
1 parent 8028575 commit a5f1e31

File tree

13 files changed

+29
-20
lines changed

13 files changed

+29
-20
lines changed

ansible/files/admin_api_scripts/pg_upgrade_scripts/initiate.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,9 @@ function initiate_upgrade {
354354
rm -rf "${PGDATANEW:?}/"
355355

356356
if [ "$IS_NIX_UPGRADE" = "true" ]; then
357-
LC_ALL=en_US.UTF-8 LC_CTYPE=$SERVER_LC_CTYPE LC_COLLATE=$SERVER_LC_COLLATE LANGUAGE=en_US.UTF-8 LANG=en_US.UTF-8 LOCALE_ARCHIVE=/usr/lib/locale/locale-archive su -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && $PGBINNEW/initdb --encoding=$SERVER_ENCODING --lc-collate=$SERVER_LC_COLLATE --lc-ctype=$SERVER_LC_CTYPE -L $PGSHARENEW -D $PGDATANEW/" -s "$SHELL" postgres
357+
LC_ALL=en_US.UTF-8 LC_CTYPE=$SERVER_LC_CTYPE LC_COLLATE=$SERVER_LC_COLLATE LANGUAGE=en_US.UTF-8 LANG=en_US.UTF-8 LOCALE_ARCHIVE=/usr/lib/locale/locale-archive su -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && $PGBINNEW/initdb --encoding=$SERVER_ENCODING --lc-collate=$SERVER_LC_COLLATE --lc-ctype=$SERVER_LC_CTYPE -L $PGSHARENEW -D $PGDATANEW/" -s "$SHELL" --username=supabase_admin postgres
358358
else
359-
su -c "$PGBINNEW/initdb -L $PGSHARENEW -D $PGDATANEW/" -s "$SHELL" postgres
359+
su -c "$PGBINNEW/initdb -L $PGSHARENEW -D $PGDATANEW/" -s "$SHELL" --username=supabase_admin postgres
360360
fi
361361

362362
UPGRADE_COMMAND=$(cat <<EOF

ansible/playbook.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@
104104
loop: "{{ sql_files }}"
105105
when: debpkg_mode or stage2_nix
106106

107+
- name: Create postgres role
108+
become: yes
109+
become_user: postgres
110+
shell:
111+
cmd: /usr/lib/postgresql/bin/psql --username=supabase_admin -d postgres -c "create role postgres superuser login; alter database postgres owner to postgres;"
112+
when: debpkg_mode or stage2_nix
113+
107114
- name: Execute init SQL files
108115
become: yes
109116
become_user: postgres

ansible/tasks/setup-postgres.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,15 +199,15 @@
199199
- name: Initialize the database
200200
become: yes
201201
become_user: postgres
202-
shell: /usr/lib/postgresql/bin/pg_ctl -D /var/lib/postgresql/data initdb -o "--allow-group-access"
202+
shell: /usr/lib/postgresql/bin/pg_ctl -D /var/lib/postgresql/data initdb -o "--allow-group-access" -o "--username=supabase_admin"
203203
vars:
204204
ansible_command_timeout: 60
205205
when: debpkg_mode
206206

207207
- name: Initialize the database stage2_nix
208208
become: yes
209209
become_user: postgres
210-
shell: source /var/lib/postgresql/.bashrc && /usr/lib/postgresql/bin/pg_ctl -D /var/lib/postgresql/data initdb -o "--allow-group-access"
210+
shell: source /var/lib/postgresql/.bashrc && /usr/lib/postgresql/bin/pg_ctl -D /var/lib/postgresql/data initdb -o "--allow-group-access" -o "--username=supabase_admin"
211211
args:
212212
executable: /bin/bash
213213
environment:

common-nix.vars.pkr.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
postgres-version = "15.6.1.96-nix-staged"
1+
postgres-version = "15.6.1.102-nix-staged"

common.vars.pkr.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
postgres-version = "15.1.1.80"
1+
postgres-version = "15.1.1.80-bootstrap-user-3"

docker/all-in-one/postgres-entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ docker_setup_db() {
226226
docker_setup_env() {
227227
file_env 'POSTGRES_PASSWORD'
228228

229-
file_env 'POSTGRES_USER' 'postgres'
230-
file_env 'POSTGRES_DB' "$POSTGRES_USER"
229+
file_env 'POSTGRES_USER' 'supabase_admin'
230+
file_env 'POSTGRES_DB' 'postgres'
231231
file_env 'POSTGRES_INITDB_ARGS'
232232
: "${POSTGRES_HOST_AUTH_METHOD:=}"
233233

flake.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
flake-utils.lib.eachSystem ourSystems (system:
2121
let
2222
pgsqlDefaultPort = "5435";
23-
pgsqlSuperuser = "postgres";
23+
pgsqlSuperuser = "supabase_admin";
2424
nix2img = nix2container.packages.${system}.nix2container;
2525

2626
# The 'oriole_pkgs' variable holds all the upstream packages in nixpkgs, which
@@ -504,7 +504,7 @@
504504
} ''
505505
export PGDATA=/tmp/pgdata
506506
mkdir -p $PGDATA
507-
initdb --locale=C
507+
initdb --locale=C --username=supabase_admin
508508
substitute ${./nix/tests/postgresql.conf.in} $PGDATA/postgresql.conf \
509509
--subst-var-by PGSODIUM_GETKEY_SCRIPT "${./nix/tests/util/pgsodium_getkey_arb.sh}"
510510
echo "listen_addresses = '*'" >> $PGDATA/postgresql.conf

migrations/db/init-scripts/00000000000000-initial-schema.sql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
create publication supabase_realtime;
66

77
-- Supabase super admin
8-
create user supabase_admin;
98
alter user supabase_admin with superuser createdb createrole replication bypassrls;
109

1110
-- Supabase replication user

nix/docker/init.sh.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
22
# shellcheck shell=bash
3-
/bin/initdb --locale=C -D /data/postgresql
3+
/bin/initdb --locale=C -D /data/postgresql --username=supabase_admin
44
ln -s /etc/postgresql.conf /data/postgresql/postgresql.conf
55
/bin/postgres -p @PGSQL_DEFAULT_PORT@ -D /data/postgresql

nix/init.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
# shellcheck shell=bash
33

4-
export PGUSER=postgres
4+
export PGUSER=supabase_admin
55
export PGDATA=$PWD/postgres_data
66
export PGHOST=$PWD/postgres
77
export PGPORT=5432

0 commit comments

Comments
 (0)