-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add possibility to customize the postgres server even if a database already exists #929
Comments
Conceptually, this is very similar to #173, #821, #191 (to link a few). I think #821 (comment) is really relevant:
For things like this where you just want to run a script before starting the process, I'd suggest you just add a new entrypoint script which does what you're looking for, then chain-loads to the real one via |
Ah! Yes, that's an alternative approach. Thanks! :-) Since there are quite a few requests for this feature, more people than me didn't think of your suggestion. Like, after the sentence "Warning: scripts in /docker-entrypoint-initdb.d are only run if you start the container with a data directory that is empty" you can add: "(see section below for advanced customization)" and then add a section that show two examples on how to override the original entrypoint on the commandline (docker run) and via docker compose. Here's an example you can copy as a base: Custom override of entrypoint using docker compose:
Make it executable: Bind-mount the file into the container and override the entrypoint:
Run Custom override of entrypoint using docker run: |
Unfortunately, this is currently implemented as much as we plan to do so (with modular |
@tianon , hi, could you explain why it is so?
|
We can't run SQL commands against PostgreSQL (generally) unless it is running and we have an appropriate method of access, and we can't start up PostgreSQL as the container's "PID 1" and still run more code reliably (nor can we start it and then "graduate" that instance to be PID 1), so it would have to be the same as it is during our existing initdb logic: start in local-listening-only mode, connect and do the thing, then shut down, then start up the "real" server. |
Thanks, now it's clear. So to make it possible, server itself should support this. |
I'm running a postgres (debian) container.
A database has been created.
Later I see performance issues due to the JIT compiler (it takes way more time to plan/evaluate than just executing the quick query).
So I want to add
jit = off
to my postgresql.confI created the file /docker-entrypoint-initdb.d/10-postgresql.conf_disable_jit.sh inside the container :
Unfortunately, this script is not executed.. :-/
If a database already exists, all custom initialization scripts are skipped!
Request:
Add a second custom container initialization directory, and always execute the scripts therein.
Like:
/docker-custom-entrypoint.d/
This way we can customize the container, the postgres server itself, etc via this directory, and customize databases using the /docker-entrypoint-initdb.d/ dir.
Then I would have been able to place my script in /docker-custom-entrypoint.d/10-postgresql.conf_disable_jit.sh instead.
The text was updated successfully, but these errors were encountered: