Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ EXTRA_NIX_CONF

if [ "$IS_NIX_UPGRADE" = "true" ]; then
if [[ ${PGVERSION%%.*} -ge 16 ]]; then
LC_ALL=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 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 --allow-group-access $CHECKSUM_FLAG --encoding=$SERVER_ENCODING --locale-provider=icu --icu-locale=en_US.UTF-8 -L $PGSHARENEW -D $PGDATANEW/ --username=supabase_admin" -s "$SHELL" postgres
LC_ALL=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 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 --allow-group-access $CHECKSUM_FLAG --encoding=$SERVER_ENCODING --locale-provider=builtin --builtin-locale=C.UTF-8 -L $PGSHARENEW -D $PGDATANEW/ --username=supabase_admin" -s "$SHELL" postgres
else
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 --allow-group-access $CHECKSUM_FLAG --encoding=$SERVER_ENCODING --lc-collate=$SERVER_LC_COLLATE --lc-ctype=$SERVER_LC_CTYPE -L $PGSHARENEW -D $PGDATANEW/ --username=supabase_admin" -s "$SHELL" postgres
fi
Expand Down
6 changes: 6 additions & 0 deletions ansible/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
ansible.builtin.set_fact:
platform: "{{ 'amd64' if ansible_facts['architecture'] == 'x86_64' else 'arm64' }}"

- name: Set is_psql boolean facts
ansible.builtin.set_fact:
is_psql_oriole: "{{ psql_version in ['psql_orioledb-17'] }}"
is_psql_17: "{{ psql_version in ['psql_17'] }}"
is_psql_15: "{{ psql_version in ['psql_15'] }}"

- import_tasks: tasks/setup-system.yml
vars_files:
- ./vars.yml
Expand Down
38 changes: 16 additions & 22 deletions ansible/tasks/setup-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@

- name: configure pam
block:
- name: Check if psql_version is psql_15
ansible.builtin.set_fact:
is_psql_15: "{{ psql_version in ['psql_15'] }}"

- name: create placeholder pam config
when: not is_psql_15
file:
Expand Down Expand Up @@ -197,27 +193,25 @@
passno: "2"
state: mounted

- name: Initialize the database stage2 (NOT PG17 NOR PG17-OrioleDB)
when: psql_version not in ['psql_17', 'psql_orioledb-17']
become: true
become_user: 'postgres'
ansible.builtin.command:
cmd: /usr/lib/postgresql/bin/pg_ctl -D /var/lib/postgresql/data initdb -o "--allow-group-access" -o "--username=supabase_admin" -o "--data-checksums"
environment:
LANG: en_US.UTF-8
LANGUAGE: en_US.UTF-8
LC_ALL: en_US.UTF-8
LC_CTYPE: en_US.UTF-8
LOCALE_ARCHIVE: /usr/lib/locale/locale-archive
vars:
ansible_command_timeout: 60
- name: Set common initdb arguments
ansible.builtin.set_fact:
initdb_common_args: -o --allow-group-access -o --username=supabase_admin -o --data-checksums

- name: Set PG15 initdb arguments
when: is_psql_15
ansible.builtin.set_fact:
initdb_pg_version_args: ""

- name: Set default initdb arguments
when: not is_psql_15
ansible.builtin.set_fact:
initdb_pg_version_args: "-o --encoding=UTF-8 -o --locale-provider=builtin -o --builtin-locale=C.UTF-8"

- name: Initialize the database stage2 (PG17 OR PG17-OrioleDB)
when: psql_version in ['psql_17', 'psql_orioledb-17']
- name: Initialize the database stage2
become: true
become_user: 'postgres'
become_user: postgres
ansible.builtin.command:
cmd: /usr/lib/postgresql/bin/pg_ctl -D /var/lib/postgresql/data initdb -o "--allow-group-access" -o "--username=supabase_admin" -o "--locale-provider=icu" -o "--encoding=UTF-8" -o "--icu-locale=en_US.UTF-8" -o "--data-checksums"
cmd: /usr/lib/postgresql/bin/pg_ctl -D /var/lib/postgresql/data initdb {{ initdb_common_args}} {{ initdb_pg_version_args }}
environment:
LANG: en_US.UTF-8
LANGUAGE: en_US.UTF-8
Expand Down
10 changes: 0 additions & 10 deletions ansible/tasks/stage2-setup-postgres.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
- name: Check psql_version and modify supautils.conf and postgresql.conf if necessary
block:
- name: Check if psql_version is psql_orioledb-17 and if psql_version is psql_15 or psql_17
ansible.builtin.set_fact:
is_psql_oriole: "{{ psql_version in ['psql_orioledb-17'] }}"
is_psql_17: "{{ psql_version in ['psql_17'] }}"
is_psql_15: "{{ psql_version in ['psql_15'] }}"

- name: Execute tasks when (is_psql_oriole or is_psql_17) and stage2
when: stage2 and (is_psql_oriole or is_psql_17)
become: true
Expand Down Expand Up @@ -134,10 +128,6 @@

- name: setup gatekeeper
block:
- name: Check if psql_version is psql_15
ansible.builtin.set_fact:
is_psql_15: "{{ psql_version == 'psql_15' }}"

- name: Install gatekeeper if not pg15
when: stage2 and not is_psql_15
block:
Expand Down
Loading