Book Image

OpenShift Cookbook

By : Shekhar Gulati
Book Image

OpenShift Cookbook

By: Shekhar Gulati

Overview of this book

Table of Contents (19 chapters)
OpenShift Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
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