Automate the deployment of an IBM Worklight customization WAR file on IBM WebSphere Application Server

How to use Rational Automation Framework to automate customized Worklight WAR deployments

Learn how to automate the deployment of a customized IBM Worklight® WAR file to IBM WebSphere® Application Server by using Rational® Automation Framework. This article details the steps for using either Rational Automation Framework's command-line interface or its rich-client UI to apply the same set of configuration changes to multiple WebSphere Application Server environments and then to deploy a Worklight customization WAR to those environments.

Leigh Williamson (leighw@us.ibm.com), Distinguished Engineer, Software Group , IBM

author photoLeigh Williamson is an IBM Distinguished Engineer who has been working in the Austin, Texas, lab since 1988, contributing to IBM's major software projects, including OS/2, DB2, AIX, Java, WebSphere Application Server, and the IBM Rational portfolio of solutions. He is currently a member of the Chief Technology Officer team, influencing the strategic direction for products addressing the needs of software-development teams. Leigh's primary focus is on tools and best practices for mobile application development. Visit his blog on mobile development topics and follow him on Twitter @leighawilli. Leigh holds a bachelor of science degree in computer science from Nova University and a master's degree in computer engineering from University of Texas.



Amol M. Gade (amolgade@in.ibm.com), Software Engineer, IBM

author photo - amal gadeAmol Gade is an Advisory Software Engineer who has been working with the IBM India Software Lab, contributing to the Rational Automation Framework for WebSphere since 2010. He is a Java professional with expertise in designing and developing software for WebSphere-based middleware-management automation. He also contributes to the mobile and DevOps initiatives at the IBM Rational India lab. He holds a bachelor of engineering degree in computer technology from Nagpur University, India.



20 May 2013

Also available in Portuguese

Introduction

Get IBM Worklight

Worklight is a comprehensive platform for creating and deploying native, HTML5, and hybrid mobile apps. Download the free IBM Worklight Developer Edition.

When you install IBM Worklight 5.0.0.3 (or later) on WebSphere Application Server, all the steps for configuring the Worklight-related database and server are automated. But later you might need to incorporate project-specific or environment-specific customization in the default Worklight WAR file, as explained in the IBM Worklight Server administration guide (see Resources for a link).

To deploy a customized WAR file (called a Worklight customization WAR), you need to do a few manual configuration steps on the WebSphere Application Server Administration Console. You can use Rational Automation Framework to perform those configuration steps and then to automate the deployment of the customization WAR. This article gives you step-by-step instructions for this process, using a hypothetical scenario.

You gain two benefits by using Rational Automation Framework to automate customization WAR deployment. First, its promote mode enables you to easily apply customizations that you configure for one WebSphere Application Server environment to others. For example, you might want to apply customizations made to a Worklight WAR for a development WebSphere Application Server environment to a quality-assurance (QA) environment or even a production environment. A second benefit is that you can assemble the steps in this article into an automation plan within Rational Automation Framework. An automation plan comes in handy when you need to deploy a Worklight customization WAR frequently. See Resources for more information on promote mode and automation plans.


An automation scenario

This article uses a hypothetical scenario to show how to configure a WebSphere Application Server development environment to use a Worklight customization WAR, apply the same configuration to a QA environment, and then deploy the customization WAR on both environments.

Table 1 describes all of the Rational Automation Framework environment property values used in this scenario:

Table 1. Rational Automation Framework (RAF) environment property values
RAF environment property valueDescription
worklight_was80_dev_envRAF environment corresponding to WebSphere Application Server development setup
worklight_was80_qa_envRAF environment corresponding to WebSphere Application Server QA setup
worklight_was80_dev_cellThe cell name of the WebSphere Application Server development setup
worklight_was80_qa_cellThe cell name of the WebSphere Application Server QA setup
worklight_was80_dev_nodeThe name of the node hosting the Worklight server in the WebSphere Application Server development setup
worklight_was80_qa_nodeThe name of the node hosting the Worklight server in the WebSphere Application Server QA setup
worklight_was80_dev_serverThe Worklight server name in the WebSphere Application Server development setup
worklight_was80_qa_serverThe Worklight server name in the WebSphere Application Server QA setup
worklight.warName of the default (non-customized) Worklight WAR
worklight_custom.warName of the customized Worklight WAR. This can still be worklight.war, but we're naming it differently here to prevent confusion.
/opt/IBM/RAFServer/rafw/bin/rafw.shThe default rafw script location. This can vary with the user's choice of RAF Server installation directory.


You can invoke all of the Rational Automation Framework actions either directly via a command-line interface or by using a rich-client UI; each step indicates the appropriate actions for each type of interface. Note: Command-line interface users on Windows-based Rational Automation Framework Server should change the .sh script extension shown in Table 1 and in the steps below to .bat.


