App Deployment - Vaadin Flow

Greetings team,
Has anyone hosted/deployed .jar file in aws EC2 instance?
If yes could you share your experience or rather guide on how to secure the app via https?

I’m considering different approaches to testing/host my app.

I have tried deploying my latest vaadin 24 (Flow) app on Elastic beanstalk following the guide given in Vaadin documentation but for some reasons, the status Changes from “Ok” to “Survere” when i upload the .jar file.

The logs points to HTTP requests failed when i enable load balancer.
Any ideas,suggestions and assistance will be highly appreciated.

Regards.
Hezron

I don’t know if in that instance, you could add a reverse proxy to manage the SSL certificates for your…

But you can do it.

letsencrypt for PoC’s, works pretty well.

1 Like

Thanks Ruben,
Looking into the resource you’ve shared.

Based on your description, I cannot help you. Can you please provide more information about the error? Also, post the logs.

Also read the docs: Configuring HTTPS for your Elastic Beanstalk environment - AWS Elastic Beanstalk

Hello Simon,

  1. My Elastic Beanstalk environment looked like this before i uploaded my .jar file

  2. Whe i uploaded the .jar file, this is what got while trying to call the domain e.g myapp.com:(At this point health status showed “OK”)

  3. This was the result after configuring Load balancer. Immediately my health changed from "OK’ to “Survere” with this details:

Let me know if you need any other clarification.
NB:// My objective is to run my app with https enabled to secure it.

Does your app run on port 5000?

server.port=5000

5000 is the port Beanstalk expect.

Yes it does.
This is how my .properties file config looks like;

server.port=5000
spring.datasource.url = jdbc:mysql://${RDS_HOSTNAME}:${RDS_PORT}/${RDS_DB_NAME}
spring.datasource.username = ${RDS_USERNAME}
spring.datasource.password = ${RDS_PASSWORD}
spring.datasource.ddl-auto = create

#Some other configurations

Have you checked the logs?

here is a part of the nginx error logs.

Simon is talking about your application logs.

Hello Simon & Christian,

My apologies from my earlier reference, here is a more detailed info.

I suspect the issue is within my production configurations conflicting with Development configs.

Heres a snippet from aws logs:

There you have the answer: use production mode when you create the artifact. I was about to guess that even before seeing the log…

If it is “standard vaaadin maven project”, that should be trickered with:

mvn package -Pproduction

Looks like you are deploying a development application.
Did you run the build-frontend Vaadin maven plugin goal when building the production JAR (or the same task for a Gradle project)?

Usually, in a Maven project you have a production profile, that enables build-frontend during the compile phase

1 Like

And sorry for the mess, Vaadin is doing things in its custom way here and I know many people fail with Vaadin because of this. If you want to try a bit different approach, check this thread. Using this approach standard methods to create deployment artifacts like mvn package or mvn spring-boot:build-image work out of the box.

Thanks Marco,

Correct.
I have since done this:

  1. Added this to my .properties file: vaadin.productionMode = true

  2. Rebuilt the .jar project with this: mvn clean package -Pproduction -Dvaadin.force.production.build=true

  3. Uploaded the .jar file and it has worked.

Thank you all.

There is no need to set vaadin.productionMode = true in application.properties. It has no effect

Hello Marco,

Noted and thanks for the insight.