From 3109b32fc98619305d36cfc6ec078e189678005b Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 18 Dec 2020 15:27:33 +0000 Subject: [PATCH] Build/Test Tools: Support the use of MariaDB in the local Docker environment. In addition to MySQL, WordPress also supports MariaDB for databases. This makes changes to the local Docker environment to allow MariaDB to be used instead, if desired. The `LOCAL_DB_TYPE` environment variable will now be used to determine which type of database container to use. This will default to `mysql`, but will also accept `mariadb`. The `LOCAL_MYSQL` environment variable (which previously held the version of MySQL to use) has been replaced with the new, more generic `LOCAL_DB_VERSION` environment variable. This change will make it possible to perform automated testing on a wider array of supported database types and versions. Props davidbaumwald. Fixes #51744. See #30462. git-svn-id: https://develop.svn.wordpress.org/trunk@49836 602fd350-edb4-49c9-b593-d223f7449a82 --- .env | 14 ++++++++++++-- docker-compose.yml | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.env b/.env index 955eecd127..ace9464317 100644 --- a/.env +++ b/.env @@ -45,8 +45,18 @@ LOCAL_PHP_XDEBUG=false # Whether or not to enable Memcached. LOCAL_PHP_MEMCACHED=false -# The MySQL version to use. See https://hub.docker.com/_/mysql/ for valid versions. -LOCAL_MYSQL=5.7 +# The database software to use. +# +# Supported values are `mysql` and `mariadb`. +LOCAL_DB_TYPE=mysql + +# The database version to use. +# +# Defaults to 5.7 with the assumption that LOCAL_DB_TYPE is set to `mysql` above. +# +# When using `mysql`, see https://hub.docker.com/_/mysql/ for valid versions. +# When using `mariadb`, see https://hub.docker.com/_/mariadb for valid versions. +LOCAL_DB_VERSION=5.7 # The debug settings to add to `wp-config.php`. LOCAL_WP_DEBUG=true diff --git a/docker-compose.yml b/docker-compose.yml index 56c994337f..9f598714d8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -53,7 +53,7 @@ services: # The MySQL container. ## mysql: - image: mysql:${LOCAL_MYSQL-latest} + image: ${LOCAL_DB_TYPE-mysql}:${LOCAL_DB_VERSION-latest} networks: - wpdevnet