A Meteor Node.js App to Heroku in 5 Minutes

DZone 's Guide to

A Meteor Node.js App to Heroku in 5 Minutes

· Cloud Zone ·
Free Resource

Meteor is an amazing framework to rapidly build fully interactive web applications based on node.js and MongoDB.

I had a look at the video on the home page and I was quite impressed. I wanted to check it out myself on the web so I installed the framework

curl https://install.meteor.com | /bin/sh

and then went ahead with creating a new app.

If you create a new app you probably won't have a feeling of where to start. So instead of starting from scratch, try starting from one of the examples

meteor create --example parties

Now that you have the code just browse through the client and the server folders, you can get a feeling of how to structure a web app.

Ok now, let's chuck it on Heroku

cd parties
heroku create devparties --stack cedar --buildpack https://github.com/jordansissel/heroku-buildpack-meteor.git

The command above will create a new heroku app called devparties using this buildpack that has all the configuration to use a MongoHQ free db.

Now let's use git to add to Heroku

git init
git commit -a -m "Initial commit"

Before pushing you will have to add the remote (heroku) git url

git remote add heroku git@heroku.com:devparties.git
git push heroku master

OK, that's it. You have your app running.

There is one last thing you command you'll have to run to set the ROOT_URL ( not sure, must be in the buildpack somewhere.. ) Anyway, if you get an error like

Starting process with command `PATH=.meteor/local/usr/bin:.meteor/local/usr/lib/meteor/bin:bin:/usr/local/bin:/usr/bin:/bin NODE_PATH=.meteor/local/usr/lib/meteor/lib/node_modules MONGO_URL=mongodb://heroku:1e2cc27d5f5415f5cd31783b6fa29afa@linus.mongohq.com:10011/app11455582 node .meteor/local/build/main.js`
2013-01-31T00:03:57+00:00 app[web.1]:             ^
2013-01-31T00:03:57+00:00 app[web.1]: app/packages/meteor/url_common.js:14
2013-01-31T00:03:57+00:00 app[web.1]: 
2013-01-31T00:03:57+00:00 app[web.1]:     at Object.Meteor.absoluteUrl (app/packages/meteor/url_common.js:14:13)
2013-01-31T00:03:57+00:00 app[web.1]:     at app/packages/accounts-password/email_templates.js:3:20
2013-01-31T00:03:57+00:00 app[web.1]:       throw new Error("Must pass options.rootUrl or set ROOT_URL in the server
2013-01-31T00:03:57+00:00 app[web.1]: Error: Must pass options.rootUrl or set ROOT_URL in the server environment
2013-01-31T00:03:57+00:00 app[web.1]:     at Array.forEach (native)
2013-01-31T00:03:57+00:00 app[web.1]:     at Function._.each._.forEach (/app/.meteor/local/build/server/node_modules/underscore/underscore.js:79:11)
2013-01-31T00:03:57+00:00 app[web.1]:     at run (/app/.meteor/local/build/server/server.js:99:7)
2013-01-31T00:03:57+00:00 app[web.1]:     at /app/.meteor/local/build/server/server.js:113:21
2013-01-31T00:03:58+00:00 heroku[web.1]: Process exited with status 1

then run the command

heroku config:add ROOT_URL=http://devparties.herokuapp.com



Published at DZone with permission of Andrew Salvadore . See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}