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
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
OPENSHIFT COOKBOOK

You're reading from   OPENSHIFT COOKBOOK Over 100 hands-on recipes that will help you create, deploy, manage, and scale OpenShift applications

Arrow left icon
Product type Paperback
Published in Oct 2014
Publisher Packt
ISBN-13 9781783981205
Length 430 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Shekhar Gulati Shekhar Gulati
Author Profile Icon Shekhar Gulati
Shekhar Gulati
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

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

Setting up an OpenShift account using rhc

In the Installing the OpenShift rhc command-line client recipe, you learned how to install the rhc command-line client. After installation, the first operation you have to perform is to set up the OpenShift account. In this recipe, you will learn how to set up your account using rhc.

Getting ready

To complete this recipe, you will need to have rhc installed on your machine. Refer to the Installing the OpenShift rhc command-line client recipe for instructions.

How to do it…

To set up an OpenShift account, open a command-line terminal and run the following command:

$ rhc setup

How it works…

Before you can use the rhc client to work with OpenShift, you have to set up the account.

The setup command does the following:

  1. It first asks you to provide your OpenShift credentials to authenticate with openshift.redhat.com.
  2. After successful authentication, rhc asks whether it should create an authorization token. An authorization token allows you to access the OpenShift server without entering the password with every command. It stores the token in the .openshift folder under the user's home directory. By default, the token is valid for 30 days, which means that after this you have to authenticate it again.
  3. Next, the setup command creates a file called express.conf in the .openshift folder under the user's home directory. The express.conf file stores the basic configuration required by rhc such as the OpenShift server location, your OpenShift username, and whether or not to create and use authorization tokens.
  4. If no SSH key exists in the .ssh folder at ~/.ssh, then the rhc setup command will generate a new key pair using the ssh-keygen utility.
  5. After generating the new SSH key pair, rhc will upload the public SSH key to the OpenShift server. OpenShift copies the public key into an authorization file on the application gear called authorized_keys at ~/.ssh/authorized_keys. In the Uploading SSh keys using the web console recipe, you uploaded the public SSH key using the web console. It will prompt you to provide the name of the key or use the default name generated by the setup command.
  6. Next, rhc checks if Git has been installed. The rhc setup command will run a simple check against your local configuration and credentials to confirm that the configurations have been completed. It will also run a series of tests to check whether ssh has been configured properly and whether your system can communicate with OpenShift servers.
  7. Finally, rhc asks the user to create a domain if one is not already created. In the Creating OpenShift domains using the web console recipe, you created the domain using the web console.

There's more…

You can run the rhc setup command anytime while working with OpenShift. Every time you run the rhc setup command, it will use the configuration properties defined in the express.conf file. If you want to generate a new, clean configuration, you can use the --clean option. This will run the setup command again, ignoring any saved configuration options stored in express.conf:

$ rhc setup --clean

See also

  • The Enabling the autocomplete feature in an rhc command-line client recipe
  • The Viewing the account details using rhc recipe
  • The Specifying a different OpenShift server hostname recipe
You have been reading a chapter from
OPENSHIFT COOKBOOK
Published in: Oct 2014
Publisher: Packt
ISBN-13: 9781783981205
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image