Skip to content

Commit c869ba6

Browse files
committed
Build/Test Tools: Check database readiness over TCP.
Merges r59484, r59489, and r63871 to the 4.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: #13731 Props lucatume, adrianmoldovanwp, johnbillion, afercia, jorbin, desrosj. See #66117. git-svn-id: https://develop.svn.wordpress.org/branches/4.9@65462 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 35a5a62 commit c869ba6

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
@@ -73,8 +73,14 @@ services:
7373
# For compatibility with PHP versions that don't support the caching_sha2_password auth plugin used in MySQL 8.0.
7474
command: --default-authentication-plugin=mysql_native_password
7575

76+
# Ping over TCP: the client resolves the literal `localhost` to the Unix socket, which the
77+
# temporary `--skip-networking` server used to initialise a cold volume answers long before
78+
# the real server listens on port 3306.
7679
healthcheck:
77-
test: [ "CMD-SHELL", "if [ \"$LOCAL_DB_TYPE\" = \"mariadb\" ]; then mariadb-admin ping -h localhost; else mysqladmin ping -h localhost; fi" ]
80+
test: [
81+
'CMD-SHELL',
82+
'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'
83+
]
7884
timeout: 5s
7985
interval: 5s
8086
retries: 10

0 commit comments

Comments
 (0)