diff --git a/.ahoy.yml b/.ahoy.yml index 05486d16e..20055a4e2 100644 --- a/.ahoy.yml +++ b/.ahoy.yml @@ -35,7 +35,7 @@ commands: usage: Show information about this project. cmd: | COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME:-${PWD##*/}} \ - VORTEX_HOST_DB_PORT=$(docker compose port mariadb 3306 2>/dev/null | cut -d : -f 2) \ + VORTEX_HOST_DB_PORT=$(docker compose port database 3306 2>/dev/null | cut -d : -f 2) \ VORTEX_HOST_SOLR_PORT=$(docker compose port solr 8983 2>/dev/null | cut -d : -f 2) \ VORTEX_HOST_SELENIUM_VNC_PORT=$(docker compose port chrome 7900 2>/dev/null | cut -d : -f 2) \ VORTEX_HOST_HAS_SEQUELACE=$(uname -a | grep -i -q darwin && mdfind -name 'Sequel Ace' 2>/dev/null | grep -q "Ace" && echo 1 || true) \ @@ -45,8 +45,8 @@ commands: usage: Open DB in Sequel Ace. cmd: | uname -a | grep -i -q darwin && mdfind -name 'Sequel Ace' 2>/dev/null |grep -q "Ace" \ - && VORTEX_HOST_DB_PORT="$(docker port $(docker compose ps -q mariadb 2>/dev/null) 3306 2>/dev/null | cut -d : -f 2)" \ - && open "mysql://${MARIADB_USERNAME:-drupal}:${MARIADB_PASSWORD:-drupal}@127.0.0.1:${VORTEX_HOST_DB_PORT}/drupal" -a "Sequel Ace" \ + && VORTEX_HOST_DB_PORT="$(docker port $(docker compose ps -q database 2>/dev/null) 3306 2>/dev/null | cut -d : -f 2)" \ + && open "mysql://${DATABASE_USERNAME:-drupal}:${DATABASE_PASSWORD:-drupal}@127.0.0.1:${VORTEX_HOST_DB_PORT}/drupal" -a "Sequel Ace" \ || echo "Not a supported OS or Sequel Ace is not installed." # ---------------------------------------------------------------------------- @@ -135,8 +135,8 @@ commands: usage: Reload the database container using local database image. cmd: | ahoy confirm "Running this command will replace your current database. Are you sure?" && - docker compose rm --force --stop --volumes mariadb && \ - ahoy up -- --build mariadb && \ + docker compose rm --force --stop --volumes database && \ + ahoy up -- --build database && \ ahoy up wait_dependencies && \ sleep 15 && \ ahoy provision && \ diff --git a/.docker/cli.dockerfile b/.docker/cli.dockerfile index d89b5a901..59f8af3a2 100644 --- a/.docker/cli.dockerfile +++ b/.docker/cli.dockerfile @@ -39,7 +39,7 @@ ENV DRUPAL_CONFIG_PATH=${DRUPAL_CONFIG_PATH} ENV WEBROOT=${WEBROOT} \ COMPOSER_ALLOW_SUPERUSER=1 \ COMPOSER_CACHE_DIR=/tmp/.composer/cache \ - SIMPLETEST_DB=mysql://drupal:drupal@mariadb/drupal \ + SIMPLETEST_DB=mysql://drupal:drupal@database/drupal \ SIMPLETEST_BASE_URL=http://nginx:8080 \ SYMFONY_DEPRECATIONS_HELPER=disabled diff --git a/.docker/mariadb.dockerfile b/.docker/database.dockerfile similarity index 96% rename from .docker/mariadb.dockerfile rename to .docker/database.dockerfile index 5fd59ff90..18588987c 100644 --- a/.docker/mariadb.dockerfile +++ b/.docker/database.dockerfile @@ -1,4 +1,4 @@ -# MariaDB container. +# Database container. # # @see https://hub.docker.com/r/uselagoon/mariadb-10.11-drupal/tags # @see https://github.com/uselagoon/lagoon-images/tree/main/images/mariadb-drupal diff --git a/.vortex/docs/content/tools/docker.mdx b/.vortex/docs/content/tools/docker.mdx index 5f2012015..70df9bcc5 100644 --- a/.vortex/docs/content/tools/docker.mdx +++ b/.vortex/docs/content/tools/docker.mdx @@ -208,9 +208,9 @@ Vortex: different from the `cli` container in that it does not have certain development dependencies installed, has a smaller size and is optimised for scalability. -- `mariadb` - a container that runs a database server. This container is used to +- `database` - a container that runs a database server. This container is used to store the application data. It can be accessed from the host via a randomly - assigned port - run `docker compose port mariadb 3306` to get the port number. + assigned port - run `docker compose port database 3306` to get the port number. - `redis` - an optional container that runs a Redis server. This container is used to store the application cache. - `solr` - an optional container that runs a Solr server. This container is used diff --git a/.vortex/docs/content/workflows/variables.mdx b/.vortex/docs/content/workflows/variables.mdx index 20dcaf305..2fafb82c7 100644 --- a/.vortex/docs/content/workflows/variables.mdx +++ b/.vortex/docs/content/workflows/variables.mdx @@ -644,7 +644,7 @@ Defined in: `scripts/vortex/export-db-image.sh` The service name to capture. -Default value: `mariadb` +Default value: `database` Defined in: `scripts/vortex/export-db-image.sh` diff --git a/.vortex/tests/bats/_helper.bash b/.vortex/tests/bats/_helper.bash index d839d8b47..4e7b42171 100644 --- a/.vortex/tests/bats/_helper.bash +++ b/.vortex/tests/bats/_helper.bash @@ -310,7 +310,7 @@ assert_files_present_vortex() { pushd "${dir}" >/dev/null || exit 1 assert_file_exists ".docker/cli.dockerfile" - assert_file_exists ".docker/mariadb.dockerfile" + assert_file_exists ".docker/database.dockerfile" assert_file_exists ".docker/nginx-drupal.dockerfile" assert_file_exists ".docker/php.dockerfile" assert_file_exists ".docker/solr.dockerfile" diff --git a/.vortex/tests/bats/_helper.workflow.bash b/.vortex/tests/bats/_helper.workflow.bash index 52e77037f..331c1d382 100644 --- a/.vortex/tests/bats/_helper.workflow.bash +++ b/.vortex/tests/bats/_helper.workflow.bash @@ -240,7 +240,7 @@ assert_timezone() { assert_output_contains "AE" run docker compose exec nginx date assert_output_contains "AE" - run docker compose exec mariadb date + run docker compose exec database date assert_output_contains "AE" # Add variable to the .env file and apply the change to container. @@ -254,7 +254,7 @@ assert_timezone() { assert_output_contains "AWST" run docker compose exec nginx date assert_output_contains "AWST" - run docker compose exec mariadb date + run docker compose exec database date assert_output_contains "AWST" # Restore file, apply changes and assert that original behaviour has been restored. @@ -293,7 +293,7 @@ assert_ahoy_info() { assert_output_contains "Docker Compose project name : star_wars" assert_output_contains "Site local URL : http://star_wars.docker.amazee.io" assert_output_contains "Path to web root : /app/${webroot}" - assert_output_contains "DB host : mariadb" + assert_output_contains "DB host : database" assert_output_contains "DB username : drupal" assert_output_contains "DB password : drupal" assert_output_contains "DB port : 3306" diff --git a/.vortex/tests/bats/fixtures/docker-compose.env.json b/.vortex/tests/bats/fixtures/docker-compose.env.json index 5c1c6d68d..892915571 100644 --- a/.vortex/tests/bats/fixtures/docker-compose.env.json +++ b/.vortex/tests/bats/fixtures/docker-compose.env.json @@ -18,6 +18,11 @@ "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -26,11 +31,6 @@ "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "star_wars.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "star_wars.docker.amazee.io", "XDEBUG_ENABLE": "" @@ -74,6 +74,11 @@ "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -82,11 +87,6 @@ "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "star_wars.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "star_wars.docker.amazee.io", "XDEBUG_ENABLE": "" @@ -121,6 +121,11 @@ "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -129,11 +134,6 @@ "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "star_wars.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "star_wars.docker.amazee.io", "XDEBUG_ENABLE": "" @@ -163,18 +163,23 @@ } ] }, - "mariadb": { + "database": { "build": { "args": { "IMAGE": "uselagoon/mariadb-10.11-drupal:VERSION" }, "context": "FIXTURE_CUR_DIR", - "dockerfile": ".docker/mariadb.dockerfile" + "dockerfile": ".docker/database.dockerfile" }, "command": null, "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -183,11 +188,6 @@ "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "star_wars.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "star_wars.docker.amazee.io", "XDEBUG_ENABLE": "" @@ -230,6 +230,11 @@ "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -238,11 +243,6 @@ "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "star_wars.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "star_wars.docker.amazee.io", "XDEBUG_ENABLE": "" @@ -290,6 +290,11 @@ "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -298,11 +303,6 @@ "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "star_wars.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "star_wars.docker.amazee.io", "XDEBUG_ENABLE": "" @@ -361,6 +361,11 @@ "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -369,11 +374,6 @@ "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "star_wars.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "star_wars.docker.amazee.io", "XDEBUG_ENABLE": "" @@ -402,7 +402,7 @@ }, "wait_dependencies": { "command": [ - "mariadb:3306", + "database:3306", "clamav:3310" ], "depends_on": { @@ -414,7 +414,7 @@ "condition": "service_started", "required": true }, - "mariadb": { + "database": { "condition": "service_started", "required": true } diff --git a/.vortex/tests/bats/fixtures/docker-compose.env_local.json b/.vortex/tests/bats/fixtures/docker-compose.env_local.json index 5c1c6d68d..892915571 100644 --- a/.vortex/tests/bats/fixtures/docker-compose.env_local.json +++ b/.vortex/tests/bats/fixtures/docker-compose.env_local.json @@ -18,6 +18,11 @@ "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -26,11 +31,6 @@ "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "star_wars.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "star_wars.docker.amazee.io", "XDEBUG_ENABLE": "" @@ -74,6 +74,11 @@ "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -82,11 +87,6 @@ "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "star_wars.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "star_wars.docker.amazee.io", "XDEBUG_ENABLE": "" @@ -121,6 +121,11 @@ "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -129,11 +134,6 @@ "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "star_wars.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "star_wars.docker.amazee.io", "XDEBUG_ENABLE": "" @@ -163,18 +163,23 @@ } ] }, - "mariadb": { + "database": { "build": { "args": { "IMAGE": "uselagoon/mariadb-10.11-drupal:VERSION" }, "context": "FIXTURE_CUR_DIR", - "dockerfile": ".docker/mariadb.dockerfile" + "dockerfile": ".docker/database.dockerfile" }, "command": null, "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -183,11 +188,6 @@ "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "star_wars.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "star_wars.docker.amazee.io", "XDEBUG_ENABLE": "" @@ -230,6 +230,11 @@ "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -238,11 +243,6 @@ "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "star_wars.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "star_wars.docker.amazee.io", "XDEBUG_ENABLE": "" @@ -290,6 +290,11 @@ "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -298,11 +303,6 @@ "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "star_wars.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "star_wars.docker.amazee.io", "XDEBUG_ENABLE": "" @@ -361,6 +361,11 @@ "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -369,11 +374,6 @@ "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "star_wars.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "star_wars.docker.amazee.io", "XDEBUG_ENABLE": "" @@ -402,7 +402,7 @@ }, "wait_dependencies": { "command": [ - "mariadb:3306", + "database:3306", "clamav:3310" ], "depends_on": { @@ -414,7 +414,7 @@ "condition": "service_started", "required": true }, - "mariadb": { + "database": { "condition": "service_started", "required": true } diff --git a/.vortex/tests/bats/fixtures/docker-compose.env_mod.json b/.vortex/tests/bats/fixtures/docker-compose.env_mod.json index 2faa6e947..e0a019da5 100644 --- a/.vortex/tests/bats/fixtures/docker-compose.env_mod.json +++ b/.vortex/tests/bats/fixtures/docker-compose.env_mod.json @@ -18,6 +18,11 @@ "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -26,11 +31,6 @@ "DRUPAL_SHIELD_USER": "jane", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "the_matrix.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "the_matrix.docker.amazee.io", "XDEBUG_ENABLE": "1" @@ -74,6 +74,11 @@ "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -82,11 +87,6 @@ "DRUPAL_SHIELD_USER": "jane", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "the_matrix.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "the_matrix.docker.amazee.io", "XDEBUG_ENABLE": "1" @@ -121,6 +121,11 @@ "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -129,11 +134,6 @@ "DRUPAL_SHIELD_USER": "jane", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "the_matrix.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "the_matrix.docker.amazee.io", "XDEBUG_ENABLE": "1" @@ -163,18 +163,23 @@ } ] }, - "mariadb": { + "database": { "build": { "args": { "IMAGE": "myorg/my_db_image" }, "context": "FIXTURE_CUR_DIR", - "dockerfile": ".docker/mariadb.dockerfile" + "dockerfile": ".docker/database.dockerfile" }, "command": null, "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -183,11 +188,6 @@ "DRUPAL_SHIELD_USER": "jane", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "the_matrix.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "the_matrix.docker.amazee.io", "XDEBUG_ENABLE": "1" @@ -230,6 +230,11 @@ "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -238,11 +243,6 @@ "DRUPAL_SHIELD_USER": "jane", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "the_matrix.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "the_matrix.docker.amazee.io", "XDEBUG_ENABLE": "1" @@ -290,6 +290,11 @@ "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -298,11 +303,6 @@ "DRUPAL_SHIELD_USER": "jane", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "the_matrix.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "the_matrix.docker.amazee.io", "XDEBUG_ENABLE": "1" @@ -361,6 +361,11 @@ "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -369,11 +374,6 @@ "DRUPAL_SHIELD_USER": "jane", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "the_matrix.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "the_matrix.docker.amazee.io", "XDEBUG_ENABLE": "1" @@ -402,7 +402,7 @@ }, "wait_dependencies": { "command": [ - "mariadb:3306", + "database:3306", "clamav:3310" ], "depends_on": { @@ -414,7 +414,7 @@ "condition": "service_started", "required": true }, - "mariadb": { + "database": { "condition": "service_started", "required": true } diff --git a/.vortex/tests/bats/fixtures/docker-compose.noenv.json b/.vortex/tests/bats/fixtures/docker-compose.noenv.json index b420522b2..e9f8fa7c4 100644 --- a/.vortex/tests/bats/fixtures/docker-compose.noenv.json +++ b/.vortex/tests/bats/fixtures/docker-compose.noenv.json @@ -18,6 +18,11 @@ "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -26,11 +31,6 @@ "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "star_wars.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "star_wars.docker.amazee.io", "XDEBUG_ENABLE": "" @@ -74,6 +74,11 @@ "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -82,11 +87,6 @@ "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "star_wars.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "star_wars.docker.amazee.io", "XDEBUG_ENABLE": "" @@ -121,6 +121,11 @@ "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -129,11 +134,6 @@ "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "star_wars.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "star_wars.docker.amazee.io", "XDEBUG_ENABLE": "" @@ -163,18 +163,23 @@ } ] }, - "mariadb": { + "database": { "build": { "args": { "IMAGE": "uselagoon/mariadb-10.11-drupal:VERSION" }, "context": "FIXTURE_CUR_DIR", - "dockerfile": ".docker/mariadb.dockerfile" + "dockerfile": ".docker/database.dockerfile" }, "command": null, "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -183,11 +188,6 @@ "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "star_wars.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "star_wars.docker.amazee.io", "XDEBUG_ENABLE": "" @@ -230,6 +230,11 @@ "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -238,11 +243,6 @@ "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "star_wars.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "star_wars.docker.amazee.io", "XDEBUG_ENABLE": "" @@ -290,6 +290,11 @@ "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -298,11 +303,6 @@ "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "star_wars.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "star_wars.docker.amazee.io", "XDEBUG_ENABLE": "" @@ -361,6 +361,11 @@ "entrypoint": null, "environment": { "CI": "true", + "DATABASE_HOST": "database", + "DATABASE_NAME": "drupal", + "DATABASE_PASSWORD": "drupal", + "DATABASE_PORT": "3306", + "DATABASE_USERNAME": "drupal", "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", @@ -369,11 +374,6 @@ "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", "LAGOON_ROUTE": "star_wars.docker.amazee.io", - "MARIADB_DATABASE": "drupal", - "MARIADB_HOST": "mariadb", - "MARIADB_PASSWORD": "drupal", - "MARIADB_PORT": "3306", - "MARIADB_USERNAME": "drupal", "TZ": "Australia/Melbourne", "VORTEX_LOCALDEV_URL": "star_wars.docker.amazee.io", "XDEBUG_ENABLE": "" @@ -402,7 +402,7 @@ }, "wait_dependencies": { "command": [ - "mariadb:3306", + "database:3306", "clamav:3310" ], "depends_on": { @@ -414,7 +414,7 @@ "condition": "service_started", "required": true }, - "mariadb": { + "database": { "condition": "service_started", "required": true } diff --git a/.vortex/tests/bats/workflow.storage.image_cached.bats b/.vortex/tests/bats/workflow.storage.image_cached.bats index 9e82f0ff9..3e846aa12 100644 --- a/.vortex/tests/bats/workflow.storage.image_cached.bats +++ b/.vortex/tests/bats/workflow.storage.image_cached.bats @@ -81,7 +81,7 @@ load _helper.workflow.bash substep "Exporting DB image to a file" run ahoy export-db "db.tar" assert_success - assert_output_contains "Found mariadb service container with id" + assert_output_contains "Found database service container with id" assert_output_contains "Committing exported container image with name docker.io/${VORTEX_DB_IMAGE}" assert_output_contains "Committed exported container image with id" assert_output_contains "Exporting database image archive to file ./.data/db.tar." diff --git a/docker-compose.yml b/docker-compose.yml index 0e4a5372b..1c040001d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -47,15 +47,15 @@ x-environment: &default-environment # Local development route used in Lagoon images and Pygmy to route requests. LAGOON_ROUTE: *default-url # Local database host (not used in production). - MARIADB_HOST: mariadb + DATABASE_HOST: database # Local database name (not used in production). - MARIADB_DATABASE: drupal + DATABASE_NAME: drupal # Local database user (not used in production). - MARIADB_USERNAME: drupal + DATABASE_USERNAME: drupal # Local database password (not used in production). - MARIADB_PASSWORD: drupal + DATABASE_PASSWORD: drupal # Local database port (not used in production). - MARIADB_PORT: 3306 + DATABASE_PORT: 3306 # Pass-through 'XDEBUG_ENABLE' to enable XDebug with "ahoy debug" or "XDEBUG_ENABLE=true docker compose up -d". XDEBUG_ENABLE: ${XDEBUG_ENABLE:-} # Pass-through 'CI' variable used to identify the CI environment. @@ -150,17 +150,17 @@ services: lagoon.persistent.class: slow #;> LAGOON - mariadb: + database: build: context: . - dockerfile: .docker/mariadb.dockerfile + dockerfile: .docker/database.dockerfile args: IMAGE: "${VORTEX_DB_IMAGE:-uselagoon/mariadb-10.11-drupal:24.11.0}" # Use custom database image (if defined) or fallback to standard database image. <<: *default-user environment: <<: *default-environment ports: - - "3306" # MariaDB port in container. Find port on host with `ahoy info` or `docker compose port mariadb 3306`. + - "3306" # MariaDB port in container. Find port on host with `ahoy info` or `docker compose port database 3306`. #;< LAGOON labels: lagoon.type: mariadb # See https://docs.lagoon.sh/using-lagoon-advanced/service-types/ @@ -237,9 +237,9 @@ services: image: drevops/docker-wait-for-dependencies:24.12.0 depends_on: - cli - - mariadb + - database - clamav - command: mariadb:3306 clamav:3310 + command: database:3306 clamav:3310 #;< LAGOON labels: lagoon.type: none # Do not deploy in Lagoon. diff --git a/scripts/vortex/doctor.sh b/scripts/vortex/doctor.sh index 22f89790a..af16dc7b9 100755 --- a/scripts/vortex/doctor.sh +++ b/scripts/vortex/doctor.sh @@ -121,7 +121,7 @@ main() { # Check that the stack is running. if [ "${VORTEX_DOCTOR_CHECK_CONTAINERS}" = "1" ]; then - container_services=(cli php nginx mariadb) + container_services=(cli php nginx database) for container_service in "${container_services[@]}"; do if ! docker compose ps --status=running --services | grep -q "${container_service}"; then fail "${container_service} container is not running." diff --git a/scripts/vortex/export-db-image.sh b/scripts/vortex/export-db-image.sh index f2545368d..befcda6c0 100755 --- a/scripts/vortex/export-db-image.sh +++ b/scripts/vortex/export-db-image.sh @@ -19,7 +19,7 @@ VORTEX_DB_EXPORT_IMAGE="${VORTEX_DB_EXPORT_IMAGE:-}" VORTEX_DB_EXPORT_CONTAINER_REGISTRY="${VORTEX_DB_EXPORT_CONTAINER_REGISTRY:-${VORTEX_CONTAINER_REGISTRY:-docker.io}}" # The service name to capture. -VORTEX_DB_EXPORT_SERVICE_NAME="${VORTEX_DB_EXPORT_SERVICE_NAME:-mariadb}" +VORTEX_DB_EXPORT_SERVICE_NAME="${VORTEX_DB_EXPORT_SERVICE_NAME:-database}" # Directory with database image archive file. VORTEX_DB_EXPORT_IMAGE_DIR="${VORTEX_DB_EXPORT_IMAGE_DIR:-${VORTEX_DB_DIR}}" diff --git a/scripts/vortex/export-db.sh b/scripts/vortex/export-db.sh index 2549c0281..bbede88c1 100755 --- a/scripts/vortex/export-db.sh +++ b/scripts/vortex/export-db.sh @@ -43,7 +43,7 @@ else # Deploy container image. # @todo Move deployment into a separate script. if [ "${VORTEX_EXPORT_DB_CONTAINER_REGISTRY_DEPLOY_PROCEED:-}" = "1" ]; then - VORTEX_DEPLOY_CONTAINER_REGISTRY_MAP=mariadb=${VORTEX_DB_IMAGE} \ + VORTEX_DEPLOY_CONTAINER_REGISTRY_MAP=database=${VORTEX_DB_IMAGE} \ ./scripts/vortex/deploy-container-registry.sh fi fi diff --git a/scripts/vortex/info.sh b/scripts/vortex/info.sh index 4b8d97f3a..2c86dc7a3 100755 --- a/scripts/vortex/info.sh +++ b/scripts/vortex/info.sh @@ -33,10 +33,10 @@ note "Project name : ${VORTEX_PROJECT}" note "Docker Compose project name : ${COMPOSE_PROJECT_NAME:-}" note "Site local URL : http://${VORTEX_LOCALDEV_URL}" note "Path to web root : $(pwd)/${VORTEX_WEBROOT}" -note "DB host : ${MARIADB_HOST}" -note "DB username : ${MARIADB_USERNAME}" -note "DB password : ${MARIADB_PASSWORD}" -note "DB port : ${MARIADB_PORT}" +note "DB host : ${DATABASE_HOST}" +note "DB username : ${DATABASE_USERNAME}" +note "DB password : ${DATABASE_PASSWORD}" +note "DB port : ${DATABASE_PORT}" note "DB port on host : ${VORTEX_HOST_DB_PORT} ${sequelace}" if [ -n "${VORTEX_DB_IMAGE:-}" ]; then note "DB-in-image : ${VORTEX_DB_IMAGE}" diff --git a/tests/phpunit/Drupal/DatabaseSettingsTest.php b/tests/phpunit/Drupal/DatabaseSettingsTest.php index 843ae196f..070e2a383 100644 --- a/tests/phpunit/Drupal/DatabaseSettingsTest.php +++ b/tests/phpunit/Drupal/DatabaseSettingsTest.php @@ -50,11 +50,11 @@ public static function dataProviderDatabases(): array { [ [ - 'MARIADB_DATABASE' => 'test_db_name', - 'MARIADB_USERNAME' => 'test_db_user', - 'MARIADB_PASSWORD' => 'test_db_pass', - 'MARIADB_HOST' => 'test_db_host', - 'MARIADB_PORT' => 'test_db_port', + 'DATABASE_NAME' => 'test_db_name', + 'DATABASE_USERNAME' => 'test_db_user', + 'DATABASE_PASSWORD' => 'test_db_pass', + 'DATABASE_HOST' => 'test_db_host', + 'DATABASE_PORT' => 'test_db_port', ], [ 'default' => [ diff --git a/tests/phpunit/Drupal/EnvironmentSettingsTest.php b/tests/phpunit/Drupal/EnvironmentSettingsTest.php index 1a5da07d8..3beecb160 100644 --- a/tests/phpunit/Drupal/EnvironmentSettingsTest.php +++ b/tests/phpunit/Drupal/EnvironmentSettingsTest.php @@ -313,7 +313,7 @@ public function testEnvironmentGeneric(): void { 'bower_components', ]; $settings['file_temp_path'] = static::TMP_PATH_TESTING; - $settings['hash_salt'] = hash('sha256', getenv('MARIADB_HOST') ?: 'localhost'); + $settings['hash_salt'] = hash('sha256', getenv('DATABASE_HOST') ?: 'localhost'); $settings['trusted_host_patterns'] = [ '^.+\.docker\.amazee\.io$', '^nginx$', @@ -358,7 +358,7 @@ public function testEnvironmentLocal(): void { 'bower_components', ]; $settings['file_temp_path'] = static::TMP_PATH_TESTING; - $settings['hash_salt'] = hash('sha256', getenv('MARIADB_HOST') ?: 'localhost'); + $settings['hash_salt'] = hash('sha256', getenv('DATABASE_HOST') ?: 'localhost'); $settings['skip_permissions_hardening'] = TRUE; $settings['trusted_host_patterns'] = [ '^.+\.docker\.amazee\.io$', @@ -403,7 +403,7 @@ public function testEnvironmentCi(): void { 'bower_components', ]; $settings['file_temp_path'] = static::TMP_PATH_TESTING; - $settings['hash_salt'] = hash('sha256', getenv('MARIADB_HOST') ?: 'localhost'); + $settings['hash_salt'] = hash('sha256', getenv('DATABASE_HOST') ?: 'localhost'); $settings['skip_permissions_hardening'] = TRUE; $settings['suspend_mail_send'] = TRUE; $settings['trusted_host_patterns'] = [ @@ -449,7 +449,7 @@ public function testEnvironmentAcquiaDynamic(): void { 'bower_components', ]; $settings['file_temp_path'] = static::TMP_PATH_TESTING; - $settings['hash_salt'] = hash('sha256', getenv('MARIADB_HOST') ?: 'localhost'); + $settings['hash_salt'] = hash('sha256', getenv('DATABASE_HOST') ?: 'localhost'); $settings['trusted_host_patterns'][] = '^.+\.docker\.amazee\.io$'; $settings['trusted_host_patterns'][] = '^nginx$'; $this->assertSettings($settings); @@ -490,7 +490,7 @@ public function testEnvironmentAcquiaDev(): void { 'bower_components', ]; $settings['file_temp_path'] = static::TMP_PATH_TESTING; - $settings['hash_salt'] = hash('sha256', getenv('MARIADB_HOST') ?: 'localhost'); + $settings['hash_salt'] = hash('sha256', getenv('DATABASE_HOST') ?: 'localhost'); $settings['trusted_host_patterns'][] = '^.+\.docker\.amazee\.io$'; $settings['trusted_host_patterns'][] = '^nginx$'; $this->assertSettings($settings); @@ -531,7 +531,7 @@ public function testEnvironmentAcquiaStage(): void { 'bower_components', ]; $settings['file_temp_path'] = static::TMP_PATH_TESTING; - $settings['hash_salt'] = hash('sha256', getenv('MARIADB_HOST') ?: 'localhost'); + $settings['hash_salt'] = hash('sha256', getenv('DATABASE_HOST') ?: 'localhost'); $settings['trusted_host_patterns'][] = '^.+\.docker\.amazee\.io$'; $settings['trusted_host_patterns'][] = '^nginx$'; $this->assertSettings($settings); @@ -570,7 +570,7 @@ public function testEnvironmentAcquiaProd(): void { 'bower_components', ]; $settings['file_temp_path'] = static::TMP_PATH_TESTING; - $settings['hash_salt'] = hash('sha256', getenv('MARIADB_HOST') ?: 'localhost'); + $settings['hash_salt'] = hash('sha256', getenv('DATABASE_HOST') ?: 'localhost'); $settings['trusted_host_patterns'][] = '^.+\.docker\.amazee\.io$'; $settings['trusted_host_patterns'][] = '^nginx$'; $this->assertSettings($settings); @@ -617,7 +617,7 @@ public function testEnvironmentLagoonDynamic(): void { 'bower_components', ]; $settings['file_temp_path'] = static::TMP_PATH_TESTING; - $settings['hash_salt'] = hash('sha256', getenv('MARIADB_HOST') ?: 'localhost'); + $settings['hash_salt'] = hash('sha256', getenv('DATABASE_HOST') ?: 'localhost'); $settings['reverse_proxy'] = TRUE; $settings['reverse_proxy_header'] = 'HTTP_TRUE_CLIENT_IP'; $settings['trusted_host_patterns'][] = '^.+\.docker\.amazee\.io$'; @@ -668,7 +668,7 @@ public function testEnvironmentLagoonDev(): void { 'bower_components', ]; $settings['file_temp_path'] = static::TMP_PATH_TESTING; - $settings['hash_salt'] = hash('sha256', getenv('MARIADB_HOST') ?: 'localhost'); + $settings['hash_salt'] = hash('sha256', getenv('DATABASE_HOST') ?: 'localhost'); $settings['reverse_proxy'] = TRUE; $settings['reverse_proxy_header'] = 'HTTP_TRUE_CLIENT_IP'; $settings['trusted_host_patterns'][] = '^.+\.docker\.amazee\.io$'; @@ -719,7 +719,7 @@ public function testEnvironmentLagoonTest(): void { 'bower_components', ]; $settings['file_temp_path'] = static::TMP_PATH_TESTING; - $settings['hash_salt'] = hash('sha256', getenv('MARIADB_HOST') ?: 'localhost'); + $settings['hash_salt'] = hash('sha256', getenv('DATABASE_HOST') ?: 'localhost'); $settings['reverse_proxy'] = TRUE; $settings['reverse_proxy_header'] = 'HTTP_TRUE_CLIENT_IP'; $settings['trusted_host_patterns'][] = '^.+\.docker\.amazee\.io$'; @@ -769,7 +769,7 @@ public function testEnvironmentLagoonProd(): void { 'bower_components', ]; $settings['file_temp_path'] = static::TMP_PATH_TESTING; - $settings['hash_salt'] = hash('sha256', getenv('MARIADB_HOST') ?: 'localhost'); + $settings['hash_salt'] = hash('sha256', getenv('DATABASE_HOST') ?: 'localhost'); $settings['reverse_proxy'] = TRUE; $settings['reverse_proxy_header'] = 'HTTP_TRUE_CLIENT_IP'; $settings['trusted_host_patterns'][] = '^.+\.docker\.amazee\.io$'; diff --git a/tests/phpunit/Drupal/SettingsTestCase.php b/tests/phpunit/Drupal/SettingsTestCase.php index b1453e353..896a1267f 100644 --- a/tests/phpunit/Drupal/SettingsTestCase.php +++ b/tests/phpunit/Drupal/SettingsTestCase.php @@ -139,7 +139,7 @@ protected function setEnvVars(array $vars): void { // Filtered real vars without a value to unset them in the lines below. $vars_real = self::getRealEnvVarsFilteredNoValues([ // Service variables. - 'MARIADB_', + 'DATABASE_', 'REDIS_', 'COMPOSE_', 'GITHUB_', diff --git a/web/sites/default/settings.php b/web/sites/default/settings.php index b4ce39dea..8c5c79105 100644 --- a/web/sites/default/settings.php +++ b/web/sites/default/settings.php @@ -68,7 +68,7 @@ $settings['file_temp_path'] = getenv('DRUPAL_TEMPORARY_FILES') ?: '/tmp'; // Base salt on the DB host name. -$settings['hash_salt'] = hash('sha256', getenv('MARIADB_HOST') ?: 'localhost'); +$settings['hash_salt'] = hash('sha256', getenv('DATABASE_HOST') ?: 'localhost'); // Expiration of cached pages. $config['system.performance']['cache']['page']['max_age'] = 900; @@ -113,11 +113,11 @@ [ 'default' => [ - 'database' => getenv('MARIADB_DATABASE') ?: 'drupal', - 'username' => getenv('MARIADB_USERNAME') ?: 'drupal', - 'password' => getenv('MARIADB_PASSWORD') ?: 'drupal', - 'host' => getenv('MARIADB_HOST') ?: 'localhost', - 'port' => getenv('MARIADB_PORT') ?: '', + 'database' => getenv('DATABASE_NAME') ?: getenv('MARIADB_DATABASE') ?: 'drupal', + 'username' => getenv('DATABASE_USERNAME') ?: getenv('MARIADB_USERNAME') ?: 'drupal', + 'password' => getenv('DATABASE_PASSWORD') ?: getenv('MARIADB_PASSWORD') ?: 'drupal', + 'host' => getenv('DATABASE_HOST') ?: getenv('MARIADB_HOST') ?: 'localhost', + 'port' => getenv('DATABASE_PORT') ?: getenv('MARIADB_PORT') ?: '', 'prefix' => '', 'driver' => 'mysql', ],