Cloudy With a Chance of Meteor.js

meteor on openshift picture

Meteor is a hot new javascript-based application framework which uses node.js and MongoDB to help you build realtime, interactive websites in a snap.

It emphasizes the use of fibers for writing node.js applications, which may make it easier to pick up for those of you who are not used to making heavy use of callbacks in your code.

Take a look at Meteor's screencast, docs, and example apps to learn more, and to reset your expectations for what is possible with modern application development.

Basic Setup

If this is your first time using OpenShift Online or meteor.js, you'll have a few setup tasks to do:

  1. Create an OpenShift Online account
  2. If you don't already have the rhc (Red Hat Cloud) command-line tools, run: sudo gem install rhc
  3. Run rhc setup to link your OpenShift Online account with your local development environment, and to select an application namespace
  4. Install Node.js, MongoDB. Then add Meteor to your local development environment: curl | sh

For additional assistance setting up the rhc command-line tool, see the following page:

Configure your OpenShift gear

Spin up a new OpenShift gear with Node.js, MongoDB, and a shim to help meteor.js connect to the correct ports. This example uses the application name: "meteor"

rhc app create meteor nodejs-0.10 mongodb-2.2 --from-code=

The above command will output a local copy of your OpenShift application source in a folder matching your application name. Be sure to run this command from within a folder where you would like to keep your project source.

Create a Meteor.js example project

To see a list of all available meteor.js example projects, type meteor create --list.

In this guide, we'll use the meteor.js "leaderboard" example:

meteor create --example leaderboard

See to learn about what other example applications are available. Feel free to try them all.

Bundle and merge your meteor.js code

Bundle up your meteor application source:

cd leaderboard # if you chose the leaderboard example
meteor bundle bundle.tar.gz # to prep for deployment

Next, you'll need to extract the resulting code into your OpenShift application folder (minus the "bundle/" folder wrapper that Meteor will automatically include). Use the -k flag when extracting to prevent the existing DB connection code from being overwritten during this merge process.

If you are developing on Linux, or using GNU tar, this command should work:

tar -xvf bundle.tar.gz --transform 's|^bundle/||' -C ../meteor/

For Mac or BSD-based operating systems:

tar -xvf bundle.tar.gz -s '/^bundle//' -C ../meteor/

The above example assumes that you named your OpenShift application "meteor", as shown in the rhc app create step. And, that your OpenShift application source code is available at this relative path: ../meteor

Add these new files to your OpenShift application's Git repo:

cd ../meteor
git add .
git commit -am "Adding a meteor.js application bundle"

Deploy to OpenShift

Then, push the new code to OpenShift to deploy your meteor.js application bundle:

git push

That's it! Check out your new Meteor.js application at:


Thanks for following along!

An OpenShift + Meteor quickstart guide is also available on GitHub -

What's Next?

Having a problem with the command "tar -xvkf bundle.tar.gz --transform 's|^bundle/||' --directory ../meteor/"

tar doesn't have a transform option


Thanks for the alert. I've added another line covering BSD's version of tar.

Hope that one works for you!

Thanks Ryan :)

The tutorial worked perfectly! It would be great if you could provide instruction to use phantomjs together with Meteor. Currently, phantomjs is the only way to get some SEO benefits on Meteor apps, and none of the major PAAS provide an easy solution to use node+phantomjs.

How do you put mongodb on a different gear? And any idea when you're going to support mongodb 2.4 which was released recently?

By default, non-scalable apps will have the db cartridges installed locally on the same gear. To configure mongodb on it's own gear, you will want to create a scalable app (-s flag if using rhc client tools). Then add the db cartridge.

As for MongoDB 2.4, please add your feature request to
and encourage folks to vote on it.

First, thanks for posting the quickstart instruction on running Meteor apps on Openshift.

I got it working with the example app. However, if I want to deploy my changes, I tried bundling my app again and replaced the files in the "meteor" folder, then git pushed. This did not work for me.

Do you have suggestions for deploying changes?

Thanks, Jack Chi

Is the shim to which you refer to get meteor to the use the right ports located in your main.js specifically:

