You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
It would be great if some functionality at the begining of
run-postgresql
were moved as new pre-init hooks to lightenrun-postgresql
script. Something which mariadb has https://github.com/sclorg/mariadb-container/tree/master/root-common/usr/share/container-scripts/mysql/pre-init .The text was updated successfully, but these errors were encountered: