Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
OPENSHIFT COOKBOOK
OPENSHIFT COOKBOOK

OPENSHIFT COOKBOOK: Over 100 hands-on recipes that will help you create, deploy, manage, and scale OpenShift applications

eBook
$9.99 $39.99
Paperback
$65.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

OPENSHIFT COOKBOOK

Chapter 2. Managing Domains

This chapter presents a number of recipes that will show you how to get started with creating and managing domains. You will also learn how domains can help you work as a team and collaborate on a project. The specific recipes of this chapter are:

  • Creating a domain using rhc
  • Renaming a domain using rhc
  • Viewing domain details using rhc
  • Adding viewer members to a domain using rhc
  • Adding an editor member to a domain using rhc
  • Adding an admin member to a domain using rhc
  • Viewing all the members in a domain using rhc
  • Removing members from a domain using rhc
  • Restricting gear sizes for a domain using rhc
  • Leaving a domain using rhc
  • Deleting a domain using rhc

Introduction

A domain represents a unique name for each user within which each user application must exist. OpenShift users cannot create an application until they have a valid domain. The domain name becomes a part of the application URL. For example, if your domain name is foo and your application name is bar, the application URL will be http://bar-foo.rhcloud.com. Every OpenShift account must have at least one domain associated with it. The OpenShift Online free tier does not allow a user to create more than one domain, but you can create more than one domain in paid tiers. The domains make it possible for users to choose any valid name for their application. They allow two or more users to have the same name for their applications. For example, user A can have an application named bar in domain foo, and similarly, user B can also have an application named bar in domain test. Once a user has a valid domain, he/she can use any valid name for their application.

Team collaboration is one...

Creating a domain using rhc

In the Creating OpenShift domains using the web console recipe of Chapter 1, Getting Started with OpenShift, you learned how to create a domain using the web console. In this recipe, you will learn how to create a domain using the rhc command line.

Getting ready

To complete this recipe, you will need to have rhc installed on your machine. Please refer to the Installing the OpenShift rhc command-line client recipe in Chapter 1, Getting Started with OpenShift, for instructions. If you are using OpenShift's free plan, you have to first delete the domain you created in the Creating OpenShift domains using the web console recipe of Chapter 1, Getting Started with OpenShift, before continuing with this recipe. This is required because you cannot have more than one domain with OpenShift's free plan. To delete a domain, run the command shown as follows. This command is explained in the Deleting a domain using rhc recipe in this chapter:

$ rhc delete-domain &lt...

Renaming a domain using rhc

Following the creation of a domain, you might need to rename it. Let's suppose you want to rename your existing name to reflect its environment. For instance, you may rename the osbook domain name to devosbook in order to indicate devosbook as your development environment.

Getting ready

To complete this recipe, you will need to have rhc installed on your machine. Please refer to the Installing the OpenShift rhc command-line client recipe in Chapter 1, Getting Started with OpenShift, for instructions.

How to do it…

To rename a domain, open a new command-line terminal and run the following command. You should provide a unique, new domain name:

$ rhc rename-domain <old_domain_name> <new_domain_name>

How it works…

To rename a domain, you have to first make sure there are no applications associated with it. If there are any applications associated with a domain, you have to first delete them. To learn how to delete an application, refer to...

Viewing domain details using rhc

In this recipe, you will learn how to view the details associated with a domain.

Getting ready

To complete this recipe, you will need to have rhc installed on your machine. Please refer to the Installing the OpenShift rhc command-line client recipe in Chapter 1, Getting Started with OpenShift, for instructions.

Also, you will need to have a valid domain associated with your account. Refer to the Creating a domain using rhc recipe in this chapter for instructions on how to create a new domain.

How to do it...

To view domain details, open a new command-line terminal and run the following command:

$ rhc show-domain --namespace <your domain name>

How it works...

The rhc show-domain command returns the details of a domain and its applications. The output of the command is shown as follows. The details include the domain name, the owner's e-mail ID, other domain members, and the information of all the applications within it:

$ rhc show-domain --namespace devosbook...

Adding viewer members to a domain using rhc

