Some Useful OpenShift Commands

Posted on the 19 July 2013 by Abhishek Somani @somaniabhi
OpenShift is a great tool to build and deploy your application on cloud. Apart from gui on your account , openshift also provide a powerful command line tool to build and manage your application , which is called RHC . You can take help from this link on how to install it on your system . So , here are some useful commands related to openshift and rhc .
rhc setup -l {open shift acc email id}
Setup commands help you to create and manager your ssl keys and other information . If you have multiple openshift accounts , you can use -l option to switch from one account to other.
rhc app ssh {app name}
This command is used to create a SSH connection to your Openshift application . The basic structure of Openshift Ruby app is like this.
app-root
  data
  repo  
  runtime
git  
mysql  
phpmyadmin  
ruby
If you want to specify location of your ssh app , you can use --ssh option like this :
rhc ssh fabric --ssh="C:\Program Files\Git\bin\ssh.exe"
If you want to save current running code which may get changed during runtime , you can use snapshot command like this:
rhc app snapshot save -a {app name}
To Get Database credential and other useful info of your app you can use show command like this :
rhc app show {app name}
To clean your application logs and temp directory , you can use tidy command .
rhc app tidy {app name}
Openshift tries to compile and build your application everytime you push a change in repository . You can redirect the openshift build output to a file using this git command
git push 2>&1 | tee git_push.log
Post Your Comments and Suggestions !!