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.
- Register at https://id.heroku.com/login
- Install Heroku Toolbelt from https://toolbelt.heroku.com
- Register at https://mongolab.com/signup and create new MongoDB database (they give 500MB for free)
- 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)
- Login to the Heroku from the command line: $ heroku login
- Create new Heroku application:
$ heroku create <appname> --stack cedar --buildpack https://github.com/oortcloud/heroku-buildpack-meteorite - 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> - Set the root URL
$ heroku config:set ROOT_URL=http://<appname>.herokuapp.com - Or this, in case you have got a domain
heroku config:add ROOT_URL=http://yourdomain.com - 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
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
thanks for sharing these instructions!
ReplyDeleteI 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.
ReplyDeleteAny idea why?
Here is what I get on the app: http://qawsedrf.herokuapp.com/ ... The MongoHQ shows that there are 5 documents in the db though :(
Navin Pai, try to connect with your MONGO_URL from some client (to make sure your connection string is fine).
ReplyDeleteDo you see anything interesting when you run: heroku logs ?
What is the output when you run: heroku config ?
got it's after deploy
ReplyDelete2013-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?
thanks!
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)
ReplyDeleteI would guess, BUILDPACK_URL is not set properly. So you can try to run:
Deleteheroku config:set BUILDPACK_URL=https://github.com/ondrej-kvasnovsky/heroku-buildpack-meteor.git
I get this error on Meteor 0.6.5.1 while deploying:
ReplyDeleteError: The package named jquery-ui does not exist.
I've got the same error when deploying to Heroku, Meteor 0.6.6.3
DeleteError: The package name query-ui does not exist
Anybody has a suggestion?
Did you solve it Graeme?
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 https://github.com/meteor/meteor/issues/1404). I also modified the buildpack and dropped the mongohq:sandbox add-on (see https://github.com/ze-phyr-us/heroku-buildpack-meteorite) which is not needed when you use MongoLab.
ReplyDeleteI have not updated to 0.7, so thanks for sharing! After I update to 0.7 I will also update the tutorial.
Deletehi ! do i need to run meteor bundle before pushing to heroku? or will the buildpack take care of bundling the app?
ReplyDeletethank you!
'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.
ReplyDeleteand this buildpackage works with meteor 0.8.0 too, right?
ReplyDeletethank you!
I have not tested it with 0.8.0 version... so I do not know.
DeleteIt works for me with 0.8.0.
DeleteThanks for sharing this. I just got Meteor working in Heroku. I was pulling my hair prior, thinking that it was straightforward.
ReplyDeleteHere are instructions for hosting Meteor 0.8.2 on Heroku, which can be challenging the first time around: http://stackoverflow.com/a/24706472/111948
ReplyDeletein step number 7, i'm get message error
ReplyDelete"Your version of git is 1.7.9.5. Which has serious security vulnerabilities.
More information here: https://blog.heroku.com/archiv...
! No app specified.
! Run this command from an app folder or specify which app to use with --app APP.
"
Hi ! I'm having trouble when pushing : it says me ->
ReplyDeleteerror 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:
remote: Meteor 1.0.5 has been installed in your home directory (~/.meteor).
remote:
remote: Now you need to do one of the following:
remote:
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:
remote: Then to get started, take a look at 'meteor --help' or see the docs at
remote: docs.meteor.com.
remote: Meteor installed
remote: Installing packages
remote:
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:
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:
remote: -----> Compressing... done, 6.2MB
remote: -----> Launching... failed
remote:
remote: ! Push rejected, failure creating release
remote:
remote: Verifying deploy....
remote:
remote: ! Push rejected to talkalang-alpha.
remote:
To https://git.heroku.com/talkalang-alpha.git
! [remote rejected] master -> master (pre-receive hook declined)
error: impossible de pousser des références vers 'https://git.heroku.com/talkalang-alpha.git'