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

Use wait-for-it in favor of the custom python script when waiting for postgres #5327

Merged
merged 1 commit into from
Oct 5, 2024

Conversation

foarsitter
Copy link
Collaborator

Proposing the usage of wait-for-it in favor of our own python script as raised in #4539

wait-for-it can also be used in the healthcheck command but that is out of scope for now.

@luzfcb
Copy link
Collaborator

luzfcb commented Aug 27, 2024

Does wait-for-it ensure that host + port is reachable and the host + port + user + password + database set is 100% functional and can execute queries?

As far as I know, it is one thing is the PostgreSQL process to be active on a certain port, and another thing is PostgreSQL to be active and able to answer queries for a specific set of user + password + database.

Specifically for health checks, there is a case where the PostgreSQL process is active on a port, but is not yet ready to receive queries. This may take a few milliseconds or seconds. That said, I don't remember where I read this. Maybe I'm wrong.

@foarsitter
Copy link
Collaborator Author

@luzfcb interesting remark! wait-for-it checks if a port accepts TCP traffic, nothing more.

For postgres healthchecks I would relay on pg_isready but the django container doesn't have postgresql-client installed so that isn't possible.

I'm testing wait-for-it localhost:5000 as a healthcheck for the django container at the moment.

Considering that the boot time of django will take a few seconds I don't think we will get in trouble here testing without credentials for postgres.

@foarsitter foarsitter linked an issue Oct 5, 2024 that may be closed by this pull request
@foarsitter foarsitter merged commit 6c64a81 into cookiecutter:master Oct 5, 2024
13 checks passed
@foarsitter foarsitter deleted the wait_for_it branch October 21, 2024 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Why prefer python than bash for wait the service start
2 participants