You can easily host an Ember.js app on Heroku by using the rack-pipeline Ruby gem.

The source for this example is on https://github.com/ctdean/emberjs-heroku-hello

The ToDo App

The Ember.js folks have made a nice todos example and put it up on https://github.com/emberjs/todos It uses rack-pipeline so we can make just a few tweaks to get it going on Heroku.

We’re assuming that you have ruby installed and that you’ve installed the tools from https://devcenter.heroku.com/articles/quickstart

There is also a skeleton at https://github.com/interline/ember-skeleton

The Procfile

Heroku will need a Procfile to work. Ours is trivial

web: bundle exec rakep server --port $PORT

To test it out first we’ll need to install all the ruby gems:

% bundle install

and the run the app using foreman:

% foreman start &

You can look at the To Do app in your browser at http://localhost:5000

Push out the app

Heroku uses git to push out the code so we need to have a git repo. Let’s pretend you’ve pulled the repo from https://github.com/ctdean/emberjs-heroku-hello (If you build it from the Ember.js source, make sure that you add Gemfile.lock to the repo.)

The Heroku app:

% heroku create --stack cedar

When the app is created it will assign a default url, in my case it was http://evening-beach-2602.herokuapp.com

And then push it out:

% git push heroku master

View the app

The app should now be running on the assigned url. You can view it in your browser using

% heroku apps:open
Published

13 Apr 2012


Previous Archive Next