-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Use dedicated port for temporary server #920
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
Conversation
This allows `pg_isready` healtheck to wait until database is initialized
This is definitely a breaking change -- we use the default port number specifically so that any tools/scripts users might already have for initializing their databases work as-is without any major changes, and just ensure that the server doesn't listen externally (meaning TCP) until after initialization is successful. Using |
@tianon the problem is that at the time server starts, the initialization is not complete - there is no database, and no SQL schema, so the healthcheck will succeed, but application accessing the server will fail. |
Neither How about switching the logic? Allow to set |
Sorry for the delay, but @tianon's comment already gives a way for a healthcheck to reliably know if the postgres server is finished initializing: The temporary server for initialization is explicitly started without any network listening for exactly this purpose: Lines 257 to 270 in cdd56d3
|
@tianon it appears what we are talking different things when speaking about "finished initializing". For me DB finished initializing when all initialization scripts had passed and dumps had restored. Given that Docker starts entrypoint + cmd process in 1 minute and initialization script takes 5 minutes, when the healtheck passes according to your advice? |
If you use |
@yosifkit and what if |
Ok. I don't remember the original problem. Probably the problem was that after initialization DB needed to be locked to run data migrations, and only after that made available for requests. The dedicated port could probably solve it, but then I am not sure how the main port should be enabled, as DB server doesn't know when migrations are finished. |
This allows
pg_isready
healtheck to wait until database is initialized#880 (comment)