Skip to content
Dropsolid Help Center home page
Product documentation
DevOps

Using drush 9 or newer on dropsolid platform

As more and more Drupal modules require Drush 9 or newer for executing tasks, you may have to add it to your project.

The current implementation of Dropsolid Platform has a hard requirement on Drush 8 (and the config and aliases defined as php code/arrays).

The plans are there to move to a less Drush dependent ecosystem, but until then some extra steps are needed to be able to use Drush 9 or newer in your deploy flow

Be aware that Drush 9 is already EOL, and it makes not much sense to install that version. Use Drush 10 instead.

Needed steps

following steps will describe how to add Drush 10 to a Dropsolid Platform Drupal project.

  • Ensure you have no Drush dependency (no 8, 9 or 10) in your root composer.json file. Dropsolid Platform provides a globally installed Drush 8 version (currently 8.3.5)
  • Create a composer_drush10 folder inside project_root/etc with following composer.json file

    {
      "name": "project/composer_drush10",
      "require": {
        "drush/drush": "^10.3",
        "twig/twig": "<<TWIG VERSION>>",
        "guzzlehttp/guzzle": "<<GUZZLE VERSION>>",
        "cweagans/composer-patches": "^1.7"
      },
      "extra": {
        "patches": {
          "drush/drush": {
            "Set location of drush logger service file, skip Robo logger when out of drush context": "https://support.dropsolid.com/dxp/assets/devops/general/drush10-external-set-logger-service-location.patch"
          }
        }
      }
    }
    
    • ensure the version of twig and guzzle are the same as in the root composer file. This is necessary to prevent incompatibility issues. You can look up the current version by executing following commands in the root folder: composer show -i twig/twig composer show -i guzzlehttp/guzzle
    • Additional patch is needed to ensure that drush10 can set a location of logger.drupaltodrush service file. Without that patch in place, class Drush\Log\DrushLog cannot be located when performing web requests.
  • Run composer install to get the Drush 10 and it's dependencies

Now you can use Drush 10 in your deploy scripts with following snippet

#!/bin/sh
DRUSH10="$SCRIPT_DIR/../../etc/composer_drush10/vendor/bin/drush"

php ${DRUSH10} <command_you_want_to_execute>

Send us your question

Do you still have unanswered questions or do you want to make some adjustments to your project? Don't hesitate to ask us your question at support@dropsolid.io or at +3293950290.