lando / platformsh

The Official Platform.sh Lando Plugin
https://docs.lando.dev/platformsh
GNU General Public License v3.0
6 stars 4 forks source link

MailHog Service Fails on Apple Silicon Because cURL Can't Resolve GitHub.com #137

Open jasonevines opened 2 years ago

jasonevines commented 2 years ago

The specific error is this, when running Lando 3.5.1 on a Macbook M1 Pro Max:

curl: (6) Could not resolve host: github.com

Here's the output pertaining to the error when running with the -vvv flag:

app-name 15:40:47 DEBUG ==> process pid14 running /Applications/Docker.app/Contents/Resources/bin/docker-compose-v1/docker-compose exec app /bin/sh curl -fsSL -o /usr/local/bin/mhsendmail github.com/evertiro/mhsendmail/releases/download/v0.2.0-M1/mhsendmail_linux_arm64 cstdio=[inherit, pipe, pipe], silent=false, mode=spawn, detached=false curl: (6) Could not resolve host: github.com app-name 15:40:48 DEBUG ==> process pid14 finished with exit code 6 app-name 15:40:48 ERROR ==> curl: (6) Could not resolve host: github.com app-name 15:40:48 DEBUG ==> message=curl: (6) Could not resolve host: github.com, stack=Error: curl: (6) Could not resolve host: github.com at /snapshot/cli/lib/shell.js From previous event: at Shell.sh (/snapshot/cli/lib/shell.js) at Object.dc (/snapshot/cli/lib/bootstrap.js) at compose (/snapshot/cli/lib/bootstrap.js) From previous event: at /snapshot/cli/lib/router.js at processImmediate (internal/timers.js:464:21) From previous event: at Object.run (/snapshot/cli/lib/router.js) at run (/snapshot/cli/lib/engine.js) at /snapshot/cli/lib/router.js From previous event: at Object.eventWrapper (/snapshot/cli/lib/router.js) at Engine.engineCmd (/snapshot/cli/lib/engine.js) at Engine.run (/snapshot/cli/lib/engine.js) at Object.runBuild (/snapshot/cli/plugins/lando-services/lib/utils.js) at AsyncEvents.<anonymous> (/snapshot/cli/plugins/lando-services/app.js) at AsyncEvents.handle (/snapshot/cli/lib/events.js) at /snapshot/cli/lib/events.js From previous event: at AsyncEvents.emit (/snapshot/cli/lib/events.js) at /snapshot/cli/lib/app.js From previous event: at App.start (/snapshot/cli/lib/app.js) at Object.run (/snapshot/cli/plugins/lando-core/tasks/start.js) From previous event: at /snapshot/cli/lib/cli.js From previous event: at Object.handler (/snapshot/cli/lib/cli.js) at Object.runCommand (/snapshot/cli/node_modules/yargs/lib/command.js:238:44) at Object.parseArgs [as _parseArgs] (/snapshot/cli/node_modules/yargs/yargs.js:1063:30) at Function.get [as argv] (/snapshot/cli/node_modules/yargs/yargs.js:1004:21) at Cli.init (/snapshot/cli/lib/cli.js) at Cli.run (/snapshot/cli/lib/cli.js) From previous event: at /snapshot/cli/bin/lando.js From previous event: at Object.<anonymous> (/snapshot/cli/bin/lando.js) at Module._compile (pkg/prelude/bootstrap.js:1751:22) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10) at Module.load (internal/modules/cjs/loader.js:950:32) at Function.Module._load (internal/modules/cjs/loader.js:790:14) at Function.runMain (pkg/prelude/bootstrap.js:1804:12) at internal/main/run_main_module.js:17:47, __stackCleaned__=true app-name 15:40:48 VERBOSE ==> reporting error action to report=true, url=https://metrics.lando.dev, report=true, url=https://metrics.lando.dev, report=true, url=https://metrics.lando.dev app-name 15:40:48 DEBUG ==> reported data command=lando start, context=local, devMode=false, instance=a358bfe49393a9e5ae4636c478a952e19142530e, nodeVersion=v14.17.2, mode=cli, type=Darwin, platform=darwin, release=21.1.0, arch=arm64, product=lando, version=3.5.1, message=curl: (6) Could not resolve host: github.com, action=error, created=2021-12-07T20:40:48.327Z

I do not encounter this problem when running the same applications using Lando on my Intel Mac.

jasonevines commented 2 years ago

The error appears to be related to the Mailhog service. If I omit the hogfrom setting in the Mailhog configuration, the error does not happen.

labboy0276 commented 2 years ago

@jasonevines can you try the pre-release 3.6.0 to see if this addresses your issue

jasonevines commented 2 years ago

The 3.6.0 release has not fixed the issue.

jasonevines commented 2 years ago

Note that I'm using Platform.sh, so maybe this should be more properly be considered a problem with the Platform.sh plugin and / or Docker images?

reynoldsalec commented 2 years ago

That's probable considering the SSL issues that we've had with P.sh's images. Moving over to the Platform plugin repo.

reynoldsalec commented 2 years ago

@jasonevines any chance the solution to #136 helped with this?

jasonevines commented 2 years ago

I tried Docker 4.x with this, too, but it didn't help.

jasonevines commented 2 years ago

I've reached out to Platform.sh, and their engineers are placing responsibility for Apple Silicon problems on Lando.

Any chance progress has been made on this?

reynoldsalec commented 2 years ago

Hey @jasonevines, I took another look at this and replicated on my M1. The problem occurs when Lando tries to pull the MailHog code from GitHub: https://github.com/lando/mailhog/blob/main/services/mailhog/builder.js

However, I do think the root problem is something about the cert workaround that Lando has used to use legacy P.sh images while the Lando/P.sh teams work out the broader incompatibilities with the newer P.sh images.

A potential workaround: when I first booted up my P.sh app, I did a lando ssh (ssh-ing into the appserver container) and ran a couple curls against GitHub. I saw a couple fail, but then they started to succeed. I then did a targeted rebuild of the MailHog container (lando rebuild -s MYMAILHOGSERVICE) and it spun up without issue. That seems to indicate that something about the certs isn't fully baked at the time when MailHog initially tries to cURL GitHub, but after all the P.sh images have been "opened" and finalized, it's ok...definitely would want @pirog or someone to confirm if that theory makes sense.

So try running a full lando rebuild -y, and after that has run (presumably giving you the GitHub resolution error), then try lando rebuild -s MYMAILLHOGSERVICE.

Long Sidenote

P.sh recently made different versions of their Docker images available to Lando, so we can test and run Lando on staging, stable, and "legacy" versions of their images. We're hoping to work through further issues with them to make those compatible with Lando (you can see a swathe of failing tests for some images on the relevant PRs).

Ultimately we're hoping that maybe we can move away from using P.sh's verbatim images...it's cool to be able to say that we use the exact same images used on your production website, but issues like this seem to pop up too frequently, and neither the Lando maintainer team or P.sh really has good tools to solve them.

reynoldsalec commented 2 years ago

...good to note as well that in my case, this didn't prevent the app from spinning up, it just meant MailHog didn't work.

reynoldsalec commented 2 years ago

Another thing to try @jasonevines: https://github.com/lando/lando/issues/1336#issuecomment-602061985

I'll see if I can try it out myself at some point.