Install Enterprise Application on WebSphere Application Server with uDeploy

I’m going to show you how to install/update an Enterprise Application in WebSphere Application Server Environment.

Let’s start with a WebSphere Enterprise Application component :

then create a Component Process:


The first step is the Clean Working Dir Shell script:

Then Download Artifacts:


Next step:  Check Application is Installed

Note: This step always succeeds. If the application specified in the step is not installed, the step adds an output property named “installed set to false. If the application is installed, this property is set to true.

Then add a Switch step:


A switch step is a utility step that enables process branching that is based on the value of a property.  In our case the property is “installed” of the “Check Application is Installed” step. Then, add two or more outgoing connections from the step, each with a possible value for that property. At run time, the process follows the connection with the matching property value.

Next steps are Install or Update Application based on the “install” property value.

Then a few “wsadmin” scripts needed for managing ear configuration:

AdminApp.edit('${p:appName}', ['-MapResRefToEJB', [[ '.*', '.*', '.*', '.*', 'javax.sql.DataSource', '${p:environment/alpha_datasource}']]])
AdminConfig.save()

 

AdminApp.edit('${p:appName}', [' -MapWebModToVH', [[ '.*',  '.*', '${p:environment/virtualhost}']]])
AdminConfig.save()

 


AdminApp.edit('${p:appName}', ['-MapResEnvRefToRes', [[ '.*', '.*', '.*', '.*', 'javax.sql.DataSource', '${p:environment/alpha_datasource}']]])
AdminConfig.save()

 

AdminApp.edit('${p:appName}', '[ -CtxRootForWebMod [[ "First Web Module" first.war,WEB-INF/web.xml FirstCR ][ "Second Web Module" second.war,WEB-INF/web.xml SecondCR ]]]' )
AdminConfig.save()

 

deployments = AdminConfig.getid('/Deployment:${p:appName}/')
deploymentObject = AdminConfig.showAttribute(deployments, 'deployedObject')
myModules = AdminConfig.showAttribute(deploymentObject, 'modules')
myModules = myModules[1:len(myModules)-1].split(" ")
for module in myModules:
  tmpStr = AdminConfig.showAttribute(module,'uri')
  if tmpStr == 'first.war':
      AdminConfig.modify(module, [['startingWeight', '8500']])  
  if tmpStr == 'second.war':
      AdminConfig.modify(module, [['startingWeight', '8000']])
  if tmpStr == 'third.war':
      AdminConfig.modify(module, [['startingWeight', '6000']])
AdminConfig.save()

 

Ending with Synchronize Nodes and Finish Step

 

Operations Engineer working with Cloud Infrastructure, Containers, Kubernetes, CI/CD pipelines, CDRA processes, GitOps.