How to automatically deploy an application in WebSphere

Home > Search > How-to
  by

  1. In the left panel of the WebSphere admin console, select Applications > Global deployment settings.
  2. Check Monitor directory to automatically deploy applications and select Apply.

Note: Polling interval is the number of seconds that will elapse between each check for new or updated files in the monitoredDeployableApps directory. Increasing this value will cause there to be greater delay in app deploys but will reduce overhead which could be advantageous from a performance perspective.

  1. Select Save.
  2. Restart the Application Server or Deployment Manager.

 

After the Application Server or Deployment Manager is restarted, the monitoredDeployableApps directory on the Application Server or Deployment Manager will exist, at was_home/profiles/your_profile/monitoredDeployableApps.

If this was done on an application server, the monitoredDeployableApps will have one subdirectory.

  • was_home/profiles/your_profile/monitoredDeployableApps/servers

If this was done on a Deployment Manager, there will be a subdirectory for clusters and servers.

  • was_home/profiles/your_profile/monitoredDeployableApps/clusters
  • was_home/profiles/your_profile/monitoredDeployableApps/servers

Subdirectories will need to manually be created under the clusters and servers directories. For example, you would do the following if you have server01, server02, and cluster01.

  • was_home/profiles/your_profile/monitoredDeployableApps/clusters/cluster01
  • was_home/profiles/your_profile/monitoredDeployableApps/servers/server01
  • was_home/profiles/your_profile/monitoredDeployableApps/servers/server02

 


Deployment Options

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

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.

 


Add an EAR, WAR, JAR, or SAR to the appropriate monitoredDeployableApps subdirectory

Placing an EAR, WAR, JAR or SAR file in the subdirectory will automatically deploy the app to the server or cluster. The app should be in the was_home/profiles/your_profile/installedApps/ directory. The date and time listed should coorelate to the date and time that the app was deployed.

~]# ll was_home/profiles/your_profile/installedApps/
drwxrwxr-x 4 root root 4096 May 1 07:49 your_app_name.ear

 

The SystemOut.log can also be checked for assurance that the WAR or EAR was successfully deployed. 

CWLDD0014I: Event id 115306418-1. Installing application your_app_name...
ADMA5016I: Installation of your_app_name started.
ADMA5013I: Application your_app_name installed successfully.

 

There will also be an attempt to start the application.

ADMN1008I: An attempt is made to start the your_app_name application.
CWLDD0021I: Application your_app_name is started on: WebSphere:cell=cell01,node=node01,server=server01,status=success.
CWLDD0021I: Application your_app_name is started on: WebSphere:cell=cell01,node=node02,server=server02,status=success.

 

When an app is automatically deployed, the app may not be automatically mapped to a virtual host (such as default_host) and the modules (JVMs, web servers) may not be mapped to the application. Typically, in an Enterprise, a deployment tool such as Anthill or Jenkins will probably be used to manage the deployment. In a SOHO network, you want want to write a script (Bash Perl Python PowerShell) to run wsadmin commands to map the virtual host and modules after the app is deployed.

 


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_home/profiles/your_profile/monitoredDeployableApps/deploymentProperties/ directory, and the app should be automatically deployed. The following event should be found in the dmgr SystemOut.log.

CWLDD0007I: Event id 123456789. Start of processing. Event type: Added, File path: /path/to/example.properties
CWLDD0028I: Event id 123456789. The target of the current operation is [WebSphere:cell=yourCell,node=yourNode,server=yourServer].
CWLDD0014I: Event id 123456789. Installing application yourApp...

 


Automatic undeploy

Removing the EAR, WAR, JAR or SAR file will automatically undeploy the app. The SystemOut.log can be checked to ensure the app was undeployed.

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 in the box below so that we can be sure you are a human.




Comments