Drush is a requirement of RA automation, both for D7 and D8. This can often mean that if drush isn’t set up correctly, issues can arise when attempting an update to a site. The basic drush commands that must run against at least one multisite of a subscription are drush pm-updatestatus and drush pm-updatecode. So if these commands can’t be run, there is likely a drush issue which must be addressed.
Some things to look for which could cause drush to fail are:
- Broken custom modules
- Hook scripts not referencing the RA environment
- The sites.php file hasn’t been configured for the RA environment
- The settings.php file hasn’t been configured with database credentials
Drush could fail due to incorrectly configured hook scripts, specifically hook scripts which don’t take into account the RA environment. To fix this you should wrap the hook in an if statement similar to the following:
if [ "$target_env" != "ra" ]; then# Execute a standard drush command.#drush @$drush_alias cc drush#drush @$drush_alias rr --fire-bazookadrush @$drush_alias vset maintenance_mode 1drush @$drush_alias cc drushdrush @$drush_alias master-execute -ydrush @$drush_alias cc drushdrush @$drush_alias updb -ydrush @$drush_alias cc drushdrush @$drush_alias fra -ydrush @$drush_alias cc alldrush @$drush_alias shepsms-settings-warm-cachedrush @$drush_alias vset maintenance_mode 0fi
To overcome an issue with database information in settings.php not referencing the RA environment, you should implement something similar to the following:
case 'ra': // do something on ra - necessary if an ra environment is present require '/var/www/site-php/example1/example1-settings.inc'; break;
A better solution to this would be to replace conditional statements with our standard database include which works on all of the environments:
if (file_exists('/var/www/site-php')) { require '/var/www/site-php/example1/example1-settings.inc'; }
Drupal 8.4 requires Drush 8.1.12 or higher. Drush 9 introduces significant changes in the way that Drupal works with Drush and Composer. While customers can upgrade to Drupal 8.4 and Drush 9 once they are released, the following should be noted:
-
While Drush 9 will be available upon release, the Acquia Cloud platform will continue to default to Drush 8.1.12. Any customer who wants to upgrade to Drupal 8.4 will need to specifically call Drush 9 to invoke Drush 9. Moving forward, Drush 9 must be installed locally as Drush 9 no longer includes a global install command.