<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>Nick Sieger: RailsConf: Ezra Zygmuntowicz - Rails Deployment</title>
  <id>tag:blog.nicksieger.com,2005:Typo</id>
  <generator uri="http://www.typosphere.org" version="4.0">Typo</generator>
  <link rel="self" type="application/atom+xml" href="http://blog.nicksieger.com/xml/atom10/article/29/feed.xml"/>
  <link rel="alternate" type="text/html" href="http://blog.nicksieger.com/articles/2006/06/24/railsconf-ezra-rails-deployment"/>
  <updated>2007-08-31T16:41:59+00:00</updated>
  <entry>
    <author>
      <name>Nick Sieger</name>
    </author>
    <id>urn:uuid:8f4d5e50-85e2-40a8-9038-2b69d1b74322</id>
    <published>2006-06-24T19:18:00+00:00</published>
    <updated>2007-08-31T16:41:59+00:00</updated>
    <title>RailsConf: Ezra Zygmuntowicz - Rails Deployment</title>
    <link rel="alternate" type="text/html" href="http://blog.nicksieger.com/articles/2006/06/24/railsconf-ezra-rails-deployment"/>
    <category term="ruby" label="ruby" scheme="http://blog.nicksieger.com/articles/category/ruby"/>
    <category term="rails" label="rails" scheme="http://blog.nicksieger.com/articles/category/rails"/>
    <category term="railsconf" scheme="http://blog.nicksieger.com/articles/tag/railsconf"/>
    <content type="html">&lt;p&gt;&lt;a href="http://brainspl.at/"&gt;Ezra&lt;/a&gt;: Programming in Ruby for 3 years, Rails for 2.  Just
another Ruby hacker, he says.  &lt;em&gt;Right!&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;Yakima Herald&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://yakimaherald.com"&gt;http://yakimaherald.com&lt;/a&gt; &amp;#8211; Local newspaper website&lt;/li&gt;
&lt;li&gt;CMS&lt;/li&gt;
&lt;li&gt;Lots of non-SQL content&lt;/li&gt;
&lt;li&gt;Classified and obituary workflow&lt;/li&gt;
&lt;li&gt;Internal credit card transaction&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Data Aggregation&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Mysql&lt;/li&gt;
&lt;li&gt;XML feeds from AP&lt;/li&gt;
&lt;li&gt;RSS and Atom feeds from parent newspaper&lt;/li&gt;
&lt;li&gt;Proprietary database for articles
&lt;ul&gt;
&lt;li&gt;Yucky Vendorscript&lt;/li&gt;
&lt;li&gt;Crusty OS 9 server!&lt;/li&gt;
&lt;li&gt;Wrote DSL to emit script over a socket to remote machine&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Deployment&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Apache?  Seems to be the industry standard&amp;#8230;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="keyword"&gt;class &lt;/span&gt;&lt;span class="class"&gt;ApacheWithFCGI&lt;/span&gt; &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt; &lt;span class="constant"&gt;ActiveRecord&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;Base&lt;/span&gt;
  &lt;span class="ident"&gt;has_many&lt;/span&gt; &lt;span class="symbol"&gt;:random_500_errors&lt;/span&gt;
&lt;span class="keyword"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Lighttpd
&lt;ul&gt;
&lt;li&gt;Better FCGI support&lt;/li&gt;
&lt;li&gt;More stable&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Switched to standalone, external FCGIs with capistrano
spinner/spawner/reaper tasks, and finally got stable.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Tuning&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Cache, cache, cache&lt;/li&gt;
&lt;li&gt;Got RAM?&lt;/li&gt;
&lt;li&gt;Hot spot/profiling/benchmarking&lt;/li&gt;
&lt;li&gt;Use httperf not ab&lt;/li&gt;
&lt;li&gt;See Zed Shaw&amp;#8217;s rant on statistics (&lt;a href="http://www.zedshaw.com/blog/programming/programmer_stats.html"&gt;Programmers Need To Learn
Statistics Or I Will Kill Them All&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Shared hosting&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Apache with ProxyPass/ProxyPassReverse talking to multiple lighty
instances is about as good as it gets.&lt;/li&gt;
&lt;li&gt;But let&amp;#8217;s face it&amp;#8230;shared hosting + Rails suck.&lt;/li&gt;
&lt;li&gt;Only as reliable as the worst application on the server&lt;/li&gt;
&lt;li&gt;Not always good neighbors&lt;/li&gt;
&lt;li&gt;Resource constraints&lt;/li&gt;
&lt;li&gt;Free-for-all&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ezra recommends a Xen VPS for Rails deployment.  I&amp;#8217;ve followed his
advice; this blog is hosted on a Xen VPS at &lt;a href="http://rimuhosting.com"&gt;http://rimuhosting.com&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Deployment models&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Starting point, web, app and db on the same server.&lt;/li&gt;
&lt;li&gt;Next, move database to a separate server.  Use the more powerful
hardware to the db.&lt;/li&gt;
&lt;li&gt;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&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="keyword"&gt;class &lt;/span&gt;&lt;span class="class"&gt;FutureOfRailsDeployment&lt;/span&gt; &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt; &lt;span class="constant"&gt;ActiveRecord&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;Base&lt;/span&gt;
  &lt;span class="ident"&gt;belongs_to&lt;/span&gt; &lt;span class="symbol"&gt;:mongrel&lt;/span&gt;
&lt;span class="keyword"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h2&gt;Mongrel&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Speaks plain old HTTP, so you can take advantage of existing tools
for load balancing, proxying or caching&lt;/li&gt;
&lt;li&gt;You can use frontends: Pound, Pen, Balance, Haproxy, Lighttpd
(although mod_proxy needs to be fixed), or Apache 2.2
mod&lt;em&gt;proxy&lt;/em&gt;balancer&lt;/li&gt;
&lt;li&gt;Mongrel cluster gem allows easy management of multiple mongrel
processes.  It&amp;#8217;s straightforward to integrate with capistrano too.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Engine Yard&lt;/h2&gt;

&lt;p&gt;Ezra describes a new hosting service he&amp;#8217;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.&lt;/p&gt;

&lt;p&gt;Go to &lt;a href="http://engineyard.com/"&gt;Engine Yard&lt;/a&gt; for a beta signup email now!&lt;/p&gt;

&lt;h2&gt;BackgroundDrb&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Distributed Ruby server that manages long runnng tasks.&lt;/li&gt;
&lt;li&gt;Uses a &lt;code&gt;MiddleMan&lt;/code&gt; proxy/stub class that allows the Rails process to
connect to the background server.&lt;/li&gt;
&lt;li&gt;Can use it as a worker queue, (e.g. for sending email) or as a
distributed memory cache.&lt;/li&gt;
&lt;li&gt;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.&lt;/li&gt;
&lt;li&gt;The code for BackgroundDrb looks really clean!  Go to
&lt;a href="http://backgroundrb.rubyforge.org/"&gt;http://backgroundrb.rubyforge.org/&lt;/a&gt; for the nitty gritty.&lt;/li&gt;
&lt;/ul&gt;</content>
  </entry>
</feed>