Let's suppose you are a system administrator of your organization, where your job is to make sure all the production applications are running smoothly. Ideally, you would not want all the developers in your organization to have access to the production environment. Giving everyone access to the production environment is waiting for the inevitable to happen. What you should remember is that you can have different domains for different environments. The domain corresponding to the production deployment will be controlled by system administrators rather than developers. OpenShift allows you to give different access levels to a different group of people. You, along with other system administrators, can enjoy admin access to the production domain, whereas developers can only have viewer access, if required. Developers will be added to the production domain in the read-only mode. They can view the information about it and its applications, but...

Introduction


A domain represents a unique name for each user within which each user application must exist. OpenShift users cannot create an application until they have a valid domain. The domain name becomes a part of the application URL. For example, if your domain name is foo and your application name is bar, the application URL will be http://bar-foo.rhcloud.com. Every OpenShift account must have at least one domain associated with it. The OpenShift Online free tier does not allow a user to create more than one domain, but you can create more than one domain in paid tiers. The domains make it possible for users to choose any valid name for their application. They allow two or more users to have the same name for their applications. For example, user A can have an application named bar in domain foo, and similarly, user B can also have an application named bar in domain test. Once a user has a valid domain, he/she can use any valid name for their application.

Team collaboration is one...

Creating a domain using rhc


In the Creating OpenShift domains using the web console recipe of Chapter 1, Getting Started with OpenShift, you learned how to create a domain using the web console. In this recipe, you will learn how to create a domain using the rhc command line.

Getting ready

To complete this recipe, you will need to have rhc installed on your machine. Please refer to the Installing the OpenShift rhc command-line client recipe in Chapter 1, Getting Started with OpenShift, for instructions. If you are using OpenShift's free plan, you have to first delete the domain you created in the Creating OpenShift domains using the web console recipe of Chapter 1, Getting Started with OpenShift, before continuing with this recipe. This is required because you cannot have more than one domain with OpenShift's free plan. To delete a domain, run the command shown as follows. This command is explained in the Deleting a domain using rhc recipe in this chapter:

$ rhc delete-domain <domain_name...

Renaming a domain using rhc


Following the creation of a domain, you might need to rename it. Let's suppose you want to rename your existing name to reflect its environment. For instance, you may rename the osbook domain name to devosbook in order to indicate devosbook as your development environment.

Getting ready

To complete this recipe, you will need to have rhc installed on your machine. Please refer to the Installing the OpenShift rhc command-line client recipe in Chapter 1, Getting Started with OpenShift, for instructions.

How to do it…

To rename a domain, open a new command-line terminal and run the following command. You should provide a unique, new domain name:

$ rhc rename-domain <old_domain_name> <new_domain_name>

How it works…

To rename a domain, you have to first make sure there are no applications associated with it. If there are any applications associated with a domain, you have to first delete them. To learn how to delete an application, refer to the Deleting the application...

Viewing domain details using rhc


In this recipe, you will learn how to view the details associated with a domain.

Getting ready

To complete this recipe, you will need to have rhc installed on your machine. Please refer to the Installing the OpenShift rhc command-line client recipe in Chapter 1, Getting Started with OpenShift, for instructions.

Also, you will need to have a valid domain associated with your account. Refer to the Creating a domain using rhc recipe in this chapter for instructions on how to create a new domain.

How to do it...

To view domain details, open a new command-line terminal and run the following command:

$ rhc show-domain --namespace <your domain name>

How it works...

The rhc show-domain command returns the details of a domain and its applications. The output of the command is shown as follows. The details include the domain name, the owner's e-mail ID, other domain members, and the information of all the applications within it:

$ rhc show-domain --namespace devosbook...

Adding viewer members to a domain using rhc


Let's suppose you are a system administrator of your organization, where your job is to make sure all the production applications are running smoothly. Ideally, you would not want all the developers in your organization to have access to the production environment. Giving everyone access to the production environment is waiting for the inevitable to happen. What you should remember is that you can have different domains for different environments. The domain corresponding to the production deployment will be controlled by system administrators rather than developers. OpenShift allows you to give different access levels to a different group of people. You, along with other system administrators, can enjoy admin access to the production domain, whereas developers can only have viewer access, if required. Developers will be added to the production domain in the read-only mode. They can view the information about it and its applications, but they cannot...

Adding an editor member to a domain using rhc


Imagine that you are leading a software development team that uses OpenShift for development. During development, you would like all the developers in your team to be able to create, delete, push, or even SSH into application gear. However, you would not want users to rename or delete a domain, as this might impact other developers in your team or other teams. Another thing you would not like is to allow developers to change gear sizes. You can restrict development domains to only use small gears to save money. In this scenario, you will give developers an editor role that gives them the freedom to work with applications but not domains.

