Make WordPress Core

Changeset 63920


Ignore:
Timestamp:
09/24/2026 06:12:30 PM (9 days ago)
Author:
lancewillett
Message:

Build/Test Tools: Check database readiness over TCP.

Ping the local Docker database over TCP so its healthcheck waits for the server to accept network connections.

Merges [63871] partially to the 7.1 branch.

Developed in: ​https://github.com/WordPress/wordpress-develop/pull/13686

Reviewed by: jorbin.
Props lucatume.
See #66117.

Location:
branches/7.1
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/7.1

  • branches/7.1/docker-compose.yml

    r63168 r63920  
    8080      - mysql:/var/lib/mysql
    8181
     82    # Ping over TCP: the client resolves the literal `localhost` to the Unix socket, which the
     83    # temporary `--skip-networking` server used to initialise a cold volume answers long before
     84    # the real server listens on port 3306.
    8285    healthcheck:
    8386      test: [
    8487        'CMD-SHELL',
    85         'if [ "$LOCAL_DB_TYPE" = "mariadb" ]; then case "$LOCAL_DB_VERSION" in 5.5|10.0|10.1|10.2|10.3) mysqladmin ping -h localhost || exit $$?;; *) mariadb-admin ping -h localhost || exit $$?;; esac; else mysqladmin ping -h localhost || exit $$?; fi'
     88        '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'
    8689      ]
    8790      timeout: 5s
  • branches/7.1/tools/local-env/scripts/install.js

    r62938 r63920  
    1010dotenvExpand.expand( dotenv.config() );
    1111
    12 // Create wp-config.php. This verifies the database connection, so retrying it doubles as the
    13 // readiness probe: the mysql healthcheck pings the container's own socket, which the temporary
    14 // server used to initialise a cold volume answers before the real server listens on TCP.
     12// Create wp-config.php. This verifies the database connection, so retrying it keeps
     13// `env:install` working on its own, without `env:start` having waited for the mysql
     14// container to report healthy first.
    1515wp_cli_retry(
    1616        `config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --force --config-file="wp-config.php"`,
Note: See TracChangeset for help on using the changeset viewer.