Rise above the Cloud hype with OpenShift

Tutorial: Getting to grips with OpenShift

Tired of requesting a new development machine for your application? Sick of setting up a new test environment? Have no fear OpenShift is here! Eric Schabell tells us how to get started...

Introduction

This article will walk you through the simple steps it takes to set up 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 OpenShift. In minutes you will be off and back to focusing on your application development, deploying to test it in OpenShift. When finished you will just discard your test machine and move on. 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.

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, California, 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 merged Red Hat technologies into a new project called OpenShift.

Just recently the OpenShift team has announced the launch of their Open Source project called OpenShift Origin, making the entire code base available online. You can even take it for a spin with the liveCD they offer, but this is outside the scope of this article. 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. This brings a lightning fast application platform for all your development needs.

OpenShift

The OpenShift website states, “OpenShift 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: and you're in the cloud.” This piques 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 which we will use as a running example for the rest of this exercise.

Getting started in OpenShift is well documented on the website as a quick start, 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 their 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.

             

Pages

Eric Schabell
Eric Schabell

What do you think?

JAX Magazine - 2014 - 03 Exclucively for iPad users JAX Magazine on Android

Comments

Latest opinions