David Bock gave a presentation about his experience deploying a Ruby on Rails app at the recent January 2007 Northern Virginia Ruby Users Group meeting. He created an app for wallhogs.com, a site where people can upload their own high-res pictures to print in a huge poster format that they can then stick up on their wall. I think we might order a big poster of DHH for the NOVARUG club room.
Dave faced some interesting challenges with deployment. The pictures required to make these huge sticky poster prints aren’t the ones that you get from your average cell phone. No, these are 8-10 MB monsters. So he knew that if this site was successful, it would need some good bandwidth and horsepower. He had some bad experiences with shared hosting and Rails, so they shopped around and ended up with a dedicated machine at rimuhosting.
Dave opted to use the currently recommended Rails stack – Apache 2.2+ -> mod_proxy_balancer -> mongrel cluster. Apache serves up the static files and does balancing, while mongrel (all hail zed, king of the internet) powers the Rails instances. For historical reference, the deprecated Rails stack is Lighttpd -> FastCGI.
Capistrano was of course used for making deployment easy and repeatable. They used two different targets, acceptance and production with slightly different recipes for each. I think that’s a good practice.
The exception notification emailer can really help you keep on top of issues and may impress your customers. I highly recommend it as well.
Random tidbits: X_FORWARDED_PROTO helped fix a problem with https. You can use a before_filter to force https on certain actions that need security. SOAP4R stable doesn’t work with Paypal – use the trunk. You can change the Paypal workflow a little bit but you have to approve it with a Paypal representative.
Interesting plugins used: acts_as_statemachine, acts_as_taggable_on_steroids, annotate_models, dollars_and_cents, exception_notification, google_analystics, query_trace, redbox, and ziya.
Cool hack: Since UPS Worldship doesn’t provide a webservice, Dave wrote his own using Ruby on Rails + ODBC.
Afterwards there was a debate about the GPL and MySQL after Dave mentioned that he was considering moving to Postgres to clear up the licensing. That was an interesting take – I hadn’t thought that using MySQL in a web app might trigger the GPL, but there are rumors that GPL 3 will clarify this.
And of course, the obligatory Ruby code snippet:
assert_equal 45, attendees.count
Next meeting: 2/21/2007 – FGM HQ in Reston, VA – Chad Fowler will be presenting. See you there!