Please note that these documents apply to OpenShift Online v2 only (accounts created before August 1st, 2016).
If you are using one of the OpenShift 3 products, please refer to documents available at

Node.js Getting Started

In addition to the usual git and the rhc command-line tools, you’ll need to install Nodejs as a local development dependency. The npm package manager comes bundled with all recent releases of Nodejs.

The rhc command-line tool makes it easy to provision new hosted application environments - complete with DNS, ssh, and git services.

Step1: Create a Nodejs Application

To launch a new application named myapp, using the nodejs-0.10 web runtime cartridge:

$ rhc app create myapp nodejs-0.10

OpenShift’s default platform features include automatic DNS setup, SSH services, and a git server. The resulting output should contain a live URL where your application will be available:

By default, the rhc app create command will also attempt to create a local git repository (for development use). This repo will contain a git remote address that can be used to push updates to your site.

The output will look something like this:

Application Options
Domain:     shifter
Cartridges: nodejs-0.10
Gear Size:  default
Scaling:    no

Creating application 'myapp' ... done

Waiting for your DNS name to be available ... done

Cloning into 'myapp'...
Warning: Permanently added the RSA host key for IP address '' to the list of known hosts.

Your application 'myapp' is now available.

  URL: (1)
  SSH to:
  Git remote: ssh://
  Cloned to:  /home/ryanj/src/myapp (2)

Run 'rhc show-app myapp' for more details about your app.
1 Public URL of application
2 Location of local Git repository

The application will now be running and accessible at the URL (1) listed in the output. A local git repository for your application was also created in the directory listed under Cloned to (2).

Advanced App Creation

Running rhc help app create provides an excellent reference of optional flags. For example, the --from-code argument makes it easy to deploy existing projects, as long as they’ve been adapted to run on OpenShift.

This command creates a new horizontally scalable "parks" application from an existing project repo, using the nodejs-0.10 and postgresql-9.2 cartridges as runtime dependencies, while setting an env variable named "FOO" to the value of "BAR" in the resulting system envonment:

$ rhc app create parks nodejs-0.10 postgresql-9.2 -s --from-code= FOO=BAR

Other Tips

Visit the OpenShift Developer Center for more information about getting started with Nodejs:

Environment Variables

OpenShift’s Nodejs cartridge uses the following system environment variables to publish router connection details, and to customize the application’s build, hosting, and scaling routines:

Environment Variable Use


Bind to this IP address in order to recieve traffic from the routing layer


Listen on this port to recieve traffic from the routing layer


This integer value may be set as an environment variable (default is 1 second)


OpenShift will not install devDependencies when NPM_CONFIG_PRODUCTION is set to "true"

See the master index of Environment Variables for more information.

Marker Files

Marker files can be used to customize various aspects of the Nodejs build and deployment process.

Adding the following empty files to your project’s .openshift/markers folder allows you to customize the runtime experience:

Marker File Effect


Push code updates without waiting for a full application restart. This feature is not available when the use_npm marker is enabled.


Initialize your application or service using npm start instead of supervisor servername.js (where servername.js is based on the value of your package.json’s `main attribute).

Next Steps

The best next step is to create an application using OpenShift.

Look at the application gallery and developer spotlight to see what other developers have created on OpenShift.

Browse our quickstarts and community cartridges to see other exciting technology you can use in your applications.

Finally, if at any point you have questions or issues, please visit the Help Center for a full list of options.