(C) Markus Feilner, CC-BY-SA 4.0

(C) Markus Feilner, CC-BY-SA 4.0

Exploring OpenShift – Red Hat's next-generation PaaS tool

Gearbox

Article from ADMIN 26/2015
By
Red Hat's OpenShift cloud service helps web developers get websites up and running very quickly. We'll show you how to get started with your own OpenShift website.

Linux market leader Red Hat has offered both cloud and platform technologies for a long time, so it was no big surprise when the Raleigh company started another cloud product in 2011. Red Hat's OpenShift [1] is a Platform-as-a-Service (PaaS) [2] product designed to support and encourage cloud integration for web developers. OpenShift exists as a web service (public cloud) or an on-premise private cloud (Figure 1).

Figure 1: Online, Enterprise, and Origin: OpenShift exists in three flavors, two of them free of charge.

Written in Ruby, OpenShift supports Java and .NET (the two most popular PaaS languages, according to Gartner), as well as Haskell, JavaScript, Perl, PHP, Python, and, of course, Ruby. Developers can choose from several database systems (including MySQL, PostgreSQL, and MongoDB), and OpenShift also supports a long list of frameworks and APIs.

Beyond all the technical details, Red Hat wants OpenShift to become the run-time environment for everyone. The "Shift" is to be accomplished by gears, cartridges, applications, client tools, and automatic scaling mechanisms. The user just needs to understand some basic concepts of SSH and Git – and be aware of the overall OpenShift architecture. As a starting point, think of OpenShift as a public cloud reachable from your PC, integrated with OpenStack, and integrated with all the other cloud offerings from Red Hat.

Gears and Cartridges

Like other PaaS technologies, OpenShift is generally focused on web development. Only Ports 22, 80, 443, 8000, and 8443 are available from the outside world (SSH, HTTP, HTTPS, and two other ports). All applications running on OpenShift will only be accessible through these ports, and apps that need incoming traffic on other ports will not work properly.

OpenShift provides server containers for user-specified applications. When Red Hat launched OpenShift at its annual summit in Boston 2011, the original version used a combination of SELinux and cgroups (instead of containers) to separate the different virtual machines securely. OpenShift v3, which is still in beta and was presented at DevConf 2015 Figure 2 [3], integrates Docker technology and Google's Kubernetes orchestration system (Figure 3).

Figure 2: At DevConf 2015 in Brno, Red Hat presented lots of Docker plans, and the first beta of OpenShift V3.
Figure 3: Kubernetes by Google helps OpenShift v3 manage and deploy containers.

Red Hat has developed its own terminology for the components of the OpenShift environment. A "gear" is a container running the user's application. Three types of gears are available, and they differ only in size of RAM or disk space.

Cartridges contain the frameworks or components needed to run applications – from JBoss to Node.js, from database servers to cron. A cartridge can be a standalone component like a framework, or it can be an embedded component that adds external functions to an application, such as cron or a database. You will almost always find more than one cartridge running on one gear, and a cartridge is not limited to a single gear.

Scaling is automatic: With its built-in HA Proxy, OpenShift will start new gears with more than 16 concurrent connections to an application. This automatic scaling is a very powerful and convenient features, as long as the programmer ensures the application can cope with being scaled.

Flavors

OpenShift comes in three flavors. You just need a Red Hat online account to start testing the free Online tier. OpenShift Enterprise , on the other hand, is the on-premise, private PaaS solution. The Enterprise project offers a web console; CLI or IDE; public, private, or hybrid cloud; and automatic application scaling by default.

OpenShift Origin [4] is the open source upstream version of OpenShift. On the website, you will find images for download (KVM, VirtualBox, and VMware), a video showing a concise guy describing how to use Puppet to build your own machine, and a deployment guide. If you want to install OpenShift yourself, follow the short and easy installation guide at the project website [5], where you'll also find prebuilt VMs. All you need is a running Red Hat or CentOS system.

Be aware that the M4 repositories on the OpenShift.org website contain OpenShift v2, and the M5 repositories lead to OpenShift v3. Version 3 offers several promising new features, but it is still in beta. (See the "OpenShift Version 3" box for more information.)

OpenShift Version 3

Version 3's combination of Docker (the container system), Kubernetes (Google's container orchestration management; Figure 3) [6], and Project Atomic, "a lean and mean OS built for containers" [7] looks promising, despite the beta state. If you want to dive deeper into the underlying technology, the OpenShift blog should be your first stop; there, you'll find great articles explaining Docker and Kubernetes in hands-on examples.

The Version 3 "Deep Dive" how-to [8] gives a good overview of the concepts and a quick start on running your own OpenShift installation. You'll learn that a Kubernetes master manages the cloud and that pods are groups of related containers. Kubelets are sort of agents that control Kubernetes nodes, and the Etcd server daemon deploys and manages configurations.

Client Tools

According to Red Hat, "OpenShift allows a choice of environments (UI, command line, IDE), but to get the most out of your applications, you'll want to at least use the OpenShift client tools (RHC). RHC is a Ruby gem, and requires Ruby and Git" [1].

RHC is a powerful collection of command-line tools for deploying and managing applications in the OpenShift environment. The RHC toolset includes dozens of simple commands for guiding and monitoring your OpenShift presence. Table 1 shows a sample of some important RHC commands. For a complete list, see the OpenShift website [1].

Table 1

Examples of Red Hat Client Tools

Tool Description
rhc setup Ensures your SSH and authentication information are correctly registered with the OpenShift server
rhc domain-show Information on your namespace, including a list of applications
rhc app-create Creates an application – various options and arguments let the user specify cartridges and define the execution environment
rhc git-clone -a Clones the Git repository for the specified OpenShift application to the current directory
rhc app start Starts an application
rhc app stop Stops a running application
rhc app-show Shows information on an OpenShift application; the -v switch offers verbose output
rhc cartridge list Lists all available cartridges
rhc cartridge add Adds a cartridge to an existing application
rhc app snapshot save Stops the application and exports an archive containing the Git repository, database dumps, and other useful information
rhc env-list Lists all the environment variables for the application

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy ADMIN Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus