lando / acquia

The Official Acquia Lando Plugin
https://docs.lando.dev/acquia
GNU General Public License v3.0
2 stars 6 forks source link

Acquia Drush Not Found #16

Closed josephkerkhof closed 2 years ago

josephkerkhof commented 3 years ago

Tell us about your setup

What is your lando version and operating system?

v3.0.29 on Pop!_OS 20.04 LTS

.lando.yml

name: ramsey
recipe: acquia
config:
  acli_version: master
  ah_application_uuid: 42be4899-9fa7-4b47-8ab2-fb8d90fdcf65
  ah_site_group: ramsey
  php: '7.3'

.acquia-cli.yml

cloud_app_uuid: 42be4899-9fa7-4b47-8ab2-fb8d90fdcf65

Tell us about the command you were running

Simply trying to invoke drush on my local site for a cache clear, config export, etc.

Paste in a series of commands that caused the bug.

lando drush

Tell us about the error you got

I get an error saying Drush can't be found:

/bin/sh: 1: drush: not found

Verbose output:

joseph@charlie:~/dev/Cw/Ramsey$ lando drush -vvv
lando 10:25:05 DEBUG ==> No update available. 
lando 10:25:05 VERBOSE ==> starting bootstrap at level engine... 
lando 10:25:05 VERBOSE ==> config bootstrap beginning... 
lando 10:25:05 DEBUG ==> emitting event pre-bootstrap-config 
lando 10:25:05 DEBUG ==> plugin lando-core loaded from /snapshot/lando/build/cli/plugins/lando-core/index.js 
lando 10:25:05 DEBUG ==> plugin lando-events loaded from /snapshot/lando/build/cli/plugins/lando-events/index.js 
lando 10:25:05 DEBUG ==> plugin lando-networking loaded from /snapshot/lando/build/cli/plugins/lando-networking/index.js 
lando 10:25:05 DEBUG ==> plugin lando-proxy loaded from /snapshot/lando/build/cli/plugins/lando-proxy/index.js 
lando 10:25:05 DEBUG ==> plugin lando-recipes loaded from /snapshot/lando/build/cli/plugins/lando-recipes/index.js 
lando 10:25:05 DEBUG ==> plugin lando-services loaded from /snapshot/lando/build/cli/plugins/lando-services/index.js 
lando 10:25:05 DEBUG ==> plugin lando-sharing loaded from /snapshot/lando/build/cli/plugins/lando-sharing/index.js 
lando 10:25:05 DEBUG ==> plugin lando-test loaded from /snapshot/lando/build/cli/plugins/lando-test/index.js 
lando 10:25:05 DEBUG ==> plugin lando-tooling loaded from /snapshot/lando/build/cli/plugins/lando-tooling/index.js 
lando 10:25:05 DEBUG ==> plugin lando-lagoon loaded from /snapshot/lando/build/cli/integrations/lando-lagoon/index.js 
lando 10:25:05 DEBUG ==> plugin lando-pantheon loaded from /snapshot/lando/build/cli/integrations/lando-pantheon/index.js 
lando 10:25:05 DEBUG ==> plugin lando-platformsh loaded from /snapshot/lando/build/cli/integrations/lando-platformsh/index.js 
lando 10:25:05 DEBUG ==> plugin lando-acquia loaded from /snapshot/lando/build/cli/experimental/lando-acquia/index.js 
lando 10:25:05 DEBUG ==> plugin lando-experimental loaded from /snapshot/lando/build/cli/experimental/lando-experimental/index.js 
lando 10:25:05 DEBUG ==> emitting event post-bootstrap-config 
lando 10:25:05 VERBOSE ==> building proxy config... 
lando 10:25:05 VERBOSE ==> config bootstrap completed. 
lando 10:25:05 VERBOSE ==> tasks bootstrap beginning... 
lando 10:25:05 DEBUG ==> emitting event pre-bootstrap-tasks 
lando 10:25:05 DEBUG ==> autoloaded task config 
lando 10:25:05 DEBUG ==> autoloaded task destroy 
lando 10:25:05 DEBUG ==> autoloaded task info 
lando 10:25:05 DEBUG ==> autoloaded task list 
lando 10:25:05 DEBUG ==> autoloaded task logs 
lando 10:25:05 DEBUG ==> autoloaded task poweroff 
lando 10:25:05 DEBUG ==> autoloaded task rebuild 
lando 10:25:05 DEBUG ==> autoloaded task restart 
lando 10:25:05 DEBUG ==> autoloaded task share 
lando 10:25:05 DEBUG ==> autoloaded task start 
lando 10:25:05 DEBUG ==> autoloaded task stop 
lando 10:25:05 DEBUG ==> autoloaded task version 
lando 10:25:05 DEBUG ==> autoloaded task init 
lando 10:25:05 DEBUG ==> autoloaded task ssh 
lando 10:25:05 DEBUG ==> emitting event post-bootstrap-tasks 
lando 10:25:05 VERBOSE ==> tasks bootstrap completed. 
lando 10:25:05 VERBOSE ==> engine bootstrap beginning... 
lando 10:25:05 DEBUG ==> emitting event pre-bootstrap-engine 
lando 10:25:05 DEBUG ==> automoved scripts from /snapshot/lando/build/cli/plugins/lando-core/scripts to /home/joseph/.lando/scripts and set to mode 755 
lando 10:25:05 DEBUG ==> automoved scripts from /snapshot/lando/build/cli/plugins/lando-proxy/scripts to /home/joseph/.lando/scripts and set to mode 755 
lando 10:25:05 DEBUG ==> automoved scripts from /snapshot/lando/build/cli/plugins/lando-recipes/scripts to /home/joseph/.lando/scripts and set to mode 755 
lando 10:25:05 DEBUG ==> automoved scripts from /snapshot/lando/build/cli/plugins/lando-services/scripts to /home/joseph/.lando/scripts and set to mode 755 
lando 10:25:05 DEBUG ==> automoved scripts from /snapshot/lando/build/cli/plugins/lando-sharing/scripts to /home/joseph/.lando/scripts and set to mode 755 
lando 10:25:05 DEBUG ==> automoved scripts from /snapshot/lando/build/cli/integrations/lando-lagoon/scripts to /home/joseph/.lando/scripts and set to mode 755 
lando 10:25:05 DEBUG ==> automoved scripts from /snapshot/lando/build/cli/integrations/lando-pantheon/scripts to /home/joseph/.lando/scripts and set to mode 755 
lando 10:25:05 DEBUG ==> automoved scripts from /snapshot/lando/build/cli/integrations/lando-platformsh/scripts to /home/joseph/.lando/scripts and set to mode 755 
lando 10:25:05 DEBUG ==> automoved scripts from /snapshot/lando/build/cli/experimental/lando-acquia/scripts to /home/joseph/.lando/scripts and set to mode 755 
lando 10:25:05 DEBUG ==> emitting event post-bootstrap-engine 
lando 10:25:05 VERBOSE ==> engine bootstrap completed. 
lando 10:25:05 VERBOSE ==> bootstrap completed. 
lando 10:25:05 DEBUG ==> emitting event post-bootstrap 
lando 10:25:05 VERBOSE ==> docker-engine exists: true 
lando 10:25:05 VERBOSE ==> docker-compose exists: true 
lando 10:25:05 DEBUG ==> emitting event cli-answers 
lando 10:25:05 DEBUG ==> emitting event cli-drush-answers 
lando 10:25:05 DEBUG ==> emitting event cli-run 
lando 10:25:05 DEBUG ==> emitting event cli-drush-run 
lando 10:25:05 DEBUG ==> emitting event pre-command-runner 
lando 10:25:05 DEBUG ==> emitting event pre-drush 
lando 10:25:05 DEBUG ==> process pid4 running /usr/bin/docker exec ramsey_appserver_1 drush cstdio=[inherit, pipe, pipe], silent=false, mode=attach, detached=false
lando 10:25:05 DEBUG ==> engine is up. 
                                       lando 10:25:05 DEBUG ==> docker is running. 
                                                                                   OCI runtime exec failed: exec failed: container_linux.go:367: starting container process caused: exec: "drush": executable file not found in $PATH: unknown
