0

I have 3 spring boot application and want to deploy all on single EC2 instance.

When i have tried to deploy war and deploy under tomcat/webapps some applications will not work as embedded tomcat in spring boot uses port 8080 and other web applications which are exists in tomcat stopped working.

Other options i have tried is changing server.port in application.properties file running jar with java -jar app.jar.

This works but for only one app if i want to run one app and if i press cntrl+c or cntrl+z or closing terminal(closing ssh connection) is stopping application.

When found during my search that we can do with AWS Elastic Beanstalk.but i have already created one free tier ec2 instance is there any way to make it work with out changing instance.

can some one help me out? Thanks

vaquar khan
  • 10,864
  • 5
  • 72
  • 96
Hema
  • 117
  • 1
  • 12

1 Answers1

1

If you want to run your app using java -jar app.jar add & to the end allowing the process to run in the background.

Using the command java -jar app.jar & you can run multiple apps in the background. This will return a pid "Process ID"

You can use this pid to kill the app later with kill -9 <pid>

To check running processes you can use ps aux | grep java (We are searching for anything that contains "java")

For running multiple wars on tomcat explicitly deploying multiple applications to Tomcat

danzdoran
  • 281
  • 2
  • 7
  • and one more question if i want to run with different ports like 8082 and 8085 etc should i add custom TCP rule in inbound address of aws console ? – Hema Feb 22 '19 at 05:36
  • Yes but be careful not to expose ports to the outside world if you don't have any security enabled. – danzdoran Feb 26 '19 at 19:46