containers icon indicating copy to clipboard operation
containers copied to clipboard

[bitnami/postgresql] Updated libpostgresql.sh to specify a host to Postgres Commands

Open james-mchugh opened this issue 1 year ago • 0 comments

Description of the change

Updates the postgresql_start_bg and postgresql_execute_print_output functions in libpostgresql.sh to specify the loopback address as the host for psql and pg_isready commands.

Benefits

If a custom unix socket directory is specified in the Primary configuration, startup will fail as the psql and pg_isready commands do not look at the correct location for the Unix socket directory. This updates them to use the loopback host which should work regardless of where the unix socket file is stored, and it is also consistent with the behavior of the probes used by the Helm chart.

Being able to specify a custom Unix socket directory is useful, as the Bitnami Postgresql image provided by Iron Bank is built on top of the RHEL Universal Base Image and uses the RHEL Postgresql port. The RHEL Postgresql port defaults to storing Postgresql's unix socket under /run, which poses an issue as it is a common security measure to deploy containers with read-only root filesystems.

Possible drawbacks

None that I'm aware of. I've tested this in standalone and replication mode, and both appeared to work as expected.

Applicable issues

  • fixes #68027

Additional information

There appears to be a separate bug here mentioned in #68027 where if the startup setup fails the first time, it will never be completed. When this happens, the Postgresql container will act as if it is healthy even though the authentication and databases have not been properly setup. This PR does not fix that issue.

james-mchugh avatar Jun 29 '24 17:06 james-mchugh