FreeKB - How to automatically deploy an application in WebSphere (monitoredDeployableApps properties file)
How to automatically deploy an application in WebSphere (monitoredDeployableApps properties file)

Home > Search > How-to


There are two ways to go about automatically deploying an app.

  • Add an EAR, WAR, JAR, or SAR to the appropriate monitoredDeployableApps subdirectory
  • Add a properties file to the monitoredDeployableApps/deploymentProperties directory

This article describes how to deploy the app by placing a properties file to the monitoredDeployableApps/deploymentProperties directory. Refer to this article for the steps on how to automatically deploy an app by placing an EAR, WAR, JAR, or SAR to the appropriate monitoredDeployableApps subdirectory.

A significant advantage to adding a properties file to the deploymentProperties directory is that you have more control at your disposal, such as being able to easily define the application name, mapping the application to a virtual host, and defining the context root of the application in the properties file.

By default, WebSphere is not setup to automatically deploy an app. Follow these steps to setup WebSphere to automatically deploy an app, which will also create the monitoredDeployableApps directory and subdirectories.


Create the properties file

If possible, it is much easier to install the application using the WebSphere admin console, and to then use wsadmin to create the properties file. You would run this wsadmin command on the dmgr. This will create a file named example.props. The example.props file can then be used for subsequent deploys.

${WAS_INSTALL_ROOT}/profiles/your_dmgr_profile/bin/wsadmin.sh -lang jython -c "print AdminTask.extractConfigProperties('[-propertiesFileName example.props -configData Deployment=your_app -options [[SimpleOutputFormat true]]]')"

 


Add a properties file to the monitoredDeployableApps/deploymentProperties directory

Following is an example properties file. If you are deploying a WAR, you will still use "EarFileLocation".

# HEADER
ResourceType=Application
ImplementingResourceType=Application

# PROPERTIES
Name=myApp
TargetServer=your_server_hostname
TargetNode=your_server_nodename
EarFileLocation=/path/to/example.ear
TargetCluster=your_cluster # Only needed if using cluster

# ENVIRONMENT VARIABLES
cellName=your_cellname
nodeName=your_nodename
serverName=your_server_hostname

 

You will simply add the properties file to the ${WAS_INSTALL_ROOT}/profiles/your_profile/monitoredDeployableApps/deploymentProperties/ directory and the app should be automatically deployed.

You can now check if the application was successfully deployed.

 


Virtual Host

Use the following to map your app to virtual host default_host. You would only change "your_app" to the name of your app.

ResourceType=Application
ImplementingResourceType=Application
ResourceId=Deployment=!{applicationName}
taskName=MapWebModToVH
row0={webModule uri virtualHost}
mutables={false false true}
row1={"your_app" your_app.war,WEB-INF/web.xml default_host}

 


Automatic undeploy

Adding DELETE=true as the first line in the properties section of the properties file will undeploy the app. Here is an example of the undeploy from a properties file.

CWLDD0007I: Event id 123456789. Start of processing. Event type: Deleted, File path: /path/to/example.properties

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 2f7c4 in the box below so that we can be sure you are a human.




Comments