OpenShift Cookbook
上QQ阅读APP看书,第一时间看更新

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
Domain devosbook (owned by openshift.cookbook@gmail.com)
--------------------------------------------------------
Created: 9:49 AM
Allowed Gear Sizes: small
Members: shekhar.redhat@gmail.com (edit)

blog @ http://blog-devosbook.rhcloud.com/ (uuid: 52d56620e0b8cd9911000166)
--------------------------------------------------------------------------
Domain: devosbook
Created: 11:30 AM
Gears: 1 (defaults to small)
Git URL: ssh://52d56620e0b8cd9911000166@blog-devosbook.rhcloud.com/~/git/blog.git/
Initial Git URL: git://github.com/openshift/wordpress-example.git
SSH: 52d56620e0b8cd9911000166@blog-devosbook.rhcloud.com
Deployment: auto (on git push)

php-5.3 (PHP 5.3)
-----------------
Gears: Located with mysql-5.1

mysql-5.1 (MySQL 5.1)
---------------------
Gears: Located with php-5.3
Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/
Database Name: blog
Password: teic7xz7JUFv
Username: adminiabcAWU

You have 1 application in your domain.

The --namespace option is optional. If you do not specify the --namespace option, OpenShift will first try to find the domain name from the Git repository configuration file in the current directory. It considers the directory from which you run the command as an OpenShift application Git repository. It uses the git config --get rhc.domain-name command to find the domain name. As we are not running the command inside an OpenShift application's Git repository, OpenShift will make a GET REST API request to fetch all the domains associated with the user. The user details and authorization token information will be retrieved from the ~/.openshift folder. After finding all the domains associated with the user, a GET REST API call will be made to fetch details for each domain. Finally, the output will be shown to the user.

There's more…

You can also view all the domains you have access to by running the rhc list-domain command:

$ rhc list-domain
Domain devosbook (owned by openshift.cookbook@gmail.com)
--------------------------------------------------------
Created: 9:49 AM
Allowed Gear Sizes: small
Members: shekhar.redhat@gmail.com (edit)

Domain ndtv123 (owned by shekhar.redhat@gmail.com)
--------------------------------------------------
Created: 12:08 PM
Allowed Gear Sizes: small
Members: openshift.cookbook@gmail.com (view)

As you can see, the openshift.cookbook@gmail.com user has access to two domains. The openshift.cookbook@gmail.com user owns the devosbook domain, but it is the only member of the ndtv123 domain.

If a user only wants to view his/her domain, he/she can use the --mine argument, as shown in the following command-line output. To view all the options available for a command, you can pass the --help option:

$ rhc list-domain --mine
Domain devosbook (owned by openshift.cookbook@gmail.com)
--------------------------------------------------------
Created: 9:49 AM
Allowed Gear Sizes: small
Members: shekhar.redhat@gmail.com (edit)

You have access to 1 domain.

See also

  • The Creating a domain using rhc recipe
  • The Viewing domain details using rhc recipe
  • The Deleting a domain using rhc recipe