This short tutorial will show you how to emulate an application versioning on JBoss EAP / WildFly with some simple management steps.
One common task for most system administrator is the need to switch to an older/newer version of an application. If you deploy one application using automatic deployment, or simply replacing the application you will get that the newer application merely replaces the older one. That’s not a big issue if you have a solid provisioning system, however it’s good to know that the application server has been trained to do this for you!
Let’s see a basic example. You have an application packaged as demowebapp-1.0.war with the following jboss-web.xml file that defines the context root:
<jboss-web> <context-root>/demowebapp</context-root> </jboss-web>
Now we will deploy the application using WildFly Web Console so reach localhost:9990 and click on Deployments
Pickup the application to be deployed as shown by the following picture and flag it as enabled:
Now the twist: The Application Name is an unique identifier of the deployment. However the Runtime Name is the name by which the deployment should be known within a server’s runtime. This would typically be the same as ‘name’, but in some cases users may wish to have two deployments with the same ‘runtime-name’ both available in the deployment content repository, in which case the deployments would need to have distinct ‘name’ values but would have the same ‘runtime-name’.
As you can see, we have used demowebapp.war as runtime name. Now let’s deploy another version of the application, say demowebapp-2.0.war:
As you can see, the runtime name is the same and the application is disabled otherwise there will be two applications with the same runtime name at the same time.
The first test will be verifying that we are delivering the version 1.0 of the application:
Now let’s disable the application demowebapp-1.0.war and conversely enable the application demowebapp-2.0.war
And now let’s test again the application:
Good, we can safely swap between application versions- the only trick is to keep just one enabled!