Introduction

OpenShift has been available since 2011 and has seen great success as a polyglot platform for the deployment of web applications and services. Part of the success of OpenShift derives from the use of containers in conjunction with a Security-Enhanced Linux (SELinux) environment. These technologies enable OpenShift to implement a secure multi tenant environment suitable for the enterprise, as well as OpenShift Online, Red Hat’s own public platform as a service (PaaS) offering.

Technology is always evolving, and to keep up with the latest advances OpenShift has also evolved. The latest version of OpenShift takes advantage of newer technologies such as Docker and Kubernetes, for managing and running applications within containers. Building on Kubernetes and OpenShift’s own magic sauce, OpenShift takes PaaS to a new level, what we like to call a container application platform.

OpenShift offers you the ability to easily deploy your web application code directly using a library of pre-defined image builders, or you can bring your own Docker images. With support in OpenShift for features such as persistent volumes, you are not limited to just running 12-factor or cloud native applications. You can also deploy databases and many legacy applications which you otherwise would not be able to run on a traditional PaaS.

OpenShift is the modern take on PaaS that you can use with your current applications, but which also provides the power and flexibility to meet future needs. This book will bring you up to speed on how OpenShift has changed to meet the new requirements for building, deploying and hosting your applications.

Who Should Read This Book

If you are impatient, this book is for you. It is intended for programmers who want to get started using OpenShift as quickly as possible, but also want to understand a little bit of what they are doing.

We will step you through how to build and deploy your first application, and also introduce you to the main concepts of OpenShift and the tools available for working with OpenShift.

As the title indicates, we are assuming little in the way of background knowledge except:

  • You have some basic programming experience.

  • You know how to create a web application.

  • You know how to use the command line.

  • You can use a text editor on a console.

We also assume you are familar with basic Linux or Windows shell commands, and how to install additional software to your computer.

The software you install will provide you with a complete working OpenShift environment that you can use locally for development or testing.

We have used Java and the WildFly application server for the examples in this book. You do not need to be proficient in Java. If you are familar with any of the popular programming languages you will do just fine.

Why We Wrote This Book

We want to enable you to become self-sufficient in the basic use of OpenShift for creating and hosting your web applications, in as few words as possible. Therefore, we will not go into long explanations of the technologies used in OpenShift or different programming paradigms, but instead will give you links where you can go to read more.

Navigating This Book

The aim of this book is to get you up and running on OpenShift as quickly as possible. To that end, we dive into the most crucial content first and fill in the finer details as we go along.

  • Chapters 1 and 2 provide a basic introduction to a container application platform, as well as the basic terms and technologies you will need to understand for the rest of the book.

  • Chapter 3 provides instructions on how you can install a self contained version of the OpenShift environment on your own computer.

  • Chapter 4 steps you through deploying your first application to OpenShift.

  • Chapter 5 adds in a database to the application, providing it with a way of managing application data.

  • Chapter 6 delves into managing deployments of your application and how to scale it up to handle more users.

  • Chapter 7 introduces application templates, a means of simplifying new application deployments.

  • Chapter 8 covers basic management commands for working with and understanding what your application is doing.

  • Chapter 9 discusses deploying your own Docker images to OpenShift.

Online Resources

In this book you will install a self contained OpenShift environment based on OpenShift Origin. This is the upstream Open Source version of OpenShift that Red Hat’s OpenShift Enterprise, OpenShift Dedicated and OpenShift Online products are based on. The all-in-one virtual machine used is available from the OpenShift Origin site.

OpenShift Origin will always include all the latest features, with support being provided by the OpenShift community.

The OpenShift product releases are created as a regular snapshot of the OpenShift Origin project. The product releases do not always have the very latest features, but if you have a commercial Red Hat subscription, the product releases include support from Red Hat.

If you would like to try out the OpenShift Enterprise version, a couple of options are available.

The first is to sign up to the Red Hat developers program at Red Hat Developers page.

This is a free program and allows you to access versions of Red Hat products for personal use on your own computer. One of the products made available through the program is the Red Hat Container Development Kit.

This includes a version of OpenShift that you can install on your own computer, but which is based on OpenShift Enterprise rather than OpenShift Origin.

A second way of trying out OpenShift Enterprise is via the Amazon Web Services (AWS) Test Drive program.

This will set you up an OpenShift environment running across a multi node cluster on AWS.

Take a look at more in-depth documentation on OpenShift and how to use it at the OpenShift documentation site.

Check out the OpenShift blog, where regular articles are published on OpenShift.

Want to hear about how others in the OpenShift community are using OpenShift, or wish to share your own experiences, you can join the OpenShift Commons.

If you have questions or issues, you can reach the OpenShift team through Stack Overflow, via email to openshift@redhat.com, on Twitter (@openshift), or in the #openshift channel on IRC’s FreeNode network.

Conventions Used in This Book

The following typographical conventions are used in this book:

Italic

Indicates new terms, URLs, email addresses, filenames, and file extensions.

Constant width

Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.

Constant width bold

Shows commands or other text that should be typed literally by the user.

Constant width italic

Shows text that should be replaced with user-supplied values or by values determined by context.

Tip

This icon signifies a tip, suggestion, or general note.

Warning

This icon indicates a warning or caution.

Using Code Examples

Supplemental material (code examples, exercises, etc.) is available for download at https://github.com/gshipley/book-insultapp.

This book is here to help you get your job done. In general, if example code is offered with this book, you may use it in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.

We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “OpenShift for Developers by Grant Shipley and Graham Dumpleton (O’Reilly). Copyright 2016 Rad Hat, Inc., 978-1-491-94300-7.”

If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at .

Safari® Books Online

Note

Safari Books Online is an on-demand digital library that delivers expert content in both book and video form from the world’s leading authors in technology and business.

Technology professionals, software developers, web designers, and business and creative professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification training.

Safari Books Online offers a range of product mixes and pricing programs for organizations, government agencies, and individuals. Subscribers have access to thousands of books, training videos, and prepublication manuscripts in one fully searchable database from publishers like O’Reilly Media, Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technology, and dozens more. For more information about Safari Books Online, please visit us online.

How to Contact Us

Please address comments and questions concerning this book to the publisher:

  • O’Reilly Media, Inc.
  • 1005 Gravenstein Highway North
  • Sebastopol, CA 95472
  • 800-998-9938 (in the United States or Canada)
  • 707-829-0515 (international or local)
  • 707-829-0104 (fax)

To comment or ask technical questions about this book, send email to .

For more information about our books, courses, conferences, and news, see our website at http://www.oreilly.com.

Find us on Facebook: http://facebook.com/oreilly

Follow us on Twitter: http://twitter.com/oreillymedia

Watch us on YouTube: http://www.youtube.com/oreillymedia

Acknowledgments

Grant

Writing a book of any length takes a considerable amount of time. This is time that is most often stolen from my family. For that reason, I would like to thank my wonderful wife Leah and our four children—Jackson, Emily, Gavin, and Mason. Without their support and understanding, I would not have been able to create this book. I love you all very much.

I would also like to thank the entire OpenShift team at Red Hat, but especially the individuals who work directly on my team: Diane, Graham, Steve, Ryan, Jorge, and Marek. Working with such a fine group of folks makes this job not seem like a job at all and more about fun and pushing new technologies to the limit.

Other people I would like to thank, in no particular order, are as follows: Ashesh, Matt, Joe, Mike, Jake, Shawn, Sathish, Sam, Corey, Clayton, Dan, Thomas, Keck, Burr, Jakub, Miciah, and everyone else who has made OpenShift such a success. Lastly, I would like to thank Alexa Overbay for her dedication to the project and all of the hard work she puts in to help myself and the OpenShift team stay organized and running smoothly.

Graham

I would like to thank Grant and Red Hat for giving me the opportunity to work at a company which values and contributes to Open Source projects. I am a strong believer in Open Source and the good that it can create in the wider community. Through my own projects I have been attempting to improve the options available to Python developers for hosting web applications. I see the OpenShift project as being a very important part of that story and am thankful for the opportunity to work on it. With a family, my wife Wendy and two young children Kara and Caiden, the flexibility of being able to work remotely from home in my role with Red Hat has helped immensely in managing the day to day demands of children working their way through school. It does mean I often work strange hours and occasionally need to travel, but I have a family which is more than tolerant and is supportive of me, for which I am very grateful.

Get OpenShift for Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.