Single server non disruptive deployments setup
If you run a single server setup and still want to have non disruptive deployments, here is a simple howto.
HOWTO
- Install redis. This should be available in all package repositories.
- Copy 3 jar into your $TOMCAT/lib
- tomcat-redis-session-manager-1.2.jar
- I ran into serious trouble when setting this up. Finally I had to build tomcat-redis-session-manager against a current tomcat-catalina. You can get this build here
- Add this to your project's META-INF/context.xml:
- Deploy new versions of your war file as described here. In short: foo##1.war defines Version 1, foo##2.war Version 2. Both are depoyed in parallel. New sessions will go to the latest version, while existing sessions keep their version. As we have moved the session management to Redis, Tomcat will always move request to the latest version. So as long as your session data is binary compatible between versions, you have true non disruptive deployments.
- Using the version I used, you need to keep in mind that the session-timeout in web.xml is treated as seconds (as per servlet spec it should be minutes)
- Also the manager app doesn't know anything about the session anymore. But you can look into all KEYS in Redis.
- I used Tomcat 7.0.68 which worked. I can confirm that 7.0.52 (as in Ubuntu 14.04) doesn't work.