Skip to content

Commit efccbbb

Browse files
committed
Build/Test Tools: Check database readiness over TCP.
Merges r59484, r59489, and r63871 to the 5.9 branch. Apply the database healthcheck changes from these revisions, retaining the client selection for older MariaDB versions. Leave their workflow and installation-script changes out of this branch. Developed in: #13741 Props lucatume, adrianmoldovanwp, johnbillion, afercia, jorbin, desrosj. See #66117. git-svn-id: https://develop.svn.wordpress.org/branches/5.9@65451 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 18be40b commit efccbbb

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎docker-compose.yml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,14 @@ services:
8282
# For compatibility with PHP versions that don't support the caching_sha2_password auth plugin used in MySQL 8.0.
8383
command: --default-authentication-plugin=mysql_native_password
8484

85+
# Ping over TCP: the client resolves the literal `localhost` to the Unix socket, which the
86+
# temporary `--skip-networking` server used to initialise a cold volume answers long before
87+
# the real server listens on port 3306.
8588
healthcheck:
86-
test: [ "CMD-SHELL", "if [ \"$LOCAL_DB_TYPE\" = \"mariadb\" ]; then mariadb-admin ping -h localhost; else mysqladmin ping -h localhost; fi" ]
89+
test: [
90+
'CMD-SHELL',
91+
'if [ "$LOCAL_DB_TYPE" = "mariadb" ]; then case "$LOCAL_DB_VERSION" in 5.5|10.0|10.1|10.2|10.3) mysqladmin ping -h 127.0.0.1 --protocol=tcp || exit $$?;; *) mariadb-admin ping -h 127.0.0.1 --protocol=tcp || exit $$?;; esac; else mysqladmin ping -h 127.0.0.1 --protocol=tcp || exit $$?; fi'
92+
]
8793
timeout: 5s
8894
interval: 5s
8995
retries: 10

0 commit comments

Comments
 (0)