lando 10:25:05 DEBUG ==> process pid4 finished with exit code 126 
lando 10:25:05 VERBOSE ==> reporting error action to report=true, url=https://metrics.lando.dev, report=true, url=https://metrics.lando.dev
lando 10:25:05 DEBUG ==> reported data command=lando drush, context=local, devMode=false, instance=13a08edd14272b0ccb90b1a00af49c1bbd439955, nodeVersion=v12.13.1, mode=cli, type=Linux, platform=linux, release=5.11.0-7612-generic, arch=x64, product=lando, version=3.0.29, message=OCI runtime exec failed: exec failed: container_linux.go:367: starting container process caused: exec: "drush": executable file not found in $PATH: unknown, stack=Error: OCI runtime exec failed: exec failed: container_linux.go:367: starting container process caused: exec: "drush": executable file not found in $PATH: unknown
    at /snapshot/lando/build/cli/lib/shell.js
From previous event:
    at Shell.sh (shell.js)
    at Object.dockerExec (utils.js)
    at /snapshot/lando/build/cli/plugins/lando-tooling/lib/build.js
From previous event:
    at Object.run (build.js)
From previous event:
    at /snapshot/lando/build/cli/lib/bootstrap.js
From previous event:
    at /snapshot/lando/build/cli/lib/cli.js
