Open shift

Installing the OpenShift Client Tools

$ sudo apt-get install ruby-full rubygems git-core
$ sudo gem install rhc
$ sudo rhc setup

OpenShift Client Tools (RHC) Setup Wizard

This wizard will help you upload your SSH keys, set your application namespace, and check that other programs like Git are properly installed.

If you have your own OpenShift server, you can specify it now. Just hit enter to use the server for OpenShift Online:
Enter the server hostname: ||

You can add more servers later using 'rhc server'.

Login to or@*****.com
Password: *********************

OpenShift can create and store a token on disk which allows to you to access the server without using your password. The key is stored in your home directory and should be kept secret.  You can
delete the key at any time by running 'rhc logout'.
Generate a token now? (yes|no) yes
Generating an authorization token for this client ... lasts 30 days

Saving configuration to /home/or/.openshift/express.conf ... done

Checking for git ... found git version 2.1.1

Checking common problems .

An SSH connection could not be established to django-***** Your SSH configuration may not be correct, or the application may not be responding. Authentication failed for user
*****@django-***** (Net::SSH::AuthenticationFailed)

Checking for a domain ... or

Checking for applications ... found 1

  django http://django-*****

  You are using 2 of 3 total gears
  The following gear sizes are available to you: small

Your client tools are now configured.
or@debian:~$ ssh-add ~/.ssh/id_rsa

Identity added: /home/or/.ssh/id_rsa (/home/or/.ssh/id_rsa)
or@debian:~$ ssh *****@django-*****


    You are accessing a service that is for use only by authorized users.
    If you do not have authorization, discontinue use at once.
    Any use of the services is subject to the applicable terms of the
    agreement which can be found at:


    Welcome to OpenShift shell

    This shell will assist you in managing OpenShift applications.

    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 delete"
    and recreate it

    Type "help" for more info.

[django-**** ****]\> ls
app-deployments  app-root  gear-registry  git  haproxy      python
[django-**** ****]\> exit
Connection to django-**** closed.
$ rhc deployment-list django

# Tail the logs of an application
$ rhc tail django
[openshift-server]\>ls -la  app-root/data

[openshift-server]\>gear deploy

Django admin pass

[openshift-server]\> python app-root/repo/wsgi/my_prj/ syncdb

[openshift-server]\> cp app-root/repo/wsgi/my_prj/sqlite3.db app-root/data

Update rhc

$ gem update rhc httpclient

How to create and unset environment variables on the server ?

$ rhc set-env My_VAR_1=my_val_1 My_VAR_2=my_val_2 -a app_name

$ rhc env set My_VAR_1=my_val_1 -a app_name
$ rhc env unset My_VAR_1 -a app_name

Restart the application

$ rhc app restart -a app_name

$ rhc app stop -a app_name
$ rhc app start -a app_name

To see where an existing application is being hosting

$ rhc app show --gears -a django

ID State Cartridges Size Region Zone SSH URL — ——- ———————- —– ————- ————– ——- * started python-2.7 haproxy-1.4 small aws-us-east-1 aws-us-east-1e * * started postgresql-9.2 small aws-us-east-1 aws-us-east-1e *