Skip to content

[bitnami/postgresql-repmgr] Support running scripts on primary node when container starts #82116

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sawntoe
Copy link

@sawntoe sawntoe commented Jun 7, 2025

Revival of #70737

Description of the change

This adds the ability to run scripts on startup always, a feature that is present in other containers such as mariadb with the /docker-entrypoint-startdb.d endpoint

Benefits

It is currently a huge pain in the behind to run scripts at startup everytime the container starts, requiring an undocumented change to the entrypoint for which there is no information anywhere

Applicable issues

@sawntoe sawntoe force-pushed the feature/postgres-repmgr-startscripts branch from fbd9ead to 3446058 Compare June 8, 2025 03:49
@javsalgar javsalgar added verify Execute verification workflow for these changes in-progress labels Jun 9, 2025
@github-actions github-actions bot removed the triage Triage is needed label Jun 9, 2025
@github-actions github-actions bot removed the request for review from javsalgar June 9, 2025 07:06
@github-actions github-actions bot requested a review from fmulero June 9, 2025 07:06
Copy link
Collaborator

@fmulero fmulero left a comment

Choose a reason for hiding this comment

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

Great! thanks a lot @sawntoe for your contribution! I appreciate it a lot.

I've just left a comment, Could you give it a glance?

@sawntoe
Copy link
Author

sawntoe commented Jun 9, 2025

Hi @fmulero, so sorry, I am unable to see any comments on the code, may I ask if its still a draft? Thanks so much!

Copy link
Collaborator

@fmulero fmulero left a comment

Choose a reason for hiding this comment

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

Sorry, I didn't add the comment to the review. My failure.

# Returns:
# None
#########################
postgresql_custom_start_scripts() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is almost the same code as in postgresql_custom_init_scripts:

To avoid duplication, could you follow the same approach we've used in mariadb?

########################
# Run custom scripts
# Globals:
# DB_*
# Arguments:
# $1 - 'init' or 'start' ('init' runs on first container start, 'start' runs everytime the container starts)
# Returns:
# None
#########################
mysql_custom_scripts() {

@sawntoe
Copy link
Author

sawntoe commented Jun 11, 2025

Hi, so sorry for the holdup, i've been quite busy. Just a question regarding the handling of scripts:
Should preinit be added to the custom scripts function or should that be a seperate PR?

@fmulero
Copy link
Collaborator

fmulero commented Jun 18, 2025

Hi, so sorry for the holdup, i've been quite busy. Just a question regarding the handling of scripts: Should preinit be added to the custom scripts function or should that be a seperate PR?

Good question. I think that could be done in a different PR, that function only supports sh files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in-progress postgresql-repmgr verify Execute verification workflow for these changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bitnami/postgresql-repmgr] Running custom script on primary database when container starting
3 participants