mirror of
git://develop.git.wordpress.org/
synced 2025-01-16 20:38:35 +01:00
ae34e2a510
Because `caching_sha2_password` is not supported on PHP 7.2 & 7.3, the local Docker environment has used the `--default-authentication-plugin` system variable to always make use of `mysql_native_password` despite MySQL 8.0 deprecating this auth plugin. However in MySQL 8.4, the `--default-authentication-plugin` option was removed in favor of `--authentication-policy`, and `mysql_native_password` is now disabled by default. `mysql_native_password` has also been removed in MySQL 9.0. This change adds support to the local Docker environment for MySQL 8.4 by adding some helper functions that determine which authentication plugin should be used based on the configured PHP/MySQL versions and automatically making the necessary configuration adjustments. Reviewed by peterwilsoncc. Merges [59279] to the 6.7 branch. Props ayeshrajans, johnbillion, aristath, jorbin. See #61218. git-svn-id: https://develop.svn.wordpress.org/branches/6.7@59309 602fd350-edb4-49c9-b593-d223f7449a82
144 lines
3.5 KiB
YAML
144 lines
3.5 KiB
YAML
services:
|
|
|
|
##
|
|
# The web server container.
|
|
##
|
|
wordpress-develop:
|
|
image: nginx:alpine
|
|
|
|
networks:
|
|
- wpdevnet
|
|
|
|
ports:
|
|
- ${LOCAL_PORT-8889}:80
|
|
|
|
environment:
|
|
LOCAL_DIR: ${LOCAL_DIR-src}
|
|
|
|
volumes:
|
|
- ./tools/local-env/default.template:/etc/nginx/conf.d/default.template
|
|
- ./:/var/www
|
|
|
|
# Load our config file, substituting environment variables into the config.
|
|
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:
|
|
condition: service_started
|
|
mysql:
|
|
condition: service_healthy
|
|
|
|
##
|
|
# The PHP container.
|
|
##
|
|
php:
|
|
image: wordpressdevelop/php:${LOCAL_PHP-latest}
|
|
|
|
networks:
|
|
- wpdevnet
|
|
|
|
environment:
|
|
- LOCAL_PHP_XDEBUG=${LOCAL_PHP_XDEBUG-false}
|
|
- XDEBUG_MODE=${LOCAL_PHP_XDEBUG_MODE-develop,debug}
|
|
- LOCAL_PHP_MEMCACHED=${LOCAL_PHP_MEMCACHED-false}
|
|
- PHP_FPM_UID=${PHP_FPM_UID-1000}
|
|
- PHP_FPM_GID=${PHP_FPM_GID-1000}
|
|
- GITHUB_REF=${GITHUB_REF-false}
|
|
- GITHUB_EVENT_NAME=${GITHUB_EVENT_NAME-false}
|
|
|
|
volumes:
|
|
- ./tools/local-env/php-config.ini:/usr/local/etc/php/conf.d/php-config.ini
|
|
- ./:/var/www
|
|
|
|
# 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"
|
|
|
|
# The init directive ensures the command runs with a PID > 1, so Ctrl+C works correctly.
|
|
init: true
|
|
|
|
extra_hosts:
|
|
- localhost:host-gateway
|
|
|
|
##
|
|
# The MySQL container.
|
|
##
|
|
mysql:
|
|
image: ${LOCAL_DB_TYPE-mysql}:${LOCAL_DB_VERSION-latest}
|
|
|
|
networks:
|
|
- wpdevnet
|
|
|
|
ports:
|
|
- "3306"
|
|
|
|
environment:
|
|
MYSQL_ROOT_PASSWORD: password
|
|
|
|
volumes:
|
|
- ./tools/local-env/mysql-init.sql:/docker-entrypoint-initdb.d/mysql-init.sql
|
|
- mysql:/var/lib/mysql
|
|
|
|
# For compatibility with PHP versions that don't support the caching_sha2_password auth plugin used in MySQL 8.0.
|
|
command: ${LOCAL_DB_AUTH_OPTION-}
|
|
|
|
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.
|
|
##
|
|
cli:
|
|
image: wordpressdevelop/cli:${LOCAL_PHP-latest}
|
|
|
|
networks:
|
|
- wpdevnet
|
|
|
|
environment:
|
|
- LOCAL_PHP_XDEBUG=${LOCAL_PHP_XDEBUG-false}
|
|
- LOCAL_PHP_MEMCACHED=${LOCAL_PHP_MEMCACHED-false}
|
|
- PHP_FPM_UID=${PHP_FPM_UID-1000}
|
|
- PHP_FPM_GID=${PHP_FPM_GID-1000}
|
|
|
|
volumes:
|
|
- ./:/var/www
|
|
|
|
# The init directive ensures the command runs with a PID > 1, so Ctrl+C works correctly.
|
|
init: true
|
|
|
|
extra_hosts:
|
|
- localhost:host-gateway
|
|
|
|
depends_on:
|
|
php:
|
|
condition: service_started
|
|
mysql:
|
|
condition: service_healthy
|
|
|
|
##
|
|
# The Memcached container.
|
|
##
|
|
memcached:
|
|
image: memcached
|
|
|
|
networks:
|
|
- wpdevnet
|
|
|
|
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: {}
|
|
|
|
networks:
|
|
# Creating our own network allows us to connect between containers using their service name.
|
|
wpdevnet:
|
|
driver: bridge
|