From 464e9c56085f9d5db23eccba498ac6d71ca59412 Mon Sep 17 00:00:00 2001 From: James Sansbury <james@lullabot.com> Date: Fri, 21 Mar 2025 16:05:20 -0400 Subject: [PATCH 01/10] Issue #3514737: initial Tugboat config --- .tugboat/config.yml | 91 ++++++++++++++++++++++++++++++++ .tugboat/create-article-node.php | 14 +++++ .tugboat/settings.local.php | 13 +++++ 3 files changed, 118 insertions(+) create mode 100644 .tugboat/config.yml create mode 100644 .tugboat/create-article-node.php create mode 100644 .tugboat/settings.local.php diff --git a/.tugboat/config.yml b/.tugboat/config.yml new file mode 100644 index 00000000..e1ee4720 --- /dev/null +++ b/.tugboat/config.yml @@ -0,0 +1,91 @@ +services: + php: + # Specify the version of Drupal you wish to use for Tugboat below. + image: tugboatqa/drupal:11 + default: true + http: false + depends: mysql + commands: + update: + # Install NodeJS + - curl -fsSL https://deb.nodesource.com/setup_$(cat $TUGBOAT_ROOT/.nvmrc).x -o nodesource_setup.sh + - bash nodesource_setup.sh + - apt-get install -y nodejs + + # Run various commands from the drupal/recommended-project root. + - | + set -eux + + # This is an environment variable we added in the Dockerfile that + # provides the path to Drupal composer root (not the web root). + cd $DRUPAL_COMPOSER_ROOT + + # Configure composer to require this module as a symlink. + composer config minimum-stability dev + composer config repositories.tugboat path $TUGBOAT_ROOT + composer require \ + drupal/experience_builder \ + drupal/demo_design_system \ + drupal/components + + # Install Drupal on the site. + rm -f $DRUPAL_DOCROOT/sites/default/settings.php + php -d memory_limit=-1 \ + vendor/bin/drush.php \ + --yes \ + --db-url=mysql://tugboat:tugboat@mysql:3306/tugboat \ + --site-name="Live preview for ${TUGBOAT_PREVIEW_NAME}" \ + --account-pass=admin \ + site:install standard + + # Require settings.local.php increase CLI memory limit, add trusted + # host patterns, and allow for enabling hidden xb_dev_standard module. + echo "require_once '$TUGBOAT_ROOT/.tugboat/settings.local.php';" >> $DOCROOT/sites/default/settings.php + + # Set up the files directory permissions. + mkdir -p $DRUPAL_DOCROOT/sites/default/files + chgrp -R www-data $DRUPAL_DOCROOT/sites/default/files + chmod 2775 $DRUPAL_DOCROOT/sites/default/files + chmod -R g+w $DRUPAL_DOCROOT/sites/default/files + + # Enable the module. + vendor/bin/drush --yes pm:install \ + experience_builder \ + xb_dev_standard \ + media_library \ + components + + # Enable starshot_demo theme. + vendor/bin/drush --yes theme:enable starshot_demo + vendor/bin/drush --yes config:set system.theme default starshot_demo + + # Create node/1 + vendor/bin/drush scr $TUGBOAT_ROOT/.tugboat/create-article-node.php + + build: + # Update Drupal core composer packages and run any Drupal updates. + - | + set -eux + cd $DRUPAL_COMPOSER_ROOT + composer install --optimize-autoloader + # Update packages and dependencies. + composer update --with-all-dependencies \ + drupal/experience_builder \ + drupal/demo_design_system \ + drupal/components + # Run Drupal updates + vendor/bin/drush --yes updb + vendor/bin/drush cache:rebuild + + # Update DDS components and fix permissions. + - npm ci + - npm run build + - npm --prefix starshot_demo ci + - npm --prefix starshot_demo run build + - chgrp -R www-data . + + # Warm Drupal caches + - 'curl --silent --header "Host: $TUGBOAT_DEFAULT_SERVICE_URL_HOST" http://localhost > /dev/null' + + mysql: + image: tugboatqa/mariadb diff --git a/.tugboat/create-article-node.php b/.tugboat/create-article-node.php new file mode 100644 index 00000000..3eee92d1 --- /dev/null +++ b/.tugboat/create-article-node.php @@ -0,0 +1,14 @@ +<?php + +declare(strict_types=1); + +// We assume the "Standard" profile is installed at this point, along with the +// Experience Builder modules. + +use Drupal\node\Entity\Node; + +$node = Node::create([ + 'type' => 'article', + 'title' => 'XB Needs This For The Time Being', +]); +$node->save(); diff --git a/.tugboat/settings.local.php b/.tugboat/settings.local.php new file mode 100644 index 00000000..21981c3b --- /dev/null +++ b/.tugboat/settings.local.php @@ -0,0 +1,13 @@ +<?php +// phpcs:ignoreFile + +// Add tugboat URLs to the Drupal trusted host patterns. +$settings['trusted_host_patterns'] = ['\.tugboatqa\.com$']; + +// Set memory_limit to unlimited for CLI operations. +if (PHP_SAPI === 'cli') { + ini_set('memory_limit', '-1'); +} + +// Allow the `xb_dev_standard` hidden module to be installed. +$settings['extension_discovery_scan_tests'] = TRUE; -- GitLab From 3b043b877934b526e9f3fd13b81e9fe2a7a29748 Mon Sep 17 00:00:00 2001 From: James Sansbury <james@lullabot.com> Date: Fri, 21 Mar 2025 16:08:04 -0400 Subject: [PATCH 02/10] only use major version from nvmrc --- .tugboat/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tugboat/config.yml b/.tugboat/config.yml index e1ee4720..2f53602a 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -8,7 +8,7 @@ services: commands: update: # Install NodeJS - - curl -fsSL https://deb.nodesource.com/setup_$(cat $TUGBOAT_ROOT/.nvmrc).x -o nodesource_setup.sh + - curl -fsSL https://deb.nodesource.com/setup_$(cat .nvmrc | awk -F. '{print $1}').x -o nodesource_setup.sh - bash nodesource_setup.sh - apt-get install -y nodejs -- GitLab From 3ffc2a73734ef16712ccc2acb322cbeb3cf5c50f Mon Sep 17 00:00:00 2001 From: James Sansbury <james@lullabot.com> Date: Fri, 21 Mar 2025 16:17:15 -0400 Subject: [PATCH 03/10] fix: install default_content module --- .tugboat/config.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.tugboat/config.yml b/.tugboat/config.yml index 2f53602a..0a09a00c 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -24,8 +24,9 @@ services: composer config minimum-stability dev composer config repositories.tugboat path $TUGBOAT_ROOT composer require \ - drupal/experience_builder \ drupal/demo_design_system \ + drupal/default_content \ + drupal/experience_builder \ drupal/components # Install Drupal on the site. @@ -50,10 +51,11 @@ services: # Enable the module. vendor/bin/drush --yes pm:install \ + components \ + default_content \ experience_builder \ - xb_dev_standard \ media_library \ - components + xb_dev_standard # Enable starshot_demo theme. vendor/bin/drush --yes theme:enable starshot_demo @@ -70,9 +72,10 @@ services: composer install --optimize-autoloader # Update packages and dependencies. composer update --with-all-dependencies \ - drupal/experience_builder \ drupal/demo_design_system \ - drupal/components + drupal/default_content \ + drupal/components \ + drupal/experience_builder # Run Drupal updates vendor/bin/drush --yes updb vendor/bin/drush cache:rebuild -- GitLab From 7e34f5603c0950b8b80229049d33d86a756f2d5f Mon Sep 17 00:00:00 2001 From: James Sansbury <james@lullabot.com> Date: Fri, 21 Mar 2025 16:38:44 -0400 Subject: [PATCH 04/10] fix: switch to npm run dist to speed up build --- .tugboat/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.tugboat/config.yml b/.tugboat/config.yml index 0a09a00c..cc27ae51 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -82,9 +82,9 @@ services: # Update DDS components and fix permissions. - npm ci - - npm run build + - npm run dist - npm --prefix starshot_demo ci - - npm --prefix starshot_demo run build + - npm --prefix starshot_demo run dist - chgrp -R www-data . # Warm Drupal caches -- GitLab From e007e81fba6cefb2046c4571e7b153888f32e1ee Mon Sep 17 00:00:00 2001 From: Kristen Pol <kristen.pol@gmail.com> Date: Fri, 21 Mar 2025 14:07:48 -0700 Subject: [PATCH 05/10] Update composer to point to correct project. --- composer.json | 4 ++-- starshot_demo/composer.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 0a86a380..ed9de211 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { - "name": "drupal/civictheme", - "description": "CivicTheme is a Drupal 10 component-based theme.", + "name": "drupal/demo_design_system", + "description": "Copy of CivicTheme used for Starshot Demo Design System base theme.", "type": "drupal-theme", "license": "GPL-2.0-or-later", "homepage": "https://github.com/civictheme/civictheme", diff --git a/starshot_demo/composer.json b/starshot_demo/composer.json index 3bb06ba8..dbe967ec 100644 --- a/starshot_demo/composer.json +++ b/starshot_demo/composer.json @@ -1,5 +1,5 @@ { - "name": "civictheme/starshot_demo", + "name": "demo_design_system/starshot_demo", "description": "The Starshot Demo Design System theme", "type": "drupal-theme", "license": "proprietary", -- GitLab From 569efd1db319fc13dbbc111650ba45a2914e31d8 Mon Sep 17 00:00:00 2001 From: James Sansbury <james@lullabot.com> Date: Fri, 21 Mar 2025 17:35:15 -0400 Subject: [PATCH 06/10] Revert "Update composer to point to correct project." This reverts commit e007e81fba6cefb2046c4571e7b153888f32e1ee. --- composer.json | 4 ++-- starshot_demo/composer.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index ed9de211..0a86a380 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { - "name": "drupal/demo_design_system", - "description": "Copy of CivicTheme used for Starshot Demo Design System base theme.", + "name": "drupal/civictheme", + "description": "CivicTheme is a Drupal 10 component-based theme.", "type": "drupal-theme", "license": "GPL-2.0-or-later", "homepage": "https://github.com/civictheme/civictheme", diff --git a/starshot_demo/composer.json b/starshot_demo/composer.json index dbe967ec..3bb06ba8 100644 --- a/starshot_demo/composer.json +++ b/starshot_demo/composer.json @@ -1,5 +1,5 @@ { - "name": "demo_design_system/starshot_demo", + "name": "civictheme/starshot_demo", "description": "The Starshot Demo Design System theme", "type": "drupal-theme", "license": "proprietary", -- GitLab From 0b627b96c33e1965b0deef76738bf38b3d9d020f Mon Sep 17 00:00:00 2001 From: James Sansbury <james@lullabot.com> Date: Fri, 21 Mar 2025 17:37:19 -0400 Subject: [PATCH 07/10] switch to drupal/civictheme for composer require/update --- .tugboat/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.tugboat/config.yml b/.tugboat/config.yml index cc27ae51..44f09ffb 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -24,7 +24,7 @@ services: composer config minimum-stability dev composer config repositories.tugboat path $TUGBOAT_ROOT composer require \ - drupal/demo_design_system \ + drupal/civictheme \ drupal/default_content \ drupal/experience_builder \ drupal/components @@ -72,7 +72,7 @@ services: composer install --optimize-autoloader # Update packages and dependencies. composer update --with-all-dependencies \ - drupal/demo_design_system \ + drupal/civictheme \ drupal/default_content \ drupal/components \ drupal/experience_builder -- GitLab From 12d7f32ff89fe290447593fac4f6b0799b15f7a3 Mon Sep 17 00:00:00 2001 From: James Sansbury <james@lullabot.com> Date: Fri, 21 Mar 2025 17:46:13 -0400 Subject: [PATCH 08/10] remove nodejs install and npm steps --- .tugboat/config.yml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.tugboat/config.yml b/.tugboat/config.yml index 44f09ffb..c6c8bcd6 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -7,11 +7,6 @@ services: depends: mysql commands: update: - # Install NodeJS - - curl -fsSL https://deb.nodesource.com/setup_$(cat .nvmrc | awk -F. '{print $1}').x -o nodesource_setup.sh - - bash nodesource_setup.sh - - apt-get install -y nodejs - # Run various commands from the drupal/recommended-project root. - | set -eux @@ -80,11 +75,7 @@ services: vendor/bin/drush --yes updb vendor/bin/drush cache:rebuild - # Update DDS components and fix permissions. - - npm ci - - npm run dist - - npm --prefix starshot_demo ci - - npm --prefix starshot_demo run dist + # Ensure web user can access theme files. - chgrp -R www-data . # Warm Drupal caches -- GitLab From 341bf966d6a7c90976cdcf00ffaa2bb771224bc1 Mon Sep 17 00:00:00 2001 From: Kristen Pol <kristen.pol@gmail.com> Date: Fri, 21 Mar 2025 15:13:44 -0700 Subject: [PATCH 09/10] Change tugboat node title. --- .tugboat/create-article-node.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tugboat/create-article-node.php b/.tugboat/create-article-node.php index 3eee92d1..3533fab8 100644 --- a/.tugboat/create-article-node.php +++ b/.tugboat/create-article-node.php @@ -9,6 +9,6 @@ use Drupal\node\Entity\Node; $node = Node::create([ 'type' => 'article', - 'title' => 'XB Needs This For The Time Being', + 'title' => 'Test article node for XB+SDDS (to go /xb/node/1 to test)', ]); $node->save(); -- GitLab From eac6aa6de7fee44d59798e37e36837aca86ca0df Mon Sep 17 00:00:00 2001 From: Kristen Pol <kristen.pol@gmail.com> Date: Fri, 21 Mar 2025 15:14:53 -0700 Subject: [PATCH 10/10] Fix typo. --- .tugboat/create-article-node.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tugboat/create-article-node.php b/.tugboat/create-article-node.php index 3533fab8..aaf16e44 100644 --- a/.tugboat/create-article-node.php +++ b/.tugboat/create-article-node.php @@ -9,6 +9,6 @@ use Drupal\node\Entity\Node; $node = Node::create([ 'type' => 'article', - 'title' => 'Test article node for XB+SDDS (to go /xb/node/1 to test)', + 'title' => 'Test article node for XB+SDDS (go to /xb/node/1 to test)', ]); $node->save(); -- GitLab