Skip to content

Commit f53d018

Browse files
committed
fix: Disable postgresql_server_tuning for buildah connections
Cause: Detecting available RAM and basing the shared memory settings of the server on that is futile and wrong during a container image build. The available RAM during that build is independent of the actual runtime, be that a bootc deployment or a system container. Consequence: postgresql.service failed to start when the available RAM during container build was higher than at deployment time. In the opposite case, the shared memory tuning was too small and thus also wrong. Fix: Disable `postgresql_server_tuning` by default for container builds, i.e. when being connected to a buildah instance.
1 parent a55a634 commit f53d018

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ based on system resources. To disable the tuning, set the
143143
postgresql_server_tuning: false
144144
```
145145

146+
However, when running against a
147+
[buildah connection](https://docs.ansible.com/ansible/latest/collections/containers/podman/buildah_connection.html),
148+
i.e. a container build, this defaults to `false`. The available RAM during a
149+
container build is independent of the actual deployment.
150+
146151
See the [`examples/`](examples) for details.
147152

148153
## Idempotence

defaults/main.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ postgresql_version: "{{ '16' if ansible_facts['os_family'] == 'RedHat'
1010
else '13' }}"
1111
postgresql_password: null
1212
postgresql_cert_name: null
13-
postgresql_server_tuning: true
13+
# the container build environment's RAM is independent from the deployment
14+
# (regardless if it's a bootc or system container one), so disable tuning there
15+
# by default
16+
postgresql_server_tuning: "{{ false if (ansible_connection | d('')) == 'buildah' else true }}"
1417
postgresql_ssl_enable: false
1518

1619
# If you want to generate the certificas in the postgresql role

0 commit comments

Comments
 (0)