Skip to content

Commit d4092d8

Browse files
committed
refactor(postgresql): switch to 'include_dir' and then rename conf files to ensure ordering
1 parent b2a64fd commit d4092d8

File tree

7 files changed

+27
-25
lines changed

7 files changed

+27
-25
lines changed

Dockerfile-15

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ COPY ansible/files/walg_helper_scripts/wal_change_ownership.sh /root/wal_change_
171171

172172
RUN sed -i \
173173
-e "s|#unix_socket_directories = '/tmp'|unix_socket_directories = '/var/run/postgresql'|g" \
174-
-e "s|#session_preload_libraries = ''|session_preload_libraries = 'supautils'|g" \
175174
/etc/postgresql/postgresql.conf && \
176175
echo "cron.database_name = 'postgres'" >> /etc/postgresql/postgresql.conf && \
177176
#echo "pljava.libjvm_location = '/usr/lib/jvm/java-11-openjdk-${TARGETARCH}/lib/server/libjvm.so'" >> /etc/postgresql/postgresql.conf && \

Dockerfile-17

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ COPY ansible/files/walg_helper_scripts/wal_change_ownership.sh /root/wal_change_
175175

176176
RUN sed -i \
177177
-e "s|#unix_socket_directories = '/tmp'|unix_socket_directories = '/var/run/postgresql'|g" \
178-
-e "s|#session_preload_libraries = ''|session_preload_libraries = 'supautils'|g" \
179178
/etc/postgresql/postgresql.conf && \
180179
echo "cron.database_name = 'postgres'" >> /etc/postgresql/postgresql.conf && \
181180
#echo "pljava.libjvm_location = '/usr/lib/jvm/java-11-openjdk-${TARGETARCH}/lib/server/libjvm.so'" >> /etc/postgresql/postgresql.conf && \

Dockerfile-orioledb-17

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ COPY ansible/files/walg_helper_scripts/wal_change_ownership.sh /root/wal_change_
175175

