Skip to content

Commit e0426ee

Browse files
committed
refactor(ansible): rename all conf files in /etc/postgresql-custom to preserve ordering
1 parent 07ab014 commit e0426ee

16 files changed

+64
-716
lines changed

Dockerfile-15

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,20 +162,19 @@ COPY --from=walg /tmp/wal-g /usr/local/bin/
162162
COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql.conf.j2 /etc/postgresql/postgresql.conf
163163
COPY --chown=postgres:postgres ansible/files/postgresql_config/pg_hba.conf.j2 /etc/postgresql/pg_hba.conf
164164
COPY --chown=postgres:postgres ansible/files/postgresql_config/pg_ident.conf.j2 /etc/postgresql/pg_ident.conf
165-
COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql-stdout-log.conf /etc/postgresql/logging.conf
166-
COPY --chown=postgres:postgres ansible/files/postgresql_config/supautils.conf.j2 /etc/postgresql-custom/supautils.conf
165+
COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql-stdout-log.conf /etc/postgresql-custom/00-logging.conf
166+
COPY --chown=postgres:postgres ansible/files/postgresql_config/supautils.conf.j2 /etc/postgresql-custom/05-supautils.conf
167167
COPY --chown=postgres:postgres ansible/files/postgresql_extension_custom_scripts /etc/postgresql-custom/extension-custom-scripts
168168
COPY --chown=postgres:postgres ansible/files/pgsodium_getkey_urandom.sh.j2 /usr/lib/postgresql/bin/pgsodium_getkey.sh
169-
COPY --chown=postgres:postgres ansible/files/postgresql_config/custom_read_replica.conf.j2 /etc/postgresql-custom/read-replica.conf
170-
COPY --chown=postgres:postgres ansible/files/postgresql_config/custom_walg.conf.j2 /etc/postgresql-custom/wal-g.conf
169+
COPY --chown=postgres:postgres ansible/files/postgresql_config/custom_read_replica.conf.j2 /etc/postgresql-custom/04-read-replica.conf
170+
COPY --chown=postgres:postgres ansible/files/postgresql_config/custom_walg.conf.j2 /etc/postgresql-custom/03-wal-g.conf
171171
COPY --chown=postgres:postgres ansible/files/walg_helper_scripts/wal_fetch.sh /home/postgres/wal_fetch.sh
172172
COPY ansible/files/walg_helper_scripts/wal_change_ownership.sh /root/wal_change_ownership.sh
173173

174174
RUN sed -i \
175175
-e "s|#unix_socket_directories = '/tmp'|unix_socket_directories = '/var/run/postgresql'|g" \
176176
-e "s|#session_preload_libraries = ''|session_preload_libraries = 'supautils'|g" \
177-
-e "s|#include = '/etc/postgresql-custom/supautils.conf'|include = '/etc/postgresql-custom/supautils.conf'|g" \
178-
-e "s|#include = '/etc/postgresql-custom/wal-g.conf'|include = '/etc/postgresql-custom/wal-g.conf'|g" /etc/postgresql/postgresql.conf && \
177+
/etc/postgresql/postgresql.conf && \
179178
echo "cron.database_name = 'postgres'" >> /etc/postgresql/postgresql.conf && \
180179
#echo "pljava.libjvm_location = '/usr/lib/jvm/java-11-openjdk-${TARGETARCH}/lib/server/libjvm.so'" >> /etc/postgresql/postgresql.conf && \
181180
echo "pgsodium.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \

