Deploying rails application on to OPENSHIFT + via RHC client tool
Want to deploy your Ruby on Rails application on openshift? then follow these steps,
1) Go to http://www.openshift.com and create an account
2) Click MY APPS > Create an application https://openshift.redhat.com/app/console/application_types and select Ruby on rails as the type of the application.
3) Put a name for your application. If this is your first time… make sure that you have a unique namespace. You can change it here: https://openshift.redhat.com/app/account
4) Clone your git repo into your local machine via the ssh codes provided…
5) or I recommend to use rhc client tool to create app on openshift
6) Then to add cartridge to your rails application use
7) Then pull your code from github,
8) Then you will need to change, your database.yml put this config for production only…
Leave the development and test ENV under mysql adapter.
9) Now in your application directory look for .openshift folder
there you will find .openshift/action_hooks/deploy file
commands written between pushd and popd lines will get executed automatically after code is updated on openshift,so if you have any other commands like starting resque, or copying some files after deploy then you can add it here.
10) Now that we have made our changes… push it!
11) That’s all, now check url for your rails app.
12) https://www.openshift.com/page/openshift-environment-variables here you will find all enviroment variables details that are available in openshift.
13) If you want to associate your own domain name eg. (www.yourdomain.com) with your openshift rails app url then you will need to create url alias as shown below
then change cname records in your DNS provider account.
14) If your application require some persistent directory for your data then you can use directory (app-root/data/) you can access this directory in your application using enviroment variable OPENSHIFT_DATA_DIR
15) If you want to remove a cartridge