[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 666
  • Last Modified:

Tomcat: Deploying new verson without site downtime

We have running application on a server with Apache HTTP server in front and Tomcat server behind it as a servlet engine. When we deploy a new version of the application on Tomcat server, we have to shutdown the site (application context), deploy a new version (DB updates + new WAR) and start the server afterwards. Also, there are some backup things done before each deploy and initial testings after starting the application again, so this all make our site not available from 10 to 30 mins (sometimes even more).

Is there some deployment strategy with the server environment, like I have described above, for deploying a new version, so that we do not have site downtime? (Please, also reconsider of possible data changes in DB during a deployment of a new version, handling open HTTP session which started before deployment...)
0
drazen_nikolic
Asked:
drazen_nikolic
  • 2
1 Solution
 
evguenCommented:
Hello drazen_nikolic,

If you do not want to have any downtime while deploying a new version of your WAR - you would need 2 servers with Tomcat. (virtual servers is also a solution, even if on the same physical server). While you're a updating the first server - the second is taking all users requests. This also means that you need a loadbalancer in front of both servers holding session informations (or with session replication technology).

With DB updates, it's quite different, as you have only one database, even if you have installed clusters.

As I have the same problematics you are talking about, I have resolved it by scripting everyting.
This way, when I need to deploy a new WAR and make some updates to the database I only launch a shell script which :
- stops tomcat server
- replace the WAR in webapps
- dump the database (just in case)
- updates the database with SQL script file (if the file is present)
- dump again the database (just in case, again)
- erase the work/ folder (as I already had troubles with)
- starts tomcat

This way, the website is unavailable for 1 minute only.

I'm currently thinking of programming the deployment process, so this would be done at 11pm, for example, with a SMS sent me on my phone with deployment status, as I already receive SMS when something goes wrong on the server.

Hope this helps

Best regards
0
 
drazen_nikolicAuthor Commented:
Hello evquen,

Thank you for your comment. We already do the similar procedure like you wrote. It is an interesting idea, though, to schedule a job which will execute the shell script or ruby code to perform the deployment at some time around midnight.

But I would like to have a solution which will result in no site downtime. How it can be managed tha session could be shared among differnet Tomcat instances, or how that session replication could be achieved?

Any tips, examples, URLs?
0
 
drazen_nikolicAuthor Commented:
It is not what I was looking for but nobody else, except you, responded. So you get all the points. :) Thank you, anyway. Regards
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now