-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Wait for linked MySQL server to accept TCP connection before database operation.... #19
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
…on. Solves issues with fig due to slow MySQL startup.
Related to #17 |
This could be a useful feature, but I would want a timeout so that the container will stop if there is no db coming (maybe it died). This could possibly be configurable (MYSQL_WAIT_TIMEOUT or something). Either way, this will definitely need to be documented. |
I'm not sure on this one. This is a fairly general problem that every single application is going to have, and has had since the introduction of networking (Docker just makes it a lot more obvious since it's now trivial to start both of these services at exactly the same moment). At the very least, this feels like something we ought to have some kind of general solution for, possibly in Docker itself. Anything else feels a little bit hacky, IMO. |
Currently the only other solution is to add |
@tianon You're right about having a general solution for this problem as it's fairly common, would be very helpful if docker itself had some option for this. But unfortunately there isn't anything available right now in docker as @yosifkit mentioned and since WP container is useless without MySQL container attached to it, shouldn't ensure MySQL is indeed available before doing anything?Also since we are already ensuring we have MySQL container is attached in our entrypoint script, shouldn't we also ensure that service is actually running before attempting to perform database operation? |
But in my opinion you should switch from |
@jerolimov |
@tianon Oh that is funny. Thanks for the link, really interesting. But keep in mind that a startup process should timeout, or? But in most cases I expect now this would work. |
Here's another workaround with a |
Are there plans to merge this? |
While I am not opposed to the idea of Wordpress automatically waiting for mysql to come up, I definitely want it to fail at some timeout instead of trying forever. |
... Solves issues with fig due to slow MySQL startup. Retries every 5 seconds until MySQL server exposes its TCP port.