Skip to content

Commit 68baadd

Browse files
committed
refactor: Move read-replica.conf to conf.d
The `read-replica.conf` file has been moved from `/etc/postgresql-custom/` to `/etc/postgresql-custom/conf.d/`. This change aligns with the standard practice of including configuration snippets from a `conf.d` directory. Changes include: - Dockerfiles: Adjusted to remove direct copy and update `sed` commands. - Ansible: Renamed configuration file and updated task to place it in `conf.d`. - Nix: Updated paths and substitutions to reflect the new location.
1 parent 2f6b03c commit 68baadd

File tree

8 files changed

+7
-19
lines changed

8 files changed

+7
-19
lines changed

Dockerfile-15

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql-stdout
214214
COPY --chown=postgres:postgres ansible/files/postgresql_config/supautils.conf.j2 /etc/postgresql-custom/supautils.conf
215215
COPY --chown=postgres:postgres ansible/files/postgresql_extension_custom_scripts /etc/postgresql-custom/extension-custom-scripts
216216
COPY --chown=postgres:postgres ansible/files/pgsodium_getkey_urandom.sh.j2 /usr/lib/postgresql/bin/pgsodium_getkey.sh
217-
COPY --chown=postgres:postgres ansible/files/postgresql_config/custom_read_replica.conf.j2 /etc/postgresql-custom/read-replica.conf
218217
COPY --chown=postgres:postgres ansible/files/postgresql_config/custom_walg.conf.j2 /etc/postgresql-custom/wal-g.conf
219218
COPY --chown=postgres:postgres ansible/files/walg_helper_scripts/wal_fetch.sh /home/postgres/wal_fetch.sh
220219
COPY ansible/files/walg_helper_scripts/wal_change_ownership.sh /root/wal_change_ownership.sh

Dockerfile-17

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql-stdout
218218
COPY --chown=postgres:postgres ansible/files/postgresql_config/supautils.conf.j2 /etc/postgresql-custom/supautils.conf
219219
COPY --chown=postgres:postgres ansible/files/postgresql_extension_custom_scripts /etc/postgresql-custom/extension-custom-scripts
220220
COPY --chown=postgres:postgres ansible/files/pgsodium_getkey_urandom.sh.j2 /usr/lib/postgresql/bin/pgsodium_getkey.sh
221-
COPY --chown=postgres:postgres ansible/files/postgresql_config/custom_read_replica.conf.j2 /etc/postgresql-custom/read-replica.conf
222221
COPY --chown=postgres:postgres ansible/files/postgresql_config/custom_walg.conf.j2 /etc/postgresql-custom/wal-g.conf
223222
COPY --chown=postgres:postgres ansible/files/walg_helper_scripts/wal_fetch.sh /home/postgres/wal_fetch.sh
224223
COPY ansible/files/walg_helper_scripts/wal_change_ownership.sh /root/wal_change_ownership.sh

Dockerfile-orioledb-17

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql-stdout
218218
COPY --chown=postgres:postgres ansible/files/postgresql_config/supautils.conf.j2 /etc/postgresql-custom/supautils.conf
219219
COPY --chown=postgres:postgres ansible/files/postgresql_extension_custom_scripts /etc/postgresql-custom/extension-custom-scripts
220220
COPY --chown=postgres:postgres ansible/files/pgsodium_getkey_urandom.sh.j2 /usr/lib/postgresql/bin/pgsodium_getkey.sh
221-
COPY --chown=postgres:postgres ansible/files/postgresql_config/custom_read_replica.conf.j2 /etc/postgresql-custom/read-replica.conf
222221
COPY --chown=postgres:postgres ansible/files/postgresql_config/custom_walg.conf.j2 /etc/postgresql-custom/wal-g.conf
223222
COPY --chown=postgres:postgres ansible/files/walg_helper_scripts/wal_fetch.sh /home/postgres/wal_fetch.sh
224223
COPY ansible/files/walg_helper_scripts/wal_change_ownership.sh /root/wal_change_ownership.sh
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# hot_standby = on
2-
# restore_command = '/usr/bin/admin-mgr wal-fetch %f %p >> /var/log/wal-g/wal-fetch.log 2>&1'
3-
# recovery_target_timeline = 'latest'
42

53
# primary_conninfo = 'host=localhost port=6543 user=replication'
4+
5+
# restore_command = '/usr/bin/admin-mgr wal-fetch %f %p >> /var/log/wal-g/wal-fetch.log 2>&1'
6+
# recovery_target_timeline = 'latest'

