AWS EC2: (Connection refused) while connecting to upstream - java

Error:
2022/02/25 05:25:23 [error] 16292#16292: *1 connect() failed (111:
Connection refused) while connecting to upstream, client: 172.31.9.17,
server: , request: "GET / HTTP/1.1", upstream:
"http://127.0.0.1:5000/", host: "172.21.11.88"
It's my first time uploading a fullstack JAR file in AWS EC2. Jar file contains Thymleaf web pages and the main java codes.
I've also done setting my RDS in AWS as well.I changed the security group to 'allow access' anywhere so I can connect to it on my local MySQL Workbench. By this, Im done setting up my SQL tables.
So I uploaded the JAR file. The status went from Healthy to Severe.
When I access the URL of my app I get this:
application.properties
server.port=5000
AWS Security Group
Inbound Rules
Health Monitoring
UPDATE:
Here's where Im at
Is this what's causing my errors?

By default EB expects your app to listen on port 5000. From docs:
By default, Elastic Beanstalk configures the nginx proxy to forward requests to your application on port 5000. You can override the default port by setting the PORT environment property to the port on which your main application listens.

Related

GCP GKE SMTP port 465 connection reset

I've got a Spring Boot Java application that sends emails via SMTP port 465 (non-gmail email). My configuration:
spring:
mail:
host: ssl0.ovh.net
port: 465
username: mailer#external.pl
password: mailerPassword
Locally everything works fine. When I deploy it on GCP Kubernetes cluster I've got a connection reset exception. I've read that GCP recommends some external paid providers but for my solution it's too much of a complication. Additionally I know that port 25 is disabled on GCP -> I've got port 465.
I've tried to simply add a firewall egress rule to enable traffic on every port for my VPC but it also didn't help.
What am I missing? Can anybody help my solve this puzzle?
Additional info:
My Java application is served as a simple deployment in k8s. It is exposed through LoadBalancer service on port 80.
Making a curl from given managed pod works - I receive a correct 2xx responses from various sites.
It turned out that my config map port changed from 456 to 465 but I forgot to restart the app. It works like a charm without any NAT configuration or firewall rules. Thanks for your support.

Configuring server and port for Tomcat Spring Boot application

I am deploying my Spring Boot application via uploading a JAR to Elastic Beanstalk.
I am getting the following error:
*1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.43.15, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "172.31.42.2"
and
I do not understand which configurations are missing. Here it says:
The Tomcat platform uses nginx (the default) or Apache HTTP Server as the reverse proxy to relay requests from port 80 on the instance to your Tomcat web container listening on port 8080. Elastic Beanstalk provides a default proxy configuration that you can extend or override completely with your own configuration.
I feel like this should give me some hint, but I still don't get what exactly I need to change.
Similar issue: 502 bad gateway Elastic Beanstalk Spring Boot
From the suggestions there I tried:
defining server.port=8080 in my application.properties
adding PORT or SERVER_PORT environment properties directly in EB
changing Java to version 8 in pom.xml
changing load balancers ports here in EB to 8080:
I might be changing things to a wrong port, or maybe in an unfortunate combination - but nothing seems to work for me.
I never had to do such things, so for me it's all super unclear and I would be thankful for all kinds of help.

Host Ip binding failed

I am trying to connect my genymotion emulator to my localhost. After reading an article I got to know that my emulator is running on virtual host so I need to run my application in the same network
So emulator is on ip 192.168.20.101 So I tried to keep my server on 192.168.20.5
I am using dropwizard server. I got an error java.net.BindException: Cannot assign requested address: bind
I used following code to change my yml file
server:
applicationConnectors:
- type: http
bindHost: 192.168.20.5
port: 8090
adminConnectors:
- type: http
bindHost: 192.168.20.5
port: 8091
I am not sure you can bind IP in inside VirtualBox network. What you can do is configure your device to run in bridge mode, like this:
This way the device runs in the same network as your host, so you can easily access localhost or other machines.

Unable to deploy Vaadin Java app to AWS Elastic Beanstalk

I'm trying to run Vaadin 8.0 app on Elastic Beanstalk. I created a War file and upload it to AWS as described here:
https://vaadin.com/wiki/-/wiki/Main/Amazon+Elastic+Beanstalk+HOWTO
The instructions are helpful but somewhat out of date.
When the code is deployed, the service state switches to "DEGRADED" with the severity of "SEVERE". When i pulled the logs I saw:
------------------------------------- /var/log/nginx/error.log -------------------------------------
2017/04/03 21:17:32 29340#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 50.252.224.113, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/",
host: "lowcost-env.minuvpn9c8.us-east-1.elasticbeanstalk.com"
which I think means there's an nginx proxy server that wants my app to be serving on port 5000, and apparently it isn't. I did not see any other errors in the log. However, I have no idea where to go next.
Help would be hugely appreciated.
thanks.

Haproxy config for bitbucket server

I am using haproxy for port forwarding to Bitbucket server ssh. Here's haproxy config:
frontend sshd
bind *:7999
default_backend ssh
timeout client 1h
backend ssh
mode tcp
server localhost-bitbucket-ssh 127.0.0.1:7999 check port 7999
However if i do:
sudo haproxy -f haproxy.cfg
i am getting the following error:
[ALERT] 305/201411 (4168) : http frontend 'sshd' (haproxy.cfg:38) tries to use incompatible tcp backend 'ssh' (haproxy.cfg:43) as its default backend (see 'mode').
[ALERT] 305/201411 (4168) : Fatal errors found in configuration.
But i was referring to an official atlassian guide: https://confluence.atlassian.com/bitbucketserver/setting-up-ssh-port-forwarding-776640364.html are they wrong?
Also if i start haproxy before bitbucket server, bitbucket server cannot start on port 7999. I am totally confused. I have paid for that software and now i need to figure it out myself how to configure it for more than 2 days...
UPDATE
It was UFW as Thomj mentioned. But for what purposes do i need haproxy? If i can't bind Bitbucket's ssh to 22 port? I don't like to set port number.
The frontend configuration is defaulting to a mode of http which can't use a backend that's configured for tcp. Try adding 'mode tcp' to the frontend:
frontend sshd
bind *:7999
default_backend ssh
timeout client 1h
mode tcp

Categories

Resources