The task you want to do can be done using ansible, and it definitely could be done using Puppet. I'm going to focus on how to accomplish it using puppet.
You can deploy your WAR files to jetty, using puppet, by using a normal "file" resource and a defined resource that you initialize for each application.
Puppet will downloaded from the URL you specify (on your Puppet Master). Jetty is able to redeploy WAR files without restarting, if the WAR file modification time changes. So if your manifest creates a copy in $JETTY_HOME/webapps
it should be automatically picked up by Jetty. This way (or by touching the context.xml) you don't need to manually restart Jetty.
In order to download the WAR file from your Puppet Master to your Application Directory you will need the following manifest (replacing $JETTY_HOME):
define jetty::deployment($path) {
notice("Deploying ${name} to http://$hostname:${appserver-jetty::port}/"),
include jetty,
file { "$JETTY_HOME/webapps/${name}.war":
owner => 'root',
source => $path,
}
}
and you need to instruct your nodes to get a specific version of your application one after another (after you're sure that it has successfully started on one of the nodes). This can be done using an ENC (external node classifier) or, if you are not using ENC, by modifying your site.pp section for each node (or group of nodes):
node jetty-node1 {
jetty::deployment { "servlet":
path => '/srv/application/Servlet-1.2.3.war'
}
},
node jetty-node2 {
jetty::deployment { "servlet":
path => '/srv/application/Servlet-2.0.1.war'
}
}
The include jetty
line is necessary only if you want to manage your Jetty configuration through puppet using eg. https://github.com/maestrodev/puppet-jetty and this defined resource needs an appserver-jetty::$port variable. This example shows the simplest way you could control exactly which version of the Application is served by which node. This way you can script the deployment, based on your health-checks and deploy on node2 only after node1 is successfully running the new version.
This example is only to demonstrate the concept.
You might want to check these additional resources for more information and ideas:
On reloading the contexts: https://stackoverflow.com/questions/13965643/auto-reloading-war-in-jetty-standalone
This is for deployment and management of tomcat, but the ideas (and the manifests) are similar: http://www.tomcatexpert.com/blog/2010/04/29/deploying-tomcat-applications-puppet
This is for a, IMO, better alternative to directly copying the WAR files - using native packages (eg. RPM) for deploying your application:
http://www.slideshare.net/actionjackx/automated-java-deployments-with-rpm