lando / php

The Official Lando PHP plugin.
https://docs.lando.dev/php
GNU General Public License v3.0
16 stars 16 forks source link

Composer tooling results in "no such container" error #39

Closed jasonevines closed 11 months ago

jasonevines commented 2 years ago

I'm running an M1 Pro Max Macbook Pro, with Lando version 3.6.5 and Docker version 4.8.2. I don't presently have access to an Intel Mac to see whether the error occurs on that platform, too.

The snippet below demonstrates the error when running install, although the problem happens with all composer commands:

❯ lando composer install
Error: No such container: localsite_app_1
ERROR: No such service: app

Here's how I've set up the tooling command, while trying to troubleshoot:

composer:
    service: appserver
    cmd:
      - php /usr/local/bin/composer

Here are the results of adding the -vvv flag to "lando composer install:

❯ lando composer install -vvv
lando 09:39:12 DEBUG ==> No update available. 
lando 09:39:12 VERBOSE ==> starting bootstrap at level engine... 
lando 09:39:12 VERBOSE ==> config bootstrap beginning... 
lando 09:39:12 DEBUG ==> emitting event pre-bootstrap-config 
lando 09:39:12 DEBUG ==> plugin lando-core loaded from /snapshot/cli/plugins/lando-core/index.js 
lando 09:39:12 DEBUG ==> plugin lando-events loaded from /snapshot/cli/plugins/lando-events/index.js 
lando 09:39:12 DEBUG ==> plugin lando-networking loaded from /snapshot/cli/plugins/lando-networking/index.js 
lando 09:39:12 DEBUG ==> plugin lando-proxy loaded from /snapshot/cli/plugins/lando-proxy/index.js 
lando 09:39:12 DEBUG ==> plugin lando-recipes loaded from /snapshot/cli/plugins/lando-recipes/index.js 
lando 09:39:12 DEBUG ==> plugin lando-services loaded from /snapshot/cli/plugins/lando-services/index.js 
lando 09:39:12 DEBUG ==> plugin lando-sharing loaded from /snapshot/cli/plugins/lando-sharing/index.js 
lando 09:39:12 DEBUG ==> plugin lando-test loaded from /snapshot/cli/plugins/lando-test/index.js 
lando 09:39:12 DEBUG ==> plugin lando-tooling loaded from /snapshot/cli/plugins/lando-tooling/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/acquia loaded from /snapshot/cli/node_modules/@lando/acquia/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/apache loaded from /snapshot/cli/node_modules/@lando/apache/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/backdrop loaded from /snapshot/cli/node_modules/@lando/backdrop/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/compose loaded from /snapshot/cli/node_modules/@lando/compose/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/dotnet loaded from /snapshot/cli/node_modules/@lando/dotnet/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/drupal loaded from /snapshot/cli/node_modules/@lando/drupal/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/elasticsearch loaded from /snapshot/cli/node_modules/@lando/elasticsearch/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/go loaded from /snapshot/cli/node_modules/@lando/go/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/joomla loaded from /snapshot/cli/node_modules/@lando/joomla/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/lagoon loaded from /snapshot/cli/node_modules/@lando/lagoon/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/lamp loaded from /snapshot/cli/node_modules/@lando/lamp/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/laravel loaded from /snapshot/cli/node_modules/@lando/laravel/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/lemp loaded from /snapshot/cli/node_modules/@lando/lemp/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/mailhog loaded from /snapshot/cli/node_modules/@lando/mailhog/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/mariadb loaded from /snapshot/cli/node_modules/@lando/mariadb/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/mean loaded from /snapshot/cli/node_modules/@lando/mean/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/memcached loaded from /snapshot/cli/node_modules/@lando/memcached/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/mongo loaded from /snapshot/cli/node_modules/@lando/mongo/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/mssql loaded from /snapshot/cli/node_modules/@lando/mssql/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/mysql loaded from /snapshot/cli/node_modules/@lando/mysql/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/nginx loaded from /snapshot/cli/node_modules/@lando/nginx/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/node loaded from /snapshot/cli/node_modules/@lando/node/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/pantheon loaded from /snapshot/cli/node_modules/@lando/pantheon/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/php loaded from /snapshot/cli/node_modules/@lando/php/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/phpmyadmin loaded from /snapshot/cli/node_modules/@lando/phpmyadmin/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/platformsh loaded from /snapshot/cli/node_modules/@lando/platformsh/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/postgres loaded from /snapshot/cli/node_modules/@lando/postgres/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/python loaded from /snapshot/cli/node_modules/@lando/python/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/redis loaded from /snapshot/cli/node_modules/@lando/redis/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/ruby loaded from /snapshot/cli/node_modules/@lando/ruby/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/solr loaded from /snapshot/cli/node_modules/@lando/solr/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/symfony loaded from /snapshot/cli/node_modules/@lando/symfony/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/tomcat loaded from /snapshot/cli/node_modules/@lando/tomcat/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/varnish loaded from /snapshot/cli/node_modules/@lando/varnish/index.js 
lando 09:39:12 DEBUG ==> plugin @lando/wordpress loaded from /snapshot/cli/node_modules/@lando/wordpress/index.js 
lando 09:39:12 DEBUG ==> emitting event post-bootstrap-config 
lando 09:39:12 VERBOSE ==> building proxy config... 
lando 09:39:12 VERBOSE ==> config bootstrap completed. 
lando 09:39:12 VERBOSE ==> tasks bootstrap beginning... 
lando 09:39:12 DEBUG ==> emitting event pre-bootstrap-tasks 
lando 09:39:12 DEBUG ==> autoloaded task config 
lando 09:39:12 DEBUG ==> autoloaded task destroy 
lando 09:39:12 DEBUG ==> autoloaded task info 
lando 09:39:12 DEBUG ==> autoloaded task list 
lando 09:39:12 DEBUG ==> autoloaded task logs 
lando 09:39:12 DEBUG ==> autoloaded task poweroff 
lando 09:39:12 DEBUG ==> autoloaded task rebuild 
lando 09:39:12 DEBUG ==> autoloaded task restart 
lando 09:39:12 DEBUG ==> autoloaded task share 
lando 09:39:12 DEBUG ==> autoloaded task start 
lando 09:39:12 DEBUG ==> autoloaded task stop 
lando 09:39:12 DEBUG ==> autoloaded task version 
lando 09:39:12 DEBUG ==> autoloaded task init 
lando 09:39:12 DEBUG ==> autoloaded task ssh 
lando 09:39:12 DEBUG ==> emitting event post-bootstrap-tasks 
lando 09:39:12 VERBOSE ==> tasks bootstrap completed. 
lando 09:39:12 VERBOSE ==> engine bootstrap beginning... 
lando 09:39:12 DEBUG ==> emitting event pre-bootstrap-engine 
lando 09:39:12 DEBUG ==> automoved scripts from /snapshot/cli/plugins/lando-core/scripts to /Users/jasonevines/.lando/scripts and set to mode 755 
lando 09:39:12 DEBUG ==> automoved scripts from /snapshot/cli/plugins/lando-proxy/scripts to /Users/jasonevines/.lando/scripts and set to mode 755 
lando 09:39:12 DEBUG ==> automoved scripts from /snapshot/cli/plugins/lando-recipes/scripts to /Users/jasonevines/.lando/scripts and set to mode 755 
lando 09:39:12 DEBUG ==> automoved scripts from /snapshot/cli/plugins/lando-services/scripts to /Users/jasonevines/.lando/scripts and set to mode 755 
lando 09:39:12 DEBUG ==> automoved scripts from /snapshot/cli/plugins/lando-sharing/scripts to /Users/jasonevines/.lando/scripts and set to mode 755 
lando 09:39:12 DEBUG ==> automoved scripts from /snapshot/cli/node_modules/@lando/acquia/scripts to /Users/jasonevines/.lando/scripts and set to mode 755 
lando 09:39:12 DEBUG ==> automoved scripts from /snapshot/cli/node_modules/@lando/lagoon/scripts to /Users/jasonevines/.lando/scripts and set to mode 755 
lando 09:39:12 DEBUG ==> automoved scripts from /snapshot/cli/node_modules/@lando/pantheon/scripts to /Users/jasonevines/.lando/scripts and set to mode 755 
lando 09:39:12 DEBUG ==> automoved scripts from /snapshot/cli/node_modules/@lando/platformsh/scripts to /Users/jasonevines/.lando/scripts and set to mode 755 
lando 09:39:12 DEBUG ==> emitting event post-bootstrap-engine 
lando 09:39:12 VERBOSE ==> engine bootstrap completed. 
lando 09:39:12 VERBOSE ==> bootstrap completed. 
lando 09:39:12 DEBUG ==> emitting event post-bootstrap 
lando 09:39:12 VERBOSE ==> docker-engine exists: true 
lando 09:39:12 VERBOSE ==> docker-compose exists: true 
lando 09:39:12 DEBUG ==> emitting event cli-answers 
lando 09:39:12 DEBUG ==> emitting event cli-composer-answers 
lando 09:39:12 DEBUG ==> emitting event cli-run 
lando 09:39:12 DEBUG ==> emitting event cli-composer-run 
lando 09:39:12 DEBUG ==> emitting event pre-command-runner 
lando 09:39:12 DEBUG ==> emitting event pre-composer 
lando 09:39:12 DEBUG ==> process pid5 running /Applications/Docker.app/Contents/Resources/bin/docker exec localsite_app_1 php /usr/local/bin/composer install cstdio=[inherit, pipe, pipe], silent=false, mode=attach, detached=false
lando 09:39:12 VERBOSE ==> checking docker version compatibility... 
lando 09:39:12 DEBUG ==> compatibility results name=desktop, link=https://docs.docker.com/docker-for-mac/release-notes/, wants=2.1.0.0 - 3.6.99, version=4.8.2, semversion=4.8.2, semmin=2.1.0, semmax=3.6.99, dockerVersion=true, satisfied=false
Error: No such container: localsite_app_1
lando 09:39:12 DEBUG ==> process pid5 finished with exit code 1 
lando 09:39:12 DEBUG ==> engine is up. 
lando 09:39:12 DEBUG ==> docker is running. 
lando 09:39:12 DEBUG ==> engine is up. 
lando 09:39:12 DEBUG ==> process pid7 running /Applications/Docker.app/Contents/Resources/bin/docker-compose-v1/docker-compose up cstdio=inherit, silent=false, mode=spawn, detached=false
ERROR: No such service: app
lando 09:39:13 DEBUG ==> process pid7 finished with exit code 1 
lando 09:39:13 VERBOSE ==> reporting error action to report=true, url=https://metrics.lando.dev, report=true, url=https://metrics.lando.dev
lando 09:39:13 DEBUG ==> reported data command=lando composer,install, context=local, devMode=false, instance=a358bfe49393a9e5ae4636c478a952e19142530e, nodeVersion=v14.19.1, mode=cli, type=Darwin, platform=darwin, release=21.5.0, arch=arm64, product=lando, version=3.6.5, message=, stack=Error
    at /snapshot/cli/lib/shell.js
From previous event:
    at Shell.sh (shell.js)
    at Object.dc (bootstrap.js)
    at compose (bootstrap.js)
    at /snapshot/cli/lib/router.js
From previous event:
    at retryEach (router.js)
    at Object.start (router.js)
From previous event:
    at /snapshot/cli/lib/router.js
From previous event:
    at Object.run (router.js)
    at run (engine.js)
    at /snapshot/cli/lib/router.js
From previous event:
    at Object.eventWrapper (router.js)
    at Engine.engineCmd (engine.js)
    at Engine.run (engine.js)
From previous event:
    at /snapshot/cli/plugins/lando-tooling/lib/build.js
From previous event:
    at Object.run (build.js)
From previous event:
    at /snapshot/cli/lib/bootstrap.js
From previous event:
    at /snapshot/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:1887:22)
    at Function.runMain (bootstrap.js:1940:12)
    at internal/main/run_main_module.js:17:47, action=error, created=2022-05-31T14:39:13.469Z

Running composer commands inside the service shell (after doing lando ssh) works fine, however.

jasonevines commented 2 years ago

Looking at the -vvv log, I see this line:

lando 09:39:12 DEBUG ==> process pid5 running /Applications/Docker.app/Contents/Resources/bin/docker exec localsite_app_1 php /usr/local/bin/composer install cstdio=[inherit, pipe, pipe], silent=false, mode=attach, detached=false

Strange that the command is being executed for the an "app_1" service when no such service has been set up.

As troubleshooting steps, I have tried running removing the vendor directory, running lando destroy, and purging Docker data.

jasonevines commented 2 years ago

If I create a "compose" tooling command, and use that rather than "composer," then everything works fine.

jasonevines commented 2 years ago

I've been able to duplicate the problem on an Intel Mac as well.

jasonevines commented 2 years ago

Is there any insight about what's happening here? It's a major usability problem.

reynoldsalec commented 11 months ago

Is there a reason you wanted to replace the existing composer command that comes packaged with all the LAMP-descended recipes (Drupal/WP/etc)?

Following works for me; note that it also works without the added tooling, since the drupal10 recipe has a composer tooling command in it by default:

name: groovy-d10
recipe: drupal10
config:
  webroot: web
tooling:
  composer:
    service: appserver
    cmd:
      - php /usr/local/bin/composer

@jasonevines I'm guessing this is pretty stale, but definitely re-open the issue if you had more problems/questions around this or DM me on the Lando Slack.