176176
RUN sed -i \
177177
-e "s|#unix_socket_directories = '/tmp'|unix_socket_directories = '/var/run/postgresql'|g" \
178-
-e "s|#session_preload_libraries = ''|session_preload_libraries = 'supautils'|g" \
179178
/etc/postgresql/postgresql.conf && \
180179
echo "cron.database_name = 'postgres'" >> /etc/postgresql/postgresql.conf && \
181180
#echo "pljava.libjvm_location = '/usr/lib/jvm/java-11-openjdk-${TARGETARCH}/lib/server/libjvm.so'" >> /etc/postgresql/postgresql.conf && \
Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,35 @@
1+
session_preload_libraries = 'supautils'
2+
3+
supautils.drop_trigger_grants = '{"postgres":["auth.audit_log_entries","auth.identities","auth.mfa_factors","auth.refresh_tokens","auth.sessions","auth.users","realtime.messages","storage.buckets","storage.migrations","storage.objects","storage.s3_multipart_uploads","storage.s3_multipart_uploads_parts"]}'
4+
5+
supautils.extension_custom_scripts_path = '/etc/postgresql-custom/extension-custom-scripts'
16
supautils.extensions_parameter_overrides = '{"pg_cron":{"schema":"pg_catalog"}}'
7+
28
supautils.policy_grants = '{"postgres":["auth.audit_log_entries","auth.identities","auth.mfa_factors","auth.refresh_tokens","auth.sessions","auth.users","realtime.messages","storage.buckets","storage.migrations","storage.objects","storage.s3_multipart_uploads","storage.s3_multipart_uploads_parts"]}'
3-
supautils.drop_trigger_grants = '{"postgres":["auth.audit_log_entries","auth.identities","auth.mfa_factors","auth.refresh_tokens","auth.sessions","auth.users","realtime.messages","storage.buckets","storage.migrations","storage.objects","storage.s3_multipart_uploads","storage.s3_multipart_uploads_parts"]}'
4-
# full list: address_standardizer, address_standardizer_data_us, adminpack, amcheck, autoinc, bloom, btree_gin, btree_gist, citext, cube, dblink, dict_int, dict_xsyn, earthdistance, file_fdw, fuzzystrmatch, hstore, http, hypopg, index_advisor, insert_username, intagg, intarray, isn, lo, ltree, moddatetime, old_snapshot, orioledb, pageinspect, pg_buffercache, pg_cron, pg_freespacemap, pg_graphql, pg_hashids, pg_jsonschema, pg_net, pg_prewarm, pg_repack, pg_stat_monitor, pg_stat_statements, pg_surgery, pg_tle, pg_trgm, pg_visibility, pg_walinspect, pgaudit, pgcrypto, pgjwt, pgmq, pgroonga, pgroonga_database, pgrouting, pgrowlocks, pgsodium, pgstattuple, pgtap, plcoffee, pljava, plls, plpgsql, plpgsql_check, plv8, postgis, postgis_raster, postgis_sfcgal, postgis_tiger_geocoder, postgis_topology, postgres_fdw, refint, rum, seg, sslinfo, supabase_vault, supautils, tablefunc, tcn, timescaledb, tsm_system_rows, tsm_system_time, unaccent, uuid-ossp, vector, wrappers, xml2
5-
# omitted because may be unsafe: adminpack, amcheck, file_fdw, lo, old_snapshot, pageinspect, pg_freespacemap, pg_surgery, pg_visibility
6-
# omitted because deprecated: intagg, xml2
7-
# omitted because doesn't require superuser: pgmq
8-
# omitted because protected: plpgsql
9+
10+
# full list:
11+
# address_standardizer, address_standardizer_data_us, adminpack, amcheck, autoinc, bloom, btree_gin, btree_gist, citext, cube, dblink, dict_int, dict_xsyn, earthdistance, file_fdw, fuzzystrmatch, hstore, http, hypopg, index_advisor, insert_username, intagg, intarray, isn, lo, ltree, moddatetime, old_snapshot, orioledb, pageinspect, pg_buffercache, pg_cron, pg_freespacemap, pg_graphql, pg_hashids, pg_jsonschema, pg_net, pg_prewarm, pg_repack, pg_stat_monitor, pg_stat_statements, pg_surgery, pg_tle, pg_trgm, pg_visibility, pg_walinspect, pgaudit, pgcrypto, pgjwt, pgmq, pgroonga, pgroonga_database, pgrouting, pgrowlocks, pgsodium, pgstattuple, pgtap, plcoffee, pljava, plls, plpgsql, plpgsql_check, plv8, postgis, postgis_raster, postgis_sfcgal, postgis_tiger_geocoder, postgis_topology, postgres_fdw, refint, rum, seg, sslinfo, supabase_vault, supautils, tablefunc, tcn, timescaledb, tsm_system_rows, tsm_system_time, unaccent, uuid-ossp, vector, wrappers, xml2
12+
13+
# omitted because may be unsafe:
14+
# adminpack, amcheck, file_fdw, lo, old_snapshot, pageinspect, pg_freespacemap, pg_surgery, pg_visibility
15+
16+
# omitted because deprecated:
17+
# intagg, xml2
18+
19+
# omitted because doesn't require superuser:
20+
# pgmq
21+
22+
# omitted because protected:
23+
# plpgsql
24+
925
supautils.privileged_extensions = 'address_standardizer, address_standardizer_data_us, autoinc, bloom, btree_gin, btree_gist, citext, cube, dblink, dict_int, dict_xsyn, earthdistance, fuzzystrmatch, hstore, http, hypopg, index_advisor, insert_username, intarray, isn, ltree, moddatetime, orioledb, pg_buffercache, pg_cron, pg_graphql, pg_hashids, pg_jsonschema, pg_net, pg_prewarm, pg_repack, pg_stat_monitor, pg_stat_statements, pg_tle, pg_trgm, pg_walinspect, pgaudit, pgcrypto, pgjwt, pgroonga, pgroonga_database, pgrouting, pgrowlocks, pgsodium, pgstattuple, pgtap, plcoffee, pljava, plls, plpgsql_check, plv8, postgis, postgis_raster, postgis_sfcgal, postgis_tiger_geocoder, postgis_topology, postgres_fdw, refint, rum, seg, sslinfo, supabase_vault, supautils, tablefunc, tcn, timescaledb, tsm_system_rows, tsm_system_time, unaccent, uuid-ossp, vector, wrappers'
10-
supautils.extension_custom_scripts_path = '/etc/postgresql-custom/extension-custom-scripts'
26+
1127
supautils.privileged_extensions_superuser = 'supabase_admin'
28+
1229
supautils.privileged_role = 'postgres'
30+
1331
supautils.privileged_role_allowed_configs = 'auto_explain.*, log_lock_waits, log_min_duration_statement, log_min_messages, log_replication_commands, log_statement, log_temp_files, pg_net.batch_size, pg_net.ttl, pg_stat_statements.*, pgaudit.log, pgaudit.log_catalog, pgaudit.log_client, pgaudit.log_level, pgaudit.log_relation, pgaudit.log_rows, pgaudit.log_statement, pgaudit.log_statement_once, pgaudit.role, pgrst.*, plan_filter.*, safeupdate.enabled, session_replication_role, track_io_timing, wal_compression'
32+
1433
supautils.reserved_memberships = 'pg_read_server_files, pg_write_server_files, pg_execute_server_program, supabase_admin, supabase_auth_admin, supabase_storage_admin, supabase_read_only_user, supabase_realtime_admin, supabase_replication_admin, supabase_etl_admin, dashboard_user, pgbouncer, authenticator'
34+
1535
supautils.reserved_roles = 'supabase_admin, supabase_auth_admin, supabase_storage_admin, supabase_read_only_user, supabase_realtime_admin, supabase_replication_admin, supabase_etl_admin, dashboard_user, pgbouncer, service_role*, authenticator*, authenticated*, anon*'

