Last Updated: February 25, 2016
·
6.587K
· kazlan

Deploying Meteor app to heroku with Meteorite and MongoLab

It's been a bit of a hassle to deploy my Meteor (0.6+) apps to heroku, so I thought I'd share my history and recipe..

I'll presume you already have your Heroku and MongoLab accounts setup as well as git set on your box. Make sure you installed Heroku toolbelt too..

This was my first try
heroku create <appname> --stack cedar --region eu --buildpack https://github.com/ondrej-kvasnovsky/heroku-buildpack-meteor.git

that buildpack is no longer valid and will fail (until rPowell's pull request is accepted), it tries to bundle with 'meteor' instead of 'mrt' and throws and error

heroku create <appname> --stack cedar --region eu --buildpack https://github.com/rpowelll/heroku-buildpack-meteor.git

This one works but sets up MongoHQ local vars and installs the Heroku plugin. So you need to uninstall the plugin and set your MONGOURL var to point to your MongoLab DB which is a bit of a hassle_

So I forked the buildpack and made it DB agnostic. Now it works like a charm. I'll detail the process.

git init
touch README.md
git add .
git commit -a -m "first deploy"
heroku create <appname> --stack cedar --region eu --buildpack  https://github.com/kazlan/heroku-buildpack-meteorite.git  __Set appname and region as needed__
heroku config:set MONGO_URL=mongodb://<username>:<password>@ds027308.mongolab.com:27308/<dbname>
heroku config:set ROOT_URL=<appname>.herokuapp.com
git push heroku master

As of version 0.6.6.1 of Meteor I needed to add the following to package.json in the root directory of the apps

{
  "name": "App_Name",
  "Version": "0.1",
  "engines": {
    "node": "0.10.20"
  }
}

All set and deployed!

Hope it helped

9 Responses
Add your response

I don't have a heroku / mongolab account yet, but I've been wanting to... since I am a big Meteor fan, this tip will help me to pull that trigger :) thx!

over 1 year ago ·

$ heroku create is missing --buildpack before the GitHub URL.

over 1 year ago ·

Indeed, thanks. Just fixed :)

over 1 year ago ·

@Jorge I get an error and the logs show the following. fibers.node is missing. Try reinstalling node-fibers?

over 1 year ago ·

as of version 0.6.6.1 I needed to set "node": "0.10.20" in package.json to get thru that problem.. will add an example package.json to the tip.

over 1 year ago ·

Thanks @kazlan. Life on the bleeding edge! I am running the latest Meteor 0.6.6.2, pushed it to Heroku with Node 0.10.20. Got an Application Error. Logs said Meteor 0.6.6.2 needs Node 0.10.21. Fired up a new node box and now my inital push fails with a SyntaxError: Unexpected token ILLEGAL when installing meteorite. Will I ever get my Meteor app on to Heroku.....

over 1 year ago ·

got me there.. My last one was a 0.6.6.1 app, will try it up tomorrow with a new one and see what happens.

over 1 year ago ·

I forked your buildpack and made the needed updates for Meteor 0.6.6.2 and Node 0.10.21 as done by https://github.com/areed

File comparison: https://github.com/benstr/heroku-buildpack-meteorite/compare/kazlan:master...master

My buildpack: https://github.com/benstr/heroku-buildpack-meteorite

over 1 year ago ·

Here are instructions for hosting Meteor 0.8.2 on Heroku, which can be challenging the first time around: http://stackoverflow.com/a/24706472/111948

over 1 year ago ·