From previous event:
    at Object.handler (cli.js)
    at Object.runCommand (command.js:238:44)
    at Object.parseArgs [as _parseArgs] (yargs.js:1063:30)
    at Function.get [as argv] (yargs.js:1004:21)
    at Cli.init (cli.js)
    at Cli.run (cli.js)
    at Object.<anonymous> (lando.js)
    at Module._compile (bootstrap.js:1324:22)
    at Function.Module.runMain (bootstrap.js:1379:12)
    at internal/main/run_main_module.js:17:11, action=error, created=2021-04-12T15:25:05.610Z
lando 10:25:05 VERBOSE ==> checking docker version compatibility... 
lando 10:25:05 DEBUG ==> compatibility results name=compose, link=https://docs.docker.com/compose/install/#install-compose-on-linux-systems, wants=1.23.0 - 1.27.4, version=1.27.4, semversion=1.27.4, semmin=1.23.0, semmax=1.27.4, dockerVersion=true, satisfied=true, name=engine, link=https://docs.docker.com/engine/install/, wants=18.09.3 - 20.10.99, version=20.10.5, semversion=20.10.5, semmin=18.9.3, semmax=20.10.99, dockerVersion=true, satisfied=true

Tell us generally about your bug

I initially pulled this website from Acquia using the lando init --source acquia as listed in the documentation. This Acquia site is running Drupal 7.

Please detail the steps we can take to replicate this bug. Be as detailed as possible.

Example:

1. Pull a Drupal 7 site in Acquia to lando using `lando init --source acquia`
2. `lando start`
3. Try to invoke drush: `lando drush`
4. Notice the error described above.
rubenvarela commented 3 years ago

You need to install Drush. They mention it does on the page, but it doesn't really.

Installs drush, acli and other power tools.

https://docs.lando.dev/config/acquia.html

What they have on /helpers/drush is

#!/bin/sh

set -e

# Get the lando logger
. /helpers/log.sh

# Set the module
LANDO_MODULE="drush"

echo ""
lando_yellow "This version of drupal prefers you have a site-local install of drush!"
echo ""
echo "Run the following command and try drush again:"
lando_green "lando composer require drush/drush"

exit 1
rubenvarela commented 3 years ago

It looks like the intention is to have Drush 10, https://github.com/lando/lando/blob/51a1079eb3d52bfeddf4a1e6608491c185995212/experimental/lando-acquia/recipes/acquia/builder.js#L14

If so, it is a bug.

pirog commented 3 years ago

I think this is a bug.

An easy one-size fits all approach here would be to globally install the latest Drush 8 for use with legacy Drupal versions and then assume that Drupal 8+ are using a composer installed version of Drush and let PATH be set up to fallback to the global one (which it already is) if there is no composer installed one.

pirog commented 3 years ago

In the just released v3.1.0 the latest drush 8 will be installed globally as a fallback option for legacy Drupal sites.

tl;dr is if you've got drush in your composer.json it will use that, otherwise you get globally installed drush 8

josephkerkhof commented 3 years ago

I can confirm the change works exactly as described. Thank you for such a quick fix and release! 😄