Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RHCLOUD-30826] - Remove use of POSTGRESQL_MASTER env vars #930

Merged
merged 1 commit into from
Feb 5, 2024

Conversation

bsquizz
Copy link
Contributor

@bsquizz bsquizz commented Feb 5, 2024

Currently when the ephemeral DB's start up, the container in the pod always restarts once.

If you look at the container logs, you can see it is running into this error:

waiting for server to start....2024-02-05 16:09:50.580 UTC [35] LOG:  starting PostgreSQL 12.14 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 13.0.1 20230208 (Red Hat 13.0.1-0), 64-bit
2024-02-05 16:09:50.581 UTC [35] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-02-05 16:09:50.582 UTC [35] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2024-02-05 16:09:50.599 UTC [35] LOG:  redirecting log output to logging collector process
2024-02-05 16:09:50.599 UTC [35] HINT:  Future log output will appear in directory "log".
 done
server started
/var/run/postgresql:5432 - accepting connections
createuser: error: creation of new role failed: ERROR:  role "postgres" already exists

And I think this is due to us setting the POSTGRESQL_MASTER_USER to be postgres -- it causes the scl container scripts to invoke this:

https://github.com/sclorg/postgresql-container/blob/16cd132d4986523b531a353401e6ed4ee0703c8b/10/root/usr/share/container-scripts/postgresql/common.sh#L241

Reading through this: https://github.com/sclorg/postgresql-container/tree/16cd132d4986523b531a353401e6ed4ee0703c8b/examples/replica#postgresql_master_password it seems that the MASTER_ env vars only relate to DB replication. We don't use this feature so we don't even need to set these env vars. We should use POSTGRESQL_ADMIN_PASSWORD though to configure the admin password: https://github.com/sclorg/postgresql-container/tree/16cd132d4986523b531a353401e6ed4ee0703c8b/examples/replica#postgresql_password-and-postgresql_admin_password

We also should not need to set PGPASSWORD on the pods anymore, so I removed that. It doesn't look like any of the images at https://github.com/sclorg/postgresql-container use this environment variable.

@bsquizz bsquizz changed the title Remove use of POSTGRESQL_MASTER env vars RHCLOUD-30826: Remove use of POSTGRESQL_MASTER env vars Feb 5, 2024
@psav
Copy link
Collaborator

psav commented Feb 5, 2024

/retest

@psav psav changed the title RHCLOUD-30826: Remove use of POSTGRESQL_MASTER env vars [RHCLOUD-30826] - Remove use of POSTGRESQL_MASTER env vars Feb 5, 2024
@bsquizz bsquizz assigned bsquizz and unassigned bsquizz Feb 5, 2024
Copy link
Contributor

@adamrdrew adamrdrew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@adamrdrew adamrdrew merged commit c0c863a into master Feb 5, 2024
6 checks passed
@psav psav deleted the no_pgsql_master_vars branch February 20, 2024 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants