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

Sunday, May 26, 2013

How to deploy Meteor on Heroku with external MongoDB


This blog post is obsolete, use instead: http://justmeteor.com/blog/deploy-to-production-on-heroku

The case is following, you have made a Meteor application and you want to deploy it on heroku.com. Also, you want to use external MongoDB database provided by mongolab.com.
  1. Register at https://id.heroku.com/login 
  2. Install Heroku Toolbelt from https://toolbelt.heroku.com
  3. Register at https://mongolab.com/signup 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 https://github.com/oortcloud/heroku-buildpack-meteorite
  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>@ds027308.mongolab.com:27308/<dbname>
  8. Set the root URL
    $ heroku config:set ROOT_URL=http://<appname>.herokuapp.com
  9. Or this, in case you have got a domain
    heroku config:add ROOT_URL=http://yourdomain.com
  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>.herokuapp.com 
    $ git remote add heroku git@heroku.com:<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 http://failtracker.com or http://templhub.com