WebSphere on demand using Cloudify

WebSphere is know as an enterprise grade application server. However, it is less common in public clouds and is not often chose for young companies building web services from ground up. 

One of the reasons that WebSphere is less common in such environments is that it is considered expensive as well as harder to install, setup and deploy in such environments.

IBM addressed cost aspect with a community edition that is free to use (http://www-01.ibm.com/software/webservers/appserv/community/).

In this post, I will outline how Cloudify can help you automate the installation, setup and deployment of WebSphere in cloud environment, thus creating it an on demand platform module you can utilize in your application stack without the concerns I mentioned above.

Cloudify does all this magic using a recipe approach. Let go over how we can build a recipe for WebSephere as the application server running a DB driven application that will utilize MongoDB as the DB:

The first step is to define a service. In the service definition we declare some metadata that describes the service (name, role…) as well as which lifecycle events we would like to implement. In addition, we can provide a closure for detecting that the service is up and ready: 

service {  
    name “WebSphere7”
     icon “websphere_logo.png”
     type “APP_SERVER”
     numInstances 1
     lifecycle{    
          install “websphere_install.groovy”         
          start “websphere_start.groovy”
          stop “websphere_stop.groovy”
          postStop “websphere_uninstall.groovy”
          startDetectionTimeoutSecs 720
          startDetection {
               ServiceUtils.isPortOccupied(8081)                                  
          }
     }
 

Each life cycle events has associate with a script cloudify will execute at the right time.

In addition, a recipe will typically include a properties file that allows easy access to configuration changes.

For example, in the WebSphere_install.groovy we use the properties file to get the URI for downloading websphere. The script downloads, extracts and set permissions to WebSphere. Then it uses a .jacl script it generates on the fly from a template and the relevant configuration context to run the actual WebSphere installation and configuration.

Similar approach is used in the websphere_start.groovy with the addition to dynamically wiring into the WebSphere the DB connection to MongoDB. This is done using the ServiceContext object that let us access the entire deployment context from the recipe.

The stop and unistall events are similar, just simpler because the context is less important there.

Once the recipe is ready, deployment, testing and releasing to the public is all easily done in the same manner using the cloudify console.

For development testing, you can start a local cloud environment on your box and run WebSphere there (assuming your box has ample Ram…) by executing to commands:

>bootstrap-localcloud 
>install-application ~/recipes/websphere

running it in your staging environment is the same deal. just change the bootstrapping to the ec2 staging environment

> bootstrap-cloud ec2-staging
>install-application ~/recipes/websphere

finally lunching to production:

> bootstrap-cloud openstack
>install-application ~/recipes/websphere

Nice! we did have to put some work into building the recipe, but once we have the recipe, it works the same for local, staging and production environment allow us to focus on the application instead of deployment & configurations.

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s