grails (11) vaadin (11) meteor (6) elasticsearch (3) java (2) centos (1) cloudbees (1) google analytics (1) gradle (1) heroku (1) javascript (1) jdbc (1) jug (1) logback (1) logging (1) mac os (1) mongodb (1) mongolab (1) mysql (1) twitter (1) ubuntu (1)

Sunday, May 26, 2013

How to deploy Meteor on Heroku with external MongoDB

The case is following, you have made a Meteor application and you want to deploy it on Also, you want to use external MongoDB database provided by
  1. Register at 
  2. Install Heroku Toolbelt from
  3. Register at and create new MongoDB database (they give 500MB for free)
  4. Open the root folder of you Meteor project in console (you need a Git repository in order to deploy applications to Heroku, just set up one or use the one provided by Heroku, it becomes accesible after you create new application)
  5. Login to the Heroku from the command line: $ heroku login
  6. Create new Heroku application: 
    $ heroku create <appname> --stack cedar --buildpack
  7. Setup other than default MongoDB for your Meteor application (you can get all the details for constructing the MONGO_URL from yours Mongolab account): 
    $ heroku config:set MONGO_URL=mongodb://<username>:<password><dbname>
  8. Set the root URL
    $ heroku config:set ROOT_URL=http://<appname>
  9. Or this, in case you have got a domain
    heroku config:add ROOT_URL=
  10. Add the Heroku Git repository as another remote to your git repository and push the code to that remote. The application will be automatically deployed and becomes accesible on <appname> 
    $ git remote add heroku<appname>.git
    $ git push heroku master
When you make changes to your code, just run git push heroku master again and all the commit from your origin/master will be released.

In case you want to see the response times for this setup, you can try it out on or 


  1. thanks for sharing these instructions!

  2. I tried this with the default leaderboard meteor example app and while the deployment went successfully and the isServer code was run successfully, the clientside is not getting the data from the mongo instance.

    Any idea why?
    Here is what I get on the app: ... The MongoHQ shows that there are 5 documents in the db though :(

  3. Navin Pai, try to connect with your MONGO_URL from some client (to make sure your connection string is fine).

    Do you see anything interesting when you run: heroku logs ?

    What is the output when you run: heroku config ?

  4. got it's after deploy

    2013-07-28T00:39:03+00:00 heroku[slug-compiler]: Slug compilation finished
    2013-07-28T00:39:04.771109+00:00 heroku[web.1]: Starting process with command `node bike_alarm.js`
    2013-07-28T00:39:05.493068+00:00 app[web.1]: bash: node: command not found
    2013-07-28T00:39:06.660391+00:00 heroku[web.1]: Process exited with status 127
    2013-07-28T00:39:06.677989+00:00 heroku[web.1]: State changed from starting to crashed
    2013-07-28T00:39:06.677989+00:00 heroku[web.1]: State changed from crashed to starting
    2013-07-28T00:39:09.018743+00:00 heroku[web.1]: Starting process with command `node bike_alarm.js`
    2013-07-28T00:39:09.835502+00:00 app[web.1]: bash: node: command not found
    2013-07-28T00:39:11.238165+00:00 heroku[web.1]: Process exited with status 127
    2013-07-28T00:39:11.253697+00:00 heroku[web.1]: State changed from starting to crashed
    2013-07-28T00:39:19.128339+00:00 heroku[web.1]: Error R99 (Platform error) -> Failed to launch the dyno within 10 seconds
    2013-07-28T00:39:19.128559+00:00 heroku[web.1]: Stopping process with SIGKILL

    any ideas?


  5. Yes, it seems you have wrong configuration. Can you show what is the output when you run: heroku config (remove your database URL string... the rest can remain)

    1. I would guess, BUILDPACK_URL is not set properly. So you can try to run:
      heroku config:set BUILDPACK_URL=

  6. I get this error on Meteor while deploying:

    Error: The package named jquery-ui does not exist.

    1. I've got the same error when deploying to Heroku, Meteor

      Error: The package name query-ui does not exist

      Anybody has a suggestion?

      Did you solve it Graeme?

  7. Thanks for sharing this. My Meteor 0.7 was crashing with "Error: a route URL prefix must begin with a slash" which was easily solved by adding "http://" to my ROOT_URL (see I also modified the buildpack and dropped the mongohq:sandbox add-on (see which is not needed when you use MongoLab.

    1. I have not updated to 0.7, so thanks for sharing! After I update to 0.7 I will also update the tutorial.

  8. hi ! do i need to run meteor bundle before pushing to heroku? or will the buildpack take care of bundling the app?
    thank you!

  9. 'git push heroku master' is all you need to do in order to deploy a new version. it will be bundled on the heroku server for you.

  10. and this buildpackage works with meteor 0.8.0 too, right?
    thank you!

    1. I have not tested it with 0.8.0 version... so I do not know.

  11. Thanks for sharing this. I just got Meteor working in Heroku. I was pulling my hair prior, thinking that it was straightforward.

  12. Here are instructions for hosting Meteor 0.8.2 on Heroku, which can be challenging the first time around:

  13. in step number 7, i'm get message error
    "Your version of git is Which has serious security vulnerabilities.

    More information here:

    ! No app specified.

    ! Run this command from an app folder or specify which app to use with --app APP.


  14. Hi ! I'm having trouble when pushing : it says me ->

    error src refspec master doesnot match any

    Then i tried to git add and git commit before pushing and it seems to workfirst, but it always finish likethis,i have got no idea why.

    remote: ######################################################################## 100.0%
    remote: Meteor 1.0.5 has been installed in your home directory (~/.meteor).
    remote: Now you need to do one of the following:
    remote: (1) Add "$HOME/.meteor" to your path, or
    remote: (2) Run this command as root:
    remote: cp "/tmp/node-meteor-zKhN/.meteor/packages/meteor-tool/1.0.45/mt-os.linux.x86_64/scripts/admin/launch-meteor" /usr/bin/meteor
    remote: Then to get started, take a look at 'meteor --help' or see the docs at
    remote: Meteor installed
    remote: Installing packages
    remote: Done installing smart packages
    remote: Building meteor bundle
    remote: This command has been deprecated in favor of 'meteor build', which allows you
    remote: to build for multiple platforms and outputs a directory instead of a single
    remote: tarball. See 'meteor help build'for more information.
    remote: Setting up MONGO_URL in .profile.d
    remote: -----> Vendoring node into slug
    remote: -----> Discovering process types
    remote: Procfile declares types -> (none)
    remote: Default types for Meteor app -> web
    remote: -----> Compressing... done, 6.2MB
    remote: -----> Launching... failed
    remote: ! Push rejected, failure creating release
    remote: Verifying deploy....
    remote: ! Push rejected to talkalang-alpha.
    ! [remote rejected] master -> master (pre-receive hook declined)
    error: impossible de pousser des références vers ''