<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Robby on Rails: Tag pound</title>
    <link>http://www.robbyonrails.com/articles/tag/pound</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>thoughts.sort_by{|t| t[:topic]}.collect </description>
    <item>
      <title>Goodbye Pound, Hello Nginx</title>
      <description>&lt;p&gt;I&amp;#8217;ve been using pound for several months and it&amp;#8217;s been a good relationship. Except, for some strange reason, I noticed that I was getting development mode errors when it was running in production mode. I thought there might be an issue with my mongrel cluster&amp;#8230; but that wasn&amp;#8217;t the case.&lt;/p&gt;


	&lt;p&gt;Let me give you a little background to how we&amp;#8217;re encouraging customers to handle their deployment on &lt;a href="http://www.planetargon.com"&gt;&lt;span class="caps"&gt;PLANET ARGON&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;Most of our hosting customers&lt;sup&gt;&lt;a href="#fn1"&gt;1&lt;/a&gt;&lt;/sup&gt; have three tiers (unless you have your own static IP address), one which we manage, two that you manage.&lt;/p&gt;


	&lt;p&gt;We handle the main web server/proxy server and proxy to your desired load balancer/proxy/server, which is generally any of the following options&amp;#8230; depending on your preference.&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://www.apsis.ch/pound"&gt;Pound&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://lighttpd.org"&gt;Lighttpd&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://nginx.net/"&gt;Nginx&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://www.apache.org"&gt;Apache&lt;/a&gt; 2.x or Apache 1.3.x&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://mongrel.rubyforge.org"&gt;Mongrel&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Each customer has a unique proxy server port and a range of other ports for their mongrel clusters.&lt;/p&gt;


	&lt;p&gt;So&amp;#8230; the typical setup is&amp;#8230;&lt;/p&gt;


	&lt;p&gt;Apache(external:80) [proxies to]==&amp;gt; Pound(localhost:8050) [proxies to]==&amp;gt; Mongrel::Cluster(localhost:10500-10503)&lt;/p&gt;


	&lt;p&gt;Well, when a request comes in through Apache, it gets passed off to Pound and each tier has it&amp;#8217;s own headers. By the time that it reaches Mongrel, all the requests appear to be coming &lt;em&gt;from&lt;/em&gt; &lt;code&gt;localhost&lt;/code&gt;.. not the remote address of the person using your application. Notice nothing but &lt;code&gt;localhost&lt;/code&gt; requests in your production.log? ...this is the reason.&lt;/p&gt;


	&lt;p&gt;So, what side-effects does this have? Well, aside from every request looking local&amp;#8230; Rails will, by default, output a normal development-mode error message if the request is coming from &lt;code&gt;localhost&lt;/code&gt;.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
    # found in...
    # actionpack/lib/action_controller/rescure.rb

    # Exception handler called when the performance of an action raises an exception.
    def rescue_action(exception)
      log_error(exception) if logger
      erase_results if performed?

      if consider_all_requests_local || local_request?
        rescue_action_locally(exception)
      else
        rescue_action_in_public(exception)
      end
    end
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;It seems that this currently causes the &lt;a href="http://dev.rubyonrails.org/svn/rails/plugins/exception_notification/"&gt;exception notification&lt;/a&gt; plugin, which we often use, to not work. We noticed this in a staging environment for an application that we&amp;#8217;re building for a client about a month ago. After debugging &lt;span class="caps"&gt;SMTP&lt;/span&gt; servers, mongrel configuration&amp;#8230; I was baffled.&lt;/p&gt;


	&lt;h2&gt;Nginx to the &lt;code&gt;rescue&lt;/code&gt;&lt;/h2&gt;


	&lt;p&gt;After some investigation and attempts to find a workaround in Pound, I decided to redeploy my blog with Nginx. This was a pretty painless process and I was able to use &lt;a href="http://docs.planetargon.com/wiki/show/Setup+Nginx"&gt;the example&lt;/a&gt; posted on the &lt;a href="http://docs.planetargon.com/"&gt;&lt;span class="caps"&gt;PLANET ARGON&lt;/span&gt; Documentation Project&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;Nginx allows you to do the following to overwrite the headers being passed to Mongrel.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
    proxy_set_header  X-Real-IP  $remote_addr;
    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;strong&gt;Problem Solved!&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;If there is a workaround for this in Pound, I&amp;#8217;d love to be able to relay this information to our customers that haven&amp;#8217;t made the switch yet.&lt;/p&gt;


	&lt;p&gt;Thank you, &lt;a href="http://blog.brightredglow.com"&gt;Brian&lt;/a&gt; and &lt;a href="http://workingwithrails.com/person/7552"&gt;Timothy&lt;/a&gt; for encouraging me to finally switch my blog to Nginx. ;-)&lt;/p&gt;


	&lt;p&gt;If you have questions related to deploying Rails applications, be sure to check out the &lt;a href="http://groups.google.com/group/rubyonrails-deployment/about"&gt;Rails Deployment google group&lt;/a&gt;.&lt;/p&gt;


	&lt;p id="fn1"&gt;&lt;sup&gt;1&lt;/sup&gt; For more information about our hosting, visit &lt;a href="http://www.planetargon.com/hosting.html"&gt;http://planetargon.com/hosting.html&lt;/a&gt;.&lt;/p&gt;