Configuration steps

  1. Uninstall the Worklight WAR file that's auto-deployed during Worklight installation from both the WebSphere Application Server development environment and the QA environment.

    RAF command-line interface users

    Run the following Rational Automation Framework actions:

    1. /opt/IBM/RAFServer/rafw/bin/rafw.sh -env worklight_was80_dev_env -cell worklight_was80_dev_cell -node worklight_was80_dev_node -server worklight_was80_dev_server -execute was_common_deploy_uninstall_app -app worklight.war
    2. /opt/IBM/RAFServer/rafw/bin/rafw.sh -env worklight_was80_qa_env -cell worklight_was80_qa_cell -node worklight_was80_qa_node -server worklight_was80_qa_server -execute was_common_deploy_uninstall_app -app worklight.war

    RAF client users

    1. In the Configuration Explorer view, double-click worklight_was80_dev_server.
    2. In the Dynamic Action Editor, select the was_common_deploy_uninstall_app action.
    3. In the Action Inputs pane, set Mode to Execute, enter worklight.war as an app in the Parameters section, and run the action.
    4. Repeat the preceding three steps for worklight_was80_qa_server.
  2. Import WebSphere environment variables defined for the WebSphere Application Server development environment.

    RAF command-line interface users

    1. Run the following Rational Automation Framework action:

      /opt/IBM/RAFServer/rafw/bin/rafw.sh -env worklight_was80_dev_env -cell worklight_was80_dev_cell -node worklight_was80_dev_node -server worklight_was80_dev_server -import was_common_configure_variables
    2. Edit the variables.xml file created at server scope in the Rational Automation Framework environment to append a new WORKLIGHT_INSTALL_DIR variable to the list of existing variables. Set the Worklight installation directory — for example, /opt/IBM/Worklight— as its value.

    RAF client users

    1. In the Configuration Explorer view, double-click worklight_was80_dev_server.
    2. In the Dynamic Action Editor, select the was_common_configure_variables action.
    3. In the Action Inputs pane, set Mode to Import and run the action.
    4. In the Configuration Workspace view, double-click worklight_was80_dev_server> Variables
    5. In the Variables Editor, click Create Variables Substitution Entry in the Actions pane.
    6. Create a variable named WORKLIGHT_INSTALL_DIR and set its value as the Worklight installation directory — for example, /opt/IBM/Worklight.
    7. Save the configuration and right-click worklight_was80_dev_server > Variables in the Configuration Workspace view.
    8. Select Team > Synchronize with Server.
  3. Apply (promote) the configuration changes from the WebSphere Application Server development environment to the QA environment.

    RAF command-line interface users

    Run the following Rational Automation Framework action:

    /opt/IBM/RAFServer/rafw/bin/rafw.sh -env worklight_was80_dev_env -cell worklight_was80_dev_cell -node worklight_was80_dev_node -server worklight_was80_dev_server -promote was_common_configure_variables -opt "source.env=worklight_was80_qa_env" -opt "source.cell=worklight_was80_qa_cell" -opt "source.node=worklight_was80_qa_node" -opt "source.server=worklight_was80_qa_server"


    RAF client users

    1. In the Configuration Explorer view, double-click worklight_was80_dev_server.
    2. In the Dynamic Action Editor, select the was_common_configure_variables action.
    3. In the Action Inputs pane, set Mode to Promote.
    4. Set source.env to worklight_was80_qa_env, set source.cell to worklight_was80_qa_cell,set source.node to worklight_was80_qa_node, and set source.server to worklight_was80_qa_server.
    5. Run the action.
  4. Apply the configuration changes to both the WebSphere Application Server development and QA environment.

    RAF command-line interface users

    Run the following Rational Automation Framework actions:

    1. /opt/IBM/RAFServer/rafw/bin/rafw.sh -env worklight_was80_dev_env -cell worklight_was80_dev_cell -node worklight_was80_dev_node -server worklight_was80_dev_server -execute was_common_configure_variables
    2. /opt/IBM/RAFServer/rafw/bin/rafw.sh -env worklight_was80_qa_env -cell worklight_was80_qa_cell -node worklight_was80_qa_node -server worklight_was80_qa_server -execute was_common_configure_variables

    RAF client users

    1. In the Configuration Explorer view, double-click worklight_was80_dev_server.
    2. In the Dynamic Action Editor, select the was_common_configure_variables action.
    3. In the Action Inputs pane, set Mode to Execute and run the action.
    4. Repeat the preceding three steps for worklight_was80_qa_server.

    Optionally, verify that the QA environment's WebSphere Application Server Administration Console lists the WORKLIGHT_INSTALL_DIR variable, as shown in Figure 1:

    Figure 1. Verifying that the QA environment's WebSphere Application Server Administration Console includes the WORKLIGHT_INSTALL_DIR variable Enlarge the figure
    Screenshot of the QA environment's WebSphere Application Server Administration Console, which includes the WORKLIGHT_INSTALL_DIR variable

Deployment steps

Now you're ready to deploy the Worklight customization WAR to both WebSphere Application Server environments.

  1. Run the following actions from the command line to add the worklight_custom.war and worklight_custom.war.properties files to the Rational Automation Framework environment:
    1. /opt/IBM/RAFServer/rafw/user/environments worklight_was80_dev_env/cells/worklight_was80_dev_cell/nodes worklight_was80_dev_node/servers/worklight_was80_dev_server/apps/media/worklight_custom.war
    2. /opt/IBM/RAFServer/rafw/user/environments worklight_was80_dev_env/cells worklight_was80_dev_cell/nodes/worklight_was80_dev_node/servers worklight_was80_dev_server/apps/properties/worklight_custom.war.properties

    In the worklight_custom.war.properties file, make sure that:

    • The Worklight Platform Library is set as the referenced shared library for the options.multi.1.MapSharedLibForMod property.
    • A unique context root is set for the options.multi.1.CtxRootForWebMod property.
    • The CLASS_LOADER_MODE property is set to PARENT_LAST.
  2. Promote the changes made in step 1 to the WebSphere Application Server QA environment.

    RAF command-line interface users

    Run the following Rational Automation Framework action:

    /opt/IBM/RAFServer/rafw/bin/rafw.sh -env worklight_was80_dev_env -cell worklight_was80_dev_cell -node worklight_was80_dev_node -server worklight_was80_dev_server -promote was_common_deploy_install_app -opt "source.env=worklight_was80_qa_env" -opt "source.cell=worklight_was80_qa_cell" -opt "source.node=worklight_was80_qa_node" -opt "source.server=worklight_was80_qa_server"


    RAF client users

    1. In the Configuration Explorer view, double-click worklight_was80_dev_server.
    2. In the Dynamic Action Editor, select the was_common_deploy_install_app action.
    3. In the Action Inputs pane, set Mode to Promote.
    4. Set source.env to worklight_was80_qa_env, set source.cell to worklight_was80_qa_cell, set source.node to worklight_was80_qa_node, and set source.server to worklight_was80_qa_server.
    5. Run the action.
  3. Deploy the customization WAR file to WebSphere Application Server.

    RAF command-line interface users

    Run the following Rational Automation Framework actions:

    1. /opt/IBM/RAFServer/rafw/bin/rafw.sh -env worklight_was80_dev_env -cell worklight_was80_dev_cell -node worklight_was80_dev_node -server worklight_was80_dev_server -execute was_common_deploy_install_app -app worklight_custom.war
    2. /opt/IBM/RAFServer/rafw/bin/rafw.sh -env worklight_was80_qa_env -cell worklight_was80_qa_cell -node worklight_was80_qa_node -server worklight_was80_qa_server -execute was_common_deploy_install_app -app worklight_custom.war

    RAF client users

    1. In the Configuration Explorer view, double-click worklight_was80_dev_server.
    2. In the Dynamic Action Editor, select the was_common_deploy_install_app action.
    3. In the Action Inputs pane, set Mode to execute, enter worklight_custom.war as an app in the Parameters section, and run the action.
    4. Repeat the preceding three steps for worklight_was80_qa_server.

    Optionally, verify that the customized Worklight application is listed in the Enterprise Applications section in the QA environment's WebSphere Application Server Administration Console, as shown in Figure 2:

    Figure 2. Verifying that the customized Worklight application is in the QA environment's WebSphere Application Server Administration Console Enlarge the figure
    Screenshot of the QA environment's WebSphere Application Server Administration Console, verifying that the customized Worklight application is listed under Enterprise Applications
  4. Import the Worklight Server classloader policy for the WebSphere Application Server development environment.

    RAF command-line interface users

    1. Run the following action:

      /opt/IBM/RAFServer/rafw/bin/rafw.sh -env worklight_was80_dev_env -cell worklight_was80_dev_cell -node worklight_was80_dev_node -server worklight_was80_dev_server -import was_common_configure_server_application_server.
    2. Edit the server.xml filed created at server scope in the Rational Automation Framework environment to change the value of the applicationClassLoadingMode attribute to PARENT_LAST.

    RAF client users

    1. In the Configuration Explorer view, double-click worklight_was80_dev_server.
    2. In the Dynamic Action Editor, select the was_common_configure_server_application_server action.
    3. In the Action Inputs pane, set Mode to Import and run the action.
    4. In the Configuration Workspace view, double-click worklight_was80_dev_server > Server Settings.
    5. In the Server Editor, click worklight_was80_dev_server and set Application class loading mode to PARENT_LAST.
    6. Save the Configuration and right-click worklight_was80_dev_server> Server Settings in the Configuration Workspace view.
    7. Select Team > Synchronize with Server.
  5. Promote the changes made in step 4 to WebSphere Application Server QA environment.

    RAF command-line interface users

    Run the following Rational Automation Framework action

    /opt/IBM/RAFServer/rafw/bin/rafw.sh -env worklight_was80_dev_env -cell worklight_was80_dev_cell -node worklight_was80_dev_node -server worklight_was80_dev_server -promote was_common_configure_server_application_server -opt "source.env=worklight_was80_qa_env" -opt "source.cell=worklight_was80_qa_cell" -opt "source.node=worklight_was80_qa_node" -opt "source.server=worklight_was80_qa_server"

    RAF client users

    1. In the Configuration Explorer view, double-click worklight_was80_dev_server.
    2. In the Dynamic Action Editor, select the was_common_configure_server_application_server action.
    3. In the Action Inputs pane, set Mode to Promote.
    4. Set source.env to worklight_was80_qa_env, source.cell to worklight_was80_qa_cell, source.node to worklight_was80_qa_node, and source.server to worklight_was80_qa_server.
    5. Run the action.
  6. Apply the changes to both the WebSphere Application Server development environment and the QA environment.

    RAF command-line interface users

    Run the following Rational Automation Framework actions

    1. /opt/IBM/RAFServer/rafw/bin/rafw.sh -env worklight_was80_dev_env -cell worklight_was80_dev_cell -node worklight_was80_dev_node -server worklight_was80_dev_server -execute was_common_configure_server_application_server .
    2. /opt/IBM/RAFServer/rafw/bin/rafw.sh -env worklight_was80_qa_env -cell worklight_was80_qa_cell -node worklight_was80_qa_node -server worklight_was80_qa_server -execute was_common_configure_server_application_server.

    RAF client users

    1. In the Configuration Explorer view, double-click worklight_was80_dev_server.
    2. In the Dynamic Action Editor, select the was_common_configure_server_application_server action.
    3. In the Action Inputs pane, set Mode to execute and run the action.
    4. Repeat the preceding three steps for worklight_was80_qa_server.

    Optionally verify that the QA environment's WebSphere Application Server Administration Console displays server-specific application settings, as shown in Figure 3:

    Figure 3. Verifying that the QA environment's WebSphere Application Server Administration Console shows server-specific application settings Enlarge the figure
    Screenshot of the WebSphere Application Server Administration Console for the QA environment verifying that it includes server-specific application settings
  7. Start the Worklight application on both the WebSphere Application Server development environment and the QA environment.

    RAF command-line interface users

    Run the following Rational Automation Framework actions:

    1. /opt/IBM/RAFServer/rafw/bin/rafw.sh -env worklight_was80_dev_env -cell worklight_was80_dev_cell -node worklight_was80_dev_node -server worklight_was80_dev_server -execute was_common_deploy_start_app -app worklight_custom.war .
    2. /opt/IBM/RAFServer/rafw/bin/rafw.sh -env worklight_was80_qa_env -cell worklight_was80_qa_cell -node worklight_was80_qa_node -server worklight_was80_qa_server -execute was_common_deploy_start_app -app worklight_custom.war.

    RAF client users

    1. In the Configuration Explorer view, double-click worklight_was80_dev_server.
    2. In the Dynamic Action Editor, select the was_common_deploy_start_app action.
    3. In the Action Inputs pane, set Mode to execute, enter worklight_custom.war as an app in the Parameters section, and run the action.
    4. Repeat the preceding three steps for worklight_was80_qa_server.

The administration console for the customized Worklight server should be accessible now, as shown in Figure 4:

Figure 4. IBM Worklight Console for the customized Worklight server now accessible in WebSphere Application Server
IBM Worklight Console for the customized Worklight server now accessible in WebSphere Application Server

Conclusion

By following the steps in this article — using either the Rational Automation Framework command-line interface or rich-client interface — you can configure a source WebSphere Application Server environment for Worklight customization WAR deployment and apply (promote) the same configuration settings to one or more target WebSphere Application Server environments. Users of the Rational Automation Framework rich-client interface can also build an automation plan containing these actions and reuse the plan to make future WebSphere Application Server configuration changes for Worklight customization WAR deployment.

Resources

Learn

Get products and technologies

Discuss

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into Mobile development on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Mobile development, WebSphere, Rational
ArticleID=930079
ArticleTitle=Automate the deployment of an IBM Worklight customization WAR file on IBM WebSphere Application Server
publish-date=05202013