I have set up everything for spray on my AWS instance.
I am also able to run the sample spray-template successfully.
But the issue is spray-template uses port 8080 to bind when I change port from 8080 to 80.
I am facing below mentioned error.
Bind to localhost/127.0.0.1:80 failed
Below is line from my Boot.Scala file
IO(Http) ? Http.Bind(service, interface = "localhost", port = 8080
Can anyone help me with this?
Thank You.
Related
Using Delphi 11.
I have two http servers running on my machine ; one on 80 port and other on 8080 .
I can sucesfully use TIDHttp to connect on the 'regular' server on 80 port, like so :
idhttp1.get('localhost');
But when i try to do the same with the server on 8080 port :
idhttp1.get('localhost:8080');
It raises the excepction "Unknown Protocol".
I can connect on both server directly on Chrome using the same addresses. What am i missing , please ?
Thanks
After i posted the question, i figured out.
Instead of
idhttp1.get('localhost:8080');
I needed to use
idhttp1.get('http://localhost:8080');
I am using dotnet-testcontainers https://github.com/HofmeisterAn/dotnet-testcontainers to spin up a container with mountebank in my xUnit test.
I can successfully create a mountebank client and create an imposter successfully.
The issue is that when the test is run, the app tries to make a call to the imposter on http://localhost:3000 and gets connection refused.
I can successfully open http://localhost:2525 and can see Mountebank default page. So mountebank is running fine. I also confirmed that the imposter was created successfully on port 3000 by looking at docker container log.
I also tried to use Postman to make a call to my imposter at http:localhost:3000 and get connection refused.
What could be the issue? Is this an issue that port 3000 in the docker container is not exposed or something? Below is my code:
MountebankClient mbClient = new MountebankClient();
var testcontainersBuilder = new TestcontainersBuilder<TestcontainersContainer>()
.WithImage("bbyars/mountebank")
.WithName("mountebank")
.WithPortBinding(2525, false)
.WithHostname("localhost");
var testContainers = testcontainersBuilder.Build();
await testContainers.StartAsync();
var testImposter = mbClient.CreateHttpImposter(3000);
testImposter.AddStub().ReturnsBody(HttpStatusCode.OK, File.ReadAllText(#".\Stubs\testImposter.json"));
mbClient.Submit(testImposter);
Might be useful for someone else who would face this issue. Figured out what the issue was. I was not mapping the host port and the imposter port in the container. Read about published ports https://docs.docker.com/config/containers/container-networking/ and used WithExposedPort(3000) and then did port binding of that port with host port using WithPortBinding(3000,3000) where the first port in this method is host port and second port is container port.
var testcontainersBuilder = new TestcontainersBuilder<TestcontainersContainer>()
.WithImage("bbyars/mountebank")
.WithName("mountebank")
.WithPortBinding(2525, 2525)
.WithExposedPort(3000)
.WithExposedPort(3100)
.WithPortBinding(3000, 3000)
.WithPortBinding(3100, 3100)
.WithWaitStrategy(Wait.ForUnixContainer().UntilPortIsAvailable(2525))
.WithHostname("localhost");
Service.Yaml
pods.yaml
i am not able to access my application from browser. What mistake i am doing ?
if i give Ipaddress:30010 -> my app is not getting reached. (attached my pod.yaml and service.yaml here in attachment)
You need to add targetPort setting in the ports section on your Service.yaml. This specifies the destination port of the container.
ports:
- name: http
port: 5432
targetPort: 5432
nodePort: 30010
port is a setting for in-cluster communication, that other containers in the cluster can access via {serviceName}:port.
You need to find your node ip. If you are using minikube then you find node ip list. By running kubectl cluster-info. Then in your browser go to http:[node-ip]:30010
I'm running a setup of 3 Ubuntu virtual machines. Two running the Python production code base and the other has a Memcached Docker container. On the Memcached machine I ran docker run -dit --name production-memcached --publish 11211:11211 memcached:latest.
The code base gets the following error message when trying to interact with it:
"exception": "TimeoutError(10060, 'A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond', None, 10060, None)"
I have ran docker exec -it production-memcached memcached stats and get the error message below.
failed to listen on TCP port 11211: Address already in use
However I've ran netstat -plnt and get tcp6 0 0 :::11211 :::* LISTEN 35030/docker-proxy, which looks fine to me.
I was able to get this to work by opening port 80 and using iptables to forward incoming port 80 to port 11211 but would prefer to use the Memcached port number.
The Memcached client is created by the following line:
client = base.Client(("domain.co.uk", 11211))
Any help would be appreciated, thanks.
DigitalOcean doesn't allow in-traffic on port 11211 to its virtual machines. If you want a Memcached machine you'll also need a virtual machine to act a proxy between you and it. I hope this saves someone the headache it caused me!
Apologies if this is a really simple question - I am following the hello-minikube the tutorial on the Kubernetes link below (running on Mac OS)
Minikube tutorial
I created a deployment on port 8380 as 8080 is in use,
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello-node ClusterIP 10.100.248.81 <none> 8380/TCP 11s
I also exposed the deployment, but when I try to curl or open the app URL I get connection refused.
Failed to connect to localhost port 8380: Connection refused
Also if I specify --type=LoadBalancer during the expose step - that also fails to connect.
Any help would be much appreciated.
I've recreated all the steps from the tutorial you have mentioned.
Your error only occurs when you do not change the port from 8080 to 8380, in one of the steps provided in the documentation. After you change it in all 3 places, it works perfectly fine.
What I suggest is checking if you changed the port in the server.js file - as it is used by the Dockerfile in build phase:
var www = http.createServer(handleRequest);
www.listen(8080); #->8380
Then in the Dockerfile in EXPOSE 8080 # -> 8380.
And the last place is while running the deployment:
kubectl run hello-node --image=hello-node:v1 --port=8380 --image-pull-policy=Never
I've tested this with --type=LoadBalancer.