From a2433ddd2536dedb7efc9d5518cb2a7bbaa092a9 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Mon, 26 Oct 2026 07:51:04 +1100 Subject: [PATCH 01/52] Kept exported environment variables over '.env' values in the tooling, as the Bash scripts did. The PHP port of the tooling let '.env' and '.env.local' replace variables already exported in the process environment, reversing the precedence of the Bash scripts. --- .../Traits/Subtests/SubtestAhoyTrait.php | 11 +-- .vortex/tooling/src/helpers.php | 9 +++ .../tooling/tests/Unit/HelpersDotenvTest.php | 74 +++++++++++++++++++ 3 files changed, 85 insertions(+), 9 deletions(-) diff --git a/.vortex/tests/phpunit/Traits/Subtests/SubtestAhoyTrait.php b/.vortex/tests/phpunit/Traits/Subtests/SubtestAhoyTrait.php index 10053e2c3..3cee8c474 100644 --- a/.vortex/tests/phpunit/Traits/Subtests/SubtestAhoyTrait.php +++ b/.vortex/tests/phpunit/Traits/Subtests/SubtestAhoyTrait.php @@ -313,23 +313,16 @@ protected function subtestAhoyProvision(): void { $this->logSubstep('Run provision with the post-provision configuration check enabled'); - // The tooling loads '.env' over the process environment, so the flag is - // enabled in '.env' rather than passed to the command. - $this->fileAddVar('.env', 'VORTEX_PROVISION_VERIFY_CONFIG_UNCHANGED_AFTER_PROVISION', '1'); - $this->syncToContainer('.env'); - $this->cmd( 'ahoy provision', [ '* Verify config after provision : Yes', '* Verified that post-provision operations did not change configuration.', ], - 'Provision should report that post-provision operations left configuration unchanged' + 'Provision should report that post-provision operations left configuration unchanged', + env: ['VORTEX_PROVISION_VERIFY_CONFIG_UNCHANGED_AFTER_PROVISION' => '1'] ); - $this->fileRestore('.env'); - $this->syncToContainer('.env'); - $this->logSubstep('Run provision with exported config files different to DB'); $this->logNote('Make a change to the configuration.'); diff --git a/.vortex/tooling/src/helpers.php b/.vortex/tooling/src/helpers.php index 1cc090d3d..dc0002d48 100755 --- a/.vortex/tooling/src/helpers.php +++ b/.vortex/tooling/src/helpers.php @@ -35,10 +35,15 @@ /** * Load environment variables from .env and .env.local files. * + * Variables already set in the process environment are never overwritten. + * A later file overrides a value loaded from an earlier file. + * * @param array $env_files * Array of environment file paths to load. */ function load_dotenv(array $env_files = ['.env']): void { + $existing = getenv(); + foreach ($env_files as $env_file) { if (file_exists($env_file)) { $lines = file($env_file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); @@ -61,6 +66,10 @@ function load_dotenv(array $env_files = ['.env']): void { $key = trim($key); $value = trim($value); + if (array_key_exists($key, $existing)) { + continue; + } + // Remove quotes if present. if ((str_starts_with($value, '"') && str_ends_with($value, '"')) || (str_starts_with($value, "'") && str_ends_with($value, "'"))) { diff --git a/.vortex/tooling/tests/Unit/HelpersDotenvTest.php b/.vortex/tooling/tests/Unit/HelpersDotenvTest.php index c2dac3dd6..4c9435807 100644 --- a/.vortex/tooling/tests/Unit/HelpersDotenvTest.php +++ b/.vortex/tooling/tests/Unit/HelpersDotenvTest.php @@ -7,6 +7,7 @@ use PHPUnit\Framework\Attributes\CoversFunction; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; /** * Tests for environment management functions. @@ -15,6 +16,7 @@ */ #[CoversFunction('DrevOps\VortexTooling\load_dotenv')] #[Group('helpers')] +#[RunTestsInSeparateProcesses] class HelpersDotenvTest extends UnitTestCase { protected function setUp(): void { @@ -80,6 +82,78 @@ public static function dataProviderLoadDotenv(): array { ]; } + #[DataProvider('dataProviderLoadDotenvPrecedence')] + public function testLoadDotenvPrecedence(array $exported, string $env, ?string $env_local, array $expected): void { + foreach ($exported as $key => $value) { + self::envSet($key, $value); + } + + $env_file = self::$tmp . '/.env'; + file_put_contents($env_file, $env); + $files = [$env_file]; + + if ($env_local !== NULL) { + $env_local_file = self::$tmp . '/.env.local'; + file_put_contents($env_local_file, $env_local); + $files[] = $env_local_file; + } + + \DrevOps\VortexTooling\load_dotenv($files); + + foreach ($expected as $key => $expected_value) { + $this->assertSame($expected_value, getenv($key), sprintf('Value of %s', $key)); + } + } + + public static function dataProviderLoadDotenvPrecedence(): array { + return [ + 'file-only keys load' => [ + 'exported' => [], + 'env' => "TEST_DOTENV_A=from_env\nTEST_DOTENV_B=from_env_b", + 'env_local' => NULL, + 'expected' => [ + 'TEST_DOTENV_A' => 'from_env', + 'TEST_DOTENV_B' => 'from_env_b', + ], + ], + 'exported variable wins over .env' => [ + 'exported' => ['TEST_DOTENV_A' => 'from_process'], + 'env' => "TEST_DOTENV_A=from_env\nTEST_DOTENV_B=from_env_b", + 'env_local' => NULL, + 'expected' => [ + 'TEST_DOTENV_A' => 'from_process', + 'TEST_DOTENV_B' => 'from_env_b', + ], + ], + 'exported empty variable wins over .env' => [ + 'exported' => ['TEST_DOTENV_A' => ''], + 'env' => 'TEST_DOTENV_A=from_env', + 'env_local' => NULL, + 'expected' => [ + 'TEST_DOTENV_A' => '', + ], + ], + '.env.local overrides .env' => [ + 'exported' => [], + 'env' => "TEST_DOTENV_A=from_env\nTEST_DOTENV_B=from_env_b", + 'env_local' => 'TEST_DOTENV_A=from_env_local', + 'expected' => [ + 'TEST_DOTENV_A' => 'from_env_local', + 'TEST_DOTENV_B' => 'from_env_b', + ], + ], + 'exported variable wins over .env and .env.local' => [ + 'exported' => ['TEST_DOTENV_A' => 'from_process'], + 'env' => 'TEST_DOTENV_A=from_env', + 'env_local' => "TEST_DOTENV_A=from_env_local\nTEST_DOTENV_C=from_env_local_c", + 'expected' => [ + 'TEST_DOTENV_A' => 'from_process', + 'TEST_DOTENV_C' => 'from_env_local_c', + ], + ], + ]; + } + public function testLoadDotenvSkipsCommentsAndEmpty(): void { $env_file = self::$tmp . '/.env.test'; file_put_contents($env_file, "# Comment\nTEST_VAR=value\n\n# Another comment\nTEST_VAR2=value2"); From fd6145c869e5e495a62a4cdaa9b59b60a9d88791 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Mon, 26 Oct 2026 07:52:26 +1100 Subject: [PATCH 02/52] Hardened the database export step in the 'test' job. Forward-ported the export-step hardening from main cf188dd28ed9922f7ea7dc8f08e2a68ab9d2379a. 2.x keeps database caching in the 'test' job, so the scheduled database job and the GitHub Actions DIDI workflow are not ported. --- .circleci/config.yml | 11 +++++--- .circleci/vortex-test-common.yml | 29 +++++++++++++++------- .github/workflows/build-test-deploy.yml | 14 ++++++++--- .vortex/tests/generate-vortex-dev-circleci | 9 ++++--- 4 files changed, 45 insertions(+), 18 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index dec987c58..67db567f6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -386,16 +386,21 @@ jobs: #;< DB_FETCH_SOURCE_CONTAINER_REGISTRY [ "${CIRCLE_NODE_TOTAL:-1}" -gt 1 ] && [ "${CIRCLE_NODE_INDEX:-0}" -ne 0 ] && export VORTEX_EXPORT_DB_CONTAINER_REGISTRY_PUSH_PROCEED=0 #;> DB_FETCH_SOURCE_CONTAINER_REGISTRY - docker compose exec cli mkdir -p .data && docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql || true + # The 'container_registry' source fetches an image without a dump file. + if [ -f .data/db.sql ]; then + docker compose exec cli mkdir -p .data + docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql + fi docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli bash -c "VORTEX_PROVISION_POST_OPERATIONS_SKIP=1 ./vendor/bin/vortex-provision" #;< DB_FETCH_SOURCE_CONTAINER_REGISTRY - grep -q ^VORTEX_DB_IMAGE .env && rm .data/db.sql || true + # Database-in-image storage caches the exported image archive instead of the dump. + [ -n "${VORTEX_DB_IMAGE:-}" ] && rm -f .data/db.sql || true #;> DB_FETCH_SOURCE_CONTAINER_REGISTRY ./vendor/bin/vortex-export-db db.sql #;< DB_FETCH_SOURCE_CONTAINER_REGISTRY if [ -n "${VORTEX_DB_IMAGE:-}" ]; then ./vendor/bin/vortex-push-db-image; fi #;> DB_FETCH_SOURCE_CONTAINER_REGISTRY - docker compose exec -T cli test -f /app/.data/db.sql && docker compose --progress quiet cp -L cli:/app/.data/db.sql .data/db.sql || true + [ -z "${VORTEX_DB_IMAGE:-}" ] && docker compose exec -T cli test -f /app/.data/db.sql && docker compose --progress quiet cp -L cli:/app/.data/db.sql .data/db.sql || true no_output_timeout: 30m # Save the clean DB dump to the cache before the slow dev-dependency diff --git a/.circleci/vortex-test-common.yml b/.circleci/vortex-test-common.yml index e399c700b..c292f9855 100644 --- a/.circleci/vortex-test-common.yml +++ b/.circleci/vortex-test-common.yml @@ -233,16 +233,21 @@ jobs: #;< DB_FETCH_SOURCE_CONTAINER_REGISTRY [ "${CIRCLE_NODE_TOTAL:-1}" -gt 1 ] && [ "${CIRCLE_NODE_INDEX:-0}" -ne 0 ] && export VORTEX_EXPORT_DB_CONTAINER_REGISTRY_PUSH_PROCEED=0 #;> DB_FETCH_SOURCE_CONTAINER_REGISTRY - docker compose exec cli mkdir -p .data && docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql || true + # The 'container_registry' source fetches an image without a dump file. + if [ -f .data/db.sql ]; then + docker compose exec cli mkdir -p .data + docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql + fi docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli bash -c "VORTEX_PROVISION_POST_OPERATIONS_SKIP=1 ./vendor/bin/vortex-provision" #;< DB_FETCH_SOURCE_CONTAINER_REGISTRY - grep -q ^VORTEX_DB_IMAGE .env && rm .data/db.sql || true + # Database-in-image storage caches the exported image archive instead of the dump. + [ -n "${VORTEX_DB_IMAGE:-}" ] && rm -f .data/db.sql || true #;> DB_FETCH_SOURCE_CONTAINER_REGISTRY ./vendor/bin/vortex-export-db db.sql #;< DB_FETCH_SOURCE_CONTAINER_REGISTRY if [ -n "${VORTEX_DB_IMAGE:-}" ]; then ./vendor/bin/vortex-push-db-image; fi #;> DB_FETCH_SOURCE_CONTAINER_REGISTRY - docker compose exec -T cli test -f /app/.data/db.sql && docker compose --progress quiet cp -L cli:/app/.data/db.sql .data/db.sql || true + [ -z "${VORTEX_DB_IMAGE:-}" ] && docker compose exec -T cli test -f /app/.data/db.sql && docker compose --progress quiet cp -L cli:/app/.data/db.sql .data/db.sql || true no_output_timeout: 30m # Save the clean DB dump to the cache before the slow dev-dependency @@ -466,12 +471,15 @@ jobs: name: Export DB after fetch command: | [ ! -f /tmp/fetch-db-success ] && echo "==> Database fetch semaphore file is missing. DB export will not proceed." && exit 0 - docker compose exec cli mkdir -p .data && docker compose cp -L .data/db.sql cli:/app/.data/db.sql || true + if [ -f .data/db.sql ]; then + docker compose exec cli mkdir -p .data + docker compose cp -L .data/db.sql cli:/app/.data/db.sql + fi docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli bash -c "VORTEX_PROVISION_POST_OPERATIONS_SKIP=1 ./vendor/bin/vortex-provision" - grep -q ^VORTEX_DB_IMAGE .env && rm .data/db.sql || true + [ -n "${VORTEX_DB_IMAGE:-}" ] && rm -f .data/db.sql || true ./vendor/bin/vortex-export-db db.sql if [ -n "${VORTEX_DB_IMAGE:-}" ]; then ./vendor/bin/vortex-push-db-image; fi - docker compose exec -T cli test -f /app/.data/db.sql && docker compose cp -L cli:/app/.data/db.sql .data/db.sql || true + [ -z "${VORTEX_DB_IMAGE:-}" ] && docker compose exec -T cli test -f /app/.data/db.sql && docker compose cp -L cli:/app/.data/db.sql .data/db.sql || true no_output_timeout: 30m vortex-dev-didi-build-fi: @@ -526,12 +534,15 @@ jobs: name: Export DB after fetch command: | [ ! -f /tmp/fetch-db-success ] && echo "==> Database fetch semaphore file is missing. DB export will not proceed." && exit 0 - docker compose exec cli mkdir -p .data && docker compose cp -L .data/db.sql cli:/app/.data/db.sql || true + if [ -f .data/db.sql ]; then + docker compose exec cli mkdir -p .data + docker compose cp -L .data/db.sql cli:/app/.data/db.sql + fi docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli bash -c "VORTEX_PROVISION_POST_OPERATIONS_SKIP=1 ./vendor/bin/vortex-provision" - grep -q ^VORTEX_DB_IMAGE .env && rm .data/db.sql || true + [ -n "${VORTEX_DB_IMAGE:-}" ] && rm -f .data/db.sql || true ./vendor/bin/vortex-export-db db.sql if [ -n "${VORTEX_DB_IMAGE:-}" ]; then ./vendor/bin/vortex-push-db-image; fi - docker compose exec -T cli test -f /app/.data/db.sql && docker compose cp -L cli:/app/.data/db.sql .data/db.sql || true + [ -z "${VORTEX_DB_IMAGE:-}" ] && docker compose exec -T cli test -f /app/.data/db.sql && docker compose cp -L cli:/app/.data/db.sql .data/db.sql || true no_output_timeout: 30m vortex-dev-didi-build-ii: diff --git a/.github/workflows/build-test-deploy.yml b/.github/workflows/build-test-deploy.yml index 5b7df80a7..9fe3cae52 100644 --- a/.github/workflows/build-test-deploy.yml +++ b/.github/workflows/build-test-deploy.yml @@ -375,16 +375,24 @@ jobs: #;< DB_FETCH_SOURCE_CONTAINER_REGISTRY if [ "${STRATEGY_JOB_TOTAL}" -gt 1 ] && [ "${STRATEGY_JOB_INDEX}" -ne 0 ]; then export VORTEX_EXPORT_DB_CONTAINER_REGISTRY_PUSH_PROCEED=0; fi #;> DB_FETCH_SOURCE_CONTAINER_REGISTRY - docker compose exec cli mkdir -p .data && docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql || true + # The 'container_registry' source fetches an image without a dump file. + if [ -f .data/db.sql ]; then + docker compose exec cli mkdir -p .data + docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql + fi docker compose exec cli bash -c "VORTEX_PROVISION_POST_OPERATIONS_SKIP=1 ./vendor/bin/vortex-provision" #;< DB_FETCH_SOURCE_CONTAINER_REGISTRY - grep -q ^VORTEX_DB_IMAGE .env && rm .data/db.sql || true + # Database-in-image storage caches the exported image archive instead of the dump. + if [ -n "${VORTEX_DB_IMAGE:-}" ]; then rm -f .data/db.sql; fi #;> DB_FETCH_SOURCE_CONTAINER_REGISTRY ./vendor/bin/vortex-export-db db.sql #;< DB_FETCH_SOURCE_CONTAINER_REGISTRY if [ -n "${VORTEX_DB_IMAGE:-}" ]; then ./vendor/bin/vortex-push-db-image; fi #;> DB_FETCH_SOURCE_CONTAINER_REGISTRY - docker compose exec -T cli test -f /app/.data/db.sql && docker compose --progress quiet cp -L cli:/app/.data/db.sql .data/db.sql || true + if [ -z "${VORTEX_DB_IMAGE:-}" ] && docker compose exec -T cli test -f /app/.data/db.sql; then docker compose --progress quiet cp -L cli:/app/.data/db.sql .data/db.sql; fi + # 'hashFiles()' runs as the runner user outside the container, so the + # root-owned files in '.data' must be readable by others. + chmod -R a+rX .data timeout-minutes: 30 #;< DB_FETCH_SOURCE_CONTAINER_REGISTRY env: diff --git a/.vortex/tests/generate-vortex-dev-circleci b/.vortex/tests/generate-vortex-dev-circleci index d0152451d..e49fcb515 100755 --- a/.vortex/tests/generate-vortex-dev-circleci +++ b/.vortex/tests/generate-vortex-dev-circleci @@ -276,12 +276,15 @@ function build_database_builder_job(string $name, array $env): string { name: Export DB after fetch command: | [ ! -f /tmp/fetch-db-success ] && echo "==> Database fetch semaphore file is missing. DB export will not proceed." && exit 0 - docker compose exec cli mkdir -p .data && docker compose cp -L .data/db.sql cli:/app/.data/db.sql || true + if [ -f .data/db.sql ]; then + docker compose exec cli mkdir -p .data + docker compose cp -L .data/db.sql cli:/app/.data/db.sql + fi docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli bash -c "VORTEX_PROVISION_POST_OPERATIONS_SKIP=1 ./vendor/bin/vortex-provision" - grep -q ^VORTEX_DB_IMAGE .env && rm .data/db.sql || true + [ -n "${VORTEX_DB_IMAGE:-}" ] && rm -f .data/db.sql || true ./vendor/bin/vortex-export-db db.sql if [ -n "${VORTEX_DB_IMAGE:-}" ]; then ./vendor/bin/vortex-push-db-image; fi - docker compose exec -T cli test -f /app/.data/db.sql && docker compose cp -L cli:/app/.data/db.sql .data/db.sql || true + [ -z "${VORTEX_DB_IMAGE:-}" ] && docker compose exec -T cli test -f /app/.data/db.sql && docker compose cp -L cli:/app/.data/db.sql .data/db.sql || true no_output_timeout: 30m YAML; From 9d110e6b57b2e341c898115425b78bd1ca9b4099 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Mon, 26 Oct 2026 07:55:35 +1100 Subject: [PATCH 03/52] Added a static nginx maintenance page switched on by 'VORTEX_WEBSERVER_MAINTENANCE_MODE'. Forward-ported from main d51c7412b36b10ebb5119cf640572d41845fcce4, with the variable named 'VORTEX_WEBSERVER_MAINTENANCE_MODE' to match the 2.x vendor-agnostic service names. --- .docker/config/nginx/maintenance.conf | 29 ++++++++ .docker/config/nginx/maintenance.html | 60 +++++++++++++++ .docker/nginx-drupal.dockerfile | 3 + .../variables/extra/lagoon.variables.sh | 7 ++ .../development/environment/docker.mdx | 4 +- .../docs/content/development/provision.mdx | 4 + .../docs/content/development/variables.mdx | 1 + .vortex/docs/content/hosting/lagoon.mdx | 74 +++++++++++++++++++ .vortex/docs/cspell.json | 1 + .../phpunit/Functional/AhoyWorkflowTest.php | 2 + .../Traits/Subtests/SubtestAhoyTrait.php | 38 ++++++++++ .vortex/tests/phpunit/Traits/SutTrait.php | 2 + docker-compose.yml | 2 + docs/deployment.md | 8 ++ 14 files changed, 234 insertions(+), 1 deletion(-) create mode 100644 .docker/config/nginx/maintenance.conf create mode 100644 .docker/config/nginx/maintenance.html diff --git a/.docker/config/nginx/maintenance.conf b/.docker/config/nginx/maintenance.conf new file mode 100644 index 000000000..3423b908c --- /dev/null +++ b/.docker/config/nginx/maintenance.conf @@ -0,0 +1,29 @@ +# Maintenance page. +# +# Answers every request with HTTP status 503 and the static maintenance page +# while VORTEX_WEBSERVER_MAINTENANCE_MODE is set to 1, so no request reaches +# PHP. +# +# The image entrypoint replaces the placeholder below with the variable's +# value when the container starts, so a changed value needs a new container. + +set $vortex_maintenance "${VORTEX_WEBSERVER_MAINTENANCE_MODE:-0}"; + +# nginx runs these directives again for the internal redirect to the error +# page, so the page URI is exempt. +if ($uri = /__maintenance.html) { + set $vortex_maintenance 0; +} + +if ($vortex_maintenance = 1) { + return 503; +} + +# A URI error page makes nginx serve the page as GET, so POST and other +# methods get the page instead of a 405 response. +error_page 503 /__maintenance.html; + +location = /__maintenance.html { + internal; + alias /etc/nginx/html/maintenance.html; +} diff --git a/.docker/config/nginx/maintenance.html b/.docker/config/nginx/maintenance.html new file mode 100644 index 000000000..355034456 --- /dev/null +++ b/.docker/config/nginx/maintenance.html @@ -0,0 +1,60 @@ + + + + + + Down for maintenance | YOURSITE + + + +
+

We'll be back soon

+

YOURSITE is down for maintenance. Please check back shortly.

+
+ + diff --git a/.docker/nginx-drupal.dockerfile b/.docker/nginx-drupal.dockerfile index 1d49af876..7d85b4b46 100644 --- a/.docker/nginx-drupal.dockerfile +++ b/.docker/nginx-drupal.dockerfile @@ -19,6 +19,9 @@ RUN apk add --no-cache tzdata COPY ./.docker/config/nginx/redirects-map.conf /etc/nginx/redirects-map.conf +COPY ./.docker/config/nginx/maintenance.conf /etc/nginx/conf.d/drupal/server_prepend-maintenance.conf +COPY ./.docker/config/nginx/maintenance.html /etc/nginx/html/maintenance.html + RUN fix-permissions /etc/nginx COPY --from=cli /app /app diff --git a/.vortex/docs/.utils/variables/extra/lagoon.variables.sh b/.vortex/docs/.utils/variables/extra/lagoon.variables.sh index ea294e48c..683007444 100755 --- a/.vortex/docs/.utils/variables/extra/lagoon.variables.sh +++ b/.vortex/docs/.utils/variables/extra/lagoon.variables.sh @@ -40,3 +40,10 @@ VORTEX_NOTIFY_SLACK_WEBHOOK="${VORTEX_NOTIFY_SLACK_WEBHOOK:-}" # # @see https://www.vortextemplate.com/docs/deployment/notifications/webhook VORTEX_NOTIFY_WEBHOOK_URL= + +# Serve the static maintenance page from the webserver container. +# +# Set to 1 on a single environment, then redeploy it. Every request is then +# answered with HTTP status 503 and the maintenance page, and none reaches PHP. +# @see https://www.vortextemplate.com/docs/hosting/lagoon#serve-a-maintenance-page +VORTEX_WEBSERVER_MAINTENANCE_MODE= diff --git a/.vortex/docs/content/development/environment/docker.mdx b/.vortex/docs/content/development/environment/docker.mdx index 49029a180..3a7faa7f0 100644 --- a/.vortex/docs/content/development/environment/docker.mdx +++ b/.vortex/docs/content/development/environment/docker.mdx @@ -225,7 +225,9 @@ The following services are defined in the `docker-compose.yml` file provided by container where cron jobs are run within a hosting environment (if that environment supports containerization). - `webserver` - a container that runs a web server. This container is used to serve - the application and pass requests to the appserver container. + the application and pass requests to the appserver container. Its + `VORTEX_WEBSERVER_MAINTENANCE_MODE` pass-through variable turns on the + [static maintenance page](../../hosting/lagoon.mdx#serve-a-maintenance-page). - `appserver` - a container that runs a PHP engine. This container is used to run the application code and execute commands in the context of the application. It is different from the `cli` container in that it does not have certain diff --git a/.vortex/docs/content/development/provision.mdx b/.vortex/docs/content/development/provision.mdx index cbeac035a..67d8714ca 100644 --- a/.vortex/docs/content/development/provision.mdx +++ b/.vortex/docs/content/development/provision.mdx @@ -128,6 +128,10 @@ To enable maintenance mode, set the `VORTEX_PROVISION_USE_MAINTENANCE_MODE=1` environment variable in your `.env` file to apply it globally or set it in your hosting provider's specific environment. +Maintenance mode runs in PHP and needs the database. To keep every request +away from PHP, for example during a migration on Lagoon, serve the [static +maintenance page](../hosting/lagoon.mdx#serve-a-maintenance-page). + ### Database sanitization The `provision` script includes a step to sanitize the database after diff --git a/.vortex/docs/content/development/variables.mdx b/.vortex/docs/content/development/variables.mdx index e6104e6b1..8d583d3a2 100644 --- a/.vortex/docs/content/development/variables.mdx +++ b/.vortex/docs/content/development/variables.mdx @@ -256,4 +256,5 @@ The list below is automatically generated with [Shellvar](https://github.com/ale | `VORTEX_TASK_COPY_DB_ACQUIA_SKIP` | Skip copying of database between Acquia environment. | `UNDEFINED` | `ACQUIA ENVIRONMENT` | | `VORTEX_TASK_COPY_FILES_ACQUIA_SKIP` | Skip copying of files between Acquia environment. | `UNDEFINED` | `ACQUIA ENVIRONMENT` | | `VORTEX_UNBLOCK_ADMIN` | Unblock admin account when logging in. | `1` | `.env` | +| `VORTEX_WEBSERVER_MAINTENANCE_MODE` | Serve the static maintenance page from the webserver container.

Set to `1` on a single environment, then redeploy it. Every request is then answered with HTTP status `503` and the maintenance page, and none reaches PHP. @see https://www.vortextemplate.com/docs/hosting/lagoon#serve-a-maintenance-page | `UNDEFINED` | `LAGOON ENVIRONMENT` | | `WEBROOT` | Name of the web root directory containing a Drupal codebase. | `web` | `.env` | diff --git a/.vortex/docs/content/hosting/lagoon.mdx b/.vortex/docs/content/hosting/lagoon.mdx index 154fba646..af8e1fcd9 100644 --- a/.vortex/docs/content/hosting/lagoon.mdx +++ b/.vortex/docs/content/hosting/lagoon.mdx @@ -109,3 +109,77 @@ VORTEX_TASK_CUSTOM_LAGOON_COMMAND="drush cron" \ The task reads the project name and SSH configuration from your `.env` and `.env.local` files; `VORTEX_TASK_CUSTOM_LAGOON_BRANCH` selects the environment and `VORTEX_TASK_CUSTOM_LAGOON_COMMAND` is the command to run there. + +### Serve a maintenance page + +A static maintenance page takes an environment offline when Drupal must +stay down, for example during a database migration or an incident. The +`webserver` container answers every request with HTTP status 503 and the +page, so no request reaches PHP. Drupal's own [maintenance +mode](../development/provision.mdx#maintenance-mode) runs in PHP and needs a +working database. + +Lagoon applies a changed variable on the next deployment, so each switch is +a variable change followed by a redeployment. To turn the page on: + +1. Set `VORTEX_WEBSERVER_MAINTENANCE_MODE` to `1` on the environment: + + ```shell + lagoon add variable --project your_site --environment main \ + --scope runtime --name VORTEX_WEBSERVER_MAINTENANCE_MODE --value 1 + ``` + + Only the value `1` turns the page on. + +2. Redeploy the environment: + + ```shell + lagoon deploy latest --project your_site --environment main + ``` + +3. Confirm that the environment answers with `503`: + + ```shell + curl -s -o /dev/null -w "%{http_code}\n" https://www.your-site-domain.example + ``` + +To bring the site back: + +1. Delete the variable: + + ```shell + lagoon delete variable --project your_site --environment main \ + --name VORTEX_WEBSERVER_MAINTENANCE_MODE + ``` + +2. Redeploy the environment: + + ```shell + lagoon deploy latest --project your_site --environment main + ``` + +The page covers every request that reaches the site's web server, including +static files, `robots.txt` and Lagoon's `/.lagoonhealthz` check. Lagoon +checks the container's health on a separate status port, so the environment +stays healthy. Shield runs in Drupal, so the page stays public on +environments that Shield protects. + +The page is `.docker/config/nginx/maintenance.html`. The `maintenance.conf` +file in the same directory holds the rules that serve it. Keep the page +self-contained, with inline styles and images, because requests for other +files get the maintenance page too. To preview your changes locally: + +1. Rebuild and recreate the `webserver` container with the variable set: + + ```shell + VORTEX_WEBSERVER_MAINTENANCE_MODE=1 ahoy up --build webserver + ``` + + The local site shows the maintenance page. + +2. Recreate the `webserver` container without the variable to bring the site + back: + + ```shell + ahoy up webserver + ``` diff --git a/.vortex/docs/cspell.json b/.vortex/docs/cspell.json index 352acfba6..eb137279e 100644 --- a/.vortex/docs/cspell.json +++ b/.vortex/docs/cspell.json @@ -59,6 +59,7 @@ "itok", "jsonpath", "lagooncli", + "lagoonhealthz", "lando", "langid", "langlet", diff --git a/.vortex/tests/phpunit/Functional/AhoyWorkflowTest.php b/.vortex/tests/phpunit/Functional/AhoyWorkflowTest.php index 35b2f417a..5927374c1 100644 --- a/.vortex/tests/phpunit/Functional/AhoyWorkflowTest.php +++ b/.vortex/tests/phpunit/Functional/AhoyWorkflowTest.php @@ -72,6 +72,8 @@ public function testAhoyWorkflowStateless(): void { $this->subtestAhoyFast404(); + $this->subtestAhoyWebserverMaintenance(); + $this->subtestAhoyReset(); $this->subtestAhoyResetHard(); diff --git a/.vortex/tests/phpunit/Traits/Subtests/SubtestAhoyTrait.php b/.vortex/tests/phpunit/Traits/Subtests/SubtestAhoyTrait.php index 3cee8c474..e72ea95f3 100644 --- a/.vortex/tests/phpunit/Traits/Subtests/SubtestAhoyTrait.php +++ b/.vortex/tests/phpunit/Traits/Subtests/SubtestAhoyTrait.php @@ -1086,6 +1086,44 @@ protected function subtestAhoyFast404(): void { $this->logStepFinish(); } + protected function subtestAhoyWebserverMaintenance(): void { + $this->logStepStart(); + + $page = 'is down for maintenance'; + $status = 'docker compose exec -T cli curl -sS -o /dev/null -w "%{http_code}"'; + + $this->logSubstep('Assert that Drupal serves the site before the maintenance page is enabled'); + $this->cmd($status . ' http://webserver:8080/', '200', 'Homepage should be answered with a 200 status'); + $this->assertWebpageContains('/', 'drupal-settings-json', 'Homepage should be rendered by Drupal'); + + $this->logSubstep('Enable the maintenance page'); + $this->cmd('ahoy up webserver', env: ['VORTEX_WEBSERVER_MAINTENANCE_MODE' => '1'], txt: '`webserver` container should be recreated with the maintenance page enabled'); + $this->cmd('docker compose exec -T cli wait-for webserver:8080', txt: 'Wait for the webserver to accept connections', tio: 60); + $this->cmd('docker compose exec -T webserver nginx -t', txt: 'Rendered nginx configuration should be valid'); + + $this->logSubstep('Assert that the webserver answers every request with the maintenance page'); + $this->cmd($status . ' http://webserver:8080/', '503', 'Homepage should be answered with a 503 status'); + $this->assertWebpageContains('/', $page, 'Homepage should show the maintenance page'); + $this->assertWebpageNotContains('/', 'drupal-settings-json', 'Homepage should not be rendered by Drupal'); + $this->cmd($status . ' --data name=admin http://webserver:8080/user/login', '503', 'Form submission should be answered with a 503 status'); + $this->cmd($status . ' http://webserver:8080/core/misc/druplicon.png', '503', 'Static file should be answered with a 503 status'); + + $this->logSubstep('Assert that the maintenance page does not depend on PHP'); + $this->cmd('docker compose stop appserver', txt: '`appserver` container should be stopped'); + $this->cmd($status . ' http://webserver:8080/', '503', 'Homepage should be answered with a 503 status while PHP is stopped'); + $this->assertWebpageContains('/', $page, 'Homepage should show the maintenance page while PHP is stopped'); + $this->cmd('docker compose start appserver', txt: '`appserver` container should be started'); + $this->cmd('docker compose exec -T cli wait-for appserver:9000', txt: 'Wait for PHP to accept connections', tio: 60); + + $this->logSubstep('Disable the maintenance page'); + $this->cmd('ahoy up webserver', txt: '`webserver` container should be recreated with the maintenance page disabled'); + $this->cmd('docker compose exec -T cli wait-for webserver:8080', txt: 'Wait for the webserver to accept connections', tio: 60); + $this->cmd($status . ' http://webserver:8080/', '200', 'Homepage should be answered with a 200 status'); + $this->assertWebpageContains('/', 'drupal-settings-json', 'Homepage should be rendered by Drupal'); + + $this->logStepFinish(); + } + protected function substepWarmCaches(): void { $this->logNote('Warming up caches'); $this->cmd('ahoy drush cr'); diff --git a/.vortex/tests/phpunit/Traits/SutTrait.php b/.vortex/tests/phpunit/Traits/SutTrait.php index 51497ad97..e96f2a626 100644 --- a/.vortex/tests/phpunit/Traits/SutTrait.php +++ b/.vortex/tests/phpunit/Traits/SutTrait.php @@ -459,6 +459,8 @@ protected function assertVortexFilesPresent(string $webroot = 'web'): void { // Docker configuration files. $this->assertFileExists('.docker/cli.dockerfile'); $this->assertFileExists('.docker/config/database/my.cnf'); + $this->assertFileExists('.docker/config/nginx/maintenance.conf'); + $this->assertFileExists('.docker/config/nginx/maintenance.html'); $this->assertFileExists('.docker/database.dockerfile'); $this->assertFileExists('.docker/nginx-drupal.dockerfile'); $this->assertFileExists('.docker/php.dockerfile'); diff --git a/docker-compose.yml b/docker-compose.yml index 9e6dc2233..6cef13e36 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -150,6 +150,8 @@ services: <<: *default-environment # FastCGI upstream; the base image defaults to 'php', the service is 'appserver'. NGINX_FASTCGI_PASS: appserver + # Pass-through 'VORTEX_WEBSERVER_MAINTENANCE_MODE' to serve the maintenance page locally with "VORTEX_WEBSERVER_MAINTENANCE_MODE=1 ahoy up webserver". + VORTEX_WEBSERVER_MAINTENANCE_MODE: ${VORTEX_WEBSERVER_MAINTENANCE_MODE:-} <<: [ *default-volumes, *default-user ] depends_on: - cli diff --git a/docs/deployment.md b/docs/deployment.md index b5c8043f8..5bc1e373b 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -50,6 +50,14 @@ To refresh the database in an existing Lagoon environment with production data: VORTEX_DEPLOY_BRANCH= VORTEX_DEPLOY_ACTION=deploy_override_db ahoy deploy ``` +### Maintenance page + +To serve a static maintenance page in place of the site, set the +`VORTEX_WEBSERVER_MAINTENANCE_MODE` variable to `1` on the environment and +redeploy it. The `webserver` container then answers every request with the +page in `.docker/config/nginx/maintenance.html`. See [Serve a maintenance +page](https://www.vortextemplate.com/docs/hosting/lagoon#serve-a-maintenance-page). + [//]: # (#;> HOSTING_LAGOON) ## Repeatable deploy hooks From 378bf48d7d37ffbbd53269fc8eef9eaf8aac6f5f Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Mon, 26 Oct 2026 07:55:54 +1100 Subject: [PATCH 04/52] Updated snapshots. --- .vortex/tests/phpunit/Fixtures/docker-compose.env.json | 1 + .vortex/tests/phpunit/Fixtures/docker-compose.env_local.json | 1 + .vortex/tests/phpunit/Fixtures/docker-compose.env_mod.json | 1 + .vortex/tests/phpunit/Fixtures/docker-compose.noenv.json | 1 + 4 files changed, 4 insertions(+) diff --git a/.vortex/tests/phpunit/Fixtures/docker-compose.env.json b/.vortex/tests/phpunit/Fixtures/docker-compose.env.json index f6f659179..8b2f11825 100644 --- a/.vortex/tests/phpunit/Fixtures/docker-compose.env.json +++ b/.vortex/tests/phpunit/Fixtures/docker-compose.env.json @@ -561,6 +561,7 @@ "NGINX_FASTCGI_PASS": "appserver", "SSMTP_MAILHUB": "127.0.0.1:1", "TZ": "UTC", + "VORTEX_WEBSERVER_MAINTENANCE_MODE": "", "XDEBUG_ENABLE": "" }, "labels": { diff --git a/.vortex/tests/phpunit/Fixtures/docker-compose.env_local.json b/.vortex/tests/phpunit/Fixtures/docker-compose.env_local.json index f6f659179..8b2f11825 100644 --- a/.vortex/tests/phpunit/Fixtures/docker-compose.env_local.json +++ b/.vortex/tests/phpunit/Fixtures/docker-compose.env_local.json @@ -561,6 +561,7 @@ "NGINX_FASTCGI_PASS": "appserver", "SSMTP_MAILHUB": "127.0.0.1:1", "TZ": "UTC", + "VORTEX_WEBSERVER_MAINTENANCE_MODE": "", "XDEBUG_ENABLE": "" }, "labels": { diff --git a/.vortex/tests/phpunit/Fixtures/docker-compose.env_mod.json b/.vortex/tests/phpunit/Fixtures/docker-compose.env_mod.json index 471b8c991..8e1a6e88d 100644 --- a/.vortex/tests/phpunit/Fixtures/docker-compose.env_mod.json +++ b/.vortex/tests/phpunit/Fixtures/docker-compose.env_mod.json @@ -561,6 +561,7 @@ "NGINX_FASTCGI_PASS": "appserver", "SSMTP_MAILHUB": "127.0.0.1:1", "TZ": "UTC", + "VORTEX_WEBSERVER_MAINTENANCE_MODE": "", "XDEBUG_ENABLE": "1" }, "labels": { diff --git a/.vortex/tests/phpunit/Fixtures/docker-compose.noenv.json b/.vortex/tests/phpunit/Fixtures/docker-compose.noenv.json index 192cde050..21696cc0e 100644 --- a/.vortex/tests/phpunit/Fixtures/docker-compose.noenv.json +++ b/.vortex/tests/phpunit/Fixtures/docker-compose.noenv.json @@ -561,6 +561,7 @@ "NGINX_FASTCGI_PASS": "appserver", "SSMTP_MAILHUB": "127.0.0.1:1", "TZ": "UTC", + "VORTEX_WEBSERVER_MAINTENANCE_MODE": "", "XDEBUG_ENABLE": "" }, "labels": { From 6477a131691317456f6cf447408f3a4ed7bdea74 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Mon, 26 Oct 2026 07:56:02 +1100 Subject: [PATCH 05/52] Updated snapshots. --- .../.docker/config/nginx/maintenance.conf | 29 +++++++++ .../.docker/config/nginx/maintenance.html | 60 +++++++++++++++++++ .../_baseline/.docker/nginx-drupal.dockerfile | 3 + .../.github/workflows/build-test-deploy.yml | 11 +++- .../_baseline/docker-compose.yml | 2 + .../ciprovider_circleci/.circleci/config.yml | 8 ++- .../.github/workflows/build-test-deploy.yml | 2 +- .../.circleci/config.yml | 8 ++- .../docker-compose.yml | 6 +- .../.github/workflows/build-test-deploy.yml | 17 ++++-- .../.circleci/config.yml | 8 ++- .../.github/workflows/build-test-deploy.yml | 6 +- .../.github/workflows/build-test-deploy.yml | 6 +- .../.github/workflows/build-test-deploy.yml | 2 +- .../.circleci/config.yml | 8 ++- .../.github/workflows/build-test-deploy.yml | 2 +- .../.circleci/config.yml | 8 ++- .../.github/workflows/build-test-deploy.yml | 6 +- .../.github/workflows/build-test-deploy.yml | 2 +- .../hosting_lagoon/docker-compose.yml | 14 ++--- .../hosting_lagoon/docs/deployment.md | 10 +++- .../.github/workflows/build-test-deploy.yml | 6 +- .../.github/workflows/build-test-deploy.yml | 2 +- .../docker-compose.yml | 14 ++--- .../docs/deployment.md | 10 +++- .../.circleci/config.yml | 8 ++- .../.github/workflows/build-test-deploy.yml | 2 +- .../docker-compose.yml | 14 ++--- .../docs/deployment.md | 10 +++- .../.github/workflows/build-test-deploy.yml | 2 +- .../migration_enabled/docker-compose.yml | 4 +- .../.circleci/config.yml | 8 ++- .../docker-compose.yml | 4 +- .../.github/workflows/build-test-deploy.yml | 4 +- .../docker-compose.yml | 14 ++--- .../docs/deployment.md | 10 +++- .../.github/workflows/build-test-deploy.yml | 2 +- .../docker-compose.yml | 4 +- .../.github/workflows/build-test-deploy.yml | 2 +- .../docker-compose.yml | 4 +- .../.github/workflows/build-test-deploy.yml | 2 +- .../docker-compose.yml | 4 +- .../.github/workflows/build-test-deploy.yml | 2 +- .../docker-compose.yml | 4 +- .../.github/workflows/build-test-deploy.yml | 2 +- .../docker-compose.yml | 4 +- .../.github/workflows/build-test-deploy.yml | 2 +- .../docker-compose.yml | 4 +- .../.github/workflows/build-test-deploy.yml | 2 +- .../.github/workflows/build-test-deploy.yml | 2 +- .../.docker/config/nginx/maintenance.html | 18 ++++++ .../docker-compose.yml | 4 +- .../docker-compose.yml | 4 +- .../.github/workflows/build-test-deploy.yml | 2 +- .../docker-compose.yml | 14 ++--- .../docs/deployment.md | 10 +++- .../.github/workflows/build-test-deploy.yml | 15 +++-- .../services_no_clamav/docker-compose.yml | 4 +- .../services_no_redis/docker-compose.yml | 4 +- .../services_no_solr/docker-compose.yml | 6 +- .../services_none/docker-compose.yml | 6 +- .../.github/workflows/build-test-deploy.yml | 2 +- .../.github/workflows/build-test-deploy.yml | 2 +- .../.github/workflows/build-test-deploy.yml | 2 +- .../timezone_circleci/.circleci/config.yml | 8 ++- .../.circleci/config.yml | 8 ++- .../.github/workflows/build-test-deploy.yml | 6 +- .../.circleci/config.yml | 8 ++- .../.github/workflows/build-test-deploy.yml | 4 +- .../.circleci/config.yml | 8 ++- .../.github/workflows/build-test-deploy.yml | 6 +- .../.circleci/config.yml | 8 ++- .../.github/workflows/build-test-deploy.yml | 2 +- .../.circleci/config.yml | 8 ++- .../.circleci/config.yml | 8 ++- .../.circleci/config.yml | 8 ++- .../.circleci/config.yml | 8 ++- .../.github/workflows/build-test-deploy.yml | 2 +- .../.circleci/config.yml | 8 ++- .../.github/workflows/build-test-deploy.yml | 4 +- .../.circleci/config.yml | 8 ++- .../.circleci/config.yml | 8 ++- .../.circleci/config.yml | 8 ++- .../.github/workflows/build-test-deploy.yml | 4 +- .../.circleci/config.yml | 8 ++- .../.circleci/config.yml | 8 ++- .../.circleci/config.yml | 8 ++- .../.github/workflows/build-test-deploy.yml | 2 +- .../.circleci/config.yml | 8 ++- .../.github/workflows/build-test-deploy.yml | 8 +-- 90 files changed, 454 insertions(+), 183 deletions(-) create mode 100644 .vortex/cli/tests/Fixtures/handler_process/_baseline/.docker/config/nginx/maintenance.conf create mode 100644 .vortex/cli/tests/Fixtures/handler_process/_baseline/.docker/config/nginx/maintenance.html create mode 100644 .vortex/cli/tests/Fixtures/handler_process/names/.docker/config/nginx/maintenance.html diff --git a/.vortex/cli/tests/Fixtures/handler_process/_baseline/.docker/config/nginx/maintenance.conf b/.vortex/cli/tests/Fixtures/handler_process/_baseline/.docker/config/nginx/maintenance.conf new file mode 100644 index 000000000..3423b908c --- /dev/null +++ b/.vortex/cli/tests/Fixtures/handler_process/_baseline/.docker/config/nginx/maintenance.conf @@ -0,0 +1,29 @@ +# Maintenance page. +# +# Answers every request with HTTP status 503 and the static maintenance page +# while VORTEX_WEBSERVER_MAINTENANCE_MODE is set to 1, so no request reaches +# PHP. +# +# The image entrypoint replaces the placeholder below with the variable's +# value when the container starts, so a changed value needs a new container. + +set $vortex_maintenance "${VORTEX_WEBSERVER_MAINTENANCE_MODE:-0}"; + +# nginx runs these directives again for the internal redirect to the error +# page, so the page URI is exempt. +if ($uri = /__maintenance.html) { + set $vortex_maintenance 0; +} + +if ($vortex_maintenance = 1) { + return 503; +} + +# A URI error page makes nginx serve the page as GET, so POST and other +# methods get the page instead of a 405 response. +error_page 503 /__maintenance.html; + +location = /__maintenance.html { + internal; + alias /etc/nginx/html/maintenance.html; +} diff --git a/.vortex/cli/tests/Fixtures/handler_process/_baseline/.docker/config/nginx/maintenance.html b/.vortex/cli/tests/Fixtures/handler_process/_baseline/.docker/config/nginx/maintenance.html new file mode 100644 index 000000000..b5578183b --- /dev/null +++ b/.vortex/cli/tests/Fixtures/handler_process/_baseline/.docker/config/nginx/maintenance.html @@ -0,0 +1,60 @@ + + + + + + Down for maintenance | star wars + + + +
+

We'll be back soon

+

star wars is down for maintenance. Please check back shortly.

+
+ + diff --git a/.vortex/cli/tests/Fixtures/handler_process/_baseline/.docker/nginx-drupal.dockerfile b/.vortex/cli/tests/Fixtures/handler_process/_baseline/.docker/nginx-drupal.dockerfile index f9baeb0d2..ee4ede565 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/_baseline/.docker/nginx-drupal.dockerfile +++ b/.vortex/cli/tests/Fixtures/handler_process/_baseline/.docker/nginx-drupal.dockerfile @@ -19,6 +19,9 @@ RUN apk add --no-cache tzdata COPY ./.docker/config/nginx/redirects-map.conf /etc/nginx/redirects-map.conf +COPY ./.docker/config/nginx/maintenance.conf /etc/nginx/conf.d/drupal/server_prepend-maintenance.conf +COPY ./.docker/config/nginx/maintenance.html /etc/nginx/html/maintenance.html + RUN fix-permissions /etc/nginx COPY --from=cli /app /app diff --git a/.vortex/cli/tests/Fixtures/handler_process/_baseline/.github/workflows/build-test-deploy.yml b/.vortex/cli/tests/Fixtures/handler_process/_baseline/.github/workflows/build-test-deploy.yml index fe91abae6..a00635dd1 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/_baseline/.github/workflows/build-test-deploy.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/_baseline/.github/workflows/build-test-deploy.yml @@ -296,10 +296,17 @@ jobs: - name: Export DB after fetch run: | if [ ! -f /tmp/fetch-db-success ]; then echo "==> Database fetch semaphore file is missing. DB export will not proceed."; exit 0; fi - docker compose exec cli mkdir -p .data && docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql || true + # The 'container_registry' source fetches an image without a dump file. + if [ -f .data/db.sql ]; then + docker compose exec cli mkdir -p .data + docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql + fi docker compose exec cli bash -c "VORTEX_PROVISION_POST_OPERATIONS_SKIP=1 ./vendor/bin/vortex-provision" ./vendor/bin/vortex-export-db db.sql - docker compose exec -T cli test -f /app/.data/db.sql && docker compose --progress quiet cp -L cli:/app/.data/db.sql .data/db.sql || true + if [ -z "${VORTEX_DB_IMAGE:-}" ] && docker compose exec -T cli test -f /app/.data/db.sql; then docker compose --progress quiet cp -L cli:/app/.data/db.sql .data/db.sql; fi + # 'hashFiles()' runs as the runner user outside the container, so the + # root-owned files in '.data' must be readable by others. + chmod -R a+rX .data timeout-minutes: 30 # Save the clean DB dump to cache from the primary parallel runner only, diff --git a/.vortex/cli/tests/Fixtures/handler_process/_baseline/docker-compose.yml b/.vortex/cli/tests/Fixtures/handler_process/_baseline/docker-compose.yml index c0e1a44db..d3fa75195 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/_baseline/docker-compose.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/_baseline/docker-compose.yml @@ -120,6 +120,8 @@ services: <<: *default-environment # FastCGI upstream; the base image defaults to 'php', the service is 'appserver'. NGINX_FASTCGI_PASS: appserver + # Pass-through 'VORTEX_WEBSERVER_MAINTENANCE_MODE' to serve the maintenance page locally with "VORTEX_WEBSERVER_MAINTENANCE_MODE=1 ahoy up webserver". + VORTEX_WEBSERVER_MAINTENANCE_MODE: ${VORTEX_WEBSERVER_MAINTENANCE_MODE:-} <<: [ *default-volumes, *default-user ] depends_on: - cli diff --git a/.vortex/cli/tests/Fixtures/handler_process/ciprovider_circleci/.circleci/config.yml b/.vortex/cli/tests/Fixtures/handler_process/ciprovider_circleci/.circleci/config.yml index 302935975..360d11518 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/ciprovider_circleci/.circleci/config.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/ciprovider_circleci/.circleci/config.yml @@ -291,10 +291,14 @@ jobs: name: Export DB after fetch command: | [ ! -f /tmp/fetch-db-success ] && echo "==> Database fetch semaphore file is missing. DB export will not proceed." && exit 0 - docker compose exec cli mkdir -p .data && docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql || true + # The 'container_registry' source fetches an image without a dump file. + if [ -f .data/db.sql ]; then + docker compose exec cli mkdir -p .data + docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql + fi docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli bash -c "VORTEX_PROVISION_POST_OPERATIONS_SKIP=1 ./vendor/bin/vortex-provision" ./vendor/bin/vortex-export-db db.sql - docker compose exec -T cli test -f /app/.data/db.sql && docker compose --progress quiet cp -L cli:/app/.data/db.sql .data/db.sql || true + [ -z "${VORTEX_DB_IMAGE:-}" ] && docker compose exec -T cli test -f /app/.data/db.sql && docker compose --progress quiet cp -L cli:/app/.data/db.sql .data/db.sql || true no_output_timeout: 30m # Save the clean DB dump to the cache before the slow dev-dependency diff --git a/.vortex/cli/tests/Fixtures/handler_process/code_coverage_provider_codecov/.github/workflows/build-test-deploy.yml b/.vortex/cli/tests/Fixtures/handler_process/code_coverage_provider_codecov/.github/workflows/build-test-deploy.yml index b292290b6..bb2d1efdb 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/code_coverage_provider_codecov/.github/workflows/build-test-deploy.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/code_coverage_provider_codecov/.github/workflows/build-test-deploy.yml @@ -1,4 +1,4 @@ -@@ -385,6 +385,17 @@ +@@ -392,6 +392,17 @@ hide_and_recreate: true diff --git a/.vortex/cli/tests/Fixtures/handler_process/code_coverage_provider_codecov_circleci/.circleci/config.yml b/.vortex/cli/tests/Fixtures/handler_process/code_coverage_provider_codecov_circleci/.circleci/config.yml index 3ad962a32..b914571d2 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/code_coverage_provider_codecov_circleci/.circleci/config.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/code_coverage_provider_codecov_circleci/.circleci/config.yml @@ -291,10 +291,14 @@ jobs: name: Export DB after fetch command: | [ ! -f /tmp/fetch-db-success ] && echo "==> Database fetch semaphore file is missing. DB export will not proceed." && exit 0 - docker compose exec cli mkdir -p .data && docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql || true + # The 'container_registry' source fetches an image without a dump file. + if [ -f .data/db.sql ]; then + docker compose exec cli mkdir -p .data + docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql + fi docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli bash -c "VORTEX_PROVISION_POST_OPERATIONS_SKIP=1 ./vendor/bin/vortex-provision" ./vendor/bin/vortex-export-db db.sql - docker compose exec -T cli test -f /app/.data/db.sql && docker compose --progress quiet cp -L cli:/app/.data/db.sql .data/db.sql || true + [ -z "${VORTEX_DB_IMAGE:-}" ] && docker compose exec -T cli test -f /app/.data/db.sql && docker compose --progress quiet cp -L cli:/app/.data/db.sql .data/db.sql || true no_output_timeout: 30m # Save the clean DB dump to the cache before the slow dev-dependency diff --git a/.vortex/cli/tests/Fixtures/handler_process/custom_modules_search_without_solr/docker-compose.yml b/.vortex/cli/tests/Fixtures/handler_process/custom_modules_search_without_solr/docker-compose.yml index b6bf68a1a..d0cb4804e 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/custom_modules_search_without_solr/docker-compose.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/custom_modules_search_without_solr/docker-compose.yml @@ -1,4 +1,4 @@ -@@ -158,17 +158,6 @@ +@@ -160,17 +160,6 @@ cache: image: uselagoon/valkey-8:__VERSION__ @@ -16,7 +16,7 @@ antivirus: build: context: . -@@ -199,13 +188,10 @@ +@@ -201,13 +190,10 @@ - antivirus - database - cache @@ -30,7 +30,7 @@ networks: ### Use external networks locally. Automatically removed in CI. amazeeio-network: ### Automatically removed in CI. -@@ -214,7 +200,6 @@ +@@ -216,7 +202,6 @@ volumes: app: {} files: {} diff --git a/.vortex/cli/tests/Fixtures/handler_process/db_fetch_source_container_registry/.github/workflows/build-test-deploy.yml b/.vortex/cli/tests/Fixtures/handler_process/db_fetch_source_container_registry/.github/workflows/build-test-deploy.yml index e2d47d50c..e5b679b4e 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/db_fetch_source_container_registry/.github/workflows/build-test-deploy.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/db_fetch_source_container_registry/.github/workflows/build-test-deploy.yml @@ -1,14 +1,23 @@ -@@ -296,11 +296,17 @@ +@@ -296,6 +296,7 @@ - name: Export DB after fetch run: | if [ ! -f /tmp/fetch-db-success ]; then echo "==> Database fetch semaphore file is missing. DB export will not proceed."; exit 0; fi + if [ "${STRATEGY_JOB_TOTAL}" -gt 1 ] && [ "${STRATEGY_JOB_INDEX}" -ne 0 ]; then export VORTEX_EXPORT_DB_CONTAINER_REGISTRY_PUSH_PROCEED=0; fi - docker compose exec cli mkdir -p .data && docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql || true + # The 'container_registry' source fetches an image without a dump file. + if [ -f .data/db.sql ]; then + docker compose exec cli mkdir -p .data +@@ -302,12 +303,18 @@ + docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql + fi docker compose exec cli bash -c "VORTEX_PROVISION_POST_OPERATIONS_SKIP=1 ./vendor/bin/vortex-provision" -+ grep -q ^VORTEX_DB_IMAGE .env && rm .data/db.sql || true ++ # Database-in-image storage caches the exported image archive instead of the dump. ++ if [ -n "${VORTEX_DB_IMAGE:-}" ]; then rm -f .data/db.sql; fi ./vendor/bin/vortex-export-db db.sql + if [ -n "${VORTEX_DB_IMAGE:-}" ]; then ./vendor/bin/vortex-push-db-image; fi - docker compose exec -T cli test -f /app/.data/db.sql && docker compose --progress quiet cp -L cli:/app/.data/db.sql .data/db.sql || true + if [ -z "${VORTEX_DB_IMAGE:-}" ] && docker compose exec -T cli test -f /app/.data/db.sql; then docker compose --progress quiet cp -L cli:/app/.data/db.sql .data/db.sql; fi + # 'hashFiles()' runs as the runner user outside the container, so the + # root-owned files in '.data' must be readable by others. + chmod -R a+rX .data timeout-minutes: 30 + env: + STRATEGY_JOB_TOTAL: ${{ strategy.job-total }} diff --git a/.vortex/cli/tests/Fixtures/handler_process/deploy_types_all_circleci/.circleci/config.yml b/.vortex/cli/tests/Fixtures/handler_process/deploy_types_all_circleci/.circleci/config.yml index c222fdadb..ce399aef7 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/deploy_types_all_circleci/.circleci/config.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/deploy_types_all_circleci/.circleci/config.yml @@ -297,10 +297,14 @@ jobs: name: Export DB after fetch command: | [ ! -f /tmp/fetch-db-success ] && echo "==> Database fetch semaphore file is missing. DB export will not proceed." && exit 0 - docker compose exec cli mkdir -p .data && docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql || true + # The 'container_registry' source fetches an image without a dump file. + if [ -f .data/db.sql ]; then + docker compose exec cli mkdir -p .data + docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql + fi docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli bash -c "VORTEX_PROVISION_POST_OPERATIONS_SKIP=1 ./vendor/bin/vortex-provision" ./vendor/bin/vortex-export-db db.sql - docker compose exec -T cli test -f /app/.data/db.sql && docker compose --progress quiet cp -L cli:/app/.data/db.sql .data/db.sql || true + [ -z "${VORTEX_DB_IMAGE:-}" ] && docker compose exec -T cli test -f /app/.data/db.sql && docker compose --progress quiet cp -L cli:/app/.data/db.sql .data/db.sql || true no_output_timeout: 30m # Save the clean DB dump to the cache before the slow dev-dependency diff --git a/.vortex/cli/tests/Fixtures/handler_process/deploy_types_all_gha/.github/workflows/build-test-deploy.yml b/.vortex/cli/tests/Fixtures/handler_process/deploy_types_all_gha/.github/workflows/build-test-deploy.yml index 56546ca20..bc73d615c 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/deploy_types_all_gha/.github/workflows/build-test-deploy.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/deploy_types_all_gha/.github/workflows/build-test-deploy.yml @@ -1,4 +1,4 @@ -@@ -520,6 +520,24 @@ +@@ -527,6 +527,24 @@ - name: Build stack run: docker compose up --detach && docker builder prune --all --force && docker image prune --force @@ -23,7 +23,7 @@ deploy: runs-on: ubuntu-latest needs: [test, lint, build] -@@ -574,6 +592,20 @@ +@@ -581,6 +599,20 @@ - name: Load environment variables from .env run: t=$(mktemp) && export -p >"${t}" && set -a && . ./.env && set +a && . "${t}" && env >> "$GITHUB_ENV" @@ -44,7 +44,7 @@ - name: Add SSH private key to the runner if: ${{ env.VORTEX_DEPLOY_SSH_PRIVATE_KEY != '' }} uses: shimataro/ssh-key-action@__HASH__ # __VERSION__ -@@ -594,6 +626,11 @@ +@@ -601,6 +633,11 @@ VORTEX_DEPLOY_PR: ${{ env.DEPLOY_PR_NUMBER || github.event.number }} VORTEX_DEPLOY_PR_HEAD: ${{ env.DEPLOY_PR_HEAD_SHA || github.event.pull_request.head.sha }} VORTEX_DEPLOY_PR_LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }} diff --git a/.vortex/cli/tests/Fixtures/handler_process/deploy_types_artifact/.github/workflows/build-test-deploy.yml b/.vortex/cli/tests/Fixtures/handler_process/deploy_types_artifact/.github/workflows/build-test-deploy.yml index 2a1d45054..d3b40dd8d 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/deploy_types_artifact/.github/workflows/build-test-deploy.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/deploy_types_artifact/.github/workflows/build-test-deploy.yml @@ -1,4 +1,4 @@ -@@ -520,6 +520,24 @@ +@@ -527,6 +527,24 @@ - name: Build stack run: docker compose up --detach && docker builder prune --all --force && docker image prune --force @@ -23,7 +23,7 @@ deploy: runs-on: ubuntu-latest needs: [test, lint, build] -@@ -574,6 +592,20 @@ +@@ -581,6 +599,20 @@ - name: Load environment variables from .env run: t=$(mktemp) && export -p >"${t}" && set -a && . ./.env && set +a && . "${t}" && env >> "$GITHUB_ENV" @@ -44,7 +44,7 @@ - name: Add SSH private key to the runner if: ${{ env.VORTEX_DEPLOY_SSH_PRIVATE_KEY != '' }} uses: shimataro/ssh-key-action@__HASH__ # __VERSION__ -@@ -594,7 +626,11 @@ +@@ -601,7 +633,11 @@ VORTEX_DEPLOY_PR: ${{ env.DEPLOY_PR_NUMBER || github.event.number }} VORTEX_DEPLOY_PR_HEAD: ${{ env.DEPLOY_PR_HEAD_SHA || github.event.pull_request.head.sha }} VORTEX_DEPLOY_PR_LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }} diff --git a/.vortex/cli/tests/Fixtures/handler_process/deploy_types_lagoon/.github/workflows/build-test-deploy.yml b/.vortex/cli/tests/Fixtures/handler_process/deploy_types_lagoon/.github/workflows/build-test-deploy.yml index f923f62ab..59d75e600 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/deploy_types_lagoon/.github/workflows/build-test-deploy.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/deploy_types_lagoon/.github/workflows/build-test-deploy.yml @@ -1,4 +1,4 @@ -@@ -594,7 +594,6 @@ +@@ -601,7 +601,6 @@ VORTEX_DEPLOY_PR: ${{ env.DEPLOY_PR_NUMBER || github.event.number }} VORTEX_DEPLOY_PR_HEAD: ${{ env.DEPLOY_PR_HEAD_SHA || github.event.pull_request.head.sha }} VORTEX_DEPLOY_PR_LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }} diff --git a/.vortex/cli/tests/Fixtures/handler_process/deploy_types_none_circleci/.circleci/config.yml b/.vortex/cli/tests/Fixtures/handler_process/deploy_types_none_circleci/.circleci/config.yml index e688c7544..f74e8bb38 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/deploy_types_none_circleci/.circleci/config.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/deploy_types_none_circleci/.circleci/config.yml @@ -286,10 +286,14 @@ jobs: name: Export DB after fetch command: | [ ! -f /tmp/fetch-db-success ] && echo "==> Database fetch semaphore file is missing. DB export will not proceed." && exit 0 - docker compose exec cli mkdir -p .data && docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql || true + # The 'container_registry' source fetches an image without a dump file. + if [ -f .data/db.sql ]; then + docker compose exec cli mkdir -p .data + docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql + fi docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli bash -c "VORTEX_PROVISION_POST_OPERATIONS_SKIP=1 ./vendor/bin/vortex-provision" ./vendor/bin/vortex-export-db db.sql - docker compose exec -T cli test -f /app/.data/db.sql && docker compose --progress quiet cp -L cli:/app/.data/db.sql .data/db.sql || true + [ -z "${VORTEX_DB_IMAGE:-}" ] && docker compose exec -T cli test -f /app/.data/db.sql && docker compose --progress quiet cp -L cli:/app/.data/db.sql .data/db.sql || true no_output_timeout: 30m # Save the clean DB dump to the cache before the slow dev-dependency diff --git a/.vortex/cli/tests/Fixtures/handler_process/deploy_types_none_gha/.github/workflows/build-test-deploy.yml b/.vortex/cli/tests/Fixtures/handler_process/deploy_types_none_gha/.github/workflows/build-test-deploy.yml index f2972a8ec..8bbf61d3a 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/deploy_types_none_gha/.github/workflows/build-test-deploy.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/deploy_types_none_gha/.github/workflows/build-test-deploy.yml @@ -1,4 +1,4 @@ -@@ -458,147 +458,3 @@ +@@ -465,147 +465,3 @@ timeout-minutes: 120 # Cancel the action after 120 minutes, regardless of whether a connection has been established. with: detached: true diff --git a/.vortex/cli/tests/Fixtures/handler_process/deps_updates_provider_ci_circleci/.circleci/config.yml b/.vortex/cli/tests/Fixtures/handler_process/deps_updates_provider_ci_circleci/.circleci/config.yml index 302935975..360d11518 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/deps_updates_provider_ci_circleci/.circleci/config.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/deps_updates_provider_ci_circleci/.circleci/config.yml @@ -291,10 +291,14 @@ jobs: name: Export DB after fetch command: | [ ! -f /tmp/fetch-db-success ] && echo "==> Database fetch semaphore file is missing. DB export will not proceed." && exit 0 - docker compose exec cli mkdir -p .data && docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql || true + # The 'container_registry' source fetches an image without a dump file. + if [ -f .data/db.sql ]; then + docker compose exec cli mkdir -p .data + docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql + fi docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli bash -c "VORTEX_PROVISION_POST_OPERATIONS_SKIP=1 ./vendor/bin/vortex-provision" ./vendor/bin/vortex-export-db db.sql - docker compose exec -T cli test -f /app/.data/db.sql && docker compose --progress quiet cp -L cli:/app/.data/db.sql .data/db.sql || true + [ -z "${VORTEX_DB_IMAGE:-}" ] && docker compose exec -T cli test -f /app/.data/db.sql && docker compose --progress quiet cp -L cli:/app/.data/db.sql .data/db.sql || true no_output_timeout: 30m # Save the clean DB dump to the cache before the slow dev-dependency diff --git a/.vortex/cli/tests/Fixtures/handler_process/hosting_acquia/.github/workflows/build-test-deploy.yml b/.vortex/cli/tests/Fixtures/handler_process/hosting_acquia/.github/workflows/build-test-deploy.yml index 105e8dd36..b11a58b30 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/hosting_acquia/.github/workflows/build-test-deploy.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/hosting_acquia/.github/workflows/build-test-deploy.yml @@ -8,7 +8,7 @@ - name: Build stack run: docker compose up --detach && docker builder prune --all --force && docker image prune --force -@@ -520,6 +523,24 @@ +@@ -527,6 +530,24 @@ - name: Build stack run: docker compose up --detach && docker builder prune --all --force && docker image prune --force @@ -33,7 +33,7 @@ deploy: runs-on: ubuntu-latest needs: [test, lint, build] -@@ -574,6 +595,20 @@ +@@ -581,6 +602,20 @@ - name: Load environment variables from .env run: t=$(mktemp) && export -p >"${t}" && set -a && . ./.env && set +a && . "${t}" && env >> "$GITHUB_ENV" @@ -54,7 +54,7 @@ - name: Add SSH private key to the runner if: ${{ env.VORTEX_DEPLOY_SSH_PRIVATE_KEY != '' }} uses: shimataro/ssh-key-action@__HASH__ # __VERSION__ -@@ -594,7 +629,11 @@ +@@ -601,7 +636,11 @@ VORTEX_DEPLOY_PR: ${{ env.DEPLOY_PR_NUMBER || github.event.number }} VORTEX_DEPLOY_PR_HEAD: ${{ env.DEPLOY_PR_HEAD_SHA || github.event.pull_request.head.sha }} VORTEX_DEPLOY_PR_LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }} diff --git a/.vortex/cli/tests/Fixtures/handler_process/hosting_lagoon/.github/workflows/build-test-deploy.yml b/.vortex/cli/tests/Fixtures/handler_process/hosting_lagoon/.github/workflows/build-test-deploy.yml index 5de23e520..2919b1443 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/hosting_lagoon/.github/workflows/build-test-deploy.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/hosting_lagoon/.github/workflows/build-test-deploy.yml @@ -14,7 +14,7 @@ # On the first build of the day (cache miss), fetch a fresh DB dump. # On subsequent builds, the restored cache already contains the dump and # the fetch script skips itself, leaving no semaphore file behind. -@@ -594,7 +603,6 @@ +@@ -601,7 +610,6 @@ VORTEX_DEPLOY_PR: ${{ env.DEPLOY_PR_NUMBER || github.event.number }} VORTEX_DEPLOY_PR_HEAD: ${{ env.DEPLOY_PR_HEAD_SHA || github.event.pull_request.head.sha }} VORTEX_DEPLOY_PR_LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }} diff --git a/.vortex/cli/tests/Fixtures/handler_process/hosting_lagoon/docker-compose.yml b/.vortex/cli/tests/Fixtures/handler_process/hosting_lagoon/docker-compose.yml index a5a8de480..9d3ec7d3a 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/hosting_lagoon/docker-compose.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/hosting_lagoon/docker-compose.yml @@ -17,7 +17,7 @@ webserver: build: -@@ -127,6 +132,11 @@ +@@ -129,6 +134,11 @@ networks: - default # This is a standard network and is used for all other environments, where requests routing is not required and/or not supported. - amazeeio-network ### This network is supported by Pygmy and used to route all requests to host machine locally. Removed in CI. @@ -29,7 +29,7 @@ # PHP FPM container. All web requests are going through this container. appserver: -@@ -142,6 +152,11 @@ +@@ -144,6 +154,11 @@ <<: [ *default-volumes, *default-user ] depends_on: - cli @@ -41,7 +41,7 @@ database: build: -@@ -154,9 +169,13 @@ +@@ -156,9 +171,13 @@ <<: *default-user ports: - '3306' # Database port in a container. Find port on host with `ahoy info` or `docker compose port database 3306`. @@ -55,7 +55,7 @@ search: build: -@@ -168,6 +187,8 @@ +@@ -170,6 +189,8 @@ - search:/var/solr ports: - '8983' # Solr port in a container. Find port on host with `ahoy info` or `docker compose port search 8983`. @@ -64,7 +64,7 @@ antivirus: build: -@@ -179,6 +200,10 @@ +@@ -181,6 +202,10 @@ - '3310' # Find port on host with `docker compose port antivirus 3310`. networks: - default @@ -75,7 +75,7 @@ # Browser container, used for browser testing. browser: -@@ -191,6 +216,8 @@ +@@ -193,6 +218,8 @@ ports: - '7900' # Find port on host with `docker compose port browser 7900`. shm_size: '1gb' # Increase '/dev/shm' partition size to avoid browser crashing. @@ -84,7 +84,7 @@ # Helper container to wait for services to become available. wait-for-dependencies: -@@ -206,6 +233,8 @@ +@@ -208,6 +235,8 @@ - cache:6379 - search:8983 - curl -s "http://search:8983/solr/drupal/select?q=*:*&rows=0&wt=json" | grep response diff --git a/.vortex/cli/tests/Fixtures/handler_process/hosting_lagoon/docs/deployment.md b/.vortex/cli/tests/Fixtures/handler_process/hosting_lagoon/docs/deployment.md index d9c8733df..34e92deb4 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/hosting_lagoon/docs/deployment.md +++ b/.vortex/cli/tests/Fixtures/handler_process/hosting_lagoon/docs/deployment.md @@ -1,4 +1,4 @@ -@@ -3,6 +3,21 @@ +@@ -3,6 +3,29 @@ For information on how deployment works, see [Vortex Deployment Documentation](https://www.vortextemplate.com/docs/deployment). @@ -16,6 +16,14 @@ +```bash +VORTEX_DEPLOY_BRANCH= VORTEX_DEPLOY_ACTION=deploy_override_db ahoy deploy +``` ++ ++### Maintenance page ++ ++To serve a static maintenance page in place of the site, set the ++`VORTEX_WEBSERVER_MAINTENANCE_MODE` variable to `1` on the environment and ++redeploy it. The `webserver` container then answers every request with the ++page in `.docker/config/nginx/maintenance.html`. See [Serve a maintenance ++page](https://www.vortextemplate.com/docs/hosting/lagoon#serve-a-maintenance-page). + ## Repeatable deploy hooks diff --git a/.vortex/cli/tests/Fixtures/handler_process/hosting_project_name___acquia/.github/workflows/build-test-deploy.yml b/.vortex/cli/tests/Fixtures/handler_process/hosting_project_name___acquia/.github/workflows/build-test-deploy.yml index 105e8dd36..b11a58b30 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/hosting_project_name___acquia/.github/workflows/build-test-deploy.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/hosting_project_name___acquia/.github/workflows/build-test-deploy.yml @@ -8,7 +8,7 @@ - name: Build stack run: docker compose up --detach && docker builder prune --all --force && docker image prune --force -@@ -520,6 +523,24 @@ +@@ -527,6 +530,24 @@ - name: Build stack run: docker compose up --detach && docker builder prune --all --force && docker image prune --force @@ -33,7 +33,7 @@ deploy: runs-on: ubuntu-latest needs: [test, lint, build] -@@ -574,6 +595,20 @@ +@@ -581,6 +602,20 @@ - name: Load environment variables from .env run: t=$(mktemp) && export -p >"${t}" && set -a && . ./.env && set +a && . "${t}" && env >> "$GITHUB_ENV" @@ -54,7 +54,7 @@ - name: Add SSH private key to the runner if: ${{ env.VORTEX_DEPLOY_SSH_PRIVATE_KEY != '' }} uses: shimataro/ssh-key-action@__HASH__ # __VERSION__ -@@ -594,7 +629,11 @@ +@@ -601,7 +636,11 @@ VORTEX_DEPLOY_PR: ${{ env.DEPLOY_PR_NUMBER || github.event.number }} VORTEX_DEPLOY_PR_HEAD: ${{ env.DEPLOY_PR_HEAD_SHA || github.event.pull_request.head.sha }} VORTEX_DEPLOY_PR_LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }} diff --git a/.vortex/cli/tests/Fixtures/handler_process/hosting_project_name___lagoon/.github/workflows/build-test-deploy.yml b/.vortex/cli/tests/Fixtures/handler_process/hosting_project_name___lagoon/.github/workflows/build-test-deploy.yml index 5de23e520..2919b1443 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/hosting_project_name___lagoon/.github/workflows/build-test-deploy.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/hosting_project_name___lagoon/.github/workflows/build-test-deploy.yml @@ -14,7 +14,7 @@ # On the first build of the day (cache miss), fetch a fresh DB dump. # On subsequent builds, the restored cache already contains the dump and # the fetch script skips itself, leaving no semaphore file behind. -@@ -594,7 +603,6 @@ +@@ -601,7 +610,6 @@ VORTEX_DEPLOY_PR: ${{ env.DEPLOY_PR_NUMBER || github.event.number }} VORTEX_DEPLOY_PR_HEAD: ${{ env.DEPLOY_PR_HEAD_SHA || github.event.pull_request.head.sha }} VORTEX_DEPLOY_PR_LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }} diff --git a/.vortex/cli/tests/Fixtures/handler_process/hosting_project_name___lagoon/docker-compose.yml b/.vortex/cli/tests/Fixtures/handler_process/hosting_project_name___lagoon/docker-compose.yml index a5a8de480..9d3ec7d3a 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/hosting_project_name___lagoon/docker-compose.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/hosting_project_name___lagoon/docker-compose.yml @@ -17,7 +17,7 @@ webserver: build: -@@ -127,6 +132,11 @@ +@@ -129,6 +134,11 @@ networks: - default # This is a standard network and is used for all other environments, where requests routing is not required and/or not supported. - amazeeio-network ### This network is supported by Pygmy and used to route all requests to host machine locally. Removed in CI. @@ -29,7 +29,7 @@ # PHP FPM container. All web requests are going through this container. appserver: -@@ -142,6 +152,11 @@ +@@ -144,6 +154,11 @@ <<: [ *default-volumes, *default-user ] depends_on: - cli @@ -41,7 +41,7 @@ database: build: -@@ -154,9 +169,13 @@ +@@ -156,9 +171,13 @@ <<: *default-user ports: - '3306' # Database port in a container. Find port on host with `ahoy info` or `docker compose port database 3306`. @@ -55,7 +55,7 @@ search: build: -@@ -168,6 +187,8 @@ +@@ -170,6 +189,8 @@ - search:/var/solr ports: - '8983' # Solr port in a container. Find port on host with `ahoy info` or `docker compose port search 8983`. @@ -64,7 +64,7 @@ antivirus: build: -@@ -179,6 +200,10 @@ +@@ -181,6 +202,10 @@ - '3310' # Find port on host with `docker compose port antivirus 3310`. networks: - default @@ -75,7 +75,7 @@ # Browser container, used for browser testing. browser: -@@ -191,6 +216,8 @@ +@@ -193,6 +218,8 @@ ports: - '7900' # Find port on host with `docker compose port browser 7900`. shm_size: '1gb' # Increase '/dev/shm' partition size to avoid browser crashing. @@ -84,7 +84,7 @@ # Helper container to wait for services to become available. wait-for-dependencies: -@@ -206,6 +233,8 @@ +@@ -208,6 +235,8 @@ - cache:6379 - search:8983 - curl -s "http://search:8983/solr/drupal/select?q=*:*&rows=0&wt=json" | grep response diff --git a/.vortex/cli/tests/Fixtures/handler_process/hosting_project_name___lagoon/docs/deployment.md b/.vortex/cli/tests/Fixtures/handler_process/hosting_project_name___lagoon/docs/deployment.md index d9c8733df..34e92deb4 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/hosting_project_name___lagoon/docs/deployment.md +++ b/.vortex/cli/tests/Fixtures/handler_process/hosting_project_name___lagoon/docs/deployment.md @@ -1,4 +1,4 @@ -@@ -3,6 +3,21 @@ +@@ -3,6 +3,29 @@ For information on how deployment works, see [Vortex Deployment Documentation](https://www.vortextemplate.com/docs/deployment). @@ -16,6 +16,14 @@ +```bash +VORTEX_DEPLOY_BRANCH= VORTEX_DEPLOY_ACTION=deploy_override_db ahoy deploy +``` ++ ++### Maintenance page ++ ++To serve a static maintenance page in place of the site, set the ++`VORTEX_WEBSERVER_MAINTENANCE_MODE` variable to `1` on the environment and ++redeploy it. The `webserver` container then answers every request with the ++page in `.docker/config/nginx/maintenance.html`. See [Serve a maintenance ++page](https://www.vortextemplate.com/docs/hosting/lagoon#serve-a-maintenance-page). + ## Repeatable deploy hooks diff --git a/.vortex/cli/tests/Fixtures/handler_process/migration_disabled_circleci/.circleci/config.yml b/.vortex/cli/tests/Fixtures/handler_process/migration_disabled_circleci/.circleci/config.yml index 302935975..360d11518 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/migration_disabled_circleci/.circleci/config.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/migration_disabled_circleci/.circleci/config.yml @@ -291,10 +291,14 @@ jobs: name: Export DB after fetch command: | [ ! -f /tmp/fetch-db-success ] && echo "==> Database fetch semaphore file is missing. DB export will not proceed." && exit 0 - docker compose exec cli mkdir -p .data && docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql || true + # The 'container_registry' source fetches an image without a dump file. + if [ -f .data/db.sql ]; then + docker compose exec cli mkdir -p .data + docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql + fi docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli bash -c "VORTEX_PROVISION_POST_OPERATIONS_SKIP=1 ./vendor/bin/vortex-provision" ./vendor/bin/vortex-export-db db.sql - docker compose exec -T cli test -f /app/.data/db.sql && docker compose --progress quiet cp -L cli:/app/.data/db.sql .data/db.sql || true + [ -z "${VORTEX_DB_IMAGE:-}" ] && docker compose exec -T cli test -f /app/.data/db.sql && docker compose --progress quiet cp -L cli:/app/.data/db.sql .data/db.sql || true no_output_timeout: 30m # Save the clean DB dump to the cache before the slow dev-dependency diff --git a/.vortex/cli/tests/Fixtures/handler_process/migration_disabled_lagoon/.github/workflows/build-test-deploy.yml b/.vortex/cli/tests/Fixtures/handler_process/migration_disabled_lagoon/.github/workflows/build-test-deploy.yml index 5de23e520..2919b1443 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/migration_disabled_lagoon/.github/workflows/build-test-deploy.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/migration_disabled_lagoon/.github/workflows/build-test-deploy.yml @@ -14,7 +14,7 @@ # On the first build of the day (cache miss), fetch a fresh DB dump. # On subsequent builds, the restored cache already contains the dump and # the fetch script skips itself, leaving no semaphore file behind. -@@ -594,7 +603,6 @@ +@@ -601,7 +610,6 @@ VORTEX_DEPLOY_PR: ${{ env.DEPLOY_PR_NUMBER || github.event.number }} VORTEX_DEPLOY_PR_HEAD: ${{ env.DEPLOY_PR_HEAD_SHA || github.event.pull_request.head.sha }} VORTEX_DEPLOY_PR_LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }} diff --git a/.vortex/cli/tests/Fixtures/handler_process/migration_disabled_lagoon/docker-compose.yml b/.vortex/cli/tests/Fixtures/handler_process/migration_disabled_lagoon/docker-compose.yml index a5a8de480..9d3ec7d3a 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/migration_disabled_lagoon/docker-compose.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/migration_disabled_lagoon/docker-compose.yml @@ -17,7 +17,7 @@ webserver: build: -@@ -127,6 +132,11 @@ +@@ -129,6 +134,11 @@ networks: - default # This is a standard network and is used for all other environments, where requests routing is not required and/or not supported. - amazeeio-network ### This network is supported by Pygmy and used to route all requests to host machine locally. Removed in CI. @@ -29,7 +29,7 @@ # PHP FPM container. All web requests are going through this container. appserver: -@@ -142,6 +152,11 @@ +@@ -144,6 +154,11 @@ <<: [ *default-volumes, *default-user ] depends_on: - cli @@ -41,7 +41,7 @@ database: build: -@@ -154,9 +169,13 @@ +@@ -156,9 +171,13 @@ <<: *default-user ports: - '3306' # Database port in a container. Find port on host with `ahoy info` or `docker compose port database 3306`. @@ -55,7 +55,7 @@ search: build: -@@ -168,6 +187,8 @@ +@@ -170,6 +189,8 @@ - search:/var/solr ports: - '8983' # Solr port in a container. Find port on host with `ahoy info` or `docker compose port search 8983`. @@ -64,7 +64,7 @@ antivirus: build: -@@ -179,6 +200,10 @@ +@@ -181,6 +202,10 @@ - '3310' # Find port on host with `docker compose port antivirus 3310`. networks: - default @@ -75,7 +75,7 @@ # Browser container, used for browser testing. browser: -@@ -191,6 +216,8 @@ +@@ -193,6 +218,8 @@ ports: - '7900' # Find port on host with `docker compose port browser 7900`. shm_size: '1gb' # Increase '/dev/shm' partition size to avoid browser crashing. @@ -84,7 +84,7 @@ # Helper container to wait for services to become available. wait-for-dependencies: -@@ -206,6 +233,8 @@ +@@ -208,6 +235,8 @@ - cache:6379 - search:8983 - curl -s "http://search:8983/solr/drupal/select?q=*:*&rows=0&wt=json" | grep response diff --git a/.vortex/cli/tests/Fixtures/handler_process/migration_disabled_lagoon/docs/deployment.md b/.vortex/cli/tests/Fixtures/handler_process/migration_disabled_lagoon/docs/deployment.md index d9c8733df..34e92deb4 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/migration_disabled_lagoon/docs/deployment.md +++ b/.vortex/cli/tests/Fixtures/handler_process/migration_disabled_lagoon/docs/deployment.md @@ -1,4 +1,4 @@ -@@ -3,6 +3,21 @@ +@@ -3,6 +3,29 @@ For information on how deployment works, see [Vortex Deployment Documentation](https://www.vortextemplate.com/docs/deployment). @@ -16,6 +16,14 @@ +```bash +VORTEX_DEPLOY_BRANCH= VORTEX_DEPLOY_ACTION=deploy_override_db ahoy deploy +``` ++ ++### Maintenance page ++ ++To serve a static maintenance page in place of the site, set the ++`VORTEX_WEBSERVER_MAINTENANCE_MODE` variable to `1` on the environment and ++redeploy it. The `webserver` container then answers every request with the ++page in `.docker/config/nginx/maintenance.html`. See [Serve a maintenance ++page](https://www.vortextemplate.com/docs/hosting/lagoon#serve-a-maintenance-page). + ## Repeatable deploy hooks diff --git a/.vortex/cli/tests/Fixtures/handler_process/migration_enabled/.github/workflows/build-test-deploy.yml b/.vortex/cli/tests/Fixtures/handler_process/migration_enabled/.github/workflows/build-test-deploy.yml index 6671189d8..39a9467cf 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/migration_enabled/.github/workflows/build-test-deploy.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/migration_enabled/.github/workflows/build-test-deploy.yml @@ -8,7 +8,7 @@ - name: Build stack run: docker compose up --detach && docker builder prune --all --force && docker image prune --force -@@ -326,6 +329,11 @@ +@@ -333,6 +336,11 @@ docker compose exec cli mkdir -p .data docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql rm -f .data/db.sql diff --git a/.vortex/cli/tests/Fixtures/handler_process/migration_enabled/docker-compose.yml b/.vortex/cli/tests/Fixtures/handler_process/migration_enabled/docker-compose.yml index b7040520b..47a76b893 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/migration_enabled/docker-compose.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/migration_enabled/docker-compose.yml @@ -15,7 +15,7 @@ # The default user under which the containers should run. x-user: &default-user -@@ -155,6 +165,19 @@ +@@ -157,6 +167,19 @@ ports: - '3306' # Database port in a container. Find port on host with `ahoy info` or `docker compose port database 3306`. @@ -35,7 +35,7 @@ cache: image: uselagoon/valkey-8:__VERSION__ -@@ -198,11 +221,13 @@ +@@ -200,11 +223,13 @@ depends_on: - antivirus - database diff --git a/.vortex/cli/tests/Fixtures/handler_process/migration_enabled_circleci/.circleci/config.yml b/.vortex/cli/tests/Fixtures/handler_process/migration_enabled_circleci/.circleci/config.yml index 5a60f1909..648f07209 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/migration_enabled_circleci/.circleci/config.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/migration_enabled_circleci/.circleci/config.yml @@ -296,10 +296,14 @@ jobs: name: Export DB after fetch command: | [ ! -f /tmp/fetch-db-success ] && echo "==> Database fetch semaphore file is missing. DB export will not proceed." && exit 0 - docker compose exec cli mkdir -p .data && docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql || true + # The 'container_registry' source fetches an image without a dump file. + if [ -f .data/db.sql ]; then + docker compose exec cli mkdir -p .data + docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql + fi docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli bash -c "VORTEX_PROVISION_POST_OPERATIONS_SKIP=1 ./vendor/bin/vortex-provision" ./vendor/bin/vortex-export-db db.sql - docker compose exec -T cli test -f /app/.data/db.sql && docker compose --progress quiet cp -L cli:/app/.data/db.sql .data/db.sql || true + [ -z "${VORTEX_DB_IMAGE:-}" ] && docker compose exec -T cli test -f /app/.data/db.sql && docker compose --progress quiet cp -L cli:/app/.data/db.sql .data/db.sql || true no_output_timeout: 30m # Save the clean DB dump to the cache before the slow dev-dependency diff --git a/.vortex/cli/tests/Fixtures/handler_process/migration_enabled_circleci/docker-compose.yml b/.vortex/cli/tests/Fixtures/handler_process/migration_enabled_circleci/docker-compose.yml index b7040520b..47a76b893 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/migration_enabled_circleci/docker-compose.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/migration_enabled_circleci/docker-compose.yml @@ -15,7 +15,7 @@ # The default user under which the containers should run. x-user: &default-user -@@ -155,6 +165,19 @@ +@@ -157,6 +167,19 @@ ports: - '3306' # Database port in a container. Find port on host with `ahoy info` or `docker compose port database 3306`. @@ -35,7 +35,7 @@ cache: image: uselagoon/valkey-8:__VERSION__ -@@ -198,11 +221,13 @@ +@@ -200,11 +223,13 @@ depends_on: - antivirus - database diff --git a/.vortex/cli/tests/Fixtures/handler_process/migration_enabled_lagoon/.github/workflows/build-test-deploy.yml b/.vortex/cli/tests/Fixtures/handler_process/migration_enabled_lagoon/.github/workflows/build-test-deploy.yml index b52861b28..0d786b6be 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/migration_enabled_lagoon/.github/workflows/build-test-deploy.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/migration_enabled_lagoon/.github/workflows/build-test-deploy.yml @@ -24,7 +24,7 @@ - name: Build stack run: docker compose up --detach && docker builder prune --all --force && docker image prune --force -@@ -327,6 +339,11 @@ +@@ -334,6 +346,11 @@ docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql rm -f .data/db.sql fi @@ -36,7 +36,7 @@ docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli ./vendor/bin/vortex-provision timeout-minutes: 30 -@@ -594,7 +611,6 @@ +@@ -601,7 +618,6 @@ VORTEX_DEPLOY_PR: ${{ env.DEPLOY_PR_NUMBER || github.event.number }} VORTEX_DEPLOY_PR_HEAD: ${{ env.DEPLOY_PR_HEAD_SHA || github.event.pull_request.head.sha }} VORTEX_DEPLOY_PR_LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }} diff --git a/.vortex/cli/tests/Fixtures/handler_process/migration_enabled_lagoon/docker-compose.yml b/.vortex/cli/tests/Fixtures/handler_process/migration_enabled_lagoon/docker-compose.yml index 27a7ad4ec..a312aa9ae 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/migration_enabled_lagoon/docker-compose.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/migration_enabled_lagoon/docker-compose.yml @@ -34,7 +34,7 @@ webserver: build: -@@ -127,6 +142,11 @@ +@@ -129,6 +144,11 @@ networks: - default # This is a standard network and is used for all other environments, where requests routing is not required and/or not supported. - amazeeio-network ### This network is supported by Pygmy and used to route all requests to host machine locally. Removed in CI. @@ -46,7 +46,7 @@ # PHP FPM container. All web requests are going through this container. appserver: -@@ -142,6 +162,11 @@ +@@ -144,6 +164,11 @@ <<: [ *default-volumes, *default-user ] depends_on: - cli @@ -58,7 +58,7 @@ database: build: -@@ -154,9 +179,26 @@ +@@ -156,9 +181,26 @@ <<: *default-user ports: - '3306' # Database port in a container. Find port on host with `ahoy info` or `docker compose port database 3306`. @@ -85,7 +85,7 @@ search: build: -@@ -168,6 +210,8 @@ +@@ -170,6 +212,8 @@ - search:/var/solr ports: - '8983' # Solr port in a container. Find port on host with `ahoy info` or `docker compose port search 8983`. @@ -94,7 +94,7 @@ antivirus: build: -@@ -179,6 +223,10 @@ +@@ -181,6 +225,10 @@ - '3310' # Find port on host with `docker compose port antivirus 3310`. networks: - default @@ -105,7 +105,7 @@ # Browser container, used for browser testing. browser: -@@ -191,6 +239,8 @@ +@@ -193,6 +241,8 @@ ports: - '7900' # Find port on host with `docker compose port browser 7900`. shm_size: '1gb' # Increase '/dev/shm' partition size to avoid browser crashing. @@ -114,7 +114,7 @@ # Helper container to wait for services to become available. wait-for-dependencies: -@@ -198,14 +248,18 @@ +@@ -200,14 +250,18 @@ depends_on: - antivirus - database diff --git a/.vortex/cli/tests/Fixtures/handler_process/migration_enabled_lagoon/docs/deployment.md b/.vortex/cli/tests/Fixtures/handler_process/migration_enabled_lagoon/docs/deployment.md index d9c8733df..34e92deb4 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/migration_enabled_lagoon/docs/deployment.md +++ b/.vortex/cli/tests/Fixtures/handler_process/migration_enabled_lagoon/docs/deployment.md @@ -1,4 +1,4 @@ -@@ -3,6 +3,21 @@ +@@ -3,6 +3,29 @@ For information on how deployment works, see [Vortex Deployment Documentation](https://www.vortextemplate.com/docs/deployment). @@ -16,6 +16,14 @@ +```bash +VORTEX_DEPLOY_BRANCH= VORTEX_DEPLOY_ACTION=deploy_override_db ahoy deploy +``` ++ ++### Maintenance page ++ ++To serve a static maintenance page in place of the site, set the ++`VORTEX_WEBSERVER_MAINTENANCE_MODE` variable to `1` on the environment and ++redeploy it. The `webserver` container then answers every request with the ++page in `.docker/config/nginx/maintenance.html`. See [Serve a maintenance ++page](https://www.vortextemplate.com/docs/hosting/lagoon#serve-a-maintenance-page). + ## Repeatable deploy hooks diff --git a/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_acquia/.github/workflows/build-test-deploy.yml b/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_acquia/.github/workflows/build-test-deploy.yml index 8b194d913..456b39c52 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_acquia/.github/workflows/build-test-deploy.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_acquia/.github/workflows/build-test-deploy.yml @@ -11,7 +11,7 @@ - name: Build stack run: docker compose up --detach && docker builder prune --all --force && docker image prune --force -@@ -326,6 +332,11 @@ +@@ -333,6 +339,11 @@ docker compose exec cli mkdir -p .data docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql rm -f .data/db.sql diff --git a/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_acquia/docker-compose.yml b/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_acquia/docker-compose.yml index b7040520b..47a76b893 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_acquia/docker-compose.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_acquia/docker-compose.yml @@ -15,7 +15,7 @@ # The default user under which the containers should run. x-user: &default-user -@@ -155,6 +165,19 @@ +@@ -157,6 +167,19 @@ ports: - '3306' # Database port in a container. Find port on host with `ahoy info` or `docker compose port database 3306`. @@ -35,7 +35,7 @@ cache: image: uselagoon/valkey-8:__VERSION__ -@@ -198,11 +221,13 @@ +@@ -200,11 +223,13 @@ depends_on: - antivirus - database diff --git a/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_container_registry/.github/workflows/build-test-deploy.yml b/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_container_registry/.github/workflows/build-test-deploy.yml index 6671189d8..39a9467cf 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_container_registry/.github/workflows/build-test-deploy.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_container_registry/.github/workflows/build-test-deploy.yml @@ -8,7 +8,7 @@ - name: Build stack run: docker compose up --detach && docker builder prune --all --force && docker image prune --force -@@ -326,6 +329,11 @@ +@@ -333,6 +336,11 @@ docker compose exec cli mkdir -p .data docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql rm -f .data/db.sql diff --git a/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_container_registry/docker-compose.yml b/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_container_registry/docker-compose.yml index b7040520b..47a76b893 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_container_registry/docker-compose.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_container_registry/docker-compose.yml @@ -15,7 +15,7 @@ # The default user under which the containers should run. x-user: &default-user -@@ -155,6 +165,19 @@ +@@ -157,6 +167,19 @@ ports: - '3306' # Database port in a container. Find port on host with `ahoy info` or `docker compose port database 3306`. @@ -35,7 +35,7 @@ cache: image: uselagoon/valkey-8:__VERSION__ -@@ -198,11 +221,13 @@ +@@ -200,11 +223,13 @@ depends_on: - antivirus - database diff --git a/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_ftp/.github/workflows/build-test-deploy.yml b/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_ftp/.github/workflows/build-test-deploy.yml index 6671189d8..39a9467cf 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_ftp/.github/workflows/build-test-deploy.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_ftp/.github/workflows/build-test-deploy.yml @@ -8,7 +8,7 @@ - name: Build stack run: docker compose up --detach && docker builder prune --all --force && docker image prune --force -@@ -326,6 +329,11 @@ +@@ -333,6 +336,11 @@ docker compose exec cli mkdir -p .data docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql rm -f .data/db.sql diff --git a/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_ftp/docker-compose.yml b/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_ftp/docker-compose.yml index b7040520b..47a76b893 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_ftp/docker-compose.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_ftp/docker-compose.yml @@ -15,7 +15,7 @@ # The default user under which the containers should run. x-user: &default-user -@@ -155,6 +165,19 @@ +@@ -157,6 +167,19 @@ ports: - '3306' # Database port in a container. Find port on host with `ahoy info` or `docker compose port database 3306`. @@ -35,7 +35,7 @@ cache: image: uselagoon/valkey-8:__VERSION__ -@@ -198,11 +221,13 @@ +@@ -200,11 +223,13 @@ depends_on: - antivirus - database diff --git a/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_lagoon/.github/workflows/build-test-deploy.yml b/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_lagoon/.github/workflows/build-test-deploy.yml index 24f69da4c..3c37aa4e6 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_lagoon/.github/workflows/build-test-deploy.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_lagoon/.github/workflows/build-test-deploy.yml @@ -24,7 +24,7 @@ - name: Build stack run: docker compose up --detach && docker builder prune --all --force && docker image prune --force -@@ -326,6 +338,11 @@ +@@ -333,6 +345,11 @@ docker compose exec cli mkdir -p .data docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql rm -f .data/db.sql diff --git a/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_lagoon/docker-compose.yml b/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_lagoon/docker-compose.yml index b7040520b..47a76b893 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_lagoon/docker-compose.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_lagoon/docker-compose.yml @@ -15,7 +15,7 @@ # The default user under which the containers should run. x-user: &default-user -@@ -155,6 +165,19 @@ +@@ -157,6 +167,19 @@ ports: - '3306' # Database port in a container. Find port on host with `ahoy info` or `docker compose port database 3306`. @@ -35,7 +35,7 @@ cache: image: uselagoon/valkey-8:__VERSION__ -@@ -198,11 +221,13 @@ +@@ -200,11 +223,13 @@ depends_on: - antivirus - database diff --git a/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_s3/.github/workflows/build-test-deploy.yml b/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_s3/.github/workflows/build-test-deploy.yml index 6671189d8..39a9467cf 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_s3/.github/workflows/build-test-deploy.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_s3/.github/workflows/build-test-deploy.yml @@ -8,7 +8,7 @@ - name: Build stack run: docker compose up --detach && docker builder prune --all --force && docker image prune --force -@@ -326,6 +329,11 @@ +@@ -333,6 +336,11 @@ docker compose exec cli mkdir -p .data docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql rm -f .data/db.sql diff --git a/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_s3/docker-compose.yml b/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_s3/docker-compose.yml index b7040520b..47a76b893 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_s3/docker-compose.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_s3/docker-compose.yml @@ -15,7 +15,7 @@ # The default user under which the containers should run. x-user: &default-user -@@ -155,6 +165,19 @@ +@@ -157,6 +167,19 @@ ports: - '3306' # Database port in a container. Find port on host with `ahoy info` or `docker compose port database 3306`. @@ -35,7 +35,7 @@ cache: image: uselagoon/valkey-8:__VERSION__ -@@ -198,11 +221,13 @@ +@@ -200,11 +223,13 @@ depends_on: - antivirus - database diff --git a/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_url/.github/workflows/build-test-deploy.yml b/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_url/.github/workflows/build-test-deploy.yml index 6671189d8..39a9467cf 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_url/.github/workflows/build-test-deploy.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_url/.github/workflows/build-test-deploy.yml @@ -8,7 +8,7 @@ - name: Build stack run: docker compose up --detach && docker builder prune --all --force && docker image prune --force -@@ -326,6 +329,11 @@ +@@ -333,6 +336,11 @@ docker compose exec cli mkdir -p .data docker compose --progress quiet cp -L .data/db.sql cli:/app/.data/db.sql rm -f .data/db.sql diff --git a/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_url/docker-compose.yml b/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_url/docker-compose.yml index b7040520b..47a76b893 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_url/docker-compose.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/migration_fetch_source_url/docker-compose.yml @@ -15,7 +15,7 @@ # The default user under which the containers should run. x-user: &default-user -@@ -155,6 +165,19 @@ +@@ -157,6 +167,19 @@ ports: - '3306' # Database port in a container. Find port on host with `ahoy info` or `docker compose port database 3306`. @@ -35,7 +35,7 @@ cache: image: uselagoon/valkey-8:__VERSION__ -@@ -198,11 +221,13 @@ +@@ -200,11 +223,13 @@ depends_on: - antivirus - database diff --git a/.vortex/cli/tests/Fixtures/handler_process/modules_no_sdc_devel/.github/workflows/build-test-deploy.yml b/.vortex/cli/tests/Fixtures/handler_process/modules_no_sdc_devel/.github/workflows/build-test-deploy.yml index 0881c7afb..7b7deb1a8 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/modules_no_sdc_devel/.github/workflows/build-test-deploy.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/modules_no_sdc_devel/.github/workflows/build-test-deploy.yml @@ -6,7 +6,7 @@ # Runs on every instance, using the `p` profile. VORTEX_CI_IS_BEHAT_RUNNER: true # Subtracted from the instance index to derive the profile number. Raise -@@ -394,18 +393,6 @@ +@@ -401,18 +400,6 @@ fi env: VORTEX_CI_CODE_COVERAGE_THRESHOLD: ${{ vars.VORTEX_CI_CODE_COVERAGE_THRESHOLD || '90' }} diff --git a/.vortex/cli/tests/Fixtures/handler_process/modules_none/.github/workflows/build-test-deploy.yml b/.vortex/cli/tests/Fixtures/handler_process/modules_none/.github/workflows/build-test-deploy.yml index 0881c7afb..7b7deb1a8 100644 --- a/.vortex/cli/tests/Fixtures/handler_process/modules_none/.github/workflows/build-test-deploy.yml +++ b/.vortex/cli/tests/Fixtures/handler_process/modules_none/.github/workflows/build-test-deploy.yml @@ -6,7 +6,7 @@ # Runs on every instance, using the `p` profile. VORTEX_CI_IS_BEHAT_RUNNER: true # Subtracted from the instance index to derive the profile number. Raise -@@ -394,18 +393,6 @@ +@@ -401,18 +400,6 @@ fi env: VORTEX_CI_CODE_COVERAGE_THRESHOLD: ${{ vars.VORTEX_CI_CODE_COVERAGE_THRESHOLD || '90' }} diff --git a/.vortex/cli/tests/Fixtures/handler_process/names/.docker/config/nginx/maintenance.html b/.vortex/cli/tests/Fixtures/handler_process/names/.docker/config/nginx/maintenance.html new file mode 100644 index 000000000..7f6042164 --- /dev/null +++ b/.vortex/cli/tests/Fixtures/handler_process/names/.docker/config/nginx/maintenance.html @@ -0,0 +1,18 @@ +@@ -3,7 +3,7 @@ + + + +- Down for maintenance | star wars ++ Down for maintenance | New hope +