-
-
Notifications
You must be signed in to change notification settings - Fork 29
[#1967] Added support for Hosting project name. #2045
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
AlexSkrypnyk
merged 1 commit into
develop
from
feature/1967-installer-support-lagoon-project
Oct 6, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
135 changes: 135 additions & 0 deletions
135
.vortex/installer/src/Prompts/Handlers/HostingProjectName.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,135 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace DrevOps\VortexInstaller\Prompts\Handlers; | ||
|
|
||
| use DrevOps\VortexInstaller\Utils\Converter; | ||
| use DrevOps\VortexInstaller\Utils\Env; | ||
| use DrevOps\VortexInstaller\Utils\File; | ||
|
|
||
| class HostingProjectName extends AbstractHandler { | ||
|
|
||
| /** | ||
| * {@inheritdoc} | ||
| */ | ||
| public function label(): string { | ||
| return 'Hosting project name'; | ||
| } | ||
|
|
||
| /** | ||
| * {@inheritdoc} | ||
| */ | ||
| public function hint(array $responses): ?string { | ||
| return 'Name as found in the hosting configuration. Usually the same as the site machine name.'; | ||
| } | ||
|
|
||
| /** | ||
| * {@inheritdoc} | ||
| */ | ||
| public function placeholder(array $responses): ?string { | ||
| return 'E.g. my_site'; | ||
| } | ||
|
|
||
| /** | ||
| * {@inheritdoc} | ||
| */ | ||
| public function isRequired(): bool { | ||
| return TRUE; | ||
| } | ||
|
|
||
| /** | ||
| * {@inheritdoc} | ||
| */ | ||
| public function shouldRun(array $responses): bool { | ||
| return isset($responses[HostingProvider::id()]) && | ||
| ( | ||
| $responses[HostingProvider::id()] === HostingProvider::LAGOON || | ||
| $responses[HostingProvider::id()] === HostingProvider::ACQUIA | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * {@inheritdoc} | ||
| */ | ||
| public function default(array $responses): null|string|bool|array { | ||
| if (isset($responses[MachineName::id()]) && !empty($responses[MachineName::id()])) { | ||
| return $responses[MachineName::id()]; | ||
| } | ||
|
|
||
| return NULL; | ||
| } | ||
|
|
||
| /** | ||
| * {@inheritdoc} | ||
| */ | ||
| public function discover(): null|string|bool|array { | ||
| // Try Acquia. | ||
| $v = Env::getFromDotenv('VORTEX_ACQUIA_APP_NAME', $this->dstDir); | ||
| if (!empty($v)) { | ||
| return $v; | ||
| } | ||
|
|
||
| // Try to discover from settings.acquia.php. | ||
| $acquia_settings_file = $this->dstDir . sprintf('/%s/sites/default/includes/providers/settings.acquia.php', $this->webroot); | ||
| if (file_exists($acquia_settings_file)) { | ||
| $content = file_get_contents($acquia_settings_file); | ||
| // Require '/var/www/site-php/your_site/your_site-settings.inc';. | ||
| if ($content !== FALSE && preg_match('/require\s+[\'"]\/var\/www\/site-php\/([a-z0-9_]+)\/[a-z0-9_]+-settings\.inc[\'"]\s*;/', $content, $matches) && !empty($matches[1])) { | ||
| return $matches[1]; | ||
| } | ||
| } | ||
|
|
||
| // Try Lagoon. | ||
| $v = Env::getFromDotenv('LAGOON_PROJECT', $this->dstDir); | ||
| if (!empty($v)) { | ||
| return $v; | ||
| } | ||
|
|
||
| // Try to discover from drush/sites/lagoon.site.yml. | ||
| $lagoon_site_file = $this->dstDir . '/drush/sites/lagoon.site.yml'; | ||
| if (file_exists($lagoon_site_file)) { | ||
| $content = file_get_contents($lagoon_site_file); | ||
| if ($content !== FALSE && preg_match('/user:\s*([a-z0-9_]+)-/', $content, $matches) && (!empty($matches[1]) && $matches[1] !== 'your_site')) { | ||
| return $matches[1]; | ||
| } | ||
| } | ||
|
|
||
| return NULL; | ||
| } | ||
|
|
||
| /** | ||
| * {@inheritdoc} | ||
| */ | ||
| public function validate(): ?callable { | ||
| return fn($v): ?string => Converter::phpPackageName($v) !== $v ? 'Please enter a valid machine name: only lowercase letters, numbers, hyphens and underscores are allowed.' : NULL; | ||
| } | ||
|
|
||
| /** | ||
| * {@inheritdoc} | ||
| */ | ||
| public function transform(): ?callable { | ||
| return fn(string $v): string => trim($v); | ||
| } | ||
|
|
||
| /** | ||
| * {@inheritdoc} | ||
| */ | ||
| public function process(): void { | ||
| if (!in_array($this->responses[HostingProvider::id()], [HostingProvider::LAGOON, HostingProvider::ACQUIA])) { | ||
| return; | ||
| } | ||
|
|
||
| $v = $this->getResponseAsString(); | ||
| $t = $this->tmpDir; | ||
| $w = $this->webroot; | ||
|
|
||
| Env::writeValueDotenv('VORTEX_ACQUIA_APP_NAME', $v, $t . '/.env'); | ||
| File::replaceContentInFile($t . '/' . $w . '/sites/default/includes/providers/settings.acquia.php', 'your_site', $v); | ||
|
|
||
| Env::writeValueDotenv('LAGOON_PROJECT', $v, $t . '/.env'); | ||
| File::replaceContentInFile($t . '/drush/sites/lagoon.site.yml', 'your_site-${env-name}', $v . '-${env-name}'); | ||
| File::replaceContentInFile($t . '/drush/sites/lagoon.site.yml', '.your_site.au2.amazee.io', '.' . $v . '.au2.amazee.io'); | ||
| } | ||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...tex/installer/tests/Fixtures/install/hosting_project_name___acquia/.docker/cli.dockerfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| @@ -16,7 +16,7 @@ | ||
| ARG LAGOON_PR_HEAD_SHA="" | ||
| ENV LAGOON_PR_HEAD_SHA=${LAGOON_PR_HEAD_SHA} | ||
|
|
||
| -ARG WEBROOT=web | ||
| +ARG WEBROOT=docroot | ||
| ENV WEBROOT=${WEBROOT} | ||
|
|
||
| # Token is used to access private repositories. Not exposed as an environment |
9 changes: 9 additions & 0 deletions
9
...ller/tests/Fixtures/install/hosting_project_name___acquia/.docker/nginx-drupal.dockerfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| @@ -14,7 +14,7 @@ | ||
| FROM uselagoon/nginx-drupal:__VERSION__ | ||
|
|
||
| # Webroot is used for Nginx web root configuration. | ||
| -ARG WEBROOT=web | ||
| +ARG WEBROOT=docroot | ||
| ENV WEBROOT=${WEBROOT} | ||
|
|
||
| RUN apk add --no-cache tzdata |
30 changes: 30 additions & 0 deletions
30
.vortex/installer/tests/Fixtures/install/hosting_project_name___acquia/.dockerignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| @@ -8,17 +8,17 @@ | ||
| * | ||
|
|
||
| # Do not ignore web. | ||
| -!web | ||
| +!docroot | ||
|
|
||
| # Do not ignore config. | ||
| !config | ||
|
|
||
| # But still ignore Drupal directories generated by Composer. | ||
| -web/core | ||
| -web/modules/contrib | ||
| -web/themes/contrib | ||
| -web/profiles/contrib | ||
| -web/libraries | ||
| +docroot/core | ||
| +docroot/modules/contrib | ||
| +docroot/themes/contrib | ||
| +docroot/profiles/contrib | ||
| +docroot/libraries | ||
| !drush | ||
| drush/contrib/ | ||
|
|
||
| @@ -51,3 +51,5 @@ | ||
| !rector.php | ||
| !scripts | ||
| !tests | ||
| + | ||
| +!hooks |
84 changes: 84 additions & 0 deletions
84
.vortex/installer/tests/Fixtures/install/hosting_project_name___acquia/.env
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| @@ -29,7 +29,7 @@ | ||
| VORTEX_PROJECT=star_wars | ||
|
|
||
| # Name of the web root directory containing a Drupal codebase. | ||
| -WEBROOT=web | ||
| +WEBROOT=docroot | ||
|
|
||
| # The timezone used within the containers. | ||
| TZ=UTC | ||
| @@ -120,6 +120,13 @@ | ||
| VORTEX_PROVISION_USE_MAINTENANCE_MODE=1 | ||
|
|
||
| ################################################################################ | ||
| +# HOSTING # | ||
| +################################################################################ | ||
| + | ||
| +# Acquia application name. | ||
| +VORTEX_ACQUIA_APP_NAME=my_custom_acquia-project | ||
| + | ||
| +################################################################################ | ||
| # DATABASE SOURCE # | ||
| ################################################################################ | ||
|
|
||
| @@ -142,13 +149,8 @@ | ||
| VORTEX_DB_FILE=db.sql | ||
|
|
||
| # Database download source. | ||
| -VORTEX_DB_DOWNLOAD_SOURCE=url | ||
| +VORTEX_DB_DOWNLOAD_SOURCE=acquia | ||
|
|
||
| -# Database dump file sourced from a URL. | ||
| -# | ||
| -# HTTP Basic Authentication credentials should be embedded into the value. | ||
| -VORTEX_DB_DOWNLOAD_URL= | ||
| - | ||
| # Environment to download the database from. | ||
| # | ||
| # Applies to hosting environments. | ||
| @@ -156,6 +158,9 @@ | ||
| # a branch name or an environment name. | ||
| VORTEX_DB_DOWNLOAD_ENVIRONMENT=prod | ||
|
|
||
| +# Acquia database name to download the database from. | ||
| +VORTEX_DB_DOWNLOAD_ACQUIA_DB_NAME=star_wars | ||
| + | ||
| ################################################################################ | ||
| # DEPLOYMENT # | ||
| ################################################################################ | ||
| @@ -162,7 +167,7 @@ | ||
|
|
||
| # Deployment occurs when tests pass in the CI environment. | ||
| # @see https://www.vortextemplate.com/docs/workflows/deployment | ||
| -VORTEX_DEPLOY_TYPES=webhook | ||
| +VORTEX_DEPLOY_TYPES=artifact | ||
|
|
||
| ################################################################################ | ||
| # NOTIFICATIONS # | ||
| @@ -179,7 +184,7 @@ | ||
| # An email address to send notifications from. | ||
| # | ||
| # Applies to email notifications. | ||
| -VORTEX_NOTIFY_EMAIL_FROM=webmaster@star-wars.com | ||
| +VORTEX_NOTIFY_EMAIL_FROM=docrootmaster@star-wars.com | ||
|
|
||
| # Email address(es) to send notifications to. | ||
| # | ||
| @@ -189,17 +194,3 @@ | ||
| # with optional names in the format "email|name". | ||
| # Example: "to1@example.com|Jane Doe, to2@example.com|John Doe" | ||
| VORTEX_NOTIFY_EMAIL_RECIPIENTS="webmaster@star-wars.com|Webmaster" | ||
| - | ||
| -################################################################################ | ||
| -# DEMO # | ||
| -################################################################################ | ||
| -# # | ||
| -# Override project-specific values for demonstration purposes. # | ||
| -# Used to showcase Vortex without asking users to perform additional steps. # | ||
| -# # | ||
| -# Remove this section after completing database download integration. # | ||
| -# # | ||
| -################################################################################ | ||
| - | ||
| -# URL of the database used for demonstration with URL database download type. | ||
| -VORTEX_DB_DOWNLOAD_URL=https://github.com/drevops/vortex/releases/download/25.4.0/db_d11.demo.sql |
12 changes: 12 additions & 0 deletions
12
.vortex/installer/tests/Fixtures/install/hosting_project_name___acquia/.env.local
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| @@ -32,3 +32,11 @@ | ||
|
|
||
| # Always override existing downloaded DB dump. | ||
| VORTEX_DB_DOWNLOAD_FORCE=1 | ||
| + | ||
| +# Database dump file sourced from Acquia. | ||
| +# Acquia Cloud API token: Acquia Cloud UI -> Account -> API tokens -> Create Token | ||
| + | ||
| +# Acquia Cloud API key. | ||
| +VORTEX_ACQUIA_KEY= | ||
| +# Acquia Cloud API secret. | ||
| +VORTEX_ACQUIA_SECRET= |
12 changes: 12 additions & 0 deletions
12
.vortex/installer/tests/Fixtures/install/hosting_project_name___acquia/.env.local.example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| @@ -32,3 +32,11 @@ | ||
|
|
||
| # Always override existing downloaded DB dump. | ||
| VORTEX_DB_DOWNLOAD_FORCE=1 | ||
| + | ||
| +# Database dump file sourced from Acquia. | ||
| +# Acquia Cloud API token: Acquia Cloud UI -> Account -> API tokens -> Create Token | ||
| + | ||
| +# Acquia Cloud API key. | ||
| +VORTEX_ACQUIA_KEY= | ||
| +# Acquia Cloud API secret. | ||
| +VORTEX_ACQUIA_SECRET= |
17 changes: 17 additions & 0 deletions
17
.vortex/installer/tests/Fixtures/install/hosting_project_name___acquia/.eslintignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| @@ -1,10 +1,10 @@ | ||
| node_modules/ | ||
| vendor/ | ||
| -web/core/ | ||
| -web/libraries/ | ||
| -web/modules/contrib/ | ||
| -web/profiles/contrib/ | ||
| -web/themes/contrib/ | ||
| -web/sites/*/files/ | ||
| +docroot/core/ | ||
| +docroot/libraries/ | ||
| +docroot/modules/contrib/ | ||
| +docroot/profiles/contrib/ | ||
| +docroot/themes/contrib/ | ||
| +docroot/sites/*/files/ | ||
| *.min.js | ||
| *.min.css |
10 changes: 10 additions & 0 deletions
10
...ts/Fixtures/install/hosting_project_name___acquia/.github/workflows/build-test-deploy.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| @@ -124,6 +124,9 @@ | ||
| VORTEX_DB_DOWNLOAD_SEMAPHORE=/tmp/download-db-success ./scripts/vortex/download-db.sh | ||
| echo "db_hash=${{ hashFiles('.data') }}" >> "$GITHUB_ENV" | ||
| timeout-minutes: 30 | ||
| + env: | ||
| + VORTEX_ACQUIA_KEY: ${{ secrets.VORTEX_ACQUIA_KEY }} | ||
| + VORTEX_ACQUIA_SECRET: ${{ secrets.VORTEX_ACQUIA_SECRET }} | ||
|
|
||
| - name: Export DB | ||
| run: | |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.