Chris Mendez in NodeJS, Javascript, For Developers, Openshift, MongoDB

Creating an ExpressJS app with MongoDB on Openshift

Here's how to create a NodeJS app with MongoDB on Openshift using Command Line.

Step 1

OpenShift the command line to create the Node.JS app.

rhc app create my_app nodejs-0.6  

Step 2

Add a mongo cartridge to the application.

rhc cartridge add mongodb --app my_app --namespace [namespace]  

Step 3

Adding MongoRock (GUI) to app. MongoRock is a Graphical User Interface for MongoDB.

rhc cartridge add -a mongodb -c rockmongo-1.1  

Step 4

Push to OpenShift.

git commit -am 'commit description' && git push  

Step 5

Tail the logs.

rhc app tail -a [app name] --namespace [namespace]  

Step 6

Start / stop the server on OpenShift

rhc app [start|stop] -a [app name]  

Step 7

Snapshot a particular version on OpenShift.

rhc app snapshot save -a [app name]  

Step 8

Restore a snapshot.

rhc app restore -a [app-name] -f [path to snapshot file]