Dockerfile-17

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,20 +162,19 @@ COPY --from=walg /tmp/wal-g /usr/local/bin/
162162
COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql.conf.j2 /etc/postgresql/postgresql.conf
163163
COPY --chown=postgres:postgres ansible/files/postgresql_config/pg_hba.conf.j2 /etc/postgresql/pg_hba.conf
164164
COPY --chown=postgres:postgres ansible/files/postgresql_config/pg_ident.conf.j2 /etc/postgresql/pg_ident.conf
165-
COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql-stdout-log.conf /etc/postgresql/logging.conf
166-
COPY --chown=postgres:postgres ansible/files/postgresql_config/supautils.conf.j2 /etc/postgresql-custom/supautils.conf
165+
COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql-stdout-log.conf /etc/postgresql-custom/00-logging.conf
166+
COPY --chown=postgres:postgres ansible/files/postgresql_config/supautils.conf.j2 /etc/postgresql-custom/05-supautils.conf
167167
COPY --chown=postgres:postgres ansible/files/postgresql_extension_custom_scripts /etc/postgresql-custom/extension-custom-scripts
168168
COPY --chown=postgres:postgres ansible/files/pgsodium_getkey_urandom.sh.j2 /usr/lib/postgresql/bin/pgsodium_getkey.sh
169-
COPY --chown=postgres:postgres ansible/files/postgresql_config/custom_read_replica.conf.j2 /etc/postgresql-custom/read-replica.conf
170-
COPY --chown=postgres:postgres ansible/files/postgresql_config/custom_walg.conf.j2 /etc/postgresql-custom/wal-g.conf
169+
COPY --chown=postgres:postgres ansible/files/postgresql_config/custom_read_replica.conf.j2 /etc/postgresql-custom/04-read-replica.conf
170+
COPY --chown=postgres:postgres ansible/files/postgresql_config/custom_walg.conf.j2 /etc/postgresql-custom/03-wal-g.conf
171171
COPY --chown=postgres:postgres ansible/files/walg_helper_scripts/wal_fetch.sh /home/postgres/wal_fetch.sh
172172
COPY ansible/files/walg_helper_scripts/wal_change_ownership.sh /root/wal_change_ownership.sh
173173

174174
RUN sed -i \
175175
-e "s|#unix_socket_directories = '/tmp'|unix_socket_directories = '/var/run/postgresql'|g" \
176176
-e "s|#session_preload_libraries = ''|session_preload_libraries = 'supautils'|g" \
177-
-e "s|#include = '/etc/postgresql-custom/supautils.conf'|include = '/etc/postgresql-custom/supautils.conf'|g" \
178-
-e "s|#include = '/etc/postgresql-custom/wal-g.conf'|include = '/etc/postgresql-custom/wal-g.conf'|g" /etc/postgresql/postgresql.conf && \
177+
/etc/postgresql/postgresql.conf && \
179178
echo "cron.database_name = 'postgres'" >> /etc/postgresql/postgresql.conf && \
180179
#echo "pljava.libjvm_location = '/usr/lib/jvm/java-11-openjdk-${TARGETARCH}/lib/server/libjvm.so'" >> /etc/postgresql/postgresql.conf && \
181180
echo "pgsodium.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \
@@ -189,7 +188,7 @@ RUN sed -i \
189188
RUN sed -i 's/ timescaledb,//g;' "/etc/postgresql/postgresql.conf"
190189
#as of pg 16.4 + this db_user_namespace totally deprecated and will break the server if setting is present
191190
RUN sed -i 's/db_user_namespace = off/#db_user_namespace = off/g;' "/etc/postgresql/postgresql.conf"
192-
RUN sed -i 's/ timescaledb,//g; s/ plv8,//g' "/etc/postgresql-custom/supautils.conf"
191+
RUN sed -i 's/ timescaledb,//g; s/ plv8,//g' "/etc/postgresql-custom/05-supautils.conf"
193192

194193

195194

Dockerfile-orioledb-17

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,20 +162,19 @@ COPY --from=walg /tmp/wal-g /usr/local/bin/
162162
COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql.conf.j2 /etc/postgresql/postgresql.conf
163163
COPY --chown=postgres:postgres ansible/files/postgresql_config/pg_hba.conf.j2 /etc/postgresql/pg_hba.conf
164164
COPY --chown=postgres:postgres ansible/files/postgresql_config/pg_ident.conf.j2 /etc/postgresql/pg_ident.conf
165-
COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql-stdout-log.conf /etc/postgresql/logging.conf
166-
COPY --chown=postgres:postgres ansible/files/postgresql_config/supautils.conf.j2 /etc/postgresql-custom/supautils.conf
165+
COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql-stdout-log.conf /etc/postgresql-custom/00-logging.conf
166+
COPY --chown=postgres:postgres ansible/files/postgresql_config/supautils.conf.j2 /etc/postgresql-custom/05-supautils.conf
167167
COPY --chown=postgres:postgres ansible/files/postgresql_extension_custom_scripts /etc/postgresql-custom/extension-custom-scripts
168168
COPY --chown=postgres:postgres ansible/files/pgsodium_getkey_urandom.sh.j2 /usr/lib/postgresql/bin/pgsodium_getkey.sh
169-
COPY --chown=postgres:postgres ansible/files/postgresql_config/custom_read_replica.conf.j2 /etc/postgresql-custom/read-replica.conf
170-
COPY --chown=postgres:postgres ansible/files/postgresql_config/custom_walg.conf.j2 /etc/postgresql-custom/wal-g.conf
169+
COPY --chown=postgres:postgres ansible/files/postgresql_config/custom_read_replica.conf.j2 /etc/postgresql-custom/04-read-replica.conf
170+
COPY --chown=postgres:postgres ansible/files/postgresql_config/custom_walg.conf.j2 /etc/postgresql-custom/03-wal-g.conf
171171
COPY --chown=postgres:postgres ansible/files/walg_helper_scripts/wal_fetch.sh /home/postgres/wal_fetch.sh
172172
COPY ansible/files/walg_helper_scripts/wal_change_ownership.sh /root/wal_change_ownership.sh
173173

