Skip to content

Instantly share code, notes, and snippets.

@jaydp17
Created July 21, 2014 19:47
Show Gist options
  • Save jaydp17/9f4dbbc76725a2302564 to your computer and use it in GitHub Desktop.
Save jaydp17/9f4dbbc76725a2302564 to your computer and use it in GitHub Desktop.

Openshift

To manage openshift apps we'll be using rhc.

Setup rhc

Follow the first 3 steps from here

Creating a rails app

rhc app create YOUR_APP_NAME http://cartreflect-claytondev.rhcloud.com/reflect?github=openshift-cartridges/advanced-ruby-cartridge

Add MongoDB Cartridge

rhc cartridge add mongodb-2.4 -a YOUR_APP_NAME

Add RockMongo [Optional]

RockMongo is similar to PhpMyAdmin but for MongoDB

rhc cartridge add rockmongo -a YOUR_APP_NAME

Note the username/password that are generated

Define the server

( by default it uses Passenger )

rhc env set OPENSHIFT_RUBY_SERVER=puma -a YOUR_APP_NAME

available options are passenger, puma, unicorn and thin. ( Gemfile should contain the gem of that server )

The folder YOUR_APP_NAME is not needed anymore, you can go ahead and delete it.

Pushing code to openshift rails app

  • Clone the source repo from github (let's say the folder that contains the source is SOURCE_FOLDER

  • cd SOURCE_FOLDER/

  • Now we need to add a remote to this git repo that should point to the git repo of openshift app

# git url is given after creating application ( rhc app create … ), or you can get it by running rhc apps
git remote add openshift GIT_URL 

git push openshift master -f

Miscellaneous

You can check which server is currently running by using this command

rhc ssh YOUR_APP_NAME '~/advanced-ruby/bin/control server'

To take effect, the application must be restated or you must deploy your code again.

rhc app restart YOUR_APP_NAME

For more info, refer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment