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

[bitnami/postgresql-repmgr] repmgr.conf file content duplicated on each container restart #53409

Open
ahweis opened this issue Dec 6, 2023 · 6 comments
Labels
on-hold Issues or Pull Requests with this label will never be considered stale postgresql-repmgr tech-issues The user has a technical issue about an application

Comments

@ahweis
Copy link

ahweis commented Dec 6, 2023

Name and Version

bitnami/postgres-repmgr:16.0.0

What architecture are you using?

None

What steps will reproduce the bug?

  1. Follow the guide "Using a Docker Compose file" on "https://hub.docker.com/r/bitnami/postgresql-repmgr" to start a single postgres server using docker compose
  2. See that "/opt/bitnami/repmgr/conf/repmgr.conf" contains configuration of the node
  3. Restart the container
  4. See that "/opt/bitnami/repmgr/conf/repmgr.conf" content is now duplicated

For each restart of the container the repmgr.conf gets populated with the same configuration

In some cases (can't reproduce consistently) a lot of "NUL" characters are added to the config file

What is the expected behavior?

That replication manager config is only populated once - and the container supports restarts

What do you see instead?

Duplicated config data

Additional information

No response

@ahweis ahweis added the tech-issues The user has a technical issue about an application label Dec 6, 2023
@github-actions github-actions bot added the triage Triage is needed label Dec 6, 2023
@javsalgar javsalgar changed the title repmgr.conf file content duplicated on each container restart [bitnami/postgresql-repmgr] repmgr.conf file content duplicated on each container restart Dec 11, 2023
@github-actions github-actions bot assigned aoterolorenzo and unassigned javsalgar Dec 11, 2023
@github-actions github-actions bot removed the triage Triage is needed label Dec 11, 2023
@aoterolorenzo
Copy link
Contributor

Hi @ahweis,

With duplicated you means that the whole configuration is appended twice on the config file? Could you show the previous and after outputs?

@ahweis
Copy link
Author

ahweis commented Dec 21, 2023

Hi @aoterolorenzo ,

First time the container is started the conf file will be configured once, and then look like below:

event_notification_command='/opt/bitnami/repmgr/events/router.sh %n %e %s "%t" "%d"'
ssh_options='-o "StrictHostKeyChecking no" -v'
use_replication_slots='1'
pg_bindir='/opt/bitnami/postgresql/bin'

# FIXME: these 2 parameter should work
node_id=1001
node_name='postgresql16-1'
location='default'
conninfo='user=replmgr password=password host=postgresql16-1 dbname=repmgr port=5432 connect_timeout=5'
failover='automatic'
promote_command='PGPASSWORD=password repmgr standby promote -f "/opt/bitnami/repmgr/conf/repmgr.conf" --log-level DEBUG --verbose'
follow_command='PGPASSWORD=password repmgr standby follow -f "/opt/bitnami/repmgr/conf/repmgr.conf" -W --log-level DEBUG --verbose'
reconnect_attempts='3'
reconnect_interval='5'
log_level='NOTICE'
priority='100'
degraded_monitoring_timeout='5'
data_directory='/bitnami/postgresql/data'
async_query_timeout='20'
pg_ctl_options='-o "--config-file=\"/opt/bitnami/postgresql/conf/postgresql.conf\" --external_pid_file=\"/opt/bitnami/postgresql/tmp/postgresql.pid\" --hba_file=\"/opt/bitnami/postgresql/conf/pg_hba.conf\""'
pg_basebackup_options=''

Then if the container is restarted the config will be written again, and the file now looks like this:

event_notification_command='/opt/bitnami/repmgr/events/router.sh %n %e %s "%t" "%d"'
ssh_options='-o "StrictHostKeyChecking no" -v'
use_replication_slots='1'
pg_bindir='/opt/bitnami/postgresql/bin'

# FIXME: these 2 parameter should work
node_id=1001
node_name='postgresql16-1'
location='default'
conninfo='user=replmgr password=password host=postgresql16-1 dbname=repmgr port=5432 connect_timeout=5'
failover='automatic'
promote_command='PGPASSWORD=password repmgr standby promote -f "/opt/bitnami/repmgr/conf/repmgr.conf" --log-level DEBUG --verbose'
follow_command='PGPASSWORD=password repmgr standby follow -f "/opt/bitnami/repmgr/conf/repmgr.conf" -W --log-level DEBUG --verbose'
reconnect_attempts='3'
reconnect_interval='5'
log_level='NOTICE'
priority='100'
degraded_monitoring_timeout='5'
data_directory='/bitnami/postgresql/data'
async_query_timeout='20'
pg_ctl_options='-o "--config-file=\"/opt/bitnami/postgresql/conf/postgresql.conf\" --external_pid_file=\"/opt/bitnami/postgresql/tmp/postgresql.pid\" --hba_file=\"/opt/bitnami/postgresql/conf/pg_hba.conf\""'
pg_basebackup_options=''
event_notification_command='/opt/bitnami/repmgr/events/router.sh %n %e %s "%t" "%d"'
ssh_options='-o "StrictHostKeyChecking no" -v'
use_replication_slots='1'
pg_bindir='/opt/bitnami/postgresql/bin'

# FIXME: these 2 parameter should work
node_id=1001
node_name='postgresql16-1'
location='default'
conninfo='user=replmgr password=password host=postgresql16-1 dbname=repmgr port=5432 connect_timeout=5'
failover='automatic'
promote_command='PGPASSWORD=password repmgr standby promote -f "/opt/bitnami/repmgr/conf/repmgr.conf" --log-level DEBUG --verbose'
follow_command='PGPASSWORD=password repmgr standby follow -f "/opt/bitnami/repmgr/conf/repmgr.conf" -W --log-level DEBUG --verbose'
reconnect_attempts='3'
reconnect_interval='5'
log_level='NOTICE'
priority='100'
degraded_monitoring_timeout='5'
data_directory='/bitnami/postgresql/data'
async_query_timeout='20'
pg_ctl_options='-o "--config-file=\"/opt/bitnami/postgresql/conf/postgresql.conf\" --external_pid_file=\"/opt/bitnami/postgresql/tmp/postgresql.pid\" --hba_file=\"/opt/bitnami/postgresql/conf/pg_hba.conf\""'
pg_basebackup_options=''

For each restart of the container the a new set of configs will be added

@ahweis
Copy link
Author

ahweis commented Jan 4, 2024

Is there a correlation with another issue I see when e.g. the container crashes and tries to startup it complains that the /tmp/repmgrd.pid already exists and therefor can't start the replication manager before this file is deleted - could the config / setup have some logic not handling this correct?

Copy link

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

@github-actions github-actions bot added the stale 15 days without activity label Jan 20, 2024
@ahweis
Copy link
Author

ahweis commented Jan 23, 2024

Keep issue alive - can I provide more details?

@github-actions github-actions bot removed the stale 15 days without activity label Jan 24, 2024
@aoterolorenzo
Copy link
Contributor

Hi @ahweis,

Let me create a task for the team in order to fix this behavior. We will reach you back here.

@aoterolorenzo aoterolorenzo added the on-hold Issues or Pull Requests with this label will never be considered stale label Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
on-hold Issues or Pull Requests with this label will never be considered stale postgresql-repmgr tech-issues The user has a technical issue about an application
Projects
None yet
Development

No branches or pull requests

3 participants