174174
RUN sed -i \
175175
-e "s|#unix_socket_directories = '/tmp'|unix_socket_directories = '/var/run/postgresql'|g" \
176176
-e "s|#session_preload_libraries = ''|session_preload_libraries = 'supautils'|g" \
177-
-e "s|#include = '/etc/postgresql-custom/supautils.conf'|include = '/etc/postgresql-custom/supautils.conf'|g" \
178-
-e "s|#include = '/etc/postgresql-custom/wal-g.conf'|include = '/etc/postgresql-custom/wal-g.conf'|g" /etc/postgresql/postgresql.conf && \
177+
/etc/postgresql/postgresql.conf && \
179178
echo "cron.database_name = 'postgres'" >> /etc/postgresql/postgresql.conf && \
180179
#echo "pljava.libjvm_location = '/usr/lib/jvm/java-11-openjdk-${TARGETARCH}/lib/server/libjvm.so'" >> /etc/postgresql/postgresql.conf && \
181180
echo "pgsodium.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \
@@ -189,7 +188,7 @@ RUN sed -i \
189188
RUN sed -i 's/ timescaledb,//g;' "/etc/postgresql/postgresql.conf"
190189
#as of pg 16.4 + this db_user_namespace totally deprecated and will break the server if setting is present
191190
RUN sed -i 's/db_user_namespace = off/#db_user_namespace = off/g;' "/etc/postgresql/postgresql.conf"
192-
RUN sed -i 's/ timescaledb,//g; s/ plv8,//g; s/ postgis,//g; s/ pgrouting,//g' "/etc/postgresql-custom/supautils.conf"
191+
RUN sed -i 's/ timescaledb,//g; s/ plv8,//g; s/ postgis,//g; s/ pgrouting,//g' "/etc/postgresql-custom/05-supautils.conf"
193192
RUN sed -i 's/\(shared_preload_libraries.*\)'\''\(.*\)$/\1, orioledb'\''\2/' "/etc/postgresql/postgresql.conf"
194193
RUN echo "default_table_access_method = 'orioledb'" >> "/etc/postgresql/postgresql.conf"
195194

ansible/files/admin_api_scripts/pg_upgrade_scripts/initiate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ EOF
515515
mkdir -p "$MOUNT_POINT/conf"
516516
cp -R /etc/postgresql-custom/* "$MOUNT_POINT/conf/"
517517
# removing supautils config as to allow the latest one provided by the latest image to be used
518-
rm -f "$MOUNT_POINT/conf/supautils.conf" || true
518+
rm -f "$MOUNT_POINT/conf/05-supautils.conf" || true
519519
rm -rf "$MOUNT_POINT/conf/extension-custom-scripts" || true
520520

521521
# removing wal-g config as to allow it to be explicitly enabled on the new instance

ansible/files/database-optimizations.service.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Description=Postgresql optimizations
44
[Service]
55
Type=oneshot
66
# we do not want failures from these commands to cause downstream service startup to fail
7-
ExecStart=-/opt/supabase-admin-api optimize db --destination-config-file-path /etc/postgresql-custom/generated-optimizations.conf
7+
ExecStart=-/opt/supabase-admin-api optimize db --destination-config-file-path /etc/postgresql-custom/01-generated-optimizations.conf
88
ExecStart=-/opt/supabase-admin-api optimize pgbouncer --destination-config-file-path /etc/pgbouncer-custom/generated-optimizations.ini
99
User=adminapi
1010

ansible/files/postgres_prestart.sh.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ check_orioledb_enabled() {
1515
}
1616

1717
get_shared_buffers() {
18-
local opt_conf="/etc/postgresql-custom/generated-optimizations.conf"
18+
local opt_conf="/etc/postgresql-custom/01-generated-optimizations.conf"
1919
if [ ! -f "$opt_conf" ]; then
2020
return 0
2121
fi
@@ -134,4 +134,4 @@ if [ $(locale -a | grep -c en_US.utf8) -eq 0 ]; then
134134
locale-gen
135135
fi
136136

137-
main
137+
main

0 commit comments

Comments
 (0)