Unable to deploy Vaadin Java app to AWS Elastic Beanstalk - java

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.

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.

AWS EC2: (Connection refused) while connecting to upstream

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.

Proxy error 502 aws after configuring .ebextensions

I've deployed my Java web application to a AWS server, but I get an 502 proxy error like this when making a get request:
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /product.
Reason: Error reading from remote server
The database connection works fine if the application is deployed locally with an online database.
I've tried to configure .ebextensions and my YAML file looks like these:
option_settings:
option_name: Timeout
value: 1000
This is my draft version of my site and you can see the error code: http://platformaruralpreno.eu-west-2.elasticbeanstalk.com/product

Connecting to couchbase running on alternate ports using java client

I'm using couchbase-client 2.3.2 for Java and Couchbase server Community 4.0
So I'm experimenting with running Couchbase on non-standard ports using the documentation at Couchbase website
I've managed to start Couchbase using these alternate ports but I've only managed to change some of the ports in the java client, here's my code:
final CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder()
.bootstrapCarrierDirectPort(21210)
.bootstrapHttpDirectPort(9091)
.build();
return CouchbaseCluster.create(env, "10.0.2.15");
My program is able to connect to couchbase and so some things, however I still need to change the view port (default 8092) and the query port (default 8093) in the client. as a result I'm met with these errors:
2016-09-30 14:03:49.696 [] WARN c.c.c.c.e.Endpoint - [null][QueryEndpoint]: Could not connect to endpoint, retrying with delay 32 MILLISECONDS: ! java.net.ConnectException: Connection refused: /10.0.2.15:8093
2016-09-30 14:03:52.077 [] WARN c.c.c.c.e.Endpoint - [null][ViewEndpoint]: Could not connect to endpoint, retrying with delay 2048 MILLISECONDS: ! java.net.ConnectException: Connection refused: /10.0.2.15:8092
So the client still tries to connect to 8092 and 8093 when in fact I've changed those to 9092 and 9093
From the JavaDoc on 2.3.4 (http://docs.couchbase.com/sdk-api/couchbase-java-client-2.3.4/), I believe what you want is this:
DefaultCouchbaseEnvironment.Builder viewEndpoints(int viewServiceEndpoints)
Even though it's completely undocumented, you need to add those ports to static_config as well:
{capi_port, 9092}.
{query_port, 9093}.
and then it works, hope someone at couchbase sees this and updates their documentation :)

Categories

Resources