The Rails 3.1 Beta is out. So far, it's pretty cool, but I like to rapidly deploy my working applications to Heroku in order to minimize the develop-to-deploy feedback loop.
My initial attempts were met with complete failure – pushing up revealed that there was no JS implementation on Heroku, causing it to fail. So I did some research, and tried to install The Ruby Racer and add it to my gemfile.
There was no luck with that – The Ruby Racer actually builds V8, and Heroku's console truncates the GCC command, causing the compile to fail.
After this, I discovered The Ruby Racer Heroku build, which comes with a pre-compiled V8. Cool. I added it to my Gemfile, and attempted to bundle. This failed horribly, cauisng compilation errors all over the place. Turns out, if you install it locally, it still tries to build.
I searched everywhere for my particular problems with no answer – until I attempted to install V8 directly through Homebrew. It failed horribly, and it had to do with Cinderella.
For rapidly setting up my machine, I use Cinderella. It enables me to setup my development environment fairly well with one command, and more importantly it's namespaced in my Home directory, enabling me to wipe my environment at any time.
This namespace broke the V8 compilation, and The Ruby Racer build. I removed Cinderella, installed homebrew and RVM by hand, and got myself back up in running in half an hour. brew install V8 passed this time.
The final problem was documented – I attempted to install The Ruby Racer again, and was met with another compile error. Apparently, if you have v8 installed, The Ruby Racer will attempt to use that build's header files instead of its own. After removing V8, it installed just fine, and with a quick push, we were up to Heroku.
Heroku will also install the rails3-static-assets plugin, which allows static asset serving. For one reason or another, this fails in Rails 3.1.
In your production.rb environment file, just set:
config.servestaticassets = true
And you're off to the races. With Sprockets, you won't have much of anything in your public directory anyway.
- Use therubyracer-heroku gem for production.
- Don't use Cinderella.
- Don't have V8 installed independently.
- Enable Rails static asset serving with: config.servestaticassets = true