Skip to content

Commit ae05606

Browse files
author
Alan Christie
committed
- Fixes user-defined configuration
1 parent b372a74 commit ae05606

5 files changed

Lines changed: 24 additions & 34 deletions

File tree

README.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,9 @@ As well as the 'standard' postgres user you can optionally also create
3131
a second (auxiliary) user with a database and optional super-user privileges
3232
using the `pg_aux` parameters (see `roles/postgresql/defaults/main.yaml`).
3333

34-
## Fine-tuning postgres with an extra configuration file
35-
You can configure any additional database [parameters] using a postgres
36-
configuration file. An example is present in the root of this project
37-
(`postgres-extra.conf`).
38-
39-
If you need a file, prepare it and then name it using the playbook's
40-
`pg_extra_configuration_file` parameter, which will be injected into the
41-
postgres **Pod** as a **ConfigMap** and processed by postgres as it starts.
34+
## Fine-tuning postgres with configuration
35+
You can configure any additional database [parameters] using the playbook
36+
variable `pg_configuration`.
4237

4338
---
4439

parameters-template.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@ pg_copy_vol_storageclass: efs
2323
pg_aux_user: frag
2424
pg_aux_user_password: blob1234
2525
pg_aux_database: frag
26+
27+
pg_configuration: |
28+
listen_addresses = '*'
29+
shared_buffers = 512MB

postgres-extra.conf

Lines changed: 0 additions & 25 deletions
This file was deleted.

roles/postgresql/defaults/main.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,22 @@ pg_aux_user_is_superuser: yes
5353
# What is placed here is written to the container as '/tmp/postgresql.conf',
5454
# which is then copied to 'PGDATA/postgresql.conf' at run-time
5555
# by our initialisation script '01-init.sh'.
56+
#
57+
# The pg_configuration can be used to set any postgres configuration
58+
# parameter: -
59+
#
60+
# pg_configuration: |
61+
# listen_addresses = '*'
62+
# autovacuum_max_workers = 2
63+
# logging_collector = true
64+
# log_min_messages = notice
65+
# max_worker_processes = 2
66+
# max_parallel_workers = 2
67+
# max_parallel_workers_per_gather = 2
68+
# max_wal_size = 1GB
69+
# shared_buffers = 128kB
70+
# synchronous_commit = off
71+
# work_mem = 4MB
5672
pg_configuration: |
5773
listen_addresses = '*'
5874

roles/postgresql/templates/configmap-postgres-init.yaml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ data:
1010
set -e
1111

1212
# Copy configuration into place
13-
cat /tmp/postgresql.conf > /var/lib/postgresql/data/postgresql.conf
13+
cat /tmp/postgresql.conf > $PGDATA/postgresql.conf
1414

1515
{% if pg_aux_user_fact %}
1616
# Configure aux user

0 commit comments

Comments
 (0)