Every time I copy OpenGrok/dist/source.war to /var/tomcat/webapps/, the tomcat generates blank error pages with 404 Not Found errors to my users, during a couple of seconds immediately after such copying.
HTTP/1.1 404 Not Found
Server: Apache-Coyote/1.1
Content-Length: 0
Date: Tue, 02 Apr 2013 19:00:14 GMT
Connection: close
This is not acceptable. Am I not deploying correctly, by manually copying a .war file into a tomcat directory, or is it an OpenGrok bug of some sort? How do I ensure there's not a single visitor that'd be getting an undue 404 during the deployment process?
Tomcat 7 has a feature called parallel deployments. Using this feature it is possible to have multiple instances of your app running under the same context path.
This blog post explains it nicely: http://www.javacodegeeks.com/2011/06/zero-downtime-deployment-and-rollback.html
To sum it up you need to manually version your wars when you add them to your appBase.
cp foo##001.war apache-tomcat-7/webapps/
cp foo##002.war apache-tomcat-7/webapps/
You may want to set undeployOldVersions and autoDeploy to true so that tomcat automatically deploys the app and removes the old version if it is no longer necessary.
Check https://tomcat.apache.org/tomcat-7.0-doc/config/host.html for further info on tomcat's config.
The Version after the ## must be string comparable, so you can use e.g. a build number from your CI System but you may have to zero pad it.
There are a few things to look out for:
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