ansible/files/postgresql_config/postgresql.conf.j2

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -761,9 +761,6 @@ jit_provider = 'llvmjit' # JIT library to use
761761
# WAL-G specific configurations
762762
#include = '/etc/postgresql-custom/wal-g.conf'
763763

764-
# read replica specific configurations
765-
include = '/etc/postgresql-custom/read-replica.conf'
766-
767764
# supautils specific configurations
768765
#include = '/etc/postgresql-custom/supautils.conf'
769766

ansible/tasks/setup-postgres.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,13 @@
167167
loop_control:
168168
loop_var: 'pg_config_item'
169169

170-
- name: Move custom read-replica.conf file to /etc/postgresql-custom/read-replica.conf
171-
ansible.builtin.template:
172-
dest: '/etc/postgresql-custom/read-replica.conf'
170+
- name: Move read-replica.conf file to /etc/postgresql-custom/conf.d/read-replica.conf
171+
ansible.builtin.copy:
172+
dest: '/etc/postgresql-custom/conf.d/read_replica.conf'
173173
mode: '0664'
174174
owner: 'postgres'
175175
group: 'postgres'
176-
src: 'files/postgresql_config/custom_read_replica.conf.j2'
176+
src: 'files/postgresql_config/conf.d/read_replica.conf'
177177

178178
# Install extensions before init
179179
- name: Install Postgres extensions

nix/packages/lib.nix

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@
4848
name = "logging.conf";
4949
path = ../../ansible/files/postgresql_config/postgresql-csvlog.conf;
5050
};
51-
readReplicaConfigFile = builtins.path {
52-
name = "readreplica.conf";
53-
path = ../../ansible/files/postgresql_config/custom_read_replica.conf.j2;
54-
};
5551
pgHbaConfigFile = builtins.path {
5652
name = "pg_hba.conf";
5753
path = ../../ansible/files/postgresql_config/pg_hba.conf.j2;
@@ -91,7 +87,6 @@
9187
POSTGRESQL_CONFIG_DIR = "${postgresqlConfigBaseDir}";
9288
PSQLORIOLEDB17_BINDIR = "${psql_orioledb-17}";
9389
PGSODIUM_GETKEY = "${paths.getkeyScript}";
94-
READREPL_CONF_FILE = "${paths.readReplicaConfigFile}";
9590
LOGGING_CONF_FILE = "${paths.loggingConfigFile}";
9691
SUPAUTILS_CONF_FILE = "${paths.supautilsConfigFile}";
9792
PG_HBA = "${paths.pgHbaConfigFile}";
@@ -123,7 +118,6 @@
123118
cp ${paths.supautilsConfigFile} $out/etc/postgresql-custom/supautils.conf || { echo "Failed to copy supautils.conf"; exit 1; }
124119
cp ${paths.pgconfigFile} $out/etc/postgresql/postgresql.conf || { echo "Failed to copy postgresql.conf"; exit 1; }
125120
cp ${paths.loggingConfigFile} $out/etc/postgresql-custom/logging.conf || { echo "Failed to copy logging.conf"; exit 1; }
126-
cp ${paths.readReplicaConfigFile} $out/etc/postgresql-custom/read-replica.conf || { echo "Failed to copy read-replica.conf"; exit 1; }
127121
cp ${paths.pgHbaConfigFile} $out/etc/postgresql/pg_hba.conf || { echo "Failed to copy pg_hba.conf"; exit 1; }
128122
cp ${paths.pgIdentConfigFile} $out/etc/postgresql/pg_ident.conf || { echo "Failed to copy pg_ident.conf"; exit 1; }
129123
cp -r ${paths.postgresqlExtensionCustomScriptsPath}/* $out/extension-custom-scripts/ || { echo "Failed to copy custom scripts"; exit 1; }

nix/tools/run-server.sh.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ vault.getkey_script = '$PGSODIUM_GETKEY_SCRIPT'" \
240240
-e "s|hba_file = '/etc/postgresql/pg_hba.conf'|hba_file = '$DATDIR/pg_hba.conf'|" \
241241
-e "s|ident_file = '/etc/postgresql/pg_ident.conf'|ident_file = '$DATDIR/pg_ident.conf'|" \
242242
-e "s|include = '/etc/postgresql/logging.conf'|#&|" \
243-
-e "s|include = '/etc/postgresql-custom/read-replica.conf'|include = '$DATDIR/read-replica.conf'|" \
244243
-e "\$a\\
245244
session_preload_libraries = 'supautils'" \
246245
-e "s|include_dir = '/etc/postgresql-custom/conf.d'|include_dir = '$DATDIR/conf.d'|" \

0 commit comments

Comments
 (0)