DevOps Automation

 View Only

Deploying WebSphere applications to multiple clusters in the same cell

By Osman Burucu posted Fri January 06, 2023 05:44 AM

  

This article was originaly published in 2016.03.21

Deploying WebSphere applications to multiple clusters in the same cell


You can use the WebSphere Application Server – Deploy plug-in for IBM UrbanCode Deploy to deploy an enterprise application (EAR file) to multiple clusters in the same cell. In the following example, the EAR file EAR1.ear contains an Enterprise JavaBeans (EJB) Module, EJB1.jar.

A typical deployment process consists of the following steps:

  1. Running the Configure using Topology Discovery action, which creates a set of clusters and cluster member resources in the application environment, as shown in the following screen capture.
    Running the Configure using Topology Discovery
  2. Creating a component, based on the WebSphere Enterprise Application component template, that contains the EAR file.
  3. Adding the component under each cluster in the environment, as shown in the following screen capture.
    Adding the component under each cluster in the environment
  4. Creating an application process that runs the Install Component step, and then calls a process that is derived from the Deploy EAR With User/Group Mappings, Resource Mappings process. The Deploy EAR With User/Group Mappings, Resource Mappings process is provided by the WebSphere Enterprise Application component template.
    The Deploy EAR With User/Group Mappings, Resource Mappings process is provided by the WebSphere Enterprise Application component template.

This approach attempts to install the application, in parallel, on each cluster. This approach succeeds on one cluster but fails on the other clusters. An error similar to following message is logged:

com.ibm.ws.scripting.ScriptingException: WASX7279E: An application with name “EAR1” already exists. Select a different name.

To work around this error, you must deploy the application to one cluster only, and then map each module of the application to the other clusters. Complete the following steps:

  1. In the environment, create a resource tag called ClusterForInstall. Apply the tag to the first cluster.
  2. Create a resource tag called ClusterForMapping, and apply the tag to all of the remaining clusters.
    Create a resource tag called ClusterForMapping, and apply the tag to all of the remaining clusters

  3. Go to the Components page, open the component (in this example, MultipleClustersComp), and then click the Processes tab.
  4. In the Actions field that is associated with the Add Target to Module process, click Copy.
  5. In the Process Clipboard, click Paste.
  6. Rename the copy of the process to Add Target to Module for Cluster. Open the process for editing.
  7. Add an Add Target to Module step for each module contained in the EAR file, by clicking Application Server > Java > WebSphere > Deployment > Add Target to Module in the step palette of the process editor. Ensure that the step name is unique.
  8. Specify the name of the module to map to the cluster in the Module URI field. In this example, it is an EJB JAR file called EJB1.jar, as shown in the following screen capture:
    Specify the name of the module to map to the cluster in the Module URI field. In this example, it is an EJB JAR file called EJB1.jar
  9. Optional: Click Show Hidden Properties to see all of the pre-populated values. The Cluster Name is known at run time because the component is under the cluster in the environment resource tree in IBM UrbanCode Deploy. When the step runs, the module is mapped to the selected cluster. You do not have to specify the cluster name explicitly in the step.
  10. Repeat steps 7-8 for each module contained in the EAR file.
  11. Create or update an application process, so that the process installs the component to the first cluster only, and maps the modules to all the other clusters, as shown in the following example:
    Create or update an application process, so that the process installs the component to the first cluster only, and maps the modules to all the other clusters
  12. The first step in the previous example is an Install Component step, as shown in the following screen capture.
    Component Process is set to the Deploy EAR deployment process, which installs the EAR file.
    Limit to Tag is set to ClusterForInstall.
    Max # of concurrent jobs is set to 1.
    The first step in the previous example is an Install Component step,
  13. The second step in the example is an Install Component step, as shown in the following screen capture.
    Component Process is set to the Add Target To Module For Cluster deployment process, which you created previously in step 6.
    Limit to Tag is set to ClusterForMapping.
    Max # of concurrent jobs is set to 1.
    The second step in the example is an Install Component step
  14. Because both processes are of type Deploy, when the application process runs, the selected component version is deployed to each cluster in the IBM UrbanCode Deploy inventory.
  15. The following screen capture shows a successful run of the application process:
    shows a successful run of the application process

    The Deploy EAR process ran only once (on Cluster1), while the process Add Target to Module for Cluster ran twice (on Cluster2 and Cluster3).
  16. The component processes to start and stop the application are supplied by the WebSphere Enterprise Application component template. These processes are of type Operational (No Version needed). When you are working in the application process editor, you can find these start and stop processes listed in the step palette, under the name of the component that they belong to (in this example, the MultipleClustersComp component). Running these start and stop processes does not change the IBM UrbanCode Deploy inventory. Because the start and stop processes can be run in parallel on all clusters without error, you can leave the default value of the Max # of concurrent jobs field set to -1.
    The component processes to start and stop the application are supplied by the WebSphere Enterprise Application component template
  17. The following screen capture shows the Start App process running in parallel on the three clusters:
    shows the Start App process running in parallel on the three clusters
  18. To uninstall the Application, create two component processes of type Uninstall. The first process actually uninstalls the EAR file from WebSphere Application Server. The second process is needed to remove the component version from the IBM UrbanCode Deploy inventory on the remaining clusters.
  19. Create a component process of type Uninstall, named Uninstall.
  20. Add the uninstall step to the component process by clicking Application Server > Java > WebSphere > Deployment > Uninstall Application in the step palette of the process editor. Accept all of the default properties for the step.
  21. Create another component process of type Uninstall, named Undo Target Mappings. Do not add steps to this process. Instead, add a note that explains the purpose of the process, as shown in the following screen capture:
    Create another component process of type Uninstall, named Undo Target Mappings. Do not add steps to this process. Instead, add a note that explains the purpose of the process,
  22. Create an application process that runs both of the component processes on different clusters, using Uninstall Component steps.
    Create an application process that runs both of the component processes on different clusters, using Uninstall Component steps.
  23. The first uninstall step is defined as shown in the following screen capture:
    The first uninstall step is defined
  24. The second uninstall step is defined as shown in the following screen capture:
    The second uninstall step is defined
  25. The first process runs only once on Cluster1 and the second process runs on all other clusters (Cluster2 and Cluster3). The EAR file is uninstalled from WebSphere Application Server. The process removes all of the component versions from the IBM Urbancode Deploy inventory. The following screen capture shows the uninstall process running successfully:
    shows the uninstall process running successfully

This process was tested with IBM UrbanCode Deploy v6.2.0.2, the WebSphere Application Server – Deploy plug-in v86, and IBM WebSphere Application Server Network Deployment v8.5.5.


#WebSphereApplicationServer(WAS)
#UrbanCodeDeploy
0 comments
5 views

Permalink