RailsConf: Ezra Zygmuntowicz - Rails Deployment

Posted by Nick Sieger Sat, 24 Jun 2006 19:18:00 GMT

Ezra: Programming in Ruby for 3 years, Rails for 2. Just another Ruby hacker, he says. Right!

Yakima Herald

  • http://yakimaherald.com -- Local newspaper website
  • CMS
  • Lots of non-SQL content
  • Classified and obituary workflow
  • Internal credit card transaction

Data Aggregation

  • Mysql
  • XML feeds from AP
  • RSS and Atom feeds from parent newspaper
  • Proprietary database for articles
    • Yucky Vendorscript
    • Crusty OS 9 server!
    • Wrote DSL to emit script over a socket to remote machine

Deployment

  • Apache? Seems to be the industry standard...
class ApacheWithFCGI < ActiveRecord::Base
  has_many :random_500_errors
end
  • Lighttpd
    • Better FCGI support
    • More stable
  • Switched to standalone, external FCGIs with capistrano spinner/spawner/reaper tasks, and finally got stable.

Tuning

Shared hosting

  • Apache with ProxyPass/ProxyPassReverse talking to multiple lighty instances is about as good as it gets.
  • But let’s face it...shared hosting + Rails suck.
  • Only as reliable as the worst application on the server
  • Not always good neighbors
  • Resource constraints
  • Free-for-all

Ezra recommends a Xen VPS for Rails deployment. I’ve followed his advice; this blog is hosted on a Xen VPS at http://rimuhosting.com.

Deployment models

  • Starting point, web, app and db on the same server.
  • Next, move database to a separate server. Use the more powerful hardware to the db.
  • Third, split each role to a separate server. But now you need an NFS to serve static and cached contents. Ezra states you can go a long way with this setup
class FutureOfRailsDeployment < ActiveRecord::Base
  belongs_to :mongrel
end

Mongrel

  • Speaks plain old HTTP, so you can take advantage of existing tools for load balancing, proxying or caching
  • You can use frontends: Pound, Pen, Balance, Haproxy, Lighttpd (although mod_proxy needs to be fixed), or Apache 2.2 modproxybalancer
  • Mongrel cluster gem allows easy management of multiple mongrel processes. It’s straightforward to integrate with capistrano too.

Engine Yard

Ezra describes a new hosting service he’s been working on that will give you a greatly simplified but powerful and performant hosting environment for your Rails applications, including a web admin console and deployment directly from SVN revisions and tags.

Go to Engine Yard for a beta signup email now!

BackgroundDrb

  • Distributed Ruby server that manages long runnng tasks.
  • Uses a MiddleMan proxy/stub class that allows the Rails process to connect to the background server.
  • Can use it as a worker queue, (e.g. for sending email) or as a distributed memory cache.
  • You can even query for progress on the background workers and push the result all the way to the browser with an ajax progress bar.
  • The code for BackgroundDrb looks really clean! Go to http://backgroundrb.rubyforge.org/ for the nitty gritty.

Posted in ,  | Tags  | no comments | no trackbacks

Comments

Trackbacks

Use the following link to trackback from your own site:
http://blog.nicksieger.com/articles/trackback/29