ansible/tasks/internal/supautils.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,6 @@
3232
target: install
3333
become: yes
3434

35-
- name: supautils - add supautils to session_preload_libraries
36-
become: yes
37-
replace:
38-
path: /etc/postgresql/postgresql.conf
39-
regexp: "#session_preload_libraries = ''"
40-
replace: session_preload_libraries = 'supautils'
41-
4235
- name: supautils - write custom 05-supautils.conf
4336
template:
4437
src: "files/postgresql_config/supautils.conf.j2"

ansible/tasks/setup-docker.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,6 @@
4242
- (debpkg_mode or stage2_nix)
4343
block:
4444
# supautils
45-
- name: supautils - add supautils to session_preload_libraries
46-
ansible.builtin.replace:
47-
path: '/etc/postgresql/postgresql.conf'
48-
regexp: "#session_preload_libraries = ''"
49-
replace: "session_preload_libraries = 'supautils'"
50-
become: true
51-
5245
- name: supautils - write custom supautils.conf
5346
ansible.builtin.template:
5447
dest: '/etc/postgresql-custom/05-supautils.conf'

nix/tools/run-server.sh.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@ vault.getkey_script = '$PGSODIUM_GETKEY_SCRIPT'" \
233233
-e "s|hba_file = '/etc/postgresql/pg_hba.conf'|hba_file = '$DATDIR/pg_hba.conf'|" \
234234
-e "s|ident_file = '/etc/postgresql/pg_ident.conf'|ident_file = '$DATDIR/pg_ident.conf'|" \
235235
-e "\$a\\
236-
session_preload_libraries = 'supautils'" \
237236
"$PSQL_CONF_FILE" > "$DATDIR/postgresql.conf"
238237
239238
# Function to configure OrioleDB specific settings

0 commit comments

Comments
 (0)