</description>
      <pubDate>Thu, 01 Feb 2007 13:48:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:14935b91-ffe5-4379-8ab9-42596c86ee78</guid>
      <author>Robby Russell</author>
      <link>http://www.robbyonrails.com/articles/2007/02/01/goodbye-pound-hello-nginx</link>
      <category>Ruby on Rails</category>
      <category>PLANET ARGON</category>
      <category>hosting</category>
      <category>nginx</category>
      <category>pound</category>
      <category>deployment</category>
    </item>
    <item>
      <title>Apache, Typo, and Feedburner</title>
      <description>&lt;p&gt;A few weeks ago, I started using FeedBurner and posted a blog entry about &lt;a href="http://www.robbyonrails.com/articles/2006/08/22/feedburner-and-lighttpd-redirects"&gt;how I configured Lighttpd&lt;/a&gt; to handle that so it didn&amp;#8217;t disrupt everyone that subscribes to my &lt;span class="caps"&gt;RSS&lt;/span&gt; feed. This was working great&amp;#8230; until the other day.. when I &lt;a href="http://www.robbyonrails.com/articles/2006/09/05/typo-upgraded-to-trunk"&gt;upgraded to Typo trunk&lt;/a&gt;. When I did this, I decided to start using mongrel::cluster and pound. Two days later&amp;#8230; I&amp;#8217;m noticing that my subscriber count has dropped over thousand people in a day&amp;#8230; was it something that I said?&lt;/p&gt;


	&lt;p&gt;A ha! I was handling the redirect with Lighttpd and had replaced it with Pound.&lt;/p&gt;


	&lt;p&gt;So, I am now delegating this to Apache.&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;  &lt;span class="comment"&gt;# Redirect typo feeds to FeedBurner&lt;/span&gt;
  &lt;span class="constant"&gt;RewriteCond&lt;/span&gt; &lt;span class="punct"&gt;%{&lt;/span&gt;&lt;span class="string"&gt;HTTP_USER_AGENT&lt;/span&gt;&lt;span class="punct"&gt;}&lt;/span&gt; &lt;span class="punct"&gt;!^&lt;/span&gt;&lt;span class="constant"&gt;FeedBurner&lt;/span&gt;&lt;span class="punct"&gt;.*&lt;/span&gt;&lt;span class="global"&gt;$&lt;/span&gt;
  &lt;span class="ident"&gt;RewriteRule&lt;/span&gt; &lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="ident"&gt;xml&lt;/span&gt;&lt;span class="punct"&gt;/(&lt;/span&gt;&lt;span class="ident"&gt;atom&lt;/span&gt;&lt;span class="punct"&gt;|&lt;/span&gt;&lt;span class="ident"&gt;rss&lt;/span&gt;&lt;span class="punct"&gt;|&lt;/span&gt;&lt;span class="ident"&gt;rss20&lt;/span&gt;&lt;span class="punct"&gt;)/&lt;/span&gt;&lt;span class="ident"&gt;feed&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;xml&lt;/span&gt;&lt;span class="global"&gt;$ &lt;/span&gt;&lt;span class="ident"&gt;http&lt;/span&gt;&lt;span class="punct"&gt;:/&lt;/span&gt;&lt;span class="regex"&gt;&lt;/span&gt;&lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="ident"&gt;feeds&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;feedburner&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;com&lt;/span&gt;&lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="constant"&gt;RobbyOnRails&lt;/span&gt; &lt;span class="punct"&gt;[&lt;/span&gt;&lt;span class="constant"&gt;R&lt;/span&gt;&lt;span class="punct"&gt;=&lt;/span&gt;&lt;span class="ident"&gt;temp&lt;/span&gt;&lt;span class="punct"&gt;,&lt;/span&gt;&lt;span class="constant"&gt;L&lt;/span&gt;&lt;span class="punct"&gt;]&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;...and all was well again.&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;&lt;span class="caps"&gt;UPDATE&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;The rewrite condition should be &lt;code&gt;!^FeedBurner.*$&lt;/code&gt; not &lt;code&gt;!^FeedBurner$&lt;/code&gt;.&lt;/p&gt;
