From 6a3e517845bb9b68840c23cfda19a920338c2e2c Mon Sep 17 00:00:00 2001 From: Grant Gaudet Date: Wed, 7 Nov 2018 08:12:33 -0800 Subject: [PATCH 1/8] Fix comment formatting in PhpUnitCommand. (#3211) --- src/Robo/Commands/Tests/PhpUnitCommand.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Robo/Commands/Tests/PhpUnitCommand.php b/src/Robo/Commands/Tests/PhpUnitCommand.php index 50a7f8067..7a30e8aec 100644 --- a/src/Robo/Commands/Tests/PhpUnitCommand.php +++ b/src/Robo/Commands/Tests/PhpUnitCommand.php @@ -15,20 +15,23 @@ class PhpUnitCommand extends BltTasks { /** * Directory in which test logs and reports are generated. * - * @var string*/ + * @var string + */ protected $reportsDir; /** * The filename for PHPUnit report. * - * @var string*/ + * @var string + */ protected $reportFile; /** * An array that contains configuration to override / * customize phpunit commands. * - * @var array*/ + * @var array + */ protected $phpunitConfig; /** From 41d24980a44672ce2bd77c8248313cb9056da332 Mon Sep 17 00:00:00 2001 From: Mike Madison Date: Wed, 7 Nov 2018 09:10:40 -0800 Subject: [PATCH 2/8] Fixes #3063 by updating faq and install docs to improve install profile instructions. (#3064) --- docs/FAQ.md | 11 +++++++++++ docs/creating-new-project.md | 6 +++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/docs/FAQ.md b/docs/FAQ.md index 7cdd67397..8c41b5cec 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -34,6 +34,8 @@ In seeking help, please keep the following points in mind: * All contributions to BLT will be reviewed for compliance with Drupal Coding Standards and best practices as defined by the project maintainer. +## Common BLT Issues and Solutions + ### BLT Command Failure (generic) **Error Message:** @@ -99,3 +101,12 @@ Errors appearing on TravisCI which are not replicable on local or other environm **Solution** [TravisCI has an internal caching feature](https://docs.travis-ci.com/user/caching) which can help speed up builds. At times, though, this cache results in semi-baffling build failures which cannot be replicated elsewhere. In these instances, the solution is sometimes simply to [clear Travis's cache](https://docs.travis-ci.com/user/caching/#Clearing-Caches). + + +## FAQ + +### Can I change the install profile ? / Do I have to use Acquia Lightning with BLT ? + +You can use any install profile you want from Core, Contrib, or your own custom development. We just default to Lightning. + +See https://blt.readthedocs.io/en/latest/creating-new-project/#creating-a-new-project-with-blt diff --git a/docs/creating-new-project.md b/docs/creating-new-project.md index e5af9838f..3029c2eb3 100644 --- a/docs/creating-new-project.md +++ b/docs/creating-new-project.md @@ -15,7 +15,11 @@ 1. Customize *blt/blt.yml* if desired, such as to choose an install profile. By default, BLT will install sites using the [*lightning*](https://github.com/acquia/lightning) profile. You can change this to any other core, contributed, or custom profile in your codebase. Make sure to download the profile if necessary, e.g., `composer require acquia/headless_lightning:~1.1.0`. - + + To use a profile other than Lightning, enter the name of the profile in blt/blt.yml in the profile:name setting. For example: + profile: + name: minimal + 1. Now it’s time to spin up your LAMP stack. 1. **Recommended**: Run the following command to create a DrupalVM instance: From 89331d823355763f738b362762401209a759f4b0 Mon Sep 17 00:00:00 2001 From: Brian Tully Date: Thu, 8 Nov 2018 14:35:36 -0500 Subject: [PATCH 3/8] [9.2.x] Fix undefined trusted_reverse_proxy_ips #3214 (#3215) Fixes #3214 -------- Changes proposed: --------- (What are you proposing we change?) - check if trusted_reverse_proxy_ips is defined as an array - if not, set an empty array Steps to replicate the issue: ---------- (If this PR is not fixing a defect/bug, you can remove this section.) 1. blt setup 2. bootstrap drupal Steps to verify the solution: ----------- (How does someone verify that this does what you think does?) 1. apply the patch 2. blt setup / bootstrap Drupal 3. check to ensure following warning does not appear: ``` Warning: in_array() expects parameter 2 to be array, null given in require() (line 27 of /app/vendor/acquia/blt/settings/blt.settings.php). require('/app/vendor/acquia/blt/settings/blt.settings.php') (Line: 806) require('/app/docroot/sites/naswa_main/settings.php') (Line: 125) Drupal\Core\Site\Settings::initialize('/app/docroot', 'sites/naswa_main', Object) (Line: 1056) Drupal\Core\DrupalKernel->initializeSettings(Object) (Line: 655) Drupal\Core\DrupalKernel->handle(Object) (Line: 19) ``` --- settings/blt.settings.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/settings/blt.settings.php b/settings/blt.settings.php index 963a499e3..1b5dee291 100644 --- a/settings/blt.settings.php +++ b/settings/blt.settings.php @@ -20,6 +20,12 @@ $request_uri = getenv('REQUEST_URI'); $http_x_request_id = getenv('HTTP_X_REQUEST_ID'); +// If trusted_reverse_proxy_ips is not defined, fail gracefully. +$trusted_reverse_proxy_ips = isset($trusted_reverse_proxy_ips) ? $trusted_reverse_proxy_ips : ''; +if (!is_array($trusted_reverse_proxy_ips)) { + $trusted_reverse_proxy_ips = []; +} + // Tell Drupal whether the client arrived via HTTPS. Ensure the // request is coming from our load balancers by checking the IP address. if (getenv('HTTP_X_FORWARDED_PROTO') == 'https' From 45f0fef83e52f0ac90bc2009de2f33c4b3b8b0e8 Mon Sep 17 00:00:00 2001 From: Mike Madison Date: Fri, 9 Nov 2018 09:54:12 -0800 Subject: [PATCH 4/8] Fixes #3185 to bring install and local docs inline. (#3186) --- docs/INSTALL.md | 12 ++++-------- docs/local-development.md | 6 +++--- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 164afddf7..e4ec51732 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -8,7 +8,7 @@ You must have the following tools on the command line of your *host operating sy * [Git](https://git-scm.com/) * [Composer](https://getcomposer.org/download/) -* [PHP 5.6+](http://php.net/manual/en/install.php) (though PHP 7.1+ is recommended) +* [PHP 7.1+](http://php.net/manual/en/install.php) Instructions for installing _all_ requirements for various operating systems are listed below. In general, make sure all installed tools are the most recent version unless otherwise noted. @@ -20,7 +20,7 @@ If you need to make requests via a proxy server, please [configure git to use a ## Installing requirements -### Mac OSX +### macOS Ensure that [Xcode](https://itunes.apple.com/us/app/xcode/id497799835?mt=12) is installed (primarily in order to support Homebrew). On OSX 10.9+ you can install Xcode with: @@ -30,16 +30,12 @@ Ensure that [Xcode](https://itunes.apple.com/us/app/xcode/id497799835?mt=12) is Then install the minimum dependencies for BLT. The preferred method is via Homebrew, though you could install these yourself without a package manager. /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - brew install php71 git composer + brew install php71 git composer drush composer global require "hirak/prestissimo:^0.3" Note that the recommended installation method for Drush has changed recently. Drush should only be installed as a dependency of individual projects, rather than being installed system-wide. BLT will manage this dependency for you on projects, but in order for you to run Drush commands independently of BLT commands you need to install the Drush Launcher: [Drush Launcher Installation](https://github.com/drush-ops/drush-launcher#installation---phar). -If you'd like to create a [Drupal VM](https://www.drupalvm.com/) with BLT, you will require the following additional libraries. If you'd like to use a LAMP stack other than Drupal VM, see [Local Development](local-development.md). - - brew tap caskroom/cask - brew cask install virtualbox vagrant - vagrant plugin install vagrant-hostsupdater +If you'd like to use [Drupal VM](https://www.drupalvm.com/) with BLT, Drupal VM has additional requirements. See the [Drupal VM Requirements](https://blt.readthedocs.io/en/latest/local-development/#using-drupal-vm-for-blt-generated-projects) to add these. If you'd like to use a LAMP stack other than Drupal VM, see [Local Development](local-development.md). If you are not using a VM, and you'd like to execute Behat tests from the host machine, you will need Java: diff --git a/docs/local-development.md b/docs/local-development.md index 02fa88f51..b5c6a53ee 100644 --- a/docs/local-development.md +++ b/docs/local-development.md @@ -18,10 +18,10 @@ Acquia developers use [PHPStorm](http://www.jetbrains.com/phpstorm/) and recomme To use [Drupal VM](http://www.drupalvm.com/) with a Drupal project that is generated with BLT: -1. Download the Drupal VM dependencies listed in [Drupal VM's README](https://github.com/geerlingguy/drupal-vm#quick-start-guide). If you're running [Homebrew](http://brew.sh/index.html) on Mac OSX, this is as simple as: +1. Download the Drupal VM dependencies listed in [Drupal VM's README](https://github.com/geerlingguy/drupal-vm#quick-start-guide). If you're running [Homebrew](http://brew.sh/index.html) on macOS, this is as simple as: brew tap caskroom/cask - brew install php56 git composer ansible drush + brew install php71 git composer ansible drush brew cask install virtualbox vagrant 1. Create & boot the VM @@ -33,7 +33,7 @@ To use [Drupal VM](http://www.drupalvm.com/) with a Drupal project that is gener git add -A git commit -m -1. Install Drupal +1. Install Drupal and finalize BLT setup vagrant ssh blt setup From 8c9cbcbba95ae1e18dccb0f0267cdb31316872cf Mon Sep 17 00:00:00 2001 From: David Pagini Date: Fri, 9 Nov 2018 18:39:49 -0500 Subject: [PATCH 5/8] Fixing updates 9002000 message. (#3205) --- src/Update/Updates.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Update/Updates.php b/src/Update/Updates.php index 617fc4fed..30c5face0 100644 --- a/src/Update/Updates.php +++ b/src/Update/Updates.php @@ -621,10 +621,11 @@ public function update_9002000() { "Review the resulting files and ensure that any customizations have been re-added.", ]; $this->updater->executeCommand("./vendor/bin/blt recipes:acsf:init:hooks"); + $formattedBlock = $this->updater->getFormatter()->formatBlock($messages, 'ice'); + $this->updater->getOutput()->writeln(""); + $this->updater->getOutput()->writeln($formattedBlock); + $this->updater->getOutput()->writeln(""); } - $formattedBlock = $this->updater->getFormatter()->formatBlock($messages, 'ice'); - $this->updater->getOutput()->writeln(""); - $this->updater->getOutput()->writeln($formattedBlock); - $this->updater->getOutput()->writeln(""); } + } From 5b485884c8b3cc8b1aaab7c7e9354528e7564bff Mon Sep 17 00:00:00 2001 From: "J.D. Flynn" Date: Fri, 9 Nov 2018 18:59:16 -0600 Subject: [PATCH 6/8] Fixing missing semi-colon at end of line. (#3208) --- scripts/factory-hooks/post-install/post-install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/factory-hooks/post-install/post-install.php b/scripts/factory-hooks/post-install/post-install.php index b196c16c2..c2ae32258 100755 --- a/scripts/factory-hooks/post-install/post-install.php +++ b/scripts/factory-hooks/post-install/post-install.php @@ -28,7 +28,7 @@ $site = 'SANDBOX'; $env = 'local'; -$uri = 'local.sandbox.com' +$uri = 'local.sandbox.com'; // ACSF Database Role if (!empty($GLOBALS['gardens_site_settings']['conf']['acsf_db_name'])) { From 6dca335d83c2f03ece85bc02dbe32909969a2e8b Mon Sep 17 00:00:00 2001 From: Mike Madison Date: Mon, 26 Nov 2018 08:05:31 -0800 Subject: [PATCH 7/8] Fixes #3243 to clean up dry-run in deploy command. (#3263) --- docs/deploy.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/deploy.md b/docs/deploy.md index ae4a2a4e5..3ce579458 100644 --- a/docs/deploy.md +++ b/docs/deploy.md @@ -73,7 +73,7 @@ See [Extending BLT](extending-blt.md) for more information on overriding default If you would like to create, commit, but _not push_ the artifact, you may do a dry run: - blt artifact:deploy -D deploy.dryRun=true + blt artifact:deploy --dry-run This is helpful for debugging deployment artifacts. From 47be5feb0dcc86cf8ad98a933957ebb76364d53a Mon Sep 17 00:00:00 2001 From: Lindsey Catlett Date: Tue, 4 Dec 2018 10:32:48 -0500 Subject: [PATCH 8/8] Multisite bugfixes (#3231) * Fix multisite test alias bug. * Fix default drush local multisite alias bug causing test failures. * Fix global varible scope and phpcs syntax. * Update variable names and fix phpcs validation errors.. --- .../post-install/post-install.php | 37 ++++++------------- .../post-settings-php/memcache.php | 8 ++-- .../factory-hooks/post-sites-php/includes.php | 10 +++-- settings/blt.settings.php | 2 +- settings/config.settings.php | 2 +- .../Commands/Generate/MultisiteCommand.php | 2 +- tests/phpunit/BltProject/MultiSiteTest.php | 2 +- 7 files changed, 26 insertions(+), 37 deletions(-) diff --git a/scripts/factory-hooks/post-install/post-install.php b/scripts/factory-hooks/post-install/post-install.php index c2ae32258..ca5bd4b9b 100755 --- a/scripts/factory-hooks/post-install/post-install.php +++ b/scripts/factory-hooks/post-install/post-install.php @@ -14,30 +14,21 @@ * */ -use Drush\Drush; -use Drupal\Component\FileCache\FileCacheFactory; -use Drupal\Core\Database\Database; -use Drupal\Core\Site\Settings; - -global $acsf_site_name; - -// Acquia hosting site / environment names -/*$site = getenv('AH_SITE_GROUP'); +// Acquia hosting site / environment names. +$site = getenv('AH_SITE_GROUP'); $env = getenv('AH_SITE_ENVIRONMENT'); -$uri = FALSE;*/ +$uri = FALSE; -$site = 'SANDBOX'; -$env = 'local'; -$uri = 'local.sandbox.com'; +global $_acsf_site_name; -// ACSF Database Role - if (!empty($GLOBALS['gardens_site_settings']['conf']['acsf_db_name'])) { - $db_role = $GLOBALS['gardens_site_settings']['conf']['acsf_db_name']; - } +// ACSF Database Role. +if (!empty($GLOBALS['gardens_site_settings']['conf']['acsf_db_name'])) { + $db_role = $GLOBALS['gardens_site_settings']['conf']['acsf_db_name']; +} $docroot = sprintf('/var/www/html/%s.%s/docroot', $site, $env); -// BLT executable +// BLT executable. $blt = sprintf('/var/www/html/%s.%s/vendor/bin/blt', $site, $env); /** @@ -51,7 +42,7 @@ function error($message) { exit(1); } -fwrite(STDERR, sprintf("Running updates on: site: %s; env: %s; db_role: %s; name: %s;\n", $site, $env, $db_role, $acsf_site_name)); +fwrite(STDERR, sprintf("Running updates on: site: %s; env: %s; db_role: %s; name: %s;\n", $site, $env, $db_role, $_acsf_site_name)); include_once $docroot . '/sites/g/sites.inc'; $sites_json = gardens_site_data_load_file(); @@ -72,13 +63,11 @@ function error($message) { $docroot = sprintf('/var/www/html/%s.%s/docroot', $site, $env); -//$cache_directory = sprintf('/mnt/tmp/%s.%s/drush_tmp_cache/%s', $site, $env, md5($uri)); -//cacheDir=`/usr/bin/env php /mnt/www/html/$site.$env/vendor/acquia/blt/scripts/blt/drush/cache.php $site $env $uri` $cache_directory = exec("/mnt/www/html/$site.$env/vendor/acquia/blt/scripts/blt/drush/cache.php $site $env $uri"); shell_exec(sprintf('mkdir -p %s', escapeshellarg($cache_directory))); -// Execute the updates +// Execute the updates. $command = sprintf( 'DRUSH_PATHS_CACHE_DIRECTORY=%s %s drupal:update --environment=%s --site=%s --define drush.uri=%s --verbose --yes --no-interaction', escapeshellarg($cache_directory), @@ -92,7 +81,7 @@ function error($message) { $result = 0; $output = array(); exec($command, $output, $result); -print join("\n", $output); +print implode("\n", $output); // Clean up the drush cache directory. shell_exec(sprintf('rm -rf %s', escapeshellarg($cache_directory))); @@ -101,5 +90,3 @@ function error($message) { fwrite(STDERR, "Command execution returned status code: $result!\n"); exit($result); } - - diff --git a/scripts/factory-hooks/post-settings-php/memcache.php b/scripts/factory-hooks/post-settings-php/memcache.php index 1de92d16f..6413ed314 100644 --- a/scripts/factory-hooks/post-settings-php/memcache.php +++ b/scripts/factory-hooks/post-settings-php/memcache.php @@ -8,11 +8,9 @@ */ // Use ACSF internal settings site flag to apply memcache settings. -if (getenv('AH_SITE_ENVIRONMENT') && - isset($site_settings['flags']['memcache_enabled']) && - isset($settings['memcache']['servers']) +if (getenv('AH_SITE_ENVIRONMENT') && + isset($site_settings['flags']['memcache_enabled']) && + isset($settings['memcache']['servers']) ) { require DRUPAL_ROOT . '/../vendor/acquia/blt/settings/memcache.settings.php'; } - - diff --git a/scripts/factory-hooks/post-sites-php/includes.php b/scripts/factory-hooks/post-sites-php/includes.php index 0486d4376..d5efc4aa5 100644 --- a/scripts/factory-hooks/post-sites-php/includes.php +++ b/scripts/factory-hooks/post-sites-php/includes.php @@ -1,12 +1,15 @@ get('multisites'); if (in_array($name, $acsf_sites)) { - $acsf_site_name = $name; + $_acsf_site_name = $name; } } } diff --git a/settings/config.settings.php b/settings/config.settings.php index 67968d3f0..d563475f9 100644 --- a/settings/config.settings.php +++ b/settings/config.settings.php @@ -96,7 +96,7 @@ $config["$split_filename_prefix.$site_dir"]['status'] = TRUE; // Set acsf site split if explicit global exists. -if (isset($acsf_site_name)) { +if (isset($_acsf_site_name)) { $config["$split_filename_prefix.$acsf_site_name"]['status'] = TRUE; } diff --git a/src/Robo/Commands/Generate/MultisiteCommand.php b/src/Robo/Commands/Generate/MultisiteCommand.php index e74656585..c4ff08a80 100644 --- a/src/Robo/Commands/Generate/MultisiteCommand.php +++ b/src/Robo/Commands/Generate/MultisiteCommand.php @@ -187,7 +187,7 @@ protected function createNewBltSiteYml( $site_yml['project']['human_name'] = $site_name; $site_yml['project']['local']['protocol'] = $url['scheme']; $site_yml['project']['local']['hostname'] = $url['host']; - $site_yml['drush']['aliases']['local'] = $site_name . ".local"; + $site_yml['drush']['aliases']['local'] = "self"; $site_yml['drush']['aliases']['remote'] = $remote_alias; YamlMunge::mergeArrayIntoFile($site_yml, $site_yml_filename); } diff --git a/tests/phpunit/BltProject/MultiSiteTest.php b/tests/phpunit/BltProject/MultiSiteTest.php index 799b7c560..3aba676bd 100644 --- a/tests/phpunit/BltProject/MultiSiteTest.php +++ b/tests/phpunit/BltProject/MultiSiteTest.php @@ -42,7 +42,7 @@ public function testMultisiteGenerate() { $this->assertEquals("$this->site1Dir.clone", $site1_blt_yml['drush']['aliases']['remote']); $site2_blt_yml = YamlMunge::parseFile("$this->sandboxInstance/docroot/sites/$this->site2Dir/blt.yml"); - $this->assertEquals("$this->site2Dir.local", $site2_blt_yml['drush']['aliases']['local']); + $this->assertEquals("self", $site2_blt_yml['drush']['aliases']['local']); $this->assertEquals("$this->site2Dir.clone", $site2_blt_yml['drush']['aliases']['remote']); // Clone.