Information for: DEVELOPERS   PARTNERS   SUPPORT

About Drush on Cloud Platform

  • EOL notice! Drupal 8 reached end-of-life on November 2, 2021. Therefore, Acquia will not be performing any testing related to Drupal 8 to ensure compatibility. Acquia recommends upgrading to Drupal 9 or later. For more information, see Frequently Asked Questions.

Note

This page is for applications running Drupal 9 or later. For information about Drush and Drupal 7, see Drush and Drupal 7 on Cloud Platform.

Drush is a command-line shell for Drupal, which you should require as part of your Composer-built Drupal website. With Drush, you can perform administrative and application maintenance tasks from the command line instead of Drupal’s administrative interface.

Using Drush on Cloud Platform

Although multiple versions of Drush (currently, Drush 6 to Drush 10) are available as global commands on Cloud Platform, Acquia recommends that you include Drush within your project. The Drush maintainers have made the decision that Drush should not be relied on as a global command since the versions required to support each new version of Drupal change frequently and it is imperative to use the version of Drush that is supported for your version of Drupal.

Installing Drush in your project

Note

Including Drush within your project is also a requirement for Remote Administration to work with Drush.

~/example_repo$ composer require drush/drush
~/example_repo$ ls -lha
[email protected] 11 user  staff   352B 28 Jan 11:04 .
[email protected] 31 user  staff   992B 17 Mar 12:23 ..
[email protected]  1 user  staff   3.2K 28 Jan 12:02 composer.json
[email protected]  1 user  staff   250K 28 Jan 12:17 composer.lock
[email protected] 21 user  staff   672B 28 Jan 12:16 docroot
[email protected] 39 user  staff   1.2K 28 Jan 12:17 vendor
~/example_repo/vendor$ ls -lha
[email protected] 39 user  staff   1.2K 28 Jan 12:17 .
[email protected] 11 user  staff   352B 28 Jan 11:04 ..
[...SNIP...]
[email protected]  3 user  staff    96B  5 Nov 13:36 drush
~/example_repo/vendor/bin$  ls -lha
[email protected]  9 user staff   288B  5 Nov 13:36 .
[email protected] 39 user staff   1.2K 28 Jan 12:17 ..
lrwxr-xr-x   1 user staff    20B  5 Nov 13:36 drush -> ../drush/drush/drush

Invoking Drush on Cloud Platform

Currently, Drush commands not specifying a version of Drush default to Drush 8.

You can use Drush with your applications after you enable SSH access to connect to Cloud Platform using SSH.

Drush versions and Drupal

  • Drush 8 is the fully supported Drush version for Drupal 8.5 or earlier. Drush 10 is the fully supported Drush version for Drupal 9 or later.

Specifying a version of Drush in commands

If you do not include Drush within your project, you can still choose to run one of the available versions provided by Acquia. To run a specific version of Drush, specify the major version after the drush command. For example, to run Drush 9, use the command drush9.

When you run Drush on your local machine and use a remote Drush alias for your Cloud Platform application (such as those described in Using Drush aliases), the remote Drush command runs the default version of Drush on Cloud Platform. Drush 8 or later attempts to determine if there is a project specific version of Drush included, and hand off the process to the project specific version. However, that handoff is not always clean and the platform default version may not be appropriate for the version of PHP or Drupal that you have installed.

Acquia recommends that you run Drush commands by specifying the application docroot location, replacing [application] with your application and [env] with your environment, as in the following example:

drush --root=/var/www/html/[application].[env]/docroot

Using different Drush versions in containers

As Cloud Platform containers support several versions of Drush, Cloud Platform provides a set of aliases that you can use to access specific major versions of Drush.

Note

Drupal 9 only supports Drush 10.

To run a specific version of Drush, specify the major version in the drush command. For example:

  • Drush 10: drush10
  • Drush 9: drush9
  • Drush 8: drush8

To run the default version of Drush, which is Drush in Cloud Platform containers, use the drush command.

Note for Pipelines users

Acquia recommends that you must always run a specific major version of Drush. Running the default version of Drush is dangerous because the behavior of your build definition file might change when a new version of Drush becomes the default.

Using Drush 9 or Drush 10 with your container

Drush 9 and Drush 10 are not installed in your Cloud Platform-supplied container. To use Drush 9 or Drush 10 with your application, you must include it as a requirement in the composer.json file of your application.

Finding help for Drush

To access help for Drush online, go to Drush Documentation.