my recent reads..

Atomic Accidents: A History of Nuclear Meltdowns and Disasters; From the Ozark Mountains to Fukushima
Power Sources and Supplies: World Class Designs
Red Storm Rising
Locked On
Analog Circuits Cookbook
The Teeth Of The Tiger
Sharpe's Gold
Without Remorse
Practical Oscillator Handbook
Red Rabbit

Tuesday, June 23, 2009

Running Heroku on Windows

What! Do rails development on Windows?

I've raved about heroku before, and it still roasts my bacon.

In recent months, there's been a bit of a switcheroo - first the migration to herokugarden, which retains all the original online editing and hosting. The perfect solution for hobby projects or prototypes. Now I'm migrating back to heroku itself, which has become their solid production hosting facility for rails applications.

As Sarah Mei reported, the heroku gem (used to create and manage your heroku application instances) had problems running under Windows, due to gem dependencies that do some decidely un-Windows things.

There is now an updated heroku gem (1.0) that I just tested out, and am happy to say it is now working fine under Windows. There are some dependent gems and it can be required to make sure you get the version that specifically supports windows. That used to include json, but at the moment the main version-pegged gem I'm using is sqlite3-ruby (at 1.2.3 instead of the head at 1.2.4)

$ gem install sqlite3-ruby -v 1.2.3
$ gem install heroku
Successfully installed heroku-1.0
1 gem installed
Installing ri documentation for heroku-1.0...
Installing RDoc documentation for heroku-1.0...

Perfect! Testing it out..

$ rails myapp
$ cd myapp
$ git init
$ git add .
$ git commit -m "init"
$ heroku create myapp
Created http://myapp.heroku.com/ | git@heroku.com:myapp.git
Git remote heroku added
$ git push heroku master
Enter passphrase for key '/d/MyDocs/My Dropbox/Config/Security/ssh/id_rsa':
Counting objects: 65, done.
Compressing objects: 100% (58/58), done.
Writing objects: 100% (65/65), 80.48 KiB, done.
Total 65 (delta 14), reused 0 (delta 0)

-----> Heroku receiving push
-----> Rails app detected
Compiled slug size is 80K

-----> Launching...... done
App deployed to Heroku

To git@heroku.com:myapp.git
* [new branch] master -> master

Sarah gave the hint as to how to fix the older heroku gem (0.9.1), and has a forked version on github. A few people collaborated to fix up the code there so no longer any script editing required (basically to remove any dependency on taps for the gem build). Installing Sarah's version involved cloning the repository, building the gem and performing the local gem installation:

$ git clone git://github.com/sarahmei/heroku.git
$ cd heroku
$ gem build Rakefile
$ gem install heroku

2 comments:

Unknown said...

Hi Sarvesh. I may not always live by the rule, but I think a worthwhile blog post has to have somehow add or create new knowledge i.e. some value-add. Otherwise just tweet;-)

The toughest way is pure original thought.

But my favorite trick is to take two existing facts/posts/articles/books, make a connection (that's the +1 original thought bit), and then write about it;-)

Sarvesh, the same applies to worthwhile comments. I'm sorry to say that compliment + unrelated self-promotion does not count as value-add.

Unknown said...

I've put some of my thoughts on Heroku on Windows here: http://allaboutruby.wordpress.com/2009/12/05/hosting-your-rails-app-first-look-at-heroku/