process.env.ROOT_URL = process.env.OPENSHIFT_APP_DNS || "localhost";
process.env.MONGO_URL = (process.env.OPENSHIFT_MONGODB_DB_URL + process.env.OPENSHIFT_APP_NAME) || 
process.env.PORT = process.env.OPENSHIFT_INTERNAL_PORT || 8000;
process.env.IP = process.env.OPENSHIFT_INTERNAL_IP || '';


I am trying to get an meteor example application to run when deploying I first got a dependency problem because gzippo was missing from dependencies in package.json. I added this line: "gzippo": "~0.2.0"

and then when I do Git push I get the following error : ( Note: I started with leaderboard and the same problems occurred there so I started from scratch with Todos and got the same problem)

TypeError: Cannot call method 'listeners' of undefined at Object.exports.overshadowListeners (/var/lib/openshift/51d9a34de0b8cde919000091/app-root/runtime/repo/app/packages/livedata/node_modules/sockjs/lib/utils.js:92:24) at Server.installHandlers (/var/lib/openshift/51d9a34de0b8cde919000091/app-root/runtime/repo/app/packages/livedata/node_modules/sockjs/lib/sockjs.js:190:13) at new Meteor.DdpStreamServer (app/packages/livedata/stream_server.js:43:15 ) at new Meteor._LivedataServer (app/packages/livedata/livedata_server.js:1024:24) at app/packages/livedata/server_convenience.js:8:19 at /var/lib/openshift/51d9a34de0b8cde919000091/app-root/runtime/repo/server/server.js:287:12 at Array.forEach (native) at Function..each._.forEach (/var/lib/openshift/51d9a34de0b8cde919000091/app-root/runtime/repo/server/node_modules/underscore/underscore.js:78:11) at /var/lib/openshift/51d9a34de0b8cde919000091/app-root/runtime/repo/server/server.js:228:7 npm info OpenShift-Nodejs-Cartridge@1.1.0 Failed to exec start script npm ERR! weird error 8 npm ERR! not ok code 0

Has anyone here had the same problem?

Thanks Ludvik

Hi Ludvik, I have the EXACT same problem! Cant get it running so far..

FIXED IT! the supplied server.js does not work anymore. It seems connect uses a slightly different syntax to start the server now. Check this gist for a working version:

cheers //thomas

Hi Thomas,

I merged your changes into my server.js and it worked great.

Thank you for solving and sharing!

Regards Ludvik

Thanks Thomas!!!

Worked with your version!

HI Friends,

I followed this excellent guide, using the leaderboard example, and also changed the server.js per Thomas' gistfile. Unfortunately, my app doesn't seem to work.

Is anybody else experiencing problems deploying a meteor.js app?


Seems the latest Meteor changes broke the quickstart app. Our SME is looking into this and will update the blog with a solution.

Any good news on the meteor version issues? I've been having a look to the git repo an it doesn't seem to be updated to cover the new structure. If not, is there any other way to run the 0.6.5. version?

I've been working on an updated meteor project shim here:

Support for the new bundle format provided by meteor 0.6.5 is just about there.

Hi Ryan, this looks like a great guide - and thanks for maintaining the quickstart!

Is your update to the quickstart working yet? I've followed the steps in this blog post and I'm getting a problem with the example application - the application deploys but fails with a 503 and when I run an rhc tail on my app I can see the following error over and over again:

/var/lib/openshift/528292975973ca5406000029/app-root/runtime/repo/programs/server/node_modules/fibers/fibers.js:13 throw new Error('`'+ modPath+ '.node` is missing. Try reinstalling `node-fibe ^ Error: `/var/lib/openshift/528292975973ca5406000029/app-root/runtime/repo/programs/server/node_modules/fibers/bin/linux-x64-v8-3.14/fibers.node` is missing. Try reinstalling `node-fibers`? at Object. (/var/lib/openshift/528292975973ca5406000029/app-root/runtime/repo/programs/server/node_modules/fibers/fibers.js:13:8) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at Object. (/var/lib/openshift/528292975973ca5406000029/app-root/runtime/repo/programs/server/boot.js:1:75) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) DEBUG: Program node meteorshim.js exited with code 8


Hi Jeremy, This quickstart no longer works with the latest version of Meteor. I'm working on an update to this quickstart and post that will help make meteor hosting on OpenShift easier. If anyone is interested in helping with that effort, feel free to ping us in #openshift on Freenode IRC. :) Sorry about the breakage, the bundle format keeps changing on me. I'll be sure to update everyone here when a fix is available. Thanks for the feedback! --RyanJ

it seems to be working for me... Release (on my local machine).. still a bit lost as to find the version of meteor running on openshift. but im guessing its the same since im bundling. is that correct?

It's still unclear to me if we will need to manually install fibers once we've deployed the application or in our local environment - that should be added to the documentation/blog.

I was able to get past the "Try reinstalling `node-fibe" error

by following this hint:

still not out of the woods though.

rhc tail meteor now shows ...

Meteor requires Node v0.10.22 or later. DEBUG: Program node meteorshim.js exited with code 1

After one day I 've prepared this "quickstart" solution, it uses NODE v0.10.24 ((but it can be changed) ) with meteor example LeaderBoard and it can be easy transformed to your real application.


I was able to get the Leaderboard example running well with Node 10.24 as a DIY cartridge. It works using either the local Mongo or MongoHQ.

Some tips for those going that direction:

1) start with this: (thanks Eddie!)

2) changes: a) the version to v.0.10.24 in config_diy.json and package.json (by the way, do not update NPM … leads to many annoying errors) b) the env must be set up …. you can alter .openshift / action_hooks / pre_build or alternatively just do changes in meteorshim (point 4 below). Either way note that you need to use "DIY_PORT" and "DIY_IP" c) retain the .openshift directory but get rid of the express related files, replacing with meteor files (next step)

3) use demetorizer instead of the bundle approach suggested above

4) use the meteorshim.js (above) but with these changes:

//added http:// to next line .... see process.env.ROOT_URL = "http://" + process.env.OPENSHIFT_APP_DNS || "localhost";

//changed port from 8000 in line below and changed the IP to avoid. events.js:72 error listen EACCES //process.env.PORT = process.env.OPENSHIFT_NODEJS_PORT || 8000; //process.env.BIND_IP = process.env.OPENSHIFT_NODEJS_IP || '';

//used these instead see process.env.PORT = process.env.OPENSHIFT_DIY_PORT || 8080; process.env.BIND_IP = process.env.OPENSHIFT_DIY_IP || '';

Hope that helps …. it would have saved me quite a few hours …. ;)

I am having 64bit binary code of an image at server side in meteorjs. I want to save this image somewhere , that may be the database or a local folder. After saving I want to return the the name of the image or the source of the image to client. Do I need to use any liberary for this? Or can I accomplish the task using mongodb grid fs?

How can I do this.

Thank you

There seems to be a problem with node_modules/fibers

remote: BIND_IP: remote: remote: /var/lib/openshift/5332ed345973cafb9e000160/app-root/runtime/repo/programs/server/node_modules/fibers/fibers.js:13 remote: throw new Error(''+ modPath+ '.node is missing. Try reinstalling node-fibe remote: ^ remote: Error:/var/lib/openshift/5332ed345973cafb9e000160/app-root/runtime/repo/programs/server/node_modules/fibers/bin/linux-x64-v8-3.14/fibers.nodeis missing. Try reinstallingnode-fibers`? remote: at Object. (/var/lib/openshift/5332ed345973cafb9e000160/app-root/runtime/repo/programs/server/node_modules/fibers/fibers.js:13:8) remote: at Module._compile (module.js:456:26) remote: at Object.Module._extensions..js (module.js:474:10) remote: at Module.load (module.js:356:32) remote: at Function.Module._load (module.js:312:12) remote: at Module.require (module.js:364:17) remote: at require (module.js:380:17) remote: at Object. (/var/lib/openshift/5332ed345973cafb9e000160/app-root/runtime/repo/programs/server/boot.js:1:75) remote: at Module._compile (module.js:456:26) remote: at Object.Module._extensions..js (module.js:474:10) remote: DEBUG: Program node meteorshim.js exited with code 8 remote: remote: DEBUG: Starting child process with 'node meteorshim.js' remote: -------------------------

Hi I'm new to meteor and OpenShift. It seems that meteor 0.8 now needs nodejs 0.10.25. Will there be any updates to reflect this soon? Thank you very much!