Getting ready

To complete this recipe, you will need to have rhc installed on your machine. Please refer to the Installing the OpenShift rhc command-line client recipe in Chapter 1, Getting Started with OpenShift, for instructions.

You will need two OpenShift accounts to work through this recipe. Please refer to...

Adding an admin member to a domain using rhc


Consider a situation where a new system administrator joins your team. As the new system admin is also responsible for making sure your production apps are running smoothly, you would like to add the new system admin as an administrator. You can do this by giving the new user an admin role.

Getting ready

To complete this recipe, you will need to have rhc installed on your machine. Please refer to the Installing the OpenShift rhc command-line client recipe in Chapter 1, Getting Started with OpenShift, for instructions.

You will need two OpenShift accounts to work through this recipe. Please refer to the Creating an OpenShift Online account recipe in Chapter 1, Getting Started with OpenShift, for OpenShift account registration instructions.

How to do it…

To add the openshift.cookbook.test@gmail.com user as an administrator to prodosbook of the domain, run the following command:

$ rhc add-member openshift.cookbook...
Left arrow icon Right arrow icon

Description

If you are a web application developer who wants to use the OpenShift platform to host your next big idea but are looking for guidance on how to achieve this, then this book is the first step you need to take. This is a very accessible cookbook where no previous knowledge of OpenShift is needed.

What you will learn

  • Teach you how to create and deploy your own Java EE and Spring applications using OpenShift
  • Help you discover how to host your Node.js applications
  • Guide you through developing and deploying Python web applications
  • Learn the trade of building horizontally scalable applications with OpenShift
  • Show you how to store your periodic database backup to Amazon S3
  • Leverage the rhc commandline tool to become efficient with OpenShift
  • Learn how to effectively use Jenkins with OpenShift applications

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Oct 29, 2014
Length: 430 pages
Edition : 1st
Language : English
ISBN-13 : 9781783981212
Vendor :
Red Hat
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Oct 29, 2014
Length: 430 pages
Edition : 1st
Language : English
ISBN-13 : 9781783981212
Vendor :
Red Hat
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 142.97
OPENSHIFT COOKBOOK
$65.99
Learn OpenShift
$43.99
Implementing OpenShift
$32.99
Total $ 142.97 Stars icon
Banner background image

Table of Contents

13 Chapters
1. Getting Started with OpenShift Chevron down icon Chevron up icon
2. Managing Domains Chevron down icon Chevron up icon
3. Creating and Managing Applications Chevron down icon Chevron up icon
4. Using MySQL with OpenShift Applications Chevron down icon Chevron up icon
5. Using PostgreSQL with OpenShift Applications Chevron down icon Chevron up icon
6. Using MongoDB and Third-party Database Cartridges with OpenShift Applications Chevron down icon Chevron up icon
7. OpenShift for Java Developers Chevron down icon Chevron up icon
8. OpenShift for Python Developers Chevron down icon Chevron up icon
9. OpenShift for Node.js Developers Chevron down icon Chevron up icon
10. Continuous Integration for OpenShift Applications Chevron down icon Chevron up icon
11. Logging and Scaling Your OpenShift Applications Chevron down icon Chevron up icon
A. Running OpenShift on a Virtual Machine Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.8
(6 Ratings)
5 star 33.3%
4 star 50%
3 star 0%
2 star 0%
1 star 16.7%
Filter icon Filter
Top Reviews

Filter reviews by




