0

Not sure if this is a ServerFault or StackOverflow question. I'm posting it here since it's more of a server-related thing.

We're running a SpringBoot application (Java) running in a Tomcat container on an Ubuntu server (as a REST API). As expected, there will be times that we will need to upload a new version of the application, and I'm wondering what is the preferred method for restarting?

Currently, we use a shell script that detects a JAR file of a certain name to be present in a certain directory, and if found, it stops the process, moves the new file, backs up the old file and restarts the application using the new JAR file.

The problem is, at times, Tomcat can take up to 15 seconds to restart, leaving the REST service down for that time. Not a lot of time, but 15 seconds in our world is an eternity.

I'm mainly asking if this is a good or terrible way to go about this, and if there is something that can be done differently to expedite the reloading of the REST application.

Thanks in advance for any pointers...

mwieczorek
  • 121
  • 3

1 Answers1

2

I could offer simple solution, you should put reverse proxy before tomcat, for example nginx, start new instance of tomcat on different port, change nginx upstream configuration and reload it.

Alexander Tolkachev
  • 4,608
  • 3
  • 14
  • 23
  • Thanks. I've forwarded this to the people who manage our server (I'm just a coder), but this sounds like the best option for a single server setup without any load balancers in place. – mwieczorek Dec 29 '17 at 14:33