Pantheon is pleased to bring Drush 10 to the platform. Drush 10 is the latest version of the venerable command line tool that has been helping streamline Drupal tasks for well over a decade. If you’re new to Drush, there are a lot of things you can do with it, from one-off cache clears to scripting configuration management as part of continuous integration. Even if you don’t use Drush, you may find it interesting to know that Pantheon relies on it behind-the-scenes for several workflow operations.
There are a lot of things you can do with Drush. For example, to get the line containing information about your installed version of PHP from the Drupal status report page, you can use the new --filter option, as described in the Pantheon Drush documentation.
There are two ways to bring Drush 10 to your Drupal 8 site on Pantheon.
Add drush_version: 10 to your pantheon.yml file.
Run composer require drush/drush:^10 on a Composer-managed site.
If you use the pantheon.yml method, Pantheon will manage Drush versions for you, so you will always get the latest, tested version of Drush 10 preinstalled on your platform.
Including Drush 10 inside your Drupal site with composer require is the recommended way to install Drush. Doing this allows Composer to resolve all dependencies of Drupal and Drush together, which ensures that there will not be any dependency conflicts between the Drupal and Drush libraries. To install Drush this way, though, your site must be managed by Composer (see below for more information).
Faster than Ever—Now with Fewer Buttons!
On Pantheon, you can invoke Drush in two ways, either via Terminus or by downloading “alias” files that allow you to target your Pantheon site with Drush directly.
The Drush 10 configuration system is now based on .yml files instead of .php files; it loads faster, and includes a built-in substitution system that allows you to define variables for commonly-used values.
The new site alias manager also uses .yml alias files instead of .php alias files, making the alias records easier to read and faster to use.
Previously, the time required to generate aliases was quite lengthy; it could take several minutes for accounts with many sites and environments. With the new implementation, generating Drush aliases only takes a few seconds. Aliases for even a hundred sites can be done in under ten seconds.
As part of this release, we removed the “Drush Aliases” button from the user dashboard. To get fresh new aliases, you can simply run `terminus aliases`. Not only will you get Drush 8 and Drush 9 & Drush 10 style aliases, but they will be saved in the proper location. And again, no need to use aliases at all if you leverage `terminus drush`.
Drush Powers WebOps
There are numerous other benefits to using Drush 10.
Drush 10 is under active development, and therefore will have the most bug fixes, and be most in sync with the latest versions of Drupal. The Drush 10 tests run faster and are better organized, which means that it will be easier to keep Drush 10 working well, even as Drush and Drupal development continues.
The new site process manager works closely with the new site alias manager to provide a more flexible way to run remote Drush commands, including support for Drupal sites running in docker containers.
Drush now comes with a suite of `generate` commands from the Drupal Code Generator (DCG) project to help you get up-and-coding quickly, should you need to write custom Drupal modules or other components.
Drush 10 has a much more flexible output formatters system. Output formatters have existed since Drush 5, but the new version is used more uniformly, has fixed many edge-case bugs, and also has a filtering system that allows table rows to be selected by matching values from any row or rows using simple expressions.
When you upgrade to Drush 10, you will also want to be sure that you have upgraded to the latest version of Terminus (version 2.2.0 or later). The new Terminus has an updated version of the drush:aliases command that supports both Drush 8 and Drush 10 alias files. These alias files are also generated much more quickly than they were in previous versions of Terminus.
If you are not ready to use Drush 10 yet, you may continue to use Drush 8 on Pantheon. In fact, if your site is not Composer-managed, you must use Drush 8 to update your site, as the pm-update and pm-download commands are not available in Drush 10. However, Drush 8 is in maintenance releases only, and it is unclear how much longer it will be possible to continue to run Drush 8 with Drupal 8. If you have not converted your Drupal sites to Composer yet, the Composer In Core Initiative for Drupal 8.8 has made the Composer integration with Drupal better than ever before. Composer can be used with Drupal today with the Pantheon Build Tools Workflow or the No CI Workflow. If you haven’t done so yet, give Composer and Drush 10 a try. It’s the best way to ensure that your site will be ready to use the latest contrib modules.
Questions? Our website operations experts are here to help.
See Also:: Drupal