Hey, I'm new to Grails, and I'm wondering about deployment. Once a .war is deployed to production, how can I update the application without downtime?
You might setup two tomcat instances with an Apache mod_proxy_balancer
in front of it, as described here. For a redeployment of the application a "rolling upgrade" strategy might be applied (assuming app1 and app2 are your two tomcat instances):
And you're done. You don't need multiple physical or virtual machines for doing so - it's also possible on a single box. If your application upgrade implies database changes, be careful. The above might be encapsulated e.g. in an gant script, so a simple "grails cluster-redeploy" does everything you need. Such a script is currently on my list, but I have no idea when this will be finished.
If you're using Tomcat, it's possible, with what's called Parallel Deployment:
http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Parallel_deployment
Simply name the war files with the version number as described in the doc:
Even if you hot deploy the WAR file (by not restarting the server) there will still be some downtime while the context reloads. This isn't a Grails thing as such, more of a J2EE/servlet thing.
As dogbert said, best to put up a maintenance page (using Apache in front of Tomcat is a good idea) and shut down the app server, upload the new WAR then start the server up again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With