-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Improving SQL container Health Checks for Env #70973
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
base: trunk
Are you sure you want to change the base?
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed this before creating my PR, but I've created #70987 as an alternative approach.
The healthcheck.sh
script may not exist reliably within the containers for older versions of MariaDB. It seems like this was added in 10.4.30 and newer. Technically we still support back through 5.5.
We could adjust the conditional in #70987 to use healthcheck.sh
as the fallback instead of mariadb-admin ping -h localhost
, but solely relying on it will likely result in failures when using old versions.
Closing this in favour to #70987 |
Since the version of |
'--connect', | ||
'--innodb_initialized', | ||
], | ||
timeout: '20s', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be a bit lower. If retries
is set to 10
, how about 5s
or 10s
?
@@ -186,6 +186,16 @@ module.exports = function buildDockerComposeConfig( config ) { | |||
mysql: { | |||
image: 'mariadb:lts', | |||
ports: [ developmentMysqlPorts ], | |||
healthcheck: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the healthcheck
is the same for both mysql
and test-mysql
, would it make sense to define a const
above that's used in both places so that there's no duplication?
What?
It appears that there have been several errors when running Docker containers for CI, as reported here like
https://github.com/WordPress/gutenberg/actions/runs/16615410203/job/47007147722?pr=70970
As @talldan has commented, maybe better logging could be implemented to see where is the issue.
Why?
One of the issues I've personally encountered with docker configurations with the WP images is the fact that mariadb takes a variable amount of time to load, and it can load a little later than the PHP server under certain conditions.
How?
To ensure that the DB is loading 100% before the PHP container, a healthcheck could do the trick
I'm taking Official docs for implementing a valid healtcheck for the maridb docker images:
https://mariadb.com/docs/server/server-management/install-and-upgrade-mariadb/installing-mariadb/binary-packages/automated-mariadb-deployment-and-administration/docker-and-mariadb/using-healthcheck-sh
Testing Instructions
npx wp-env start
I want to see how well this patch goes with current GHA.