How to deploy cloud applications to IBM Workload Deployer

Using Workload Deployer development tools in Rational Application Developer

The IBM Workload Deployer appliance provides a customizable and easily managed cloud environment for application deployment, with on-demand resource provisioning. Rational Application Developer for WebSphere 8.0 supports Workload Deployer functionality in the form of tools for developing applications and deploying them to the appliance. This article demonstrates common functionality in the new Workload Deployer to build and deploy a simple end-to-end cloud application.

Aditya S. Matange (amatange@us.ibm.com), Software Engineer, IBM

author photoAditya Matange is a software test engineer for the IBM Rational software division. He is a system tester for Rational Application Developer for WebSphere and the test focal point for cloud and Workload Deployer technologies. He holds Bachelor of Science and Master of Computer Science degrees from North Carolina State University.



Morris S. Johnson (morrisj@us.ibm.com), Advisory Software Engineer, IBM

author photoMorris Johnson is a software test engineer for IBM Rational software. He is the advisory test architect for the Rational Application Developer for WebSphere and the Rational Software Architect products. He has numerous years of experience in designing verification patterns, validating software systems, and leading testing efforts. He holds a Bachelor of Science degree from Hampton University and a Master of Engineering degree from North Carolina State University.



03 April 2012

Also available in Chinese Vietnamese

Before you start

Overview

IBM® Rational® Application Developer helps Java developers quickly develop and deploy Java, Java Enterprise Edition (Java EE), Open Services Gateway initiative (OSGi), Service Component Architecture (SCA), portal, and web applications. It provides robust tooling to support commonly used application servers and includes development use versions of the latest IBM® WebSphere® Application Server. Additionally, Rational Application Developer supports development with industry standard databases, such as IBM® DB2®, and source control systems, such as IBM® Rational Team Concert™.

The IBM Workload Deployer, the successor to the WebSphere CloudBurst Appliance, also enables deployment of virtual application patterns augmented with performance, load balancing, and scaling policy options. It uses predefined middleware patterns to simplify configurations within a cloud environment.

With the addition of Workload Deployer-specific tools within Rational Application Developer, you can define and develop web, Java EE, and OSGI applications components of a virtual application pattern and manage creation, deployment, and removal of the cloud application artifacts directly from the development environment.

What developers can learn from this article

This article demonstrates common functionality in the new IBM Workload Deployer appliance to build, deploy, and run a simple end-to-end cloud application on Workload Deployer. You will learn how to create a Workload Deployer definition, build and acquire a cloud application, associate Java EE content with the application, and deploy to Workload Deployer. The article also explains how to work with Workload Deployer-provisioned databases.

There are several reasons why your organization could benefit from moving to Workload Deployer for enterprise application development:

  • Cost savings for an organization that uses provisioned WebSphere Application Server and DB2 images through Workload Deployer over multiple dedicated WebSphere and DB2 servers
  • Rapid and self-service provisioning of resources when dedicated servers are unavailable
  • Access to reusable application patterns to simplify construction and deployment
  • Standardized management of and access to images and virtual systems

Prerequisites

Before starting the example in this article, you will need the following configuration:

  • IBM Rational Application Developer for WebSphere Software, Version 8.0.3 or later, with the following features installed on your workstation:
    • IBM Workload Deployer development tools
    • Java EE and web services development tools
    • WebSphere Application Server Version 7.0 development tools
    • Tools for developing applications without a local server installation
  • IBM Workload Deployer v3.0.0.0 or later with at least one cloud group defined

Set up your workspace

Start Rational Application Developer with a new workspace and with the Java EE perspective open. We will begin by creating a simple project to hold a cloud application, and import a sample application for deployment.

Create a new project:

  1. Launch the New Project Wizard (right-click in the Enterprise Explorer view and select New > Project).
  2. Select General > Project, and click Next.
  3. Name the project CloudApplication , and click Finish.
  4. Optionally, enable the validation builders, because they are set to Off by default for general projects. Then right-click the CloudApplication project, select Properties, and then choose these options:
    • Select Enable project specific setting.
    • Select Add Validation Builder to project.
    • Click OK.

Import and prepare the Enterprise JavaBean (EJB) application that you will be deploying to Workload Deployer:

  1. Download the SurveyEJBEAR.zip file (see the Downloads section in this article).
  2. Launch the Import Wizard (right-click in the Enterprise Explorer view, and select Import > Import).
  3. Select General > Existing Projects into Workspace and click Next.
  4. Select the radio button for Select archive file and browse to find the SurveyEJBEAR.zip file.
  5. Select all projects, and click Finish.

Note:
Workload Deployer does not automatically generate EJB deployment code.

  1. Generate deployment code for the EJB project (right-click SurveyEJB in the Enterprise Explorer view, and select Java EE > Prepare for Deployment).

Your workspace and sample application should now be properly set up.

Figure 1. Workspace projects after preliminary setup
Four projects in the workspace

Create a new Workload Deployer server configuration

Now you need to create a server configuration for Workload Deployer so that Rational Application Developer can communicate with Workload Deployer:

  1. Launch the New Server wizard (right-click in the Servers view, and select New > Server).
  2. Select Workload Deployer.
  3. Enter the IP address or hostname of Workload Deployer in the "Server’s host name" field, and click Next.
Figure 2. Select Workload Deployer and enter the IP address
Define a New Server dialog window
  1. Enter the username and password for your Workload Deployer user in the corresponding fields.
  2. Select a cloud group (click Select and choose a cloud group from the list).
  3. Click Finish.

Note:
If there are no cloud groups listed, you can configure one in Workload Deployer if your permissions allow, or you can contact your Workload Deployer administrator.

You should now see the Workload Deployer listed in the Servers view, as shown in Figure 3.

Figure 3. Workload Deployer in the Servers tab
Servers view now lists your Workload Deployer

Create a virtual application pattern using the dashboard

Next, you will create a virtual application pattern. This pattern is necessary to define what specific components your application requires when deployed to the cloud and what content will be included in each of those components.

  1. Launch the Workload Deployer dashboard by right-clicking the newly created Workload Deployer configuration in the Servers view, and selecting Launch Dashboard.
  2. A browser window will launch and display a login screen for the dashboard. Enter your Workload Deployer user name and password, and click Login.
  3. From the toolbar at the top of the dashboard, select the triangle icon (downward arrow) next to Patterns and then select Virtual Applications.
Figure 4. Selecting Patterns > Virtual Application from toolbar
Virtual Applications selected on a drop-down menu
  1. Click the + [plus sign] icon to add a new pattern.
  2. Select Blank application as the type, and click Start Building.
Figure 5. Start building a new virtual application
Select the blank application pattern
  1. Add the Enterprise Application component:
    • Enterprise Application – WebSphere Application Server
      1. From the Application Components drawer, drag an Enterprise Application component into the diagram.
Figure 6. Add an Enterprise Application component
Component added to the diagram space
  1. Add the database component:
    • Database – DB2
      1. From the Database Components drawer, drag a Database component into the diagram.
      2. Select the Database component in the diagram, and set the Database Name field to eclipse.
      3. Upload the Survey.sql file included in a zipped file in the Downloads section (save this file on your workstation, click the Schema File Browse button, select Survey.sql from the save location, and then click Open).
Figure 7. Add and configure a database component
Database configuration information
  1. Reference from the enterprise application to the database:
    1. Select the Enterprise Application component, and drag the dot that appears on the right side of this component to the Database component, thereby creating a one-way arrow.
    2. Select the newly created link, and set the JNDI Name of Data Source field to jdbc/ejbSurvey.
Figure 8. Add and configure the Enterprise Application > Database link
Arrow links the application to the database
  1. Click in an empty area of the diagram, and set the Name field to Survey from RAD.
  2. Click Save in the upper-left corner to save your application pattern.

Your application pattern should now look similar to Figure 9.

Figure 9. Completed application pattern
Shows finalized application pattern
  1. Close the Virtual Application Builder.

Acquire the cloud application and associate a sample project

Next, you must acquire the virtual application pattern that you just created on Workload Deployer as a cloud application in Rational Application Developer. After you do this, you can associate the deployable sample EAR project with it so that you can deploy the full application to Workload Deployer from Rational Application Developer.

  1. In Rational Application Developer, go to the Servers view, right-click on the Workload Deployer configuration, and select Acquire Cloud Applications.

The Acquire Cloud Application wizard will launch with a default query to find all applications already entered.

  1. Click Perform query to run this query.
  2. From the list of cloud applications, select Survey from RAD, which you created in the previous step, and click Next.
Figure 10. Acquiring an application
Shows the Acquire Cloud Application Wizard

Now you must choose a project to house the cloud application.

  1. Select the CloudApplication project that you created at the start of this example, keep the default file name of appmodel.json, and click Next.
  2. In the Associations list, click on the Enterprise Application component entry in the table, and then click the ellipses () button.
  3. Select SurveyEAR in the pop-up window that follows, and click OK.
Figure 11. Associating a sample EAR with the acquired cloud application
SurveyEAR added in the Project Location column
  1. Click Finish to complete acquiring the application.

In the Enterprise Explorer view, you should now have an appmodel.json file within the applicationModels folder of the CloudApplication project. In the Servers view, under the Workload Deployer configuration, you should see appmodel [CloudApplication] already added.


Publish, start, and run the application

All that remains to do is to deploy and run the application. Because you added an association in the previous section, you must first publish the application from Rational Application Developer to update the virtual application pattern on the Workload Deployer, and then start the application to deploy it to the cloud.

In the Servers view under the Workload Deployer configuration, you should see appmodel [CloudApplication] already added.

  1. Right-click on Workload Deployer, and select Publish to update the pattern on the Workload Deployer appliance.
  2. When publication is finished (server status will change from [Connected, Republish] to [Connected, Synchronized]), right-click appmodel [CloudApplication] and click Start.
Figure 12. Starting the application
Select Start from the context menu in the Servers tab

Deployment might take several minutes. After the application is deployed and started (shows a status of [Started, Synchronized]), you can run the application. To do this, you must determine the endpoint URL by using the dashboard.

  1. Launch the Workload Deployer dashboard (right-click on the Workload Deployer configuration in the Servers view, and select Launch Dashboard).
  2. A browser window will launch and take you to the dashboard.

    Note:
    If you previously logged out, you will be taken to a login screen, instead, where you need to enter your Workload Deployer user name and password and click Login.
  3. From the toolbar at the top of the dashboard, select the triangle icon (downward arrow) next to Instances and then select Virtual Applications from the drop-down menu.
Figure 13. Selecting Instances > Virtual Application from toolbar
Menu to view Virtual Application instances
  1. Select Survey from RAD.
  2. Click Endpoint under WAS in the Role Status column.
  3. Click the URL in the Endpoint Information pop-up window to launch the application.
Figure 14. Running the application through the endpoint URL
Displays the endpoint URL for this example
  1. The application should launch and show the screen in Figure 15.
Figure 15. Application logon screen
Log on to the deployed application
  1. Enter the user ID, clouduser1, and password, password, and click Logon.
  2. From the list of surveys that follows, you can enter responses to a survey by selecting the corresponding link.
Figure 16. List of surveys
Displays a list of available surveys

Work with databases in Rational Application Developer

Deploying a cloud application containing a database component results in the provisioning of a database instance. In this example, the Survey.sql file contains the database definition that is associated with the database component for the Survey virtual application pattern. During the provisioning process, this database definition is executed, resulting in the creation of the specified tables and columns. During the development of cloud applications, you might need to view the contents of the actual provisioned database to validate the business logic or to manipulate the database contents.

Rational Application Developer includes database tools that you can use to operate on the provisioned database. Just as the endpoint for the enterprise application is exposed on the provisioned server that contains WebSphere Application Server, the database endpoint is also exposed for the corresponding database server.

In the Workload Deployer dashboard

For the running database VM (virtual machine), select and copy the endpoint URL:

  1. From the Workload Deployer dashboard toolbar, select the triangle icon (downward arrow) next to Instances, and then select Virtual Applications.
  2. On the screen that follows, select Survey from RAD.
  3. Under DB2 in the Role Status column, click Endpoint (see Figure 17).
  4. Select the Appuser URL in the Endpoint Information pop-up view: Copy the entire URL, starting at jdbc:db2. This URL contains all of the information to access the database.
Figure 17. Locating the database endpoint
Shows how to find the endpoint for the database

In Rational Application Developer

Now, enable and view the Rational Application Developer database tools:

  1. Switch to Database Development perspective in Rational Application Developer.
  2. In the Data Source Explorer view, create a new database connection.
  3. In the connection parameter, select DB2 for Linux, UNIX, and Windows.
  4. The default driver is IBM Data Server Driver for JDBC and SQL (JDBC4.0)
    Tip:
    Keep this default driver. It is provided by Rational Application Developer.
  5. Dissect the endpoint JDBC URL that you copied earlier, and enter corresponding values into the database connection wizard.
Figure 18. Translating the endpoint to locating the database endpoint
Database endpoint broken down into relevant parts

The resulting connection information should appear as shown in the Connection Parameter view (see Figure 19).

Figure 19. Database Connection Parameters dialog window
Parameters use database endpoint information

You can use the data source explorer view (see Figure 20) to see the active database connection, specific tables, and other database attributes.

Figure 20. Data source explorer view
Database contents after successfully connecting

You can also view the contents for a table, as well as run any supported SQL statements from within the tools. These features are available from the Database Development perspective. For more assistance with the database features, see the "Developing data access applications" section in the Rational Application Developer information center (see the Resources section here for a link).


Acknowledgements

The authors would like to thank Chris Brealey and Robert Taniwa for their reviews and feedback. Also, thanks to Ken McClamroch, who was the original designer and developer of the Survey application.


Downloads

DescriptionNameSize
Survey application to import and deploySurveyEJBEAR.zip97KB
Database definition fileSurvey.zip2KB

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 Rational software on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Rational, DevOps
ArticleID=807558
ArticleTitle=How to deploy cloud applications to IBM Workload Deployer
publish-date=04032012