lando / pantheon

The Official Lando Pantheon plugin.
https://docs.lando.dev/pantheon
GNU General Public License v3.0
12 stars 18 forks source link

Can no longer use drush in Pantheon recipe #262

Closed beau-townsend closed 1 month ago

beau-townsend commented 1 month ago

Using the same Pantheon recipe lando file that I've been using for several years, I can no longer use drush. I receive the error "/bin/sh: 1: drush: not found" when I execute lando drush. image

Attempting to execute lando drush sa result sin the error "OCI runtime exec failed: exec failed: unable to start container process: exec: "drush": executable file not found in $PATH: unknown" image

I'm using Linux Mint. Here are the contents of my lando file:

name: terminus
recipe: pantheon
services:
  appserver:
    php: 8
    overrides:
      environment:
        TERMINUS_HIDE_GIT_MODE_WARNING: 1
    build_as_root:
      - cd /usr/local/bin
      - curl -L https://github.com/pantheon-systems/terminus/releases/download/3.1.4/terminus.phar --output terminus
      - chmod +x terminus
      - ./terminus self:update
tooling:
  sftp:
    service: appserver
    description: Execute SFTP commands through this lando instance.
    cmd: /usr/bin/sftp
  git:
    service: appserver
    description: Execute git commands through this lando instance.
    cmd: /usr/bin/git
  mysql:
    service: appserver
    description: Execute mysql commands through this lando instance.
    cmd: /usr/bin/mysql

I did SSH into the instance and found that there is no drush command under /usr/bin nor /usr/local/bin.

When executing lando I do see lando drush as an available command..

I did try to destroy and rebuild the instance, but no luck. I don't know if these are related, but rebuild produces several certificate related errors:

Rising anew like a fire phoenix from the ashes! Rebuilding app...

no container to killNo stopped containers
[+] Pulling 5/5
 ✔ database Pulled                                                                                                                                                                                             0.5s 
 ✔ cache Pulled                                                                                                                                                                                                0.6s 
 ✔ appserver Pulled                                                                                                                                                                                            0.6s 
 ✔ edge Pulled                                                                                                                                                                                                 0.6s 
 ✔ index Pulled                                                                                                                                                                                                0.6s 
[+] Running 1/0
 ✔ Container landoproxyhyperion5000gandalfedition_proxy_1  Running                                                                                                                                             0.0s 
[+] Running 3/3
 ✔ Network terminus_default          Created                                                                                                                                                                   0.2s 
 ✔ Volume "terminus_home_appserver"  Created                                                                                                                                                                   0.0s 
 ✔ Container terminus_appserver_1    Started                                                                                                                                                                   0.5s 
Pantheon pre-run scripting
cat: /certs/cert.crt: No such file or directory
cat: /certs/cert.key: No such file or directory
ERROR ==> 
[+] Running 15/15
 ✔ Volume "terminus_home_database"         Created                                                                                                                                                             0.0s 
 ✔ Volume "terminus_home_appserver_nginx"  Created                                                                                                                                                             0.0s 
 ✔ Volume "terminus_data_index"            Created                                                                                                                                                             0.0s 
 ✔ Volume "terminus_home_edge"             Created                                                                                                                                                             0.0s 
 ✔ Volume "terminus_data_database"         Created                                                                                                                                                             0.0s 
 ✔ Volume "terminus_home_cache"            Created                                                                                                                                                             0.0s 
 ✔ Volume "terminus_home_edge_ssl"         Created                                                                                                                                                             0.0s 
 ✔ Volume "terminus_home_index"            Created                                                                                                                                                             0.0s 
 ✔ Container terminus_appserver_1          Running                                                                                                                                                             0.0s 
 ✔ Container terminus_database_1           Started                                                                                                                                                             2.1s 
 ✔ Container terminus_index_1              Started                                                                                                                                                             2.0s 
 ✔ Container terminus_cache_1              Started                                                                                                                                                             1.7s 
 ✔ Container terminus_appserver_nginx_1    Started                                                                                                                                                             1.5s 
 ✔ Container terminus_edge_1               Started                                                                                                                                                             2.5s 
 ✔ Container terminus_edge_ssl_1           Started                                                                                                                                                             2.8s 
[+] Healthchecking 1/1
 ✔ Healthcheck terminus_database_1   Passed
ln: failed to create symbolic link '/var/www/certs/binding.pem': No such file or directory

I recently had another related certificate issues that I was able to resolve here: https://github.com/lando/core/issues/225

My use case is that I frequently use terminus alias, which does still works, in conjunction with lando drush sa in order to execute scripts against multiple sites on Pantheon. Usually in the form of:

sites=($(lando drush sa --pipe)); for site in "${sites[@]}";
do                                     
  if [[ ! $site == @pantheon.* ]]; then
    continue
  fi                      
## Do stuff here ...                                               
done

I appreciate any help on this matter. Is it possible to roll back to a prior version of lando?

Thanks!

AaronFeledy commented 1 month ago

Yes, the cert errors are releated. The service's build process stops when it hits those errors, so it never gets to the point where it would normally install drush. A fix is in the works, but you could try this workaround in the mean time: https://github.com/lando/pantheon/issues/261#issuecomment-2415251135

beau-townsend commented 1 month ago

Bingo! Thank you! That worked a treat. I really appreciate the rapid workaround.

pirog commented 1 month ago

will be shipping out an update momentarily as well!

AaronFeledy commented 1 month ago

This should now be fixed in v1.6.0. Get it with lando update.

beau-townsend commented 1 month ago

Updated and it's working. Thanks for the quick fix!