How to Deploy an app to OpenShift - A Step-by-step Tutorial

If you deploy your applications to Heroku you can only upload 5 applications, if you want to deploy a new one, you need to verify you account with your credit card.

Heroku Error

These are the steps you need to follow to deploy to OpenShift.


Changes in your code

  • app.listen with process.env.OPENSHIFT_NODEJS_PORT and process.env.OPENSHIFT_NODEJS_IP , both requires.
  • In your package.json set your "main": 'yourMainFile.js and "script": { "start": "node yourMainFile.js" }

Deploying our app

Choose a web programming cartridge

  • Choose a name (second input will be same for all you apps)

[Fill our name and our domain

  • Fill our Git URL and our branch name

Where you can find your Git URL and your branch name at GitHub

Fill your Git URL and your branch name

  • “Create Application”. It will take some time

You will be redirected here when you finish deployment

  • Enter to “Application”, then into your App and check it’s started.

Your applications list

Details of your application

Enviroment variables

In my case I have my database in mLab, so I need to create some enviroment variables.

rhc only works with versions 1.9.3 and 2.0.0 of Ruby.

If you are having trouble with setting up rhc , try this answer on StackOverflow.

rhc env set VARIABLE=value VARIABLE2=value2 -a App_Name .

You need to restart your app to load the variables.

If you find a better way to solve this limitation. Feel free to contribute to our Wiki and share it with us.

You can check the app working at