Aegir 3 is incompatible with Drush 9+

Created on 15 March 2018, over 6 years ago
Updated 20 February 2024, 4 months ago

Problem

Given that:

  • Aegir 3 assumes a global Drush, which must be Drush 8 or lower.
  • Drush 9 and above operate only as site-local instances.
  • Modern Drupal 8 codebase templates (e.g. via Composer) ship with Drush 9.

... Aegir 3 cannot currently (by default) host modern Drupal 8 sites.

Solutions

These are to be implemented in this order:

  1. Updating Drush 8 so that it can stop handing off control to a local Drush if a variable is set. Yes, this needs to be fixed upstream, but one of the Aegir maintainers (@ergonlogic) is already a Drush maintainer so, pending a discussion with the other maintainers, this should be doable (and would happen sooner if someone were able to sponsor the work).
  2. #2912579: [META] Move provision off of Drush / Provision 4 (Experimental, replaces Drush with Symfony)
  3. #2714641: META: Aegir NG Architecture / Aegir 5 (Experimental, replaces Drush with Ansible)
  4. Update the Aegir 3 code, everywhere, to be able to work with Drush 9+. This seems unlikely given that nobody's started working on it, and there are other initiatives to solve this problem more sustainably.

Workarounds

Don't create Platforms based on code that contains any site-local Drush 9+ code. This will involve one or more of:

  • Moving Drush to the `require-dev` section of `composer.json` (or simply removing it).
  • Deleting all other Drush artifacts from the Git repository.
  • If deploying code directly from Packagist (and not a Git repository) via Aegir Deploy , start with a Drush-free template such as aegir/drupal-project-composer.
  • Running BOA, which removes Drush 9 from the codebase automatically on the first verify of the platform.
  • Disable cloaking, install Drush 8.4.6 locally, and call the site-local drush directly (see #65 below).

Original issue

I have been using the Drupal Composer project for building Drupal 8 sites successfully until my most recent project.

Turns out this one includes Drush 9 in composer.json.

When running a Verify task, global Drush kicks off to site-local Drush, so I get a "Command not found" error for provision save.

When I switch to Drush 8 in the composer.json, it works.

Steps to recreate, Must use PHP 7 in latest version of drupal-composer/drupal-project:

  1. composer create-project drupal-composer/drupal-project:8.x-dev /var/aegir/platforms/drupal8drush9 --stability dev --no-interaction
  2. Visit node/add/platform. Enter "drupal8drush9" into "Name", so you get "/var/aegir/platforms/drupal8drush9" as a publish path. NOTE: This is intentionally incorrect, the docroot for drupal-composer project is "web".
  3. The platform verify task will complete successfully! If you dig into the logs you will see drush apparently recognizes the composer root, and knows to look into /web all by itself: Change working directory to /var/aegir/platforms/drupal8drush9/web
  4. Test verify on the backend: You will notice the platform alias does not exist!
  5. Test the first "backend invoke" from the verify task: /usr/local/bin/drush --backend=2 --root=/var/aegir/platforms/drupal8drush9 --uri= provision-save '@platform_drupal8drush9' 2>&1 You will get Command "provision-save" is not defined., which is from the new drush.
  6. Try and add a site to the platform, you will get Could not find provision alias named: @platform_drupal8drush9

The same thing happens if you set the platform publish path correctly. Verify task passes with success, but in reality, it failed.

🐛 Bug report
Status

Active

Version

4.0

Component

Drush integration

Created by

🇺🇸United States Jon Pugh Newburgh, NY

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇨🇦Canada porchlight

    Anybody by chance have Aegir 3 working with Drupal 10? We were able to get Drupal 9, but I've tried to apply some of the above solutions to Drupal 10 and not having any luck.

  • 🇵🇱Poland memtkmcc

    TL;DR BOA supports Drupal 10 while running slightly modified Drush 8. We don’t need newer Drush versions and we shouldn’t.

    Longer version follows.

    Aegir 3 can work only with Drush 8 because it’s the only still supported Drush version which can be reliably used as standalone Drush.

    All post-8 Drush versions up to 11 could theoretically be used as standalone (on command line but not with Aegir) if their dependencies matched the managed Drupal site code, which in practice happens rarely and thus should be used as site-local only.

    Composer doesn’t care about possible versions conflicts between Drush and Drupal and you could get pretty different versions of the same Drush release installed depending on when you have installed it. This makes using them as standalone a completely unpredictable mess.

    That’s why Drush 12 has been officially announced as the first version which can’t be used as standalone at all — no matter how hard you would try.

    The only question was therefore: can we make the old good Drush 8 able to avoid conflicts despite aggressive deprecation coming with Drupal 10?

    It seemed impossible initially, so we at Omega8.cc launched a complete rewrite of our BOA stack to make it use Aegir 3 without Drush — at least without the way it was always used, based on bootstrapping Drupal directly, with the intention to use it as a bridge with our own backend code, not affected by any Drush and Drupal compatibility issues.

    It turned into serious rabbit hole and we have realized we couldn’t make it a mature enough project before Drupal 9 EOL, which in turn got us back in the dirty hacking and trying to make things work, removing obstacles as we go through tedious and frustrating debugging and testing cycles.

    We didn’t believe it was possible, really, but we just wanted to give it a try before taking the risk of switching horses completely and without option to go back.

    Guess what.. it worked! We are planning to release it tonight and upgrade all hosted Aegir systems later this night. More details are coming once we have more free time.

    Take a look: https://github.com/omega8cc/boa/issues/1678#issuecomment-1778803057

  • 🇨🇦Canada porchlight

    Hey @memtkmcc glad you got it figured out! Would you mind sharing what would work for those of us not on the BOA stack? I tried installing the BOA drush 8 fork and using your D10 patch posted on your github, but I must be missing something still as my site install task still contains errors. Are you installing drush 11/12 on the site level? Any help or direction would be greatly appreciated. Thanks for all your efforts!

  • 🇵🇱Poland memtkmcc

    Hey @porchlight, we are currently preparing to backport our patches to all relevant parts of Aegir and will also post a how-to to list requirements and changes normally automated in BOA but requiring some simple manual work for standalone Aegir. New issues will be opened to track this process.

  • 🇨🇦Canada porchlight

    @memtkmcc AMAZING! Looking forward to it! Thanks for the quick reply

  • 🇺🇸United States Jon Pugh Newburgh, NY

    DevShop runs hosting 4.x and provision 4.x in a composer platform, which includes drush8.

    Then, drush 10/11 is installed globally.

    Running drush @hostmaster works, properly passes from drush 11 to site-local drush8 in hostmaster.

    https://github.com/opendevshop/devshop/blob/1.x/src/DevShop/Control/comp...

    It uses provision 4.x and hosting 4.x branch, which is just a stopgap for current generation. Lots of hacks to get DevShop more stable. I added drush9+ yml alias ge eration so "drush sa" works with both drush 8 and 9+.

    If someone wants to take this back to aegir, feel free.

    It works.

  • Trying to use your composer file @jon-pugh
    "The `url` supplied for the path (../../../devmaster) repository does not exist"

  • 🇺🇸United States Jon Pugh Newburgh, NY

    The file is for devshop, it will need to be updated for aegir.

    I'll try to set aside some time this week to do this.

Production build 0.69.0 2024