</description>
      <pubDate>Fri, 08 Sep 2006 16:51:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:85328eff-4648-4b08-85b3-613be6e3fc66</guid>
      <author>Robby Russell</author>
      <link>http://www.robbyonrails.com/articles/2006/09/08/apache-typo-and-feedburner</link>
      <category>Typo</category>
      <category>feedburner</category>
      <category>typo</category>
      <category>apache</category>
      <category>configuration</category>
      <category>pound</category>
      <category>mongrel</category>
    </item>
    <item>
      <title>Rails and Mongrel go to the Pound</title>
      <description>&lt;p&gt;We&amp;#8217;ve been encouraging our &lt;a href="http://www.planetargon.com/rails_hosting.html"&gt;Rails hosting&lt;/a&gt; customers to give Pound and Mongrel a try for deploying their &lt;a href="http://www.rubyonrails.org"&gt;Ruby on Rails&lt;/a&gt; applications. &lt;a href="http://david.planetargon.us"&gt;David Gibbons&lt;/a&gt; has been adding some recipes for doing this on the &lt;a href="http://docs.planetargon.com"&gt;&lt;span class="caps"&gt;PLANET ARGON&lt;/span&gt; Documentation Project&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;Check out:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://docs.planetargon.com/wiki/show/Pound+and+Mongrel"&gt;Pound and Mongrel&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://docs.planetargon.com/wiki/show/Running+with+Mongrel"&gt;Running with Mongrel&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;...and today David posted an article on his blog titled, &lt;a href="http://david.planetargon.us/articles/2006/08/08/why-you-need-multiple-mongrel-instances-with-rails"&gt;Why you need multiple mongrel instances with rails&lt;/a&gt;!&lt;/p&gt;
</description>
      <pubDate>Tue, 08 Aug 2006 19:35:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:17292c36-5206-42d8-93bf-eacc4995533b</guid>
      <author>Robby Russell</author>
      <link>http://www.robbyonrails.com/articles/2006/08/08/rails-and-mongrel-go-to-the-pound</link>
      <category>mongrel</category>
      <category>rails</category>
      <category>pound</category>
      <category>deployment</category>
      <category>hosting</category>
      <category>planetargon</category>
      <category>dgibbons</category>
    </item>
  </channel>
</rss>
