Using OpenShift

Exclusive offer: get 50% off this eBook here
Implementing OpenShift

Implementing OpenShift — Save 50%

A fast-paced, practical guide for using OpenShift to deploy your own open source Platform-as-a-Service with this book and ebook

$14.99    $7.50
by Adam Miller | October 2013 | Open Source

The article by Adam Miller, the author of Implementing OpenShift, covers all the different ways for WebDevs to consume OpenShift using different approaches. We will explore the command-line utilities, the OpenShift web console (including an overview of what OpenShift calls "Quickstart Applications"), as well as IDE integrations, where we walk through using JBoss dev tools that is based on the very popular Eclipse IDE (http://www.eclipse.org/).

The following are the three common ways in which we can utilize OpenShift as a user:

  • Command-line utilities
  • Web Console
  • IDE integration

(For more resources related to this topic, see here.)

Each of these utilize the OpenShift REST API at the backend; therefore, as a user, we could potentially orchestrate OpenShift using the API with such common command-line utilities as curl to write scripts for automation. We could also use the API to write our own custom user interface, if we had the desire. In the following sections, we will explore using each of the currently supported user experiences, all of which can be intermixed as they communicate with the backend in a uniform fashion using the REST API previously mentioned.

Getting started using OpenShift

As discussed previously, we will be using the OpenShift Online free hosted service for example portions. OpenShift Online has the lowest barrier of entry from a user's perspective because we will not have to deploy our own OpenShift PaaS before being able to utilize it. Since we will be using the OpenShift Online service, the very first step is going to be to visit their website and sign up for a free account via https://openshift.redhat.com/app/account/new.

New Account Form

Once this step is complete, we will find an e-mail in our inbox that was provided during sign up, with a subject line similar to Confirm your Red Hat OpenShift account; inside that e-mail will be a URL that needs to be followed to complete the setup and verification step. Now that we've successfully completed the sign up phase, let's move on to exploring the different ways in which we can use and interact with OpenShift.

Command-line utilities

Due to the advancements in modern computing and the advent of mobile devices such as tablets, smart phones, and many other devices, we are often accustomed to Graphical User Interface (GUI) over Command-Line Interface (CLI) for most of our computing needs. This trend is heavier in the realm of web applications because of the rich visual experiences that can be delivered using next generation web technologies. However, those of us who are in the development and system administration circles of the world are no strangers to the CLI, and we know that it is often the most powerful way to accomplish an array of tasks pertaining to development and administration. Much of this is a credit to powerful shell environments that have their roots in traditional UNIX environments; popular examples of these are bash and zsh. Also, in more recent years, PowerShell for the Microsoft Windows platform has aimed to provide some relatively similar CLI power.

The shell, as it is referenced here, is that of a UNIX shell, which is a command interpreter that supports such features as variables, functions, pipes, I/O redirection, variable substitution, flow control, conditionals, the ability to be scripted, and more. There is also a POSIX standard for a shell that defines a standard set of features and behaviors that must be complied with, allowing for portability of complex scripts.

With this inherent power at the fingertips of the person who wields the command line, the development team of the OpenShift PaaS has written a command-line utility, much in the spirit of offering powerful utilities to its users and developers. Before we get too deep into the details, let's quickly look at what a normal application creation and deployment requires in OpenShift using the following command:

$ rhc app create myawesomewebapp ruby-1.9 $ cd myawesomewebapp (Write, create, and implement code changes) $ git commit -a -m "wrote awesome code" $ git push

It will be discussed at length shortly, but for a quick rundown, the rhc app create myawesomewebapp ruby-1.9 command creates an application, which runs on OpenShift using ruby-1.9 as the programming platform. Behind the scenes, it's provisioning space, resources, and configuring services for us. It also creates a git repository that is then cloned locally—in our example named myawesomewebapp—and in order to access this, we need to change directories into the git repository. That is precisely what the next command cd myawesomewebapp does.

And you're live, running your web application in the cloud. While this is an extremely high-level overview and there are some prerequisites necessary, normal use of OpenShift is that easy. In the following section, we will discuss at length all the steps necessary to launch a live application in OpenShift Online using the rhc command-line utility and git.

This command-line utility, rhc, is written in the Ruby programming language and is distributed as a RubyGem (https://rubygems.org/). This is the recommended method of installation for Ruby modules, libraries, and utilities due to the platform-independent nature of Ruby and the ease of distribution of gems.

The rhc command-line utility is also available using the native package management for both Fedora and Red Hat Enterprise Linux (via the EPEL repository, available at https://fedoraproject.org/wiki/EPEL) by running the yum install rubygem-rhc command.

Another noteworthy proponent of RubyGems is that they can be installed to a user's home directory within their local machine's operating system, allowing them to be utilized even in environments where systems are centrally managed by an IT department. RubyGems are also installed using the gem package manager for users of GNU/Linux package managers, such as yum, apt-get, and pacman or Mac OS X's community homebrew (brew) package manager, which will be familiar with the concept. For those unfamiliar with these concepts, a package manager will track a software named "package" and its dependencies, handle installation, updates, as well as removal. We will take a short moment to tangent into the topic of RubyGems before moving on to the command-line utility for OpenShift to ensure that we don't leave out any background information.

Summary

Hopefully, we can select our preferred method of deploying on OpenShift, and developers of all backgrounds, preferences, and development platforms will feel at home working with OpenShift as a development and deployment platform.

Resources for Article:


Further resources on this subject:


Implementing OpenShift A fast-paced, practical guide for using OpenShift to deploy your own open source Platform-as-a-Service with this book and ebook
Published: October 2013
eBook Price: $14.99
Book Price: $29.99
See more
Select your format and quantity:

About the Author :


Adam Miller

Adam Miller is currently employed at Red Hat Inc. as the Release Engineer for OpenShift Online, Red Hat's auto-scaling Platform-as-a-Service (PaaS) for applications. Adam has completed Bachelor's of Science in Computer Science and Master's of Science in Information Assurance and Security, both from the Sam Houston State University. He is a Red Hat Certified Engineer (Cert# 110-008-810), and is an active member of the open source community with a running history of contributions to the Fedora Project (FAS account name: maxamillion).

Books From Packt


 OpenNebula 3 Cloud Computing
OpenNebula 3 Cloud Computing

OpenStack Cloud Computing Cookbook
OpenStack Cloud Computing Cookbook

Apache CloudStack Cloud Computing
Apache CloudStack Cloud Computing

OpenStack Cloud Computing Cookbook - Second Edition
OpenStack Cloud Computing Cookbook - Second Edition

Getting Started with Oracle Public Cloud
Getting Started with Oracle Public Cloud

VMware vCloud Security
VMware vCloud Security

iCloud Standard Guide
iCloud Standard Guide

Google Apps: Mastering Integration and Customization
Google Apps: Mastering Integration and Customization


No votes yet

Post new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
C
w
C
7
F
S
Enter the code without spaces and pay attention to upper/lower case.
Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software