How to manage multiple Openshift accounts using rhc

Openshift is one of the best PaaS from my point of view. In comparison with Heroku, Openshift I believe has upper hand and much superiority, particularly in CLI tool, ssh facility, and most importantly huge numbers of offered frameworks. Therefore, it totally makes sense to have different account for different purposes. However, switching between account might be cumbersome especially when you want to deploy, monitor different applications located in different account. Don’t worry, Openshift CLI tool (rhc) provides all required facility and switching between account is one of them. Basically what you need to do is to logout from one account and then login to another account to do the task. This usually can be done with two commands and will take less than a minute to do.

Assume I am logged in using foo@bar.com account to and now I want to switch to foo1@bar.com account. To do so I do this,

$ rhc logout
$ rhc setup -l foo1@bar.com

The above solution works perfectly fine, but even if you don’t want to switch between accounts constantly, there is better solution. Assume, I am logged in using foo@bar.com and decided to quickly check log of one my application named “xyz” which is in foo1@bar.com account and then continue my work using foo@bar.com account.  To do so, I need to use -l argument with every command without switching sessions like following,

$ rhc tail xyz -l foo1@bar.com

As you can see by using -l parameter in every command you are not required to switch session for each single simple task.

Leave a Reply