Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support/document use of Drush 12 #1783

Open
chrissnyder2337 opened this issue Jul 7, 2023 · 11 comments
Open

Support/document use of Drush 12 #1783

chrissnyder2337 opened this issue Jul 7, 2023 · 11 comments

Comments

@chrissnyder2337
Copy link

chrissnyder2337 commented Jul 7, 2023

Description

Drush 11 is not recommended for Drupal 10 and will be EOL in Nov 2023.

Drush 12 will not be compatible with Drush Launcher: drush-ops/drush-launcher#105

Docksal's current documentation on drush setup does not explain how to use Drush 12, and not use Drush Launcher.

Please document/support a way to remove Drush Launcher and/or documented how to update the PATH environment variable as noted in the recent update to Drush's install docs.

Steps to reproduce the issue:

  1. Update Drupal project to use Drupal 10, and update Drush to version 12. (see https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-8-or-later/upgrading-a-composer-based-site)
  2. Run fin drush status
  3. See the Error below.

Describe the results you received:

The following message is displayed.

PHP Fatal error: Uncaught RuntimeException: Drush Launcher is not compatible with Drush 12+. See drush-ops/drush-launcher#105. in /var/www/vendor/drush/drush/includes/preflight.inc:23
Stack trace:
#0 phar:///usr/local/bin/drush/bin/drush.php(143): drush_main()
#1 /usr/local/bin/drush(14): require('phar:///usr/loc...')
#2 {main}
thrown in /var/www/vendor/drush/drush/includes/preflight.inc on line 23

christophersnyder_MacBook-Pro___Projects_sic-drupal_docroot

@jhedstrom
Copy link
Contributor

Fixing this will resolve docksal/service-cli#299

@ivnish
Copy link

ivnish commented Jul 10, 2023

Where is the new release with these fixes planned?

@loopy3025
Copy link

I have created an issue in the BLT project. If you run Drush commands by using vendor/bin/drush instead of drush, it works. For example fin exec vendor/bin/drush status will give you a response without the errors. That doesn't help for BLT commands, though.

acquia/blt#4690

@chrissnyder2337
Copy link
Author

Thanks @loopy3025. using fin exec vendor/bin/drush does work.

However, this is not an ideal long-term solution. Removing Drush Launcher and updating the PATH variable would be ideal so we don't have to update a bunch of developer documentation and scripts.

@shelane
Copy link
Member

shelane commented Jul 11, 2023

This is already defined in all of the images. However, I’m not sure how it would be to make the launcher not run.

echo -e "\n"'export PATH="$PATH:${PROJECT_ROOT:-/var/www}/vendor/bin"' >> $HOME/.profile; \

Obviously, there are Docksal users with Drupal 9 still. @lmakarov will have to weigh in on what adjustments to make to the images.

@chrissnyder2337
Copy link
Author

However, I’m not sure how it would be to make the launcher not run.

Drush Launcher could (possibly optionally) be removed from the image. Either by not installing it in the first place or removing it with rm /usr/local/bin/drush.

Those using earlier versions of Drush, and Drupal 9 would still work without Drush Launcher because the project's version of Drush would be installed and in the system's PATH

@jhedstrom
Copy link
Contributor

Swapping the order of the PATH would load the one in the vendor directory before the one in /usr/local/bin/drush, but then that would never be called, so as noted above, that might as well be removed.

echo -e "\n"'export PATH="${PROJECT_ROOT:-/var/www}/vendor/bin:$PATH"' >> $HOME/.profile; \

@ivnish
Copy link

ivnish commented Jul 14, 2023

I think drush launcher needs only for Drupal 7 sites. Drupal 8+ sites have drush in vendor/
But how many developers are using docker for development D7 sites? 1% or less?

@chrissnyder2337
Copy link
Author

chrissnyder2337 commented Jul 14, 2023

Swapping the order of the PATH would load the one in the vendor directory before the one in /usr/local/bin/drush, but then that would never be called, so as noted above, that might as well be removed.

The concern I have with the change of order approach is that if the project has composer installed as a project dependency, the project's version of Composer would be used instead of the system's composer. This is generally okay, but can cause issues if the project is not set up/installed correctly, as it would cause fin composer to not work and would require the developer to know how to use the system's version of Composer to fix.

If we want to change the order of the included PATH to prevent Drush Launcher from running, I would recommend only placing /var/www/vendor/bin/drush in the front and keeping var/www/vendor/bin at the end.

echo -e "\n"'export PATH="${PROJECT_ROOT:-/var/www}/vendor/bin/drush:$PATH:${PROJECT_ROOT:-/var/www}/vendor/bin"' >> $HOME/.profile; \

But at this point it just might be better to remove Drush Launcher if we don't need it.

@lmakarov
Copy link
Member

lmakarov commented Sep 6, 2023

Sounds like we'll drop Drush Launcher in the next docksal/cli release.
Drupal 7 projects already have to stick with legacy docksal/cli versions anyway, so nothing will break there.

@loopy3025
Copy link

Note I believe this is fixed if you switch to https://github.com/docksal/service-cli/releases/tag/v3.6.0 I recommend we resolve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants