Book Image

Implementing OpenShift

By : Adam Miller
Book Image

Implementing OpenShift

By: Adam Miller

Overview of this book

Gone are the days of having to provision hardware, deploy, and manage an entire environment just to write code for the next big idea, project, or custom web application. A Platform-as-a-Service cloud aims to fulfill this need, allowing developers to work more efficiently as well as allowing DevOps teams to spend less time fulfilling requests for these environments. Join us as we move into the future with OpenShift. Implementing OpenShift will walk the reader through how to easily develop and deploy upon an open source OpenShift Platform-as-a-Service. We will then discuss the architecture of the platform so that users have some insight into the inner workings of the environment. We will then take a step away from the user aspect and cover DevOps topics so that we can perform the deployment of our very own open source Platform-as-a-Service using the upstream OpenShift Origin code base. Developers are no longer in need of provisioning full-scale development environments by provisioning servers, installing and configuring software, and maintaining infrastructure just to write software. This book will show you how developers can move out of this archaic mindset and into the future utilizing OpenShift Platform-as-a-Service technologies, breaking away from the marketing jargon and into the technology that allows developers to get work done. This book also delves into the realm of DevOps, allowing you to run your own environment to support your development teams more efficiently. This book will show you how the OpenShift Platform-as-a-Service can redefine the way web application developers work by providing the building blocks upon which they are able to create their next big idea. From there, the reader will progress through the OpenShift architecture and on to a brisk automated deployment using DevOps technologies. You will learn everything you need to know in order to use OpenShift to develop and deploy applications in the cloud as well as how to deploy your very own OpenShift Origin-based Platform-as-a-Service cloud.
Table of Contents (12 chapters)

Preface

When web developers traditionally came up with their next big idea, before they could start writing any serious amount of code, they either had to deploy and run their own infrastructure or had to submit a request to their system administration team. This process would generally require some amount of budgetary approval for computer hardware, storage, network allocation, space in a rack in their organization's data center, as well as electrical, heating, and cooling considerations.

Now, with the widespread adoption of virtualization technologies, much of this process can be expedited, but there is still the administrative overhead of configuration and administration of the backend services needed to support the development environment. This is where the innovation of the cloud comes in, not just marketing buzz words that we all know and love, but real innovation that is changing the shape of IT as we know it.

For those innovative minds looking to build the next big web application or adventuring into a new web startup endeavor, these are real concerns that need addressing. This is precisely the subject area where OpenShift aims to be the answer. OpenShift is an open source PaaS (Platform as a Service) Cloud from Red Hat, Inc. OpenShift is an application platform that enables developers to not worry about the backend infrastructure, but instead worry about what they want to worry about, that is writing code to bring to life the brilliant web application they've dreamed up.

OpenShift allows developers to access infrastructure technologies, such as web servers, powering their favorite frameworks, in their favorite programming languages, and using their favorite database backend. OpenShift, at the time of writing, officially supports Perl, Python, PHP, Ruby, Java, and Node.js, along with a pairing of MySQL, PostgreSQL, and MongoDB, which can all be utilized, along with autoscaling that will dynamically respond to application load. OpenShift also offers integration with Jenkins CI, RocksMongo, PHPMyAdmin, and a feature set that is continuously growing. All of this can be controlled by either a web console, IDE integrations, or from a set of command-line tools that are available for Linux, Mac, and Windows. Deployment of code is handled by a popular version control system named Git (http://git-scm.com/).

What this book covers?

As previously discussed, OpenShift is an open source platform, like a Service Cloud environment, from Red Hat, Inc. OpenShift is not only a platform offering the features listed in the previous text, but is also an open source project that has devised three subprojects differing in the way they deliver the OpenShift technology to the users, developers, and community members. Further, we would know about the relationship between the subprojects, each of which has been described as follows:

  • OpenShift Origin: It is an upstream open source project that is filed under the Apache License 2.0, and it is where all the rapid innovation of the platform happens and is targeted to be community powered and driven. The source code is listed on GitHub under the OpenShift Origin page, which is https://github.com/openshift/. It contains all the quickstarts, developer tools, client utilities, as well as the server code that powers the platform, which lives under the origin-server Git repository. OpenShift Origin also hosts a web presence with a multitude of information, available at http://openshift.github.io/. At the time of writing, OpenShift Origin is an official feature of the community-driven Fedora Project's GNU/Linux distribution; for more information please reference https://fedoraproject.org/wiki/OpenShift_Origin.

  • OpenShift Online: It is the online hosted version of OpenShift; it is a hardened and stabilized version of the OpenShift Origin codebase. OpenShift Online provides users with a working OpenShift environment to utilize for free, in what is known as the "free tier", and the free offering that is now free will always be free as per the OpenShift Online documentation. There is also a commercialized offering of OpenShift Online, allowing for the purchase of extra resources when they are needed or desired, as per the OpenShift Online Pricing Guide (https://www.openshift.com/products/pricing). The online version will be discussed in detail, covering how to use OpenShift, because it is a great way to get up and run for free with minimal startup effort.

  • OpenShift Enterprise: It is the Enterprise open source PaaS that allows customers to get a hardened and stabilized version of the OpenShift Origin code that is fully supported by Red Hat. This product is available for deployment on premises in the customer's own data center or private cloud. OpenShift Enterprise also features integration with Red Hat's JBoss Middleware platform. This product is available at the time of writing but will not receive further discussion throughout this book because it doesnot fit into the scope of this text, and anyone who is interested in this product should pursue more information at the product's web page, that is, https://www.openshift.com/products/enterprise.

Chapter 1, Understanding the Essentials, discusses what the cloud really is, what it means for technologists, and demystifies the new realm of acronyms, such as Infrastructure as a Service (IaaS), Platform as a Service (PaaS), and Software as a Service (SaaS). We will also go through an introductory session dedicated to the Git and SSH technologies, as they are part of the OpenShift toolset that both end users (WebDevs) and administrators (DevOps) will need to have some familiarity with. Finally, we will perform a bird's eye overview of the OpenShift architecture, covering different components of OpenShift itself.

Chapter 2, Using 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/).

Chapter 3, OpenShift – Technologies and Working, discusses the technologies OpenShift leverages to provide its unique architecture. We will cover Pluggable Authentication Modules (PAM), Security Enhanced Linux (SELinux), Linux kernel Control Groups (Cgroups), Software Collections (SCL), and the Marionette Collective (MCollective). Once background knowledge has been established about building blocks, we will spend time discussing each component of the architecture previously introduced in Chapter 1, Understanding the Essentials. This section will include the OpenShift Broker, Node, Web Console, and the OpenShift REST API.

Chapter 4, Deploying an OpenShift PaaS, is mostly going to interest those who are in the DevOps arena and are interested in deploying OpenShift Origin to host their own PaaS. Here, we're going to introduce the Fedora Project and its relationship with OpenShift Origin. There will be an introduction to some open source virtualization technologies that will be used for demonstration purposes and can be used to follow along, or your virtualization technology of choice can be used. We will briefly discuss the topic of configuration management and orchestration, including an introduction to the open source Ansible IT orchestration engine (http://www.ansibleworks.com/); from there we will discuss methods of deploying your own OpenShift Origin environment, including a walk through using what is known as an Ansible "Playbook". Finally, we will show how to interact with your newly deployed OpenShift Origin environment just as you would with the OpenShift Online hosted service.

What you need for this book

There is a certain level of prerequisite knowledge expected; you should either be a web developer, well versed in your web framework of choice, or a little knowledge of the Git version control system would be preferred, but it will be covered in some capacity later on, so if Git is not high on the reader's skill list, fret not. For those who continue on to the DevOps portion of the text, please be aware that an introductory understanding of GNU/Linux administration is expected with preference for Red Hat Enterprise Linux or Fedora Linux administration, as these will receive focus in the instructional sections. However, the functionality of the platform will be covered at length in its own right, so explicit understanding of Red Hat and/or Fedora is not a hard requirement.

Note

For those who are not running Red Hat Enterprise Linux (https://www.redhat.com/products/enterprise-linux/) but prefer one of the "RHEL Clones", such as CentOS (https://www.centos.org/) or Scientific Linux (https://www.scientificlinux.org/), the instructional portion of this book will be fully applicable and should function just fine.

Who the book is for?

This book is for web developers in search of a development platform that offers an easier way to deploy and develop their web applications. OpenShift provides this using industry standard technology upon a flexible platform that offers the ability to write code the way the developer wants without any vendor lock-in. This book will also branch into the DevOps territory and touch on deploying the upstream OpenShift Origin codebase in a simple configuration to show how OpenShift makes life easier, not only for developers but also for those who manage the infrastructure upon which these developers depend.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "Gear using the quota command without actually entering into an interactive shell session remotely."

A block of code is set as follows:

#!/usr/bin/env ruby

puts "Hello world!"

Any command-line input or output is written as follows:

user@mylaptop$ ssh [email protected] 'quota'
Disk quotas for user [email protected] (uid 6017):
Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
/dev/mapper/EBSStore01-user_home01
                    604       0 1048576             172       0   40000

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Once we select Create Application, we will be presented with a screen that offers details about our database, how to access the application's gear, cloning our new Git repository and more".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.