Nikhil Mone

Nikhil Mone

It is easier to deploy the applications on Openshift, but at times we need to see/alter the configuration/setup for our application/server. Command line is one of the fastest and orthodox way for all the application admins. So lets try to navigate through Openshift Server. This article assumes that you host an application on Openshift and have gone through previous articles.

You can directly SSH to your application as below

Step-1 : Login to “openshift.redhat.com” and go to “My Applications” tab.

Step-2 : Click on the application, of which you want to see configuration/check logs etc. Look for the GIT Repository.

Step-3 : Copy from the ‘ssh-key’ to ‘rhcloud.com’

<ssh-key>@<application name>-<namespace/domain name>.rhcloud.com

for example :

HGFWDHGW878c2c535skejw34w3r@myTestApp-mydomain.rhcloud.com

Step-4 : Open a terminal(for linux) Cygwin terminal for (windows) and type below command :

ssh   <ssh-key>@<application name>-<namespace/domain name>.rhcloud.com

for example :

ssh HGFWDHGW878c2c535skejw34w3r@myTestApp-mydomain.rhcloud.com

This will prompt you for passphrase, enter it and get through.

[root@nikhil ~]# ssh HGFWDHGW878c2c535skejw34w3rg@myTestApp-mydomain.rhcloud.com
Enter passphrase for key '/root/.ssh/libra_id_rsa':

Welcome to OpenShift shell

This shell will assist you in managing OpenShift applications.

!!! IMPORTANT !!! IMPORTANT !!! IMPORTANT !!!
Shell access is quite powerful and it is possible for you to
accidentally damage your application.  Proceed with care!
If worse comes to worst, destroy your application with 'rhc app destroy'
and recreate it
!!! IMPORTANT !!! IMPORTANT !!! IMPORTANT !!!

Type "help" for more info.

[myTestApp-mydomain.rhcloud.com ~]> pwd
/var/lib/stickshift/HGFWDHGW878c2c535skejw34w3rg
[myTestApp-mydomain.rhcloud.com ~]> ls -ltra
ls: cannot access .ssh: Permission denied
total 40
d??????????  ? ?                                ?                                   ?            ? .ssh
drwxr-xr-x.  2 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg 4096 May 17 06:27 .java
drwxr-xr-x.  3 root                             root                             4096 May 17 06:27 git
-rw-r--r--.  1 root                             root                               56 May 17 06:27 .gitconfig
drwxr-xr-x.  8 root                             root                             4096 May 17 06:27 myTestApp
drwxr-xr-x.  3 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg 4096 May 17 06:27 .m2
d---------.  3 root                             root                             4096 May 17 06:27 .tmp
drwxr-x---. 10 root                             HGFWDHGW878c2c535skejw34w3rg 4096 May 17 09:45 .
drwxr-xr-x.  8 root                             root                             4096 May 17 09:45 mysql-5.1
drwxr-x---.  3 root                             HGFWDHGW878c2c535skejw34w3rg 4096 May 17 09:45 .env
drwxr-x--x. 93 root                             root                             4096 May 21 00:48 ..

Checking the configuration :

[myTestApp-mydomain.rhcloud.com myTestApp]> ls -ltra
total 36
drwxr-xr-x.  2 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg 4096 May 17 06:27 tmp
drwxr-xr-x.  2 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg 4096 May 17 06:27 data
drwxr-xr-x.  2 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg 4096 May 17 06:27 ci
lrwxrwxrwx.  1 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg   12 May 17 06:27 repo -> runtime/repo
drwxr-xr-x.  4 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg 4096 May 17 06:27 jbossas-7
lrwxrwxrwx.  1 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg   24 May 17 06:27 logs -> jbossas-7/standalone/log
drwxr-xr-x.  8 root                             root                             4096 May 17 06:27 .
-rwxr-xr-x.  1 root                             root                              180 May 17 06:27 myTestApp_ctl.sh
drwxr-xr-x.  3 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg 4096 May 17 06:27 runtime
drwxr-xr-x.  2 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg 4096 May 17 06:27 run
drwxr-x---. 10 root                             HGFWDHGW878c2c535skejw34w3rg 4096 May 17 09:45 ..

[myTestApp-mydomain.rhcloud.com configuration]> pwd
/var/lib/stickshift/HGFWDHGW878c2c535skejw34w3rg/myTestApp/jbossas-7/standalone/configuration

[myTestApp-mydomain.rhcloud.com configuration]> ls -ltra
total 60
-rw-r--r--. 1 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg   837 May 17 06:27 mgmt-users.properties
-rw-r--r--. 1 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg   813 May 17 06:27 application-users.properties
-rw-r--r--. 1 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg   787 May 17 06:27 application-roles.properties
-rw-r--r--. 1 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg  2042 May 17 06:27 logging.properties
drwxr-xr-x. 6 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg  4096 May 17 06:27 ..
lrwxrwxrwx. 1 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg    95 May 17 10:11 modules -> /var/lib/stickshift/HGFWDHGW878c2c535skejw34w3rg/myTestApp/repo/.openshift/config/modules
drwxr-xr-x. 7 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg  4096 May 17 10:12 standalone_xml_history
drwxr-xr-x. 3 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg  4096 May 17 10:12 .
-rw-r--r--. 1 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg 25605 May 17 10:12 standalone.xml



[myTestApp-mydomain.rhcloud.com myTestApp]> cd jbossas-7/
bin/               jboss-modules.jar  modules/           standalone/

As we can see from the above OpenShift only supports standalone profile (though JBoss AS7 has both standalone and domain profiles)

To tail the logs you can navigate to logs dir :

[myTestApp-mydomain.rhcloud.com log]> pwd
/var/lib/stickshift/HGFWDHGW878c2c535skejw34w3rg/myTestApp/jbossas-7/standalone/log
[myTestApp-mydomain.rhcloud.com log]> ls -ltra
total 6892
drwxr-xr-x. 6 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg    4096 May 17 06:27 ..
-rw-r--r--. 1 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg    8209 May 17 10:11 boot.log
-rw-r--r--. 1 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg 1394863 May 17 23:57 server.log.2012-05-17
-rw-r--r--. 1 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg 1817851 May 18 23:59 server.log.2012-05-18
-rw-r--r--. 1 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg 1839824 May 19 23:58 server.log.2012-05-19
-rw-r--r--. 1 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg 1810795 May 20 23:59 server.log.2012-05-20
drwxr-xr-x. 2 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg    4096 May 21 00:01 .
-rw-r--r--. 1 HGFWDHGW878c2c535skejw34w3rg HGFWDHGW878c2c535skejw34w3rg  141596 May 21 01:51 server.log

Cheers !! 🙂
Middleware Magic Team

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.