Tuesday, February 24, 2009

Rails Deployment Blues

While developing in Rails is a joy, deployment can still be an adventure. Very interesting post on the Heroku blog on this topic. Here is a short list of hiccups that I experienced, that can be avoided by you, gentle reader:
  • Slicehost is great, and a $20 slice is a good way to get started. I went with Ubuntu 8.10 (intrepid).
  • Start with the following steps to secure and set up
  • Figuring out what to install from source versus package is tough. After many false starts, it seems like the only thing you need to install from source is Ruby Gems. DHH notes this in his plug for phusion. And he is right. Despite reports to the contrary, there are no issues with Ruby 1.8.7 that comes from the Ubuntu package. MySQL and Apache worked fine from the package as well.
  • Once you have Ruby 1.8.7 and Gem 1.3.1, Phusion should install without problem.
  • Ubuntu oddity: MySQL does not put mysql.sock under /tmp, as ROR expects. It puts a mysqld.sock under mysqld. Thank you Herval. Also, very cool Phil Ochs lyrics on your page: one of my favorite songs.
  • If using Capistrano, make sure you have a non-gui svn client on your local machine.
  • Deployment oddity: script/process/reaper was showing up as non-executable. I am still not sure why this was happening, but Topfunky had a good solution. I am really starting to see the power of Capistrano: you can bundle all these server side commands into a single file that runs from your local machine.
  • Even bigger deployment oddity: When finally everything is almost working, something remains amiss. I can start the app with Webrick, but not with Phusion. One last change: config/environment.rb must be owned by www-data. Again, put it in a Capistrano block, but I have no idea why this is happening.