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

Move some functionality to pre-init hooks #235

Open
ficap opened this issue Feb 13, 2018 · 2 comments
Open

Move some functionality to pre-init hooks #235

ficap opened this issue Feb 13, 2018 · 2 comments
Labels

Comments

@ficap
Copy link
Contributor

ficap commented Feb 13, 2018

It would be great if some functionality at the begining of run-postgresql were moved as new pre-init hooks to lighten run-postgresql script. Something which mariadb has https://github.com/sclorg/mariadb-container/tree/master/root-common/usr/share/container-scripts/mysql/pre-init .

@hhorak
Copy link
Member

hhorak commented May 31, 2019

I've come accross a request for this today. There are basically ordering issues in some cases -- steps migrate_db and create_users are always run after all other scripts that are provided in the postgresql-init entrypoint (https://github.com/sclorg/postgresql-container/blob/generated/10/root/usr/bin/run-postgresql#L47), but there are cases when users would like to run scripts only during initialization, but after create_users and migrate_db is done.

Also, rewriting or removing create_users and migrate_db functionality is not possible currently, if required from some reason. All these issues could be solved if we make create_users and migrate_db to be scripts in postgresql-init entrypoint. By ordering of the files sourced from this directory, users can tell whether they want to run their added script before or after those scripts.

@hhorak hhorak added the easyfix label May 31, 2019
@pkubatrh
Copy link
Member

pkubatrh commented Oct 4, 2019

One other workaround you can use for "post-init like" behaviour is writing a start script, that checks the PG_INITIALIZED variable, which is set to something other than false when the postgresql datadir is first initialized during the run of the container.

I do not think this is documented anywhere as this was not the intended use for it when it was introduced to the start script, but we might change this if it proves useful to have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants