Eric D. Schabell: January 2012

Tuesday, January 31, 2012

Rise above the Cloud hype with OpenShift

Rise above the Cloud hype
Are you tired of requesting a new development machine for your application? Are you sick of having to setup a new test environment for your application? Do you just want to focus on developing your application in peace without 'dorking with the stack' all of the time? We hear you. We have been there too. Have no fear, OpenShift is here!

In this article will walk you through the simple steps it takes to setup not one, not two, not three, but up to five new machines in the Cloud with OpenShift. You will have your applications deployed for development, testing or to present them to the world at large in minutes. No more messing around.

We start with an overview of what OpenShift is, where it comes from and how you can get the client tooling setup on your workstation. You will then be taken on a tour of the client tooling as it applies to the entry level of OpenShift, called Express. In minutes you will be off and back to focusing on your application development, deploying to test it in OpenShift Express. When finished you will just discard your test machine and move on. When you have mastered this, it will be time to ramp up into the next level with OpenShift Flex. This opens up your options a bit so you can do more with complex applications and deployments that might need a bit more fire power. After this you will be fully capable of ascending into the OpenShift Cloud when you chose, where you need it and at a moments notice. This is how development is supposed to be, development without stack distractions.
Dorking with the stack?

Introduction
There is a great amount of hype in the IT world right now about Cloud. There is no shortage of acronyms for the various areas that have been carved out, like IaaS, PaaS and SaaS. OpenShift is a Platform as a Service (PaaS) from Red Hat which provides you with a platform to run your applications. For you as a developer, you want to look at the environment where you put your applications as just a service that is being provided. You don't want to bother with how that service is constructed of a set of components, how they are configured or where they are running. You just want to make use of this service that they offer to deploy, develop, test and run your application. At this basic level, OpenShift provides a platform for your Java applications.

First let's take a quick look at where OpenShift comes from. It started at a company called Makara that was based in Redwood City, Calif., providing solutions to enable organizations to deploy, manage, monitor and scale their applications on both private or public clouds. Red Hat acquired Makara in November of 2010, and in the following year they have merged Red Hat technologies into a new project called OpenShift[1]. They launched a first project that initially provides two levels of service[2], a shared hosting solution called Express and a dedicated hosting solution known as Flex. What makes this merging of technologies interesting for a Java developer is that Red Hat has included the next generation application platform based on JBoss AS 7 in OpenShift[3]. This brings a lightning fast application platform for all your development needs.

OpenShift Express
The OpenShift website states, “Express is a free, cloud-based application platform for Java, Perl, PHP, Python, and Ruby applications. It's super-simple—your development environment is also your deployment environment: git push, "and you're in the cloud.” This peaks the interest so lets give it a try and see if we can raise our web application into the clouds. For this we have our jBPM Migration web application[4] which we will use as a running example for the rest of this exercise.

Getting started in Express is well documented on the website as a quick start[5], which you can get to once you have signed up for a Red Hat Cloud (rhcloud) account. This quick start provides us with the four steps you need to get our application online and starts with the installation of the necessary client tools. This is outlined for Red Hat Enterprise Linux (RHEL), Fedora Linux, generic Linux distributions, Mac OS X and Windows. For RHEL and Fedora it is a simple package installation, for the rest it is a Ruby based gem installation which we will leave for the reader to apply to her system.

Once the client tooling is installed, there are several commands based on the form rhc-<command>. There is an online interface available but most developers prefer the control offered by the command line client tools so we will be making use of these. Here is an overview of what is available with a brief description of each:
  • rhc-create-domain – used to bind a registered rhcloud user to a domain in rhcloud. You can have maximum of one domain per registered rhcloud user.
  • rhc-create-app - used to create an application for a given rhcloud user, a given development environment (Java, Ruby, Python, Perl, PHP) and for a given rhcloud domain. You can create up to five applications for a given domain. This will generate the full URI for your rhcloud instance, setup your rhcloud instance based on the environment you chose and by default will create a local git project for your chosen development environment.
  • rhc-snapshot – used to create a local backup of a given rhcloud instance.
  • rhc-ctl-app – used to control a given rhcloud application. Here you can add a database, check the status of the instance, start, stop, etc.
  • rhc-tail-files – used to connect to a rhcloud applications log files and dump them into your command shell.
  • rhc-user-info – used to look at a given rhcloud user, the defined domains and created applications.
  • rhc-chk – used to run a simple configuration check on your setup.

Create your domain
To get started with our demo application we need to do a few simple thing to get an Express instance setup for hosting our Java application, beginning with a domain.
# We need to create the domain for Express to start setting up
# We need to create the domain for Express to start setting up
# our URL with the client tooling using 
# rhc-create-domain -n domainname -l rhlogin
#
$ rhc-create-domain --help

Usage: /usr/bin/rhc-create-domain
Bind a registered rhcloud user to a domain in rhcloud.

  NOTE: to change ssh key, please alter your ~/.ssh/libra_id_rsa and
        ~/.ssh/libra_id_rsa.pub key, then re-run with --alter

  -n|--namespace   namespace   Namespace for your application(s) (alphanumeric - max 16 chars) (required)
  -l|--rhlogin     rhlogin     Red Hat login (RHN or OpenShift login with OpenShift Express access) (required)
  -p|--password    password    RHLogin password (optional, will prompt)
  -a|--alter                   Alter namespace (will change urls) and/or ssh key
  -d|--debug                   Print Debug info
  -h|--help                    Show Usage info

# So we setup one for our Java application. Note that we already have 
# setup my ssh keys for OpenShift, if you have not yet done that, 
# then it will walk you through it.
#
$ rhc-create-domain -n inthe -l [rhcloud-user] -p [mypassword]

OpenShift Express key found at /home/[homedir]/.ssh/libra_id_rsa.  Reusing...
Contacting https://openshift.redhat.com
Creation successful

You may now create an application.  Please make note of your local config file
in /home/[homedir]/.openshift/express.conf which has been created and populated for you.

Create your application
Next we want to create our application, which means we want to tell the OpenShift Express which stack we need. This is done with the rhc-create-app client tool.
# Let's take a look at the options available before we setup a Java 
# instance for our application.
#
$ rhc-create-app --help
Contacting https://openshift.redhat.com to obtain list of cartridges...
 (please excuse the delay)

Usage: /usr/bin/rhc-create-app
Create an OpenShift Express app.

  -a|--app   application     Application name  (alphanumeric - max 16 chars) (required)
  -t|--type  type            Type of app to create (perl-5.10, jbossas-7.0, wsgi-3.2, rack-1.1, php-5.3) (required)
  -l|--rhlogin  rhlogin      Red Hat login (RHN or OpenShift login with OpenShift Express access) (Default: xxxxxxxxx)
  -p|--password  password    RHLogin password  (optional, will prompt)
  -r|--repo  path            Git Repo path (defaults to ./$app_name)
  -n|--nogit                 Only create remote space, don't pull it locally
  -d|--debug                 Print Debug info
  -h|--help                  Show Usage info

# It seems we can choose between several but we want the jboss-as7.0 
# stack (called a cartridge). Provide a user, password and location 
# for the git repo to be created called 'jbpmmigration', see the 
# documentation for the defaults. Let's watch the magic happen!
#
$ rhc-create-app -a jbpmmigration -t jbossas-7.0 -l [rhcloud-user] -p [mypassword] -r /home/[homedir]/git-projects/jbpmmigration

Found a bug? Post to the forum and we'll get right on it.
    IRC: #openshift on freenode
    Forums: https://www.redhat.com/openshift/forums

Attempting to create remote application space: jbpmmigration
Contacting https://openshift.redhat.com
API version:    1.1.1
Broker version: 1.1.1

RESULT:
Successfully created application: jbpmmigration

Checking ~/.ssh/config 
Contacting https://openshift.redhat.com 
Found rhcloud.com in ~/.ssh/config... No need to adjust 
Now your new domain name is being propagated worldwide (this might take a minute)... 
Pulling new repo down 
Warning: Permanently added 'jbpmmigration-inthe.rhcloud.com,50.17.167.44' (RSA) to the list of known hosts. 
Confirming application jbpmmigration is available 
  Attempt # 1 

Success!  Your application is now published here: 

      http://jbpmmigration-inthe.rhcloud.com/ 

The remote repository is located here: 

    ssh://1806d6b78bb844d49378874f222f4403@jbpmmigration-inthe.rhcloud.com/~/git/jbpmmigration.git/ 

To make changes to your application, commit to jbpmmigration/. Then run 'git push' to update your OpenShift Express space .

If we take a look at my given path to the repo we find a git-projects/jbpmmigration git repository. Note that if you decide to alter your domain name you will have to adjust the git repository config file to reflect where the remote repository is, see above the line with 'ssh:.....'. Also the page is already live at http://jbpmmigration-ishereon.rhcloud.com/. It is just a splash screen to get you started, so now we move on to deploying our existing jBPM Migration project.

First lets look at the provided README in our git project which gives some insight to the repository layout.
Repo layout
===========
deployments/ - location for built wars (Details below) 
src/ - maven src structure 
pom.xml - maven build file  
.openshift/ - location for openshift specific files 
.openshift/config/ - location for configuration files such as standalone.xml (used to modify jboss config such as datasources) 
../data - For persistent data (also in env var OPENSHIFT_DATA_DIR) 
.openshift/action_hooks/build - Script that gets run every push, just prior to starting your app  

For this article we only will examine the deployments and src directories. You can just drop in your WAR files, remove the pom.xml file in the root of the project and they will be automatically deployed. If you want to deploy exploded WAR files then you just add a file called '.dodeploy' as outlined in the README file. For real project development we want to push our code through the normal src directory structure and this is also possible by working with the provided pom.xml file. The README file provided gives all the details needed to get your started.

Our demo application, jbpmmigration also comes with a README file that provides the instructions to add the project contents to our new git repository, so we will run these commands to pull the files into our local project.
# placing our application into our express git repo.
#
$ cd jbpmmigration 
$ git remote add upstream -m master git://github.com/eschabell/openshift-jbpmmigration.git 
$ git pull -s recursive -X theirs upstream master 

# now we need to push the content.
#
$ git push origin

[jbpmmigration maven build log output removed]
...
remote: [INFO] ------------------------------------------------------------------------ 
remote: [INFO] BUILD SUCCESS 
remote: [INFO] ------------------------------------------------------------------------ 
remote: [INFO] Total time: 3.114s 
remote: [INFO] Finished at: Mon Nov 14 10:26:57 EST 2011 
remote: [INFO] Final Memory: 5M/141M 
remote: [INFO] ------------------------------------------------------------------------ 
remote: ~/git/jbpmmigration.git 
remote: Running .openshift/action_hooks/build 
remote: Running .openshift/action_hooks/deploy 
remote: Starting application... 
remote: Done 
remote: Running .openshift/action_hooks/post_deploy 
To ssh://1806d6b78bb844d49378874f222f4403@jbpmmigration-inthe.rhcloud.com/~/git/jbpmmigration.git/ 
   410a1c9..7ea0003  master -> master 

As you can see we have now pushed our content to the rhcloud instance we created, it deployed the content and started our instance. Now we should be able to find our application online at http://jbpmmigration-ishereon.rhcloud.com/jbpmmigration_upload-0.4/.

The final step would then be that you are finished working on this application and want to free it up for a new application. You can then make a backup with the rhc-snapshot client tool and then remove your instance with rhc-ctl-app client tool.
# Ready to get rid of our application now.
#
$ rhc-ctl-app -a jbpmmigration -l eschabell -c destroy 
Password: ********

Contacting https://openshift.redhat.com 
!!!! WARNING !!!! WARNING !!!! WARNING !!!! 
You are about to destroy the jbpmmigration application. 

This is NOT reversible, all remote data for this application will be removed. 
Do you want to destroy this application (y/n): y 

Contacting https://openshift.redhat.com 
API version:    1.1.1 
Broker version: 1.1.1 

RESULT: 
Successfully destroyed application: jbpmmigration 

As you can see, it is really easy to get started with the five free instances you have to play with for your application development. You might notice that there are limitation, with no ability to use specific integrated monitoring tooling, auto-scaling features are missing and control of the configuration is limited. For those needing more access and features, take a look at the next step up with OpenShift Flex[6].

This completes our tour of the OpenShift Express project where we provided you with a glimpse of the possibilities that await you and your applications. It was a breeze to create your domain, define your applications needs and import your project into the provided git project. After pushing your changes to the new Express instance you are off and testing your application development in the cloud. This is real. This is easy. Now get out there and raise your code above the cloud hype.

References
  1. OpenShift,https://openshift.redhat.com.
  2. Project overview OpenShift, https://openshift.redhat.com/app/platform.
  3. JBoss AS7 in the Cloud, http://www.jboss.org/openshift.
  4. jBPM Migration project web application, https://github.com/eschabell/jbpmmigration_upload.
  5. OpenShift Express Quick Start, https://openshift.redhat.com/app/express#quickstart.
  6. OpenShift Flex Quick Start, https://openshift.redhat.com/app/flex#quickstart.


Final note: I was asked at the end of 2011 to put together and introduction article to OpenShift, the Red Hat Platform as a Service (PaaS) open source project. It was to be published in a Dutch language magazine at the beginning of 2012. I wanted to post the English language version here for the rest of the non-Dutch speaking population. 

Friday, January 27, 2012

Portugal Java User Group (JUG) - on tour with jBPM and Openshift

I will be in Lisbon, Portugal on Feb 16 at the Portugal JUG with sessions on  jBPM and OpenShift. The abstracts are below and will soon be published on their JUG site, but it is in Portuguese so you might need some translation help!

JBoss jBPM Brings More Power to your Business Processes
A Business Process Management System (BPMS) offers you the capabilities to better manage and streamline your business processes. JBoss jBPM continues its vision in this area by offering a lightweight process engine for executing business processes, combined with the necessary services and tooling to support business processes in their entire life-cycles. This allows not only developers but also business users to manage your business processes more efficiently.
A lot has happened in the BPM area over the last few years, with the introduction of the BPMN 2.0 standard, the increasing interest in more dynamic and adaptive processes, integration with business rules and event processing, case management, etc. In this session, we will show you how jBPM5 tackles these challenges, discuss migration to this new platform and give you an overview of its most important features.

An OpenShift Primer for Developers to get your code into the Cloud

Whether you're a seasoned Java developer looking to start hacking on EE6 or you just wrote your first line of Ruby yesterday, the cloud is turning out to be the perfect environment for developing applications in just about any modern language or framework. There are plenty of clouds and platform-as-a-services to choose from, but where to start? Join us for an action-packed hour of power where we'll show you how to deploy an application written in the language of your choice - Java, Ruby, PHP, Perl or Python, with the framework of your choice - EE6, CDI, Seam, Spring, Zend, Cake, Rails, Sinatra, PerlDancer or Django to the OpenShift PaaS in just minutes. And without having to rewrite your app to get it to work the way the cloud provider thinks your app should work. 

Check the command-line fu as we leverage Git to onboard apps onto OpenShift Express in seconds, while also making use of the web browser do the heavy-lifting of provisioning clusters, deploying, monitoring and auto-scaling apps in OpenShift Flex. 

If you want to learn how the OpenShift PaaS and investing an hour of your time can change everything you thought you knew about developing applications in the cloud, this session is for you!

The schedule is shaping up like this:

  • 17h30 - Welcome and registration
  • 18h00 - JBoss Brings More Power to your Business Processes
  • 19h00 - An OpenShift Primer for Developers to get your Code into the Cloud
  • 20h00 - Drink and Networking

Location will be at Instituto Superior TA(c)cnico (IST), see you there? ;-)

Wednesday, January 18, 2012

Luxembourg Java User Group (YaJUG) - OpenShift and jBPM session recap

Room filling up, ~50 attendees!
Last night I was on site for an evening with the YaJUG, hosted in the Tudor building which was a very nice venue in downtown Luxembourg.

There were around 50 participants and the interaction was rather lively, I think I got something like ~20 questions around just the OpenShift session! The questions ranged from the obvious to the more cunning where participants not only want to be able to tinker with apache configurations but also auto scale their Express instances or even try to cluster the 5 free instances we offer them. I love that kind of ingenuity!

His first app on OpenShift
by end of the
session!
I wanted to emphasize the ease with which anyone can get their applications running in the OpenShift Express cloud instances. I challenged the group from the start by asking anyone with a laptop to get it open and try to deploy their first application into the OpenShift cloud by the end of the evening. As you can see in the picture, Weber Phillipp (I think it was actually his little brother if I am not mistaken...) came up to me at the end to show his results, well done!

 Later I followed up with a look at OpenShift Flex where most of the more Enterprise type of questions were answered. Check out twitter tag #yajug for their comments, but be aware, some of the feedback is in French.

 The second session was an overview of the status of jBPM 5 and included a rather in depth discussion of the upcoming BRMS 5.3 as there was some real interest in the JBoss product that are supported. There were several jBPM 3.2 users in the crowd, so spend some time demo'ing not only jBPM5 but the web designer and jBPM Migration Project tooling that has been integrated there.

The sessions were recorded so the YaJUG members will be provided a link to them soon via their site and a photographer was also enthusiastically taking lots of pictures! We planned to record my session desktop for the demo's, but the recording failed to start.



UPDATE: The session had a photographer that was busy snapping away:

Wednesday, January 11, 2012

Codemotion 2012 - submissions for jBPM and OpenShift

I am again submitting proposals to Codemotion 2012, this year in Rome. I have pushed out two talks, one on jBPM and another on OpenShift:


JBoss Brings More Power to your Business Processes
A lot has happened in the Business Process Management area over the last few years, with the intro of the BPMN 2.0 standard, the increasing interest in more dynamic and adaptive processes, integration with business rules and event processing, case management, etc. In this session, we will show you how JBoss jBPM tackles these challenges, discuss migration to this new platform and give an overview of its most important features.

Get your code into the Cloud with OpenShift
Whether you're a seasoned Java developer looking to start hacking on EE6 or you just wrote your first line of Ruby yesterday, the cloud is perfect for developing apps in any modern language or framework. Join us for an action-packed hour of power where we'll show you how to deploy an application written in a language of your choice - Java, Ruby, PHP, Perl or Python, with a framework of  your choice - EE6, CDI, Seam, Zend, Rails, Sinatra, PerlDancer or Django to the OpenShift PaaS in just minutes.

Fingers crossed and hope to talk to you in Rome, Italy in March! ;-)





Tuesday, January 10, 2012

jBPM5 - add native Eclipse BPMN2 Visual Editor to Eclipse or JBoss Developer Studio

Eclipse Native BPMN2 Editor
Interested in using the Eclipse native BPMN2 editor when designing your jBPM processes? Here is how you can pull in the project that is now hosted within the Eclipse Foundation.
Figure 1: Name the update site.

First you need to add the update site at Help -> Install New Software -> Add as shown in Figure 1. Then you give it a name as shown in Figure 2.

http://download.eclipse.org/bpmn2-modeler/site

Figure 2: Watch install.
This will pull up the BPMN2 Editor check box that you can select to install the editor. Just select this box and select Next + Next + Accept agreement + Finish.

Figure 3: Open with Visual Editor
Watch the software install, see Figure 2 and a restart will give you the option to use the Eclipse Native BPMN2 editor. Select a process.bpmn2 file, right mouse click, select Open With and you should see the menu entry BPMN2 Visual Editor.


Note:
A note about the processes to be displayed. If you do not have any location information in the file, such as a default generated jBPM Migration Tool conversion output file, then it will not display in this editor. The jBPM Migration Tool relies on the BPMN2 Process Editor and its Arrange buttons to generate this information.

Enjoy! ;-)

Taking screenshots on an OS X Macbook

I was looking for the various ways to make a screenshot on my macbook and wanted to log these for future reference.


Each capture sequence below saves a file to your desktop, unless you add a Control key to any sequence which will give you the capture as a copy to the clipboard.

Also see the Grab utility for more complex captures, including recording desktop activities.


  • Entire desktop - Cmd + Shift + 3
  • Specific area - Cmd + Shift + 4, gives crosshairs that can be positioned for click and drag
  • Single window - Cmd + Shift + 4 + Spacebar, gives a camera that highlights windows to be captured


Monday, January 9, 2012

YaJUG event - an evening with OpenShift and jBPM

I will be in Luxembourg next week to present a few interesting technologies for the Java User Group, called YaJUG. The abstracts are below and you can find the details if you happen to be in the area online at their site:

An OpenShift Primer for Developers to get your Code into the Cloud: Eric D. Schabell (Red Hat)
Whether you're a seasoned Java developer looking to start hacking on EE6 or you just wrote your first line of Ruby yesterday, the cloud is turning out to be the perfect environment for developing applications in just about any modern language or framework. There are plenty of clouds and platform-as-a-services to choose from, but where to start? Join us for an action-packed hour of power where we'll show you how to deploy an application written in the language of your choice - Java, Ruby, PHP, Perl or Python, with the framework of your choice - EE6, CDI, Seam, Spring, Zend, Cake, Rails, Sinatra, PerlDancer or Django to the OpenShift PaaS in just minutes. And without having to rewrite your app to get it to work the way the cloud provider thinks your app should work.
Check the command-line fu as we leverage Git to onboard apps onto OpenShift Express in seconds, while also making use of the web browser do the heavy-lifting of provisioning clusters, deploying, monitoring and auto-scaling apps in OpenShift Flex.
If you want to learn how the OpenShift PaaS and investing an hour of your time can change everything you thought you knew about developing applications in the cloud, this session is for you!
JBoss Brings More Power to your Business Processes: Eric D. Schabell (Red Hat)
A Business Process Management System (BPMS) offers you the capabilities to better manage and streamline your business processes. JBoss jBPM continues its vision in this area by offering a lightweight process engine for executing business processes, combined with the necessary services and tooling to support business processes in their entire lifecycles. This allows not only developers but also business users to manage your business processes more efficiently.
A lot has happened in the BPM area over the last few years, with the introduction of the BPMN 2.0 standard, the increasing interest in more dynamic and adaptive processes, integration with business rules and event processing, case management, etc. In this session, we will show you how jBPM5 tackles these challenges, discuss migration to this new platform and give you an overview of its most important features.
17h30 - Welcome and registration
18h00 - An OpenShift Primer for Developers to get your Code into the Cloud
19h00 - JBoss Brings More Power to your Business Processes
20h00 - Drink and Networking
See you there? ;-)

Friday, January 6, 2012

Released jBPM Migration Tooling v0.11


Right behing release the previous release we have pushed out jBPM Migration Tooling v0.11.

Wow, you must be thinking this team is working really hard and must not be getting any sleep at all! Nothing could be further from the truth. We are just getting integrated into the JBoss family way of working with regards to releasing a project into the wild.

We were missing some necessary components that need to be generated by our Maven configuration so that we were allowed through the JBoss Nexus process. When jbpmmigration-0.10 failed to meet the Nexus standards, we are forced to restart the process and therefore you now can be the proud owners of jbpmmigration-0.11! ;-)

The change log can be found on the project wiki, but for posterity it is provided here:
  • update the project POM file to generate a sources jar, needed to deploy into JBoss Nexus.
The OpenShift jBPM Migration WebApp has been updated to run with the current release, http://jbpmmigration-ishereon.rhcloud.com/jbpmmigration_upload-0.4.

Enjoy!

Wednesday, January 4, 2012

Released jBPM Migration Tooling v0.10

A new year and a new version is appropriate, don't you think? :-)

The jBPM Migration Tooling project is happy to release v0.10 into the wild, you can get it from github and soon in the JBoss Nexus repository.

The change log can be found on the project wiki, but for posterity it is provided here:
  • issue 41 resolved, unique ids for context variables.
  • issue 42 resolved, added ability to select xsd to use for conversion, default is jpdl 3.2.
  • issue 43 resolved, adjusted stylesheet usage in migration class.
  • issue 44 resolved, added JbpmMigration test class.
  • issue 46 & 47 resolved, cleaned up api for JpdlValidation and BpmnValidation classes.
  • issue 48 resolved, test output is now sorted in the directories related to the called tests, provides overview of all migration test output after a testing run, was over writing previously.
  • issue 51 resolved, pom adjusted to provide an optional cli jar (more dependencies included in resulting jar).
  • issue 52 resolved, fixed gateway nodes to provide gatewayDirection attributed needed by some editors to correctly display.
  • maven pom adjustments for JBoss jBPM team jenkens setup.
The OpenShift jBPM Migration WebApp has been updated to run with the current release, http://jbpmmigration-ishereon.rhcloud.com/jbpmmigration_upload-0.3/.


Enjoy!