Guzzlehttp client connection refused over non standard port - http

I'm running a few containers using docker-compose.
One of the services I added recently is exposed on port 3000
Any request made to this service using guzzle throws the following error:
cURL error 7: Failed to connect to service-stub port 3000: Connection refused (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
It works if I change the port to 5000, however I have another service using that port hence need to run the new service on a different port.
Anyone know how to get around this issue?

Related

Cannot connect using TCP with ngrok and postman

I have testing a grpc service made in golang. The server is running in localhost:50051. If I test with Postman, the application retrieve me a valid response:
Now, I trying to connect with an application, so I am using ngrok to expose my service.
First, I tried with this command:
./ngrok tcp localhost:50051
This is pointing to tcp://0.tcp.ngrok.io:19230, so I entered 0.tcp.ngrok.io:19230 into postman, but nothing happened, only I got an error.
Then, I tried to use a ngrok.yml configuration for the tunnel. This is the file:
Of course, using ./ngrok start grpc, and using the new ngrok tcp connection with postman, the same error occurs.
I don't know what I am doing wrong.

Ngrok errors '502 bad gateway' - How to point web server to point 5000

I'm new to Web App so I'm sorry if this is a simple question.
I enter: ngrok http 5000
Then when I go to the correct https address I get the message below.
The connection to https://e71eb98330fe.ngrok.io was successfully tunneled to your ngrok client, but the client failed to establish a connection to the local address 127.0.0.1:5000.
Make sure that a web service is running on 127.0.0.1:5000 and that it is a valid address.
The error encountered was: dial tcp 127.0.0.1:5000: connect: connection refused
According to this answer:
I need to set up a web server and point it to local host 5000.
But my error is slightly different and even when I try going to: localhost:5000
It doesn't work.
Is the problem just that I need to point a web server to 5000? How do I do that?

Error when trying to connect to gRPC endpoint from a UI tool or proxy tool

I'm testing gRPC with .NetCore and looked up for a GUI tool or something that can help me to test my endpoint like testing REST API.
I found a proxy tool: grpc-json-proxy that can be used with Postman tool (also found another GUI tool: grpcox).
Using any tool gives an error like the following when trying to connect to the endpoint:
unable to do request err=[Post
http://localhost:5001/greet.Greeter/SayHello: dial tcp 127.0.0.1:5001:
connect: connection refused]
Any idea what could be the issue?
Most importantly, are you confident the gRPC server is listening on localhost:50051? You may confirm this (on Linux) using:
GRPC="50051"
ss --tcp --listening --processes "sport = :${GRPC}"
NOTE you may need to sudo ss ... to get the process
Or more simply:
telnet localhost 50051
If you get Connected to... that's a good sign
Then, if you're using either of these tools through docker, you'll need to ensure the container can access the host's 50051 port. To do this, run the container use --net=host. This will make the host's port available to the container.
I use grpCurl

ngrok not connecting to local server

So, I am running ngrok (current version) on my Mac OSx. But I am getting the following error:
Failed to complete tunnel connection
The connection to http://35504712.ngrok.io was successfully tunneled to your ngrok client, but the client failed to establish a connection to the local address localhost:3746.
Make sure that a web service is running on localhost:3746 and that it is a valid address.
The error encountered was: dial tcp xx.xx.xx.xx:3746: getsockopt: connection refused
I know my server is running properly, as I can actually click the link to my localserver in the error message and get a response from my server.
Any ideas on how to diagnose?
Have you made sure you're running ngrok inside your project directory, also can you still access localhost:3746?
Also what command are you using to start hosting the ngrok sever?

Akka remoting binds to hostname instead of bind-hostname

Context
I am trying to run an akka application on a node and make it work with other nodes using akka remoting capabilities.
My node has an IP address, 10.254.55.10, and there is an external IP, 10.10.10.44, redirecting to the former. This external IP is the one on which I want other nodes to contact me.
Extract from my akka app config:
akka {
remote {
netty.tcp {
hostname = "10.10.10.44"
port = 2551
bind-hostname = "10.254.55.10"
bind-port = 2551
}
}
}
I know everything works fine on the network side, because when I listen on my IP with netcat, I can send messages to myself via telnet using the external IP.
In other words, when running these two commands in separate shells:
$ nc -l 10.254.55.10 2551
$ telnet 10.10.10.44 2551
I'm able to communicate with myself, proving the network redirection works fine between the two IPs.
Problem
When launching the application, it crashes with a bind error:
INFO Remoting - Starting remoting
ERROR a.r.t.n.NettyTransport - failed to bind to /10.10.10.44:2551, shutting down Netty transport
Exception in thread "main" java.lang.ExceptionInInitializerError
[...]
Caused by: org.jboss.netty.channel.ChannelException: Failed to bind to: /10.10.10.44:2551
[...]
Caused by: java.net.BindException: Cannot assign requested address
[...]
INFO a.r.RemoteActorRefProvider$RemotingTerminator - Shutting down remote daemon.
I assume what makes it crash is that it tries to bind to an IP that is not present locally (i.e. 10.10.10.44). But what I don't understand in first place is why akka is even trying to bind to 10.10.10.44, since it is not my bind-hostname (which is 10.254.55.10). This doc page seemed pretty clear to me on that matter, yet it doesn't work...
The project I was working with was based on akka 2.3.4, in which bind-hostname and bind-port configuration keys do not exist. I upgraded to latest version at the time, akka 2.4.1, and it solved the problem.

Resources