Coder Social home page Coder Social logo

Comments (11)

greg-1-anderson avatar greg-1-anderson commented on May 25, 2024

Does this command work, if you run it manually?

ssh -t -o PasswordAuthentication=no <username>@<ip_address> '/home/forge/vendor/bin/drush status -vvv --uri=https://my.website.com 

If not, what is the path to the site-local Drush in your remote Drupal site?

from drush.

lhridley avatar lhridley commented on May 25, 2024

That command will not work because drush is not located at that path, it is located in the vendor/bin directory of the local site installation.

In troubleshooting this after opening this ticket, I did determine that if the path to the drush-script is explicitely specified in the site alias file (which means that we are bypassing the drush launcher script (which we do have installed), the site aliases work again.

Guess this means that drush-launcher is not compatible with Drush 12.

from drush.

greg-1-anderson avatar greg-1-anderson commented on May 25, 2024

It is true that drush-launcher is not presently compatible with Drush 12.

Drush 12 also adds the requirement that the remote Drush be a site-local Drush. It should assume that Drush is located in vendor/bin on your remote site, but your initial report showed that Drush was trying to find it in bin. (n.b. the command I asked you to run was different from the one that you reported as not working only in the location of Drush, which I manually changed from bin to vendor/bin.)

You didn't show drush-script in use in your initial report, but in your most recent comment you imply that you might be using it. The existence of drush-script is relevant to Drush's behavior here.

from drush.

lhridley avatar lhridley commented on May 25, 2024

I think this can be closed, since adding the specific path to the local drush install for each environment defined in the self.site.yml file rectified the problem. But, now this is documented for anyone else that encounters this issue.

Thanks @greg-1-anderson !

from drush.

greg-1-anderson avatar greg-1-anderson commented on May 25, 2024

What did you change to fix it? Is your site local Drush located at vendor/bin, or somewhere else?

from drush.

lhridley avatar lhridley commented on May 25, 2024

The site local drush is in "vendor/bin", I added the following to the drush aliases:

paths:
    drush-script: '/home/forge/<my.website.com>/public/vendor/bin/drush'

from drush.

greg-1-anderson avatar greg-1-anderson commented on May 25, 2024

Yes, that workaround will be necessary if your site has the project root at the docroot. It is recommended to put vendor outside of the docroot, e.g. with Drush located at '/home/forge/<my.website.com>/vendor/bin/drush'

from drush.

joelpittet avatar joelpittet commented on May 25, 2024

I'm running into this drush script being incorrect too:

bash: line 1: /var/www/bin/drush: No such file or directory

The drush-script workaround mentioned above works.

  paths:
    drush-script: '/var/www/PROJECT_ROOT/vendor/bin/drush'

@greg-1-anderson Do you happen to know where/how that path is derived? I'll dig a bit

from drush.

joelpittet avatar joelpittet commented on May 25, 2024

Tracking it down, seems like the problem happens in
\Drush\SiteAlias\ProcessManager::relativePathToVendorBinDrush
Screenshot 2023-10-17 at 21 30 26

from drush.

joelpittet avatar joelpittet commented on May 25, 2024

What that translates to for me:

prod:
  host: www.example.org
  user: www
  root: /var/www/SITE/current # (PROJECT ROOT)
  uri: https://www.example.org

When this runs to join the root and relative path:
Path::join($siteAlias->root(), $this->relativePathToVendorBinDrush());
vendor/drush/drush/src/SiteAlias/ProcessManager.php:73

That ../../bin in the above screenshot cuts out the SITE/current and even if I put the root to the Web Root:
/var/www/SITE/current/web # (Web ROOT)

It's still the wrong directory.

Am I doing something wrong in my interpretation of what root is?

from drush.

joelpittet avatar joelpittet commented on May 25, 2024

Luckily xdebug allowed me to find the issue was the relative directory wasn’t correct when applied to the remote site alias.

runtime.project seemed to match better with the goal in the docblock of the method changed in that PR and the only available variable that did… but one thing I’ll note the site alias's root needs to be the project root, not the web/doc root (unless that’s where you’re vendor directory is…) I had my root in the site alias set to the webroot for Drush 11, and it needed to change...

The example is not clear what root is.
https://github.com/drush-ops/drush/blob/12.x/examples/example.site.yml#L9

from drush.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.