mirror of
git://develop.git.wordpress.org/
synced 2025-04-27 07:32:32 +02:00
Build/Test Tools: Ensure database containers are prepared for commands.
By default, Docker waits for a container to be started before considering it “ready”. But this does not necessarily mean that it’s ready to receive commands. This adds a check that ensures the database container is ready to receive commands before proceeding with running commands. Follow up to [56439], [56440], [56443]. Props rmccue, desrosj. See #30462, #58867. git-svn-id: https://develop.svn.wordpress.org/trunk@56464 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
218fbd91ab
commit
a8a0bf0cc8
@ -25,7 +25,10 @@ services:
|
||||
command: /bin/sh -c "envsubst '$$LOCAL_DIR' < /etc/nginx/conf.d/default.template > /etc/nginx/conf.d/default.conf && exec nginx -g 'daemon off;'"
|
||||
|
||||
depends_on:
|
||||
- php
|
||||
php:
|
||||
condition: service_started
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
|
||||
##
|
||||
# The PHP container.
|
||||
@ -52,9 +55,6 @@ services:
|
||||
# Copy or delete the Memcached dropin plugin file as appropriate.
|
||||
command: /bin/sh -c "if [ $LOCAL_PHP_MEMCACHED = true ]; then cp -n /var/www/tests/phpunit/includes/object-cache.php /var/www/src/wp-content/object-cache.php; else rm -f /var/www/src/wp-content/object-cache.php; fi && exec php-fpm"
|
||||
|
||||
depends_on:
|
||||
- mysql
|
||||
|
||||
# The init directive ensures the command runs with a PID > 1, so Ctrl+C works correctly.
|
||||
init: true
|
||||
|
||||
@ -83,6 +83,12 @@ services:
|
||||
# For compatibility with PHP versions that don't support the caching_sha2_password auth plugin used in MySQL 8.0.
|
||||
command: --default-authentication-plugin=mysql_native_password
|
||||
|
||||
healthcheck:
|
||||
test: [ "CMD-SHELL", "if [ \"$LOCAL_DB_TYPE\" = \"mariadb\" ]; then mariadb-admin ping -h localhost; else mysqladmin ping -h localhost; fi" ]
|
||||
timeout: 5s
|
||||
interval: 5s
|
||||
retries: 10
|
||||
|
||||
##
|
||||
# The WP CLI container.
|
||||
##
|
||||
@ -107,6 +113,12 @@ services:
|
||||
extra_hosts:
|
||||
- localhost:host-gateway
|
||||
|
||||
depends_on:
|
||||
php:
|
||||
condition: service_started
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
|
||||
##
|
||||
# The Memcached container.
|
||||
##
|
||||
@ -119,6 +131,10 @@ services:
|
||||
ports:
|
||||
- 11211:11211
|
||||
|
||||
depends_on:
|
||||
php:
|
||||
condition: service_started
|
||||
|
||||
volumes:
|
||||
# So that sites aren't wiped every time containers are restarted, MySQL uses a persistent volume.
|
||||
mysql: {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user