Deploying Your Ear File Can Be Challenging
I am often asked how to standardize an ear file deployment around a WebSphere Cluster. Deploying an ear file to a cluster can present challenges, particularly when attempting to accomplish the task with one-off deployment scripts written in any number of scripting languages. In this example, I am using the defined logic with our DeployHub Continuous Deploy solution, designed to standardize the application release automation process. This logic can be called by any external process such as a Jenkins continuous integration workflow, or CloudBees Continuous Delivery pipeline process.
Whatever you may be using to orchestrate the calling of your deployment does not matter much. What matters is the ability to create a reproducible ear file deployment that all team members, from development to operations, can understand and track.
Steps for Setting Up an Ear File Deployment in the Websphere Cluster
- Get a list of the Servers that belong to the Cluster
- Loop through the list of Servers in the Cluster and Stop the App on each one
- Remove the App
- Install the App
- Apply warClassLoaderPolicy updates
- Apply classLoader updates
- Apply startingWeight
- Loop through the list of Servers in the Cluster and apply the following if changed
- Stop the Server
- Apply genericJvmArguments
- Apply initialHeapSize
- Apply maximumHeapSize
- Apply customProperty
- Apply websphereVariables
- Start the Server
- Loop through the list of Servers in the Cluster
- Start the Server if needed
- Start the App on the Server if needed
NOTES: You may need to get the Cell Name for the Websphere Instance since that is one of the initial starting points. Most of the time you can hard code it.
The stopping and re-starting of the Server is only needed if genericJvmArguments, initialHeapSize, maximumHeapSize, customProperty, websphereVariables values have changed. Otherwise, the servers can be left running saving total deployment time. If you are using Jenkins, our plug-in can be downloaded from DeployHub Jenkins Plugin.
Make sure to check if something is stopped or started beforehand as this will prevent errors from being thrown. Of course, you can do similar processing for a War file.