Skip to content

Commit a119df9

Browse files
authored
refactor: Move PostgreSQL auto_explain config to conf.d (#1943)
* refactor: Move PostgreSQL auto_explain config to conf.d Moves `auto_explain.log_min_duration` setting from inline Dockerfile definitions and the main PostgreSQL configuration file to a dedicated `auto_explain.conf` file within the `conf.d` directory. This change centralizes the configuration for better management and consistency across different PostgreSQL versions. Updates PostgreSQL release versions in `ansible/vars.yml` with the project-specific suffix. * refactor: Simplify PostgreSQL conf template sourcing The source path for PostgreSQL configuration templates has been simplified. Previously, underscores in `ext_item` were removed when constructing the template filename. This change removes that transformation, directly using `{{ ext_item }}.conf`. This implies that template files in `files/postgresql_config/conf.d/` now match the `ext_item` loop variables directly (e.g., `auto_explain.conf`).
1 parent d1f4f72 commit a119df9

File tree

7 files changed

+15
-7
lines changed

7 files changed

+15
-7
lines changed

Dockerfile-15

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,6 @@ RUN sed -i \
241241
#echo "pljava.libjvm_location = '/usr/lib/jvm/java-11-openjdk-${TARGETARCH}/lib/server/libjvm.so'" >> /etc/postgresql/postgresql.conf && \
242242
echo "pgsodium.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \
243243
echo "vault.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \
244-
echo 'auto_explain.log_min_duration = 10s' >> /etc/postgresql/postgresql.conf && \
245244
usermod -aG postgres wal-g && \
246245
mkdir -p /etc/postgresql-custom/conf.d && \
247246
chown -R postgres:postgres /etc/postgresql-custom

Dockerfile-17

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ RUN sed -i \
246246
#echo "pljava.libjvm_location = '/usr/lib/jvm/java-11-openjdk-${TARGETARCH}/lib/server/libjvm.so'" >> /etc/postgresql/postgresql.conf && \
247247
echo "pgsodium.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \
248248
echo "vault.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \
249-
echo 'auto_explain.log_min_duration = 10s' >> /etc/postgresql/postgresql.conf && \
250249
usermod -aG postgres wal-g && \
251250
mkdir -p /etc/postgresql-custom/conf.d && \
252251
chown -R postgres:postgres /etc/postgresql-custom

Dockerfile-orioledb-17

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ RUN sed -i \
246246
#echo "pljava.libjvm_location = '/usr/lib/jvm/java-11-openjdk-${TARGETARCH}/lib/server/libjvm.so'" >> /etc/postgresql/postgresql.conf && \
247247
echo "pgsodium.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \
248248
echo "vault.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \
249-
echo 'auto_explain.log_min_duration = 10s' >> /etc/postgresql/postgresql.conf && \
250249
usermod -aG postgres wal-g && \
251250
mkdir -p /etc/postgresql-custom/conf.d && \
252251
chown -R postgres:postgres /etc/postgresql-custom
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
auto_explain.log_min_duration = 10s

ansible/files/postgresql_config/postgresql.conf.j2

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,5 +773,4 @@ include_dir = '/etc/postgresql-custom/conf.d' # include files ending in '.conf'
773773
#------------------------------------------------------------------------------
774774

775775
# Add settings for extensions here
776-
auto_explain.log_min_duration = 10s
777776
cron.database_name = 'postgres'

ansible/tasks/finalize-ami.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@
44
group: 'postgres'
55
src: 'files/postgresql_config/postgresql-csvlog.conf'
66

7+
- name: auto_explain and pg_cron confs
8+
ansible.builtin.template:
9+
dest: "/etc/postgresql-custom/conf.d/{{ ext_item }}.conf"
10+
group: 'postgres'
11+
src: "files/postgresql_config/conf.d/{{ ext_item }}.conf"
12+
loop:
13+
- auto_explain
14+
# - pg_cron
15+
loop_control:
16+
loop_var: 'ext_item'
17+
718
- name: UFW - Allow SSH connections
819
community.general.ufw:
920
name: 'OpenSSH'

ansible/vars.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ postgres_major:
1010

1111
# Full version strings for each major version
1212
postgres_release:
13-
postgresorioledb-17: "17.6.0.011-orioledb"
14-
postgres17: "17.6.1.054"
15-
postgres15: "15.14.1.054"
13+
postgresorioledb-17: "17.6.0.011-orioledb-INDATA-255"
14+
postgres17: "17.6.1.054-INDATA-255"
15+
postgres15: "15.14.1.054-INDATA-255"
1616

1717
# Non Postgres Extensions
1818
pgbouncer_release: 1.19.0

0 commit comments

Comments
 (0)