Troy Dawson Dec 10, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Very good book about using OpenShift. Good for everyone from beginners to experts. The chapters lead you through the steps and let you know why and what you are doing. But you can also use it as a reference book, jumping to just the sections that you are having problems with.My favorite chapter was Chapter 10 on Continuous Integration. Sounds boring but it talks about why and how to use Jenkins. I've been using Jenkins for a couple years at work, but didn't understand what was happening until I read that chapter.
Amazon Verified review Amazon
dani Nov 23, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This great book lets you, with a very little effort, to understand the OpenShift technology. You don't need a strong background on virtualization and container technologies, but at the same time it does not get bored a skilled user.The overview on the OpenShift technology and its utilities (rhc) is very clear and easy to follow, also thanks to the OpenShift free profile which allows you to test and play with the rhc command while you go through with the book reading. More complex tasks like backups, snapshots, rollbacks are addressed and explained. Also the security aspects are taken into account.Several real-world examples, with end-to-end receipts, are showed in the book: MySQL, PostgreSQL, MongoDB for database apps, Python, Java, Node.js for web oriented development.A chapter is dedicated on how to use Jenkins CI as a Continuous Integration system for OpenShift apps; this is an aspect which is most of the times not took into account, but it's very important nowadays.I would consider as the "core" of the book the chapter on scaling OpenShift applications, which is a salient characteristic of OpenShift and it is not always an easy task to solve.In conclusion a must have book if you want to start and play with OpenShift, even if you are a beginner or if you are not but you don't have familiarity with complex and scalable application deployment.All the code mentioned in the book is available on their GitHub repo: https://github.com/OpenShift-Cookbook
Amazon Verified review Amazon
rahul Nov 08, 2014
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
This is a great cookbook which is aimed at people with no particular background. You could find it completely applicable if you are comfortable with any of java, python or nodejs. Alternatively if you are profound with all the languages then you will find some repeated info. The first couple of chapters(1 & 3) are required for understanding the openshift platform, beyond that you can pick and choose. One good part about the book is you could refer to any chapter and the recipes will explain you complete end to end things, starting from the most simple things to the last mile you want to reach, the code samples help to achieve the point. This could be a developer book looking to experiment and learn new things or a devops book, looking to get some infra (jenkins/domains/databases) for some requirements.I will discuss the book further in the context of the table of contents.The book starts with 11 chapters covering different aspects of openshift.Chapter 1 : You can not skip this one, the chapter explains in well detail the complete platform and the offering.Chapter 2 : If you are a developer like me then you can skip this as this one refers to paid aspect of domains.Chapter 3 : The chapter can not be skipped at all as it explains how to trend on the platform. Creating and managing apps explains the platform offering with respect to day-today activities.Chapter 4/5 : If your are DBMS guy then pick any one of them, which suits you the best. The chapters have good amount of recipes to explain the concepts which can be applied to any other DBMS.chapter 6: For NoSql fans this one is to lookout for. Again the chapter lists recipes for complete day-to-day work, which can be applied to any other NoSql as explained the last recipe.Chapter 7/8/9 : Take your pick. Be it java, python or nodejs the recipes list the complete features in good detail. Alternatively you could go through one chapter which will make you work with openshift in any of the supported languages, and for specific things like java-maven integration, or python-apache integration you could look for specific recipes.chapter 10/11 : The chapters explain the devops tools offered from the platform. While developers can easily skip these chapters, but if some one is looking at how to start with the tools(jenkins/haproxy), the individual recipes are good starting point. For devops guys the chapter list complete details of where and how to look for the required info.In a nutshell this is a good comprehensive book to know what openshift can offer.
Amazon Verified review Amazon
Rudy De Busscher Nov 19, 2014
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
The book has, as the title indicates, the typical structure of the cookbook style. Each time you get the detailed instructions what you need to perform to achieve a certain goal.Then there is an explanation what you just did and how it works.This books assumes no prior knowledge of OpenShift and starts with the basics. The first things you do is singing up online for a free account of OpenShift and installing rhc, the command line based client to interact with OpenShift.Scattered throughout the book, there is also an explanation of the concepts and terms which are used by OpenShift, like what exactly is a node or a gear.There are various recipes dedicated to Java, Python and node.js to get you started with an application and the typical use cases like specifying environment variables, choosing additional frameworks, debugging, using maven dependencies and so on are al covered.There are also much scenarios that use a database and the possibilities to use them in your application on OpenShift. The MySQL, PostgreSQL and MongoDb recipes take almost one third of the book.But also other important topics like security, team collaboration and scaling are covered.Specialised topics like integration with other services then databases, like the xPaas services, aren’t described. The book is targeted to database based web applications.In conclusion, it is a must have book for anyone who wants to start developing application in the cloud with OpenShift. It contains not only the basic use case scenarios but allows you to create advanced database based applications.
Amazon Verified review Amazon
Antti Peltonen Dec 10, 2014
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Essential manual for beginners and seasoned professionals working with OpenShift. If you are unaware what OpenShift is and how it can benefit you and your organization in its software development, devops and system administration challenges this book is definitely for you too.Read my full review from my blog at http://www.bcow.me/openshift-cookbook
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.