Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot make any calls between services (and even inside service's own container) #2579

Closed
tpluscode opened this issue Aug 27, 2020 · 13 comments
Assignees
Labels
bug Something aint working right!

Comments

@tpluscode
Copy link

tpluscode commented Aug 27, 2020

Tell us about your setup

What is your lando version and operating system?

v3.0.11 on macOS 10.15.5

Tell us about your .lando.yml

Paste in the contents of your .lando.yml this is SUPER HELPFUL for us.

Example:

name: wikibus-apis
services:
  sources:
    type: node:custom
    command: node --inspect=0.0.0.0:34567 -r ts-node/register --inspect packages/sources/index.ts
    port: 34566
    ssl: true
    overrides:
      image: node:14
      ports:
        - '0.0.0.0:34567:34567'
    moreHttpPorts:
      - 34567
  users:
    type: node:custom
    command: node --inspect=0.0.0.0:34667 -r ts-node/register --inspect apis/users/index.ts
    port: 34666
    ssl: true
    moreHttpPorts:
      - 34667
    overrides:
      image: node:14
      ports:
        - '0.0.0.0:34667:34667'
proxy:
  store:
    - wikibus-store.lndo.site:3030
  users:
    - wikibus-users.lndo.site:34666

You can find the entire project on https://github.com/wikibus/apis

Tell us about the command you were running

lando start
docker exec -it wikibusapis_sources_1 bash

curl https://wikibus-users.lndo.site/user/foo
curl https://wikibus-sources.lndo.site/
curl http://sources.wikibusapis.internal

Tell us about the error you got

It seems impossible to reach the APIs running in the sources and users services containers. I want to call between services but even trying to reach sources from its own container is impossible, trying any of the URLs: proxied as well as *.internal

All those calls inside the container fail with Failed to connect to X port 80: Connection refused but I can definitely reach my apps over the lndo.site proxy from the host system

Tell us more

The code in the repo does not reflect that but I tried all kinds of ways to make sure that the services listen on all hosts. app.listen(port, '0.0.0.0') in express as well setting 0.0.0.0 as shown above to make sure that lando also complies.

@tpluscode tpluscode added the bug Something aint working right! label Aug 27, 2020
@tpluscode
Copy link
Author

Aha, so yes, the only way that works is to call http://users:34666 😞

@tpluscode
Copy link
Author

Otherwise lndo.site only works when calling the service from its own container and only with the port like

lando ssh -s users -c "curl http://wikibus-users.lndo.site:34666"

@pirog pirog self-assigned this Oct 21, 2020
@pirog pirog added this to the 3.1.0 milestone Oct 21, 2020
@pirog pirog removed this from the 4.0.0-alpha.1 milestone Oct 28, 2020
@pirog pirog closed this as completed Oct 29, 2020
@tpluscode
Copy link
Author

Thank you @pirog for fixing this. Is there any time frame for 3.1?

@pirog
Copy link
Member

pirog commented Nov 3, 2020 via email

@tpluscode
Copy link
Author

Oh sorry, I was confused by the GitHub messages. It says "added to 3.1" and the "removed from 4.0.0-alpha.1" but I didn't realise they are the same thing :)

@pirog
Copy link
Member

pirog commented Nov 3, 2020 via email

@tpluscode
Copy link
Author

Unfortunately this still does not work correctly. I can have my service run on port 443 to make it accessible over its SSL proxy but custom ports are still not mapped

@tpluscode
Copy link
Author

Ah no, sorry, I cannot trick the proxy with 443. Then requests fail with SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol

So the only way is to expose port 80 from the service and http proxy will respond

@pirog
Copy link
Member

pirog commented Nov 10, 2020

@tpluscode you might want to read the docs on how this is expected supposed to work
https://docs.lando.dev/config/networking.html#port-considerations

@tpluscode
Copy link
Author

Thank you. I am not hung up on custom ports.

Would it at least be possible that HTTPS requests work internally?

So with config as below I would be able to call https://thing.my-project.lndo.site?

proxy:
  appserver:
    - thing.my-project.lndo.site

SSL termination would be totally fine, if the proxy connected to the service on HTTP with X-Forwarded-Proto 🙏

@pirog
Copy link
Member

pirog commented Nov 10, 2020

@tpluscode an implication in the docs i shared is that if you want https to work internally then that cannot happen through the proxy eg the service itself also needs to be listening on 443. The proxy does do ssl termination and sets the correct header already but this is besides the point because internally the proxy is not part of the equation.

@tpluscode
Copy link
Author

For this, please refer to my comment above. I tried listening on 443 and then internal https requests would fail with

SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol

@pirog
Copy link
Member

pirog commented Nov 10, 2020

If you are using a node service then it is going to be up to you to make sure it can listen on 443 correctly. Here is an example of doing that with express
https://github.com/lando/lando/blob/master/examples/node12/src/app-https.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something aint working right!
Projects
None yet
Development

No branches or pull requests

2 participants