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

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 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 editor to the devosbook domain of openshift.cookbook@gmail.com, run the following command:

$ rhc add-member openshift.cookbook.test@gmail.com --namespace devosbook --role edit

How it works…

The edit role allows a user to perform the following actions on a domain:

  • A user can create applications under the domain
  • A user can delete applications under the domain
  • A user can view logs of the application
  • A user can perform other application-related actions such as start, stop, and restart
  • A user can push the source code using Git
  • A user can SSH into the application gear using SSH

When you run the rhc add-member command with the edit role, OpenShift will firstly add a new member to a domain with an edit role and then copy the user public SSH key to the OpenShift gear ~/.ssh/authorized_keys file. This allows an editor to perform SSH-related operations such as code deployment using Git and SSH to the application gear.

To check whether the editor has been added successfully, you can view the domain details:

$ rhc show-domain
Domain devosbook (owned by openshift.cookbook@gmail.com)
-----------------------------------------------------
Created: Jan 14 9:49 AM
Allowed Gear Sizes: small
Members: openshift.cookbook.test@gmail.com (edit)

There's more…

You can also use the web console to add the editor to your application. Just follow the steps mentioned in the Adding viewer members to a domain using rhc recipe in this chapter.

See also

  • The Adding viewer members to a domain using rhc recipe
  • The Adding an admin member to a domain using rhc recipe
  • The Viewing all the members in a domain using rhc recipe