Skip to content

Commit 7876920

Browse files
committed
refactor(postgresql): split auto_explain and pg_cron out into their own config files
1 parent e0426ee commit 7876920

File tree

8 files changed

+33
-8
lines changed

8 files changed

+33
-8
lines changed

Dockerfile-15

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql.conf.j
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
165165
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/autoexplain.conf /etc/postgresql-custom/auto_explain.conf
167+
COPY --chown=postgres:postgres ansible/files/postgresql_config/pgcron.conf /etc/postgresql-custom/pg_cron.conf
166168
COPY --chown=postgres:postgres ansible/files/postgresql_config/supautils.conf.j2 /etc/postgresql-custom/05-supautils.conf
167169
COPY --chown=postgres:postgres ansible/files/postgresql_extension_custom_scripts /etc/postgresql-custom/extension-custom-scripts
168170
COPY --chown=postgres:postgres ansible/files/pgsodium_getkey_urandom.sh.j2 /usr/lib/postgresql/bin/pgsodium_getkey.sh

Dockerfile-17

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql.conf.j
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
165165
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/autoexplain.conf /etc/postgresql-custom/auto_explain.conf
167+
COPY --chown=postgres:postgres ansible/files/postgresql_config/pg_cron.conf /etc/postgresql-custom/pg_cron.conf
166168
COPY --chown=postgres:postgres ansible/files/postgresql_config/supautils.conf.j2 /etc/postgresql-custom/05-supautils.conf
167169
COPY --chown=postgres:postgres ansible/files/postgresql_extension_custom_scripts /etc/postgresql-custom/extension-custom-scripts
168170
COPY --chown=postgres:postgres ansible/files/pgsodium_getkey_urandom.sh.j2 /usr/lib/postgresql/bin/pgsodium_getkey.sh

Dockerfile-orioledb-17

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql.conf.j
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
165165
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/autoexplain.conf /etc/postgresql-custom/auto_explain.conf
167+
COPY --chown=postgres:postgres ansible/files/postgresql_config/pg_cron.conf /etc/postgresql-custom/pg_cron.conf
166168
COPY --chown=postgres:postgres ansible/files/postgresql_config/supautils.conf.j2 /etc/postgresql-custom/05-supautils.conf
167169
COPY --chown=postgres:postgres ansible/files/postgresql_extension_custom_scripts /etc/postgresql-custom/extension-custom-scripts
168170
COPY --chown=postgres:postgres ansible/files/pgsodium_getkey_urandom.sh.j2 /usr/lib/postgresql/bin/pgsodium_getkey.sh
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# auto_explain
2+
3+
auto_explain.log_min_duration = 10s
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# pg_cron
2+
3+
cron.database_name = 'postgres'

ansible/files/postgresql_config/postgresql.conf.j2

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,3 @@ jit_provider = 'llvmjit' # JIT library to use
159159
# assignments, so they can usefully be given more than once.
160160

161161
include_dir = '/etc/postgresql-custom' # include files ending in '.conf' from a directory, e.g., 'conf.d'
162-
163-
#------------------------------------------------------------------------------
164-
# CUSTOMIZED OPTIONS
165-
#------------------------------------------------------------------------------
166-
167-
# Add settings for extensions here
168-
auto_explain.log_min_duration = 10s
169-
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
dest: /etc/postgresql-custom/00-logging.conf
55
group: postgres
66

7+
- name: auto_explain and pg_cron confs
8+
ansible.builtin.template:
9+
dest: "/etc/postgresql-custom/{{ ext_item }}.conf"
10+
group: 'postgres'
11+
src: "files/postgresql_config/{{ ext_item | split('_') | join('') }}.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
ufw:
920
rule: allow

nix/packages/lib.nix

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@
4444
name = "00-logging.conf";
4545
path = ../../ansible/files/postgresql_config/postgresql-csvlog.conf;
4646
};
47+
autoexplainConfigFile = builtins.path {
48+
name = "auto_explain.conf";
49+
path = ../../ansible/files/postgresql_config/autoexplain.conf;
50+
};
51+
pgcronConfigFile = builtins.path {
52+
name = "pg_cron.conf";
53+
path = ../../ansible/files/postgresql_config/pg_cron.conf;
54+
};
4755
readReplicaConfigFile = builtins.path {
4856
name = "readreplica.conf";
4957
path = ../../ansible/files/postgresql_config/custom_read_replica.conf.j2;
@@ -113,6 +121,8 @@
113121
cp ${paths.supautilsConfigFile} $out/etc/postgresql-custom/05-supautils.conf || { echo "Failed to copy supautils.conf"; exit 1; }
114122
cp ${paths.pgconfigFile} $out/etc/postgresql/postgresql.conf || { echo "Failed to copy postgresql.conf"; exit 1; }
115123
cp ${paths.loggingConfigFile} $out/etc/postgresql-custom/00-logging.conf || { echo "Failed to copy logging.conf"; exit 1; }
124+
cp ${paths.autoexplainConfigFile} $out/etc/postgresql-custom/auto_explain.conf || { echo "Failed to copy auto_explain.conf"; exit 1; }
125+
cp ${paths.pgcronConfigFile} $out/etc/postgresql-custom/pg_cron.conf || { echo "Failed to copy pg_cron.conf"; exit 1; }
116126
cp ${paths.readReplicaConfigFile} $out/etc/postgresql-custom/04-read-replica.conf || { echo "Failed to copy read-replica.conf"; exit 1; }
117127
cp ${paths.pgHbaConfigFile} $out/etc/postgresql/pg_hba.conf || { echo "Failed to copy pg_hba.conf"; exit 1; }
118128
cp ${paths.pgIdentConfigFile} $out/etc/postgresql/pg_ident.conf || { echo "Failed to copy pg_ident.conf"; exit 1; }

0 commit comments

Comments
 (0)