lando / cli

The cli part of Lando
https://docs.lando.dev/cli
GNU General Public License v3.0
30 stars 33 forks source link

[v3.8.1] WSL2 database connection issue #175

Closed uberhacker closed 1 year ago

uberhacker commented 1 year ago

This issue appears to be consistent across different projects using various recipes and independent of whether docker is running inside the Linux distro (tested with Ubuntu 20.04) or whether Docker Desktop is running the docker services. I don't know what else to say other than try it out yourself to see if the issue is repeatable. Example output from a project using the Pantheon recipe shown below:

$ lando start
Let's get this party started! Starting app myproject...
[+] Running 1/0
 ⠿ Container landoproxyhyperion5000gandalfedition-proxy-1  Running                                                                                                                                                                      0.0s
WARN[0000] network lando_proxyedge: network.external.name is deprecated. Please set network.name with external: true
[+] Running 8/0
 ⠿ Container myproject-appserver_nginx-1  Running                                                                                                                                                                                    0.0s
 ⠿ Container myproject-node-1             Running                                                                                                                                                                                    0.0s
 ⠿ Container myproject-edge-1             Running                                                                                                                                                                                    0.0s
 ⠿ Container myproject-appserver-1        Running                                                                                                                                                                                    0.0s
 ⠿ Container myproject-edge_ssl-1         Running                                                                                                                                                                                    0.0s
 ⠿ Container myproject-cache-1            Running                                                                                                                                                                                    0.0s
 ⠿ Container myproject-database-1         Running                                                                                                                                                                                    0.0s
 ⠿ Container myproject-index-1            Running                                                                                                                                                                                    0.0s
Waiting until database service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
ERROR ==> database reported as unhealthy.
ERROR ==> Error: (HTTP code 404) no such container - No such container: landoproxyhyperion5000gandalfedition_proxy_1  message=Error: (HTTP code 404) no such container - No such container: landoproxyhyperion5000gandalfedition_proxy_1 , stack=Error: Error: (HTTP code 404) no such container - No such container: landoproxyhyperion5000gandalfedition_proxy_1
    at /home/ed/lando-cli/node_modules/@lando/core/lib/docker.js:14:9
From previous event:
    at containerOpt (/home/ed/lando-cli/node_modules/@lando/core/lib/docker.js:13:94)
    at Landerode.scan (/home/ed/lando-cli/node_modules/@lando/core/lib/docker.js:47:12)
    at Object.exports.scan (/home/ed/lando-cli/node_modules/@lando/core/lib/router.js:114:19)
    at run (/home/ed/lando-cli/node_modules/@lando/core/lib/engine.js:18:59)
    at /home/ed/lando-cli/node_modules/@lando/core/lib/router.js:26:15
    at processImmediate (node:internal/timers:466:21)
From previous event:
    at Object.exports.eventWrapper (/home/ed/lando-cli/node_modules/@lando/core/lib/router.js:26:4)
    at Engine.engineCmd (/home/ed/lando-cli/node_modules/@lando/core/lib/engine.js:18:104)
    at Engine.scan (/home/ed/lando-cli/node_modules/@lando/core/lib/engine.js:385:17)
    at /home/ed/lando-cli/node_modules/@lando/core/plugins/lando-networking/app.js:52:27
From previous event:
    at AsyncEvents.<anonymous> (/home/ed/lando-cli/node_modules/@lando/core/plugins/lando-networking/app.js:47:54)
    at AsyncEvents.handle (/home/ed/lando-cli/node_modules/@lando/core/lib/events.js:84:25)
    at /home/ed/lando-cli/node_modules/@lando/core/lib/events.js:117:21
    at processImmediate (node:internal/timers:466:21)
From previous event:
    at AsyncEvents.emit (/home/ed/lando-cli/node_modules/@lando/core/lib/events.js:111:20)
    at /home/ed/lando-cli/node_modules/@lando/core/lib/app.js:438:29
From previous event:
    at App.start (/home/ed/lando-cli/node_modules/@lando/core/lib/app.js:438:6)
    at Object.run (/home/ed/lando-cli/node_modules/@lando/core/plugins/lando-core/tasks/start.js:17:20)
    at /home/ed/lando-cli/lib/cli.js:409:54
From previous event:
    at /home/ed/lando-cli/lib/cli.js:407:10
From previous event:
    at Object.handler (/home/ed/lando-cli/lib/cli.js:341:37)
    at Object.runCommand (/home/ed/lando-cli/node_modules/yargs/lib/command.js:238:44)
    at Object.parseArgs [as _parseArgs] (/home/ed/lando-cli/node_modules/yargs/yargs.js:1063:30)
    at Function.get [as argv] (/home/ed/lando-cli/node_modules/yargs/yargs.js:1004:21)
    at Cli.init (/home/ed/lando-cli/lib/cli.js:254:51)
    at Cli.run (/home/ed/lando-cli/lib/cli.js:468:10)
    at /home/ed/lando-cli/bin/lando.js:151:46
From previous event:
    at /home/ed/lando-cli/bin/lando.js:151:31
    at processImmediate (node:internal/timers:466:21)
From previous event:
    at Object.<anonymous> (/home/ed/lando-cli/bin/lando.js:148:30)
    at Module._compile (node:internal/modules/cjs/loader:1165:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1219:10)
    at Module.load (node:internal/modules/cjs/loader:1043:32)
    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:22:47, __stackCleaned__=true

██╗   ██╗██╗  ██╗     ██████╗ ██╗  ██╗██╗
██║   ██║██║  ██║    ██╔═══██╗██║  ██║██║
██║   ██║███████║    ██║   ██║███████║██║
██║   ██║██╔══██║    ██║   ██║██╔══██║╚═╝
╚██████╔╝██║  ██║    ╚██████╔╝██║  ██║██╗
 ╚═════╝ ╚═╝  ╚═╝     ╚═════╝ ╚═╝  ╚═╝╚═╝

An error occurred while starting up your app!
Here are a few things you can try to get back into a good state:

  ■ Try running lando rebuild
  ■ Try restarting in debug mode lando restart -vvv
  ■ Try checking the logs with lando logs

If those fail then consult the troubleshooting materials:

  ■ https://docs.lando.dev/help/logs.html
  ■ https://docs.lando.dev/help/updating.html

Or post your issue to Slack or GitHub

  ■ Slack - https://launchpass.com/devwithlando
  ■ GitHub - https://github.com/lando/lando/issues/new/choose

ERROR ==> Error: (HTTP code 404) no such container - No such container: landoproxyhyperion5000gandalfedition_proxy_1

Output from .lando.yml below:

name: myproject
recipe: pantheon
config:
  framework: drupal8
  site: myproject
  id: axax1x1x-bxfx-4x6x-9x5x-ex7x5x8xdx2x <<< redacted
  composer_version: 2

Device specs below:

Device name DELL-PRECISION-M6700
Processor   Intel(R) Core(TM) i7-3720QM CPU @ 2.60GHz   2.60 GHz
Installed RAM   32.0 GB
Device ID   EABBCE70-933F-450B-8B60-186618B6CF37
Product ID  00330-75017-75573-AAOEM
System type 64-bit operating system, x64-based processor
Pen and touch   No pen or touch input is available for this display

Windows specs below:

Edition Windows 10 Pro
Version 22H2
Installed on    ‎1/‎30/‎2022
OS build    19045.2364
Experience  Windows Feature Experience Pack 120.2212.4190.0

WSL2 specs below:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.5 LTS
Release:        20.04
Codename:       focal
$ uname -a
Linux DELL-PRECISION-M6700 5.15.79.1-microsoft-standard-WSL2 #1 SMP Wed Nov 23 01:01:46 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
$ docker -v
Docker version 20.10.22, build 3a2c30b
$ docker-compose -v
Docker Compose version v2.15.0
$ lando version <<< installed from source
v3.8.1
$ node -v
v16.19.0
$ npm -v
9.2.0
$ yarn -v
1.22.19

Possible causes:

  1. WARN[0000] network lando_proxyedge: network.external.name is deprecated. Please set network.name with external: true
  2. Error: (HTTP code 404) no such container - No such container: landoproxyhyperion5000gandalfedition_proxy_1

I found it odd that No such container: landoproxyhyperion5000gandalfedition_proxy_1 reported underscores but the container name reported by docker had dashes as shown below:

$ docker ps
CONTAINER ID   IMAGE                                   COMMAND                  CREATED          STATUS          PORTS                                                                     NAMES
7bedcb6817a1   bitnami/nginx:1.17.10-debian-10-r52     "/lando-entrypoint.s…"   18 minutes ago   Up 18 minutes   8080/tcp, 8443/tcp, 127.0.0.1:32857->443/tcp                              myproject-edge_ssl-1
3db8b985dcf3   wodby/varnish:4.1                       "/lando-entrypoint.s…"   18 minutes ago   Up 18 minutes   6081-6082/tcp, 127.0.0.1:32856->80/tcp                                    myproject-edge-1
aeb3abb316d2   devwithlando/pantheon-index:latest      "/lando-entrypoint.s…"   18 minutes ago   Up 18 minutes   127.0.0.1:32852->449/tcp                                                  myproject-index-1
45987e4a2fd5   bitnami/nginx:1.16.1-debian-10-r106     "/lando-entrypoint.s…"   18 minutes ago   Up 18 minutes   8080/tcp, 8443/tcp, 127.0.0.1:32854->80/tcp, 127.0.0.1:32853->443/tcp     myproject-appserver_nginx-1
db6e9d08f6b4   bitnami/mariadb:10.6.5-debian-10-r30    "/lando-entrypoint.s…"   18 minutes ago   Up 18 minutes   127.0.0.1:32850->3306/tcp                                                 myproject-database-1
adb9c69e0cca   redis:2.8                               "/lando-entrypoint.s…"   18 minutes ago   Up 18 minutes   127.0.0.1:32851->6379/tcp                                                 myproject-cache-1
ed6d9444b324   devwithlando/pantheon-appserver:8.1-4   "/lando-entrypoint.s…"   19 minutes ago   Up 18 minutes   9000/tcp                                                                  myproject-appserver-1
dad1232af9cb   traefik:2.2.0                           "/lando-entrypoint.s…"   3 hours ago      Up 3 hours      127.0.0.1:80->80/tcp, 127.0.0.1:443->443/tcp, 127.0.0.1:32778->8080/tcp   landoproxyhyperion5000gandalfedition-proxy-1

Let me know if any more info is needed. Thanks for looking.

uberhacker commented 1 year ago

Ah-ha! The issue appears to be docker-compose. If I downgrade to 1.29.2, it fixes this issue. See https://github.com/lando/cli/pull/151, although that PR needs to be refactored for the latest Lando code.

uberhacker commented 1 year ago

In any event, Lando v3.8.1 is not compatible with docker-compose 2.15.0.

pirog commented 1 year ago

@uberhacker makes sense as we don't support docker compose v2.

we've started to work on the new V4 runtime over at https://github.com/lando/core-next which will also only support docker compose V1 at first release. however v4 moves lando to more of a "component/registry" design so all "components" will be swappable globally and on a per app basis.

this means that it will be MUCH easier and less scary for us (or anyone for that matter) to provide alternate "orchestrators" eg docker compose v2 or kubernetes.