Four weeks ago my colleague Robert van Loghem wrote about what the full scope of a deployment in an enterprise Java environment. The scenario that Robert presented included the configuration of databases, web servers, firewalls and Java EE resources. All are just as important to get your application up and running as the deployment of an EAR file.
But even though Robert's procedure was more complicated than the simple installation of an EAR file, it did not cover an even more common scenario; upgrading an application to a new version. While the initial deployment of an application is important, I think that upgrades are even more interesting for a number of reasons:
Because the upgrade scenario is the most important deployment scenario, it is something that comes up often when talking to clients about Deployit, our deployment automation product.
Let's go back to Robert's scenario. The application that was deployed in that scenario consisted of an EAR file, some static content (HTML files, images, etc.), and a number of SQL DDL scripts. So how should we upgrade that application to the next version, say v1.1? For the sake of simplicity, let us assume that the database schema hasn't changed between v1.0 and v1.1.Basically there are two scenarios imaginable. Either we undo the whole deployment of v1.0 and do a clean deployment of v1.0, something we like to call a full redeployment, or we do the minimal amount work to do the upgrade, an incremental deployment.
An incremental deployment would look like this:
And a full redeployment would look like this:
If you compare these two scenarios, you will notice a number of differences:
By removing and then recreating the web server and application server configuration in this deployment scenario, we will know exactly what the results will be. Any changes done to the configuration that are not documented in the deployment scenario will be removed and will not be recreated. To make it possible to do this, we have to stop the web server and application server and then start them again near the end of the scenario. This might negatively impact the availability of your application, but you know you need to set up a cluster to make your application highly available anyway, don't you?
What's also very interesting about the full redeployment scenario is that steps 7 through 12 look exactly like the initial deployment scenario for this application. The only things that are missing are the steps needed to create the database schema. Because the database keeps state it is not feasible to drop and recreate the schema. And looking at the full redeployment scenario some more, we see that steps 1 though 6 are what needs to be done to undeploy the application for good. Let's sum up the advantages and disadvantages of both scenarios:
While full redeployment can be sometimes be hard to get working properly, the fact that they are repeatable and predictable is such a major benefit that I think it far outweighs any disadvantages. Incremental deployments might seem like a leaner and meaner approach to deploying upgrades, but in fact you are sacrificing that thing that is essential to a deployment scenario; that it is a repeatable, predictable and undoable process. Only when state is kept (we are talking about databases here), are incremental deployments really necessary. In all other circumstances I recommend to implement a full redeployment scenario for upgrades.
Filed under Deployment, Xebia Labs | 1 Comment »
[...] deployments vs. full redeployments (Vincent Partington) Link Welches Deployment, ob “Incremental” oder “Full”, ist das Richtige für [...]