<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>John's Tidbits</title>
	<atom:link href="http://inodes.org/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://inodes.org/blog</link>
	<description>Moo - Development, Trouble-shooting and Random thoughts...</description>
	<pubDate>Fri, 20 Jun 2008 02:32:51 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Firefox popup blocking</title>
		<link>http://inodes.org/blog/2008/06/20/firefox-popup-blocking/</link>
		<comments>http://inodes.org/blog/2008/06/20/firefox-popup-blocking/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 23:51:59 +0000</pubDate>
		<dc:creator>johnf</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[firefox]]></category>

		<category><![CDATA[popup]]></category>

		<guid isPermaLink="false">http://inodes.org/blog/?p=75</guid>
		<description><![CDATA[Wouldn&#8217;t it make more sense for firefox to allow popups based on the destination site rather than on the source?
For example most popups I click on are for YouTube. Now some on these are on random blogging sites. Which means that to jump to the YouTube page for that video I have to allow popups [...]]]></description>
			<content:encoded><![CDATA[<p>Wouldn&#8217;t it make more sense for firefox to allow popups based on the destination site rather than on the source?</p>
<p>For example most popups I click on are for YouTube. Now some on these are on random blogging sites. Which means that to jump to the YouTube page for that video I have to allow popups for some random blog, which can now popup as many ads as it wants.</p>
<p>Wouldn&#8217;t it make more sense to allow YouTube as a popup destination. It really comes down to the fact that I trust YouTube more than some random blog embedding YouTube videos.</p>
<p>I haven&#8217;t thought about this very much so maybe there is a good reason why you wouldn&#8217;t want this. If a few other people agree with me I&#8217;ll go file a bug. Hmm I wonder if you could write an extension to do it.</p>
<p><strong>Update:</strong> Peter <a href="http://hardy.dropbear.id.au/blog/2008/06/why-destination-based-popup-blocking-fails" onclick="javascript:pageTracker._trackPageview('/outbound/article/hardy.dropbear.id.au');">raises a good point</a> as to why this is a bad idea.</p>
]]></content:encoded>
			<wfw:commentRss>http://inodes.org/blog/2008/06/20/firefox-popup-blocking/feed/</wfw:commentRss>
		</item>
		<item>
		<title>bzr-svn and svn revisions</title>
		<link>http://inodes.org/blog/2008/06/14/bzr-svn-and-svn-revisions/</link>
		<comments>http://inodes.org/blog/2008/06/14/bzr-svn-and-svn-revisions/#comments</comments>
		<pubDate>Sat, 14 Jun 2008 09:19:26 +0000</pubDate>
		<dc:creator>johnf</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[bzr]]></category>

		<category><![CDATA[revision]]></category>

		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://inodes.org/blog/?p=74</guid>
		<description><![CDATA[I was updating an svn branch today using bzr, thanks to bzr-svn, and I wanted to know what svn revision I was at.
You can easily see the bzr revision by running

johnf@zoot:~/trunk$ bzr revno
34

But it gives no indication of where you are in SVN land. After a bit of rummaging around I discovered the following

johnf@zoot:~/trunk$ bzr [...]]]></description>
			<content:encoded><![CDATA[<p>I was updating an svn branch today using bzr, thanks to bzr-svn, and I wanted to know what svn revision I was at.</p>
<p>You can easily see the bzr revision by running</p>
<pre name="code" class="shell">
johnf@zoot:~/trunk$ bzr revno
34
</pre>
<p>But it gives no indication of where you are in SVN land. After a bit of rummaging around I discovered the following</p>
<pre name="code" class="shell">
johnf@zoot:~/trunk$ bzr version-info
revision-id: svn-v3-trunk0:90e61fa5-4541-0410-a685-e5b9dba3c764:trunk:74
date: 2008-05-29 19:24:44 +0000
build-date: 2008-06-14 19:10:59 +1000
revno: 34
branch-nick: trunk
</pre>
<p>The <strong>revision-id</strong> field seems to be the key and seems to indicate I&#8217;m using SVN revision 74. Checking the branch via the web confirmed that.</p>
]]></content:encoded>
			<wfw:commentRss>http://inodes.org/blog/2008/06/14/bzr-svn-and-svn-revisions/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Hardy, exim4, SMTP-AUTH and LDAP&#8230; (or debian openssl causes pain)</title>
		<link>http://inodes.org/blog/2008/05/15/hardy-exim4-smtp-auth-and-ldap-or-debian-openssl-causes-pain/</link>
		<comments>http://inodes.org/blog/2008/05/15/hardy-exim4-smtp-auth-and-ldap-or-debian-openssl-causes-pain/#comments</comments>
		<pubDate>Thu, 15 May 2008 00:33:42 +0000</pubDate>
		<dc:creator>johnf</dc:creator>
		
		<category><![CDATA[Sysadmin]]></category>

		<category><![CDATA[auth]]></category>

		<category><![CDATA[edgy]]></category>

		<category><![CDATA[exim]]></category>

		<category><![CDATA[hardy]]></category>

		<category><![CDATA[ldap]]></category>

		<category><![CDATA[smtp]]></category>

		<guid isPermaLink="false">http://inodes.org/blog/2008/05/15/hardy-exim4-smtp-auth-and-ldap-or-debian-openssl-causes-pain/</guid>
		<description><![CDATA[As most people will know yesterday caused a lot of people a lot of pain as they ran around replacing SSH keys and SSL certificates.
While running around fixing up all our servers, most of them in one felll swoop thanks to puppet, I realised two of our servers were still running Edgy. I figured it [...]]]></description>
			<content:encoded><![CDATA[<p>As most people will know yesterday caused a lot of people a lot of pain as they ran around replacing SSH keys and SSL certificates.</p>
<p>While running around fixing up all our servers, most of them in one felll swoop thanks to puppet, I realised two of our servers were still running Edgy. I figured it was high time I moved them to Hardy.</p>
<p>Everything went fairly smoothly with some minor hicups, except for SMTP-AUTH for exim. We use an ldap backed SMTP-AUTH and this just wouldn&#8217;t work after the upgrade. The following error was appearing in the logs.</p>
<pre class="code">
ldap_search failed: -7, Bad search filter
</pre>
<p>This lead to hours upon hours of google searches, staring at debug messages and even at one stage resorting to using GDB. Eventually after staring at debug messages harder it twigged when I saw the following.</p>
<pre class="code">
perform_ldap_search: ldapdn URL = "ldap:///ou=people,o=vquence?dn?sub?(uid=moo) "
</pre>
<p>Notice the space just before the closing double quote. It seems that the new openldap libraries don&#8217;t like errant spaces in your search filter.</p>
<p>Now to remember what I was doing yesterday morning before this whole derailment began.</p>
<p>Note: Before anyone comments I will completely deny that during these upgrades I did anything as silly as <strong>rm -rf `dpkg -L random-font-package`</strong>, no matter what twitter says.</p>
]]></content:encoded>
			<wfw:commentRss>http://inodes.org/blog/2008/05/15/hardy-exim4-smtp-auth-and-ldap-or-debian-openssl-causes-pain/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Hardy and password locking</title>
		<link>http://inodes.org/blog/2008/04/29/hardy-and-password-locking/</link>
		<comments>http://inodes.org/blog/2008/04/29/hardy-and-password-locking/#comments</comments>
		<pubDate>Tue, 29 Apr 2008 06:32:02 +0000</pubDate>
		<dc:creator>johnf</dc:creator>
		
		<category><![CDATA[Sysadmin]]></category>

		<category><![CDATA[expiry]]></category>

		<category><![CDATA[gutsy]]></category>

		<category><![CDATA[hardy]]></category>

		<category><![CDATA[lock]]></category>

		<category><![CDATA[passwd]]></category>

		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://inodes.org/blog/2008/04/29/hardy-and-password-locking/</guid>
		<description><![CDATA[
passwd -l root

In gutsy the above would simply lock the account by placing an ! in front of the passwd in your /etc/shadow file. 
In hardy it now also sets the account as expired. Meaning you can&#8217;t ssh to it even if you have SSH keys in place.
Time to go and rebuild my EC2 AMI. [...]]]></description>
			<content:encoded><![CDATA[<pre class="code">
passwd -l root
</pre>
<p>In gutsy the above would simply lock the account by placing an ! in front of the passwd in your /etc/shadow file. </p>
<p>In hardy it now also sets the account as expired. Meaning you can&#8217;t ssh to it even if you have SSH keys in place.</p>
<p>Time to go and rebuild my EC2 AMI. <img src='http://inodes.org/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p />
</p>
<p><strong>Update:</strong> To get the old behavour back you can do the following</p>
<pre class="code">
passwd -l root
usermod -e "" root
</pre>
]]></content:encoded>
			<wfw:commentRss>http://inodes.org/blog/2008/04/29/hardy-and-password-locking/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Sorting in Mutt</title>
		<link>http://inodes.org/blog/2008/04/14/sorting-in-mutt/</link>
		<comments>http://inodes.org/blog/2008/04/14/sorting-in-mutt/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 03:21:43 +0000</pubDate>
		<dc:creator>johnf</dc:creator>
		
		<category><![CDATA[FOSS]]></category>

		<category><![CDATA[email]]></category>

		<category><![CDATA[mutt]]></category>

		<category><![CDATA[sort]]></category>

		<category><![CDATA[spam]]></category>

		<category><![CDATA[threads]]></category>

		<guid isPermaLink="false">http://inodes.org/blog/2008/04/14/sorting-in-mutt/</guid>
		<description><![CDATA[A couple of days ago I discovered the following mutt config option.

set sort = threads
set sort_aux = last-date-received

This means you get the usual threading but that a thread is sorted by the date the last message in the thread was received. This keeps a thread which receives new mail at the bottom of your mailbox [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of days ago I discovered the following mutt config option.</p>
<pre class="code">
set sort = threads
set sort_aux = last-date-received
</pre>
<p>This means you get the usual threading but that a thread is sorted by the date the last message in the thread was received. This keeps a thread which receives new mail at the bottom of your mailbox rather than up at the top.</p>
<p>Another idea I found useful is to sort my spam mailbox by subject. Since a lot of SPAM has exactly the same subject it makes it really easily to quickly scan the mailbox for HAM.</p>
<p>You can easily do this with the following additions to your muttrc</p>
<pre class="code">
folder-hook . set sort=threads
folder-hook spam set sort=subject
</pre>
<p>You need to set the default as mutt will change the sort order when you change to the spam folder but won&#8217;t change it back when you jump out of it.</p>
]]></content:encoded>
			<wfw:commentRss>http://inodes.org/blog/2008/04/14/sorting-in-mutt/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Firefox 3 and howtoforge.com</title>
		<link>http://inodes.org/blog/2008/03/19/firefox-3-and-howtoforgecom/</link>
		<comments>http://inodes.org/blog/2008/03/19/firefox-3-and-howtoforgecom/#comments</comments>
		<pubDate>Wed, 19 Mar 2008 02:07:11 +0000</pubDate>
		<dc:creator>johnf</dc:creator>
		
		<category><![CDATA[Hacks]]></category>

		<category><![CDATA[firefox]]></category>

		<category><![CDATA[iptables]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[networking]]></category>

		<guid isPermaLink="false">http://inodes.org/blog/2008/03/19/firefox-3-and-howtoforgecom/</guid>
		<description><![CDATA[There is currently a bug in firefox 3 which causes it to  crash with an XError BadAloc when you go to any page hosted on howtoforge.
This seems to be related to the image at http://howtoforge.com/themes/htf_glass/images/bg_header_bottom_left15.png. I suggest you don&#8217;t click on that link  
Apparently this image is 10,000 pixels wide. It looks like [...]]]></description>
			<content:encoded><![CDATA[<p>There is currently a bug in firefox 3 which causes it to <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=402204" onclick="javascript:pageTracker._trackPageview('/outbound/article/bugzilla.mozilla.org');"> crash with an XError BadAloc</a> when you go to any page hosted on <a href="http://howtoforge.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/howtoforge.com');">howtoforge</a>.</p>
<p>This seems to be related to the image at <a href="http://howtoforge.com/themes/htf_glass/images/bg_header_bottom_left15.png" onclick="javascript:pageTracker._trackPageview('/outbound/article/howtoforge.com');">http://howtoforge.com/themes/htf_glass/images/bg_header_bottom_left15.png</a>. I suggest you don&#8217;t click on that link <img src='http://inodes.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Apparently this image is 10,000 pixels wide. It looks like this is probably a GTK issue since the same problem happended when I opened the image with evince!</p>
<p>I tried writing a greasemonkey script to get around this problem but it loads too late to avert the crash. So iptables to the rescue.</p>
<p><strong>iptables -I OUTPUT -d howtoforge.com -m string &#8211;algo bm &#8211;to 70 &#8211;string &#8220;GET /themes/htf_glass/images/bg_header_bottom_left15.png&#8221; -j DROP</strong></p>
<pre class="code">
iptables &#32;
    -I OUTPUT \ # Match packets levaing my laptop
    -d howtoforge.com  \ # Only packets going to howtoforge
    -m string \ # Invoke the string matcher
    --algo bm \ # Pick a matching algorithm
    --to 70 \ # Only check the first 70 bytes of each packet
    --string "GET /themes/htf_glass/images/bg_header_bottom_left15.png" \
    -j DROP # Drop the sucker
</pre>
]]></content:encoded>
			<wfw:commentRss>http://inodes.org/blog/2008/03/19/firefox-3-and-howtoforgecom/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Puppet, Facts and Certificates</title>
		<link>http://inodes.org/blog/2008/03/13/puppet-facts-and-certificates/</link>
		<comments>http://inodes.org/blog/2008/03/13/puppet-facts-and-certificates/#comments</comments>
		<pubDate>Thu, 13 Mar 2008 03:14:16 +0000</pubDate>
		<dc:creator>johnf</dc:creator>
		
		<category><![CDATA[Sysadmin]]></category>

		<category><![CDATA[bugfix]]></category>

		<category><![CDATA[ec2]]></category>

		<category><![CDATA[puppet]]></category>

		<category><![CDATA[vquence]]></category>

		<guid isPermaLink="false">http://inodes.org/blog/2008/03/13/puppet-facts-and-certificates/</guid>
		<description><![CDATA[I&#8217;m currently setting up Puppet at Vquence so that, among other things, we can deploy hosts into Amazon EC2 more easily. 
To ensure a minimum setup time on a new server I wanted the setup to be as simple as

 echo &#8216;DAEMON_OPTS=&#8221;-w 120 &#8211;fqdn newserver.vquence.com &#8211;server puppetmaster.vquence.com&#8221; > /etc/default/puppet 
 aptitude install puppet 

This means [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently setting up <a href="http://reductivelabs.com/projects/puppet/" onclick="javascript:pageTracker._trackPageview('/outbound/article/reductivelabs.com');">Puppet</a> at Vquence so that, among other things, we can deploy hosts into Amazon EC2 more easily. </p>
<p>To ensure a minimum setup time on a new server I wanted the setup to be as simple as</p>
<ul>
<li> echo &#8216;DAEMON_OPTS=&#8221;-w 120 &#8211;fqdn <strong>newserver.vquence.com</strong> &#8211;server puppetmaster.vquence.com&#8221; > /etc/default/puppet </li>
<li> aptitude install puppet </li>
</ul>
<p>This means that the puppet client will use <strong>newserver.vquence.com</strong> as the common name in the SSL certificate it creates for itself. On the puppet master the SSL cert name is then used to pick a node rather than the hostname reported by facter.</p>
<p>This means that I don&#8217;t need to worry about setting up /etc/hostname, even better /etc/hostname can be managed by puppet.</p>
<p>You can control this functionality on the puppet master by using the node_name option. From the docs</p>
<pre>
    # How the puppetmaster determines the client's identity
    # and sets the 'hostname' fact for use in the manifest, in particular
    # for determining which 'node' statement applies to the client.
    # Possible values are 'cert' (use the subject's CN in the client's
    # certificate) and 'facter' (use the hostname that the client
    # reported in its facts)
    # The default value is 'cert'.
    # node_name = cert
</pre>
<p>The problem was that the &#8216;hostname&#8217; fact wasn&#8217;t being set. It looks like there was a regression in SVN#1673 when some refactoring was performed.</p>
<p>I&#8217;ve filed bug <a href="http://reductivelabs.com/trac/puppet/ticket/1133" onclick="javascript:pageTracker._trackPageview('/outbound/article/reductivelabs.com');">#1133</a> and you can clone my git <a href="http://inodes.org/~johnf/git/puppet" >repository.</a></p>
<p>I haven&#8217;t included any tests in the patch as I&#8217;m not sure how to. The master.rb test already tests this functionality but doesn&#8217;t test that the facts object has actually been changed. I think a test on <strong>getconfig</strong> is probably required but I&#8217;m not sure how you would access the facts after calling it.</p>
<p><strong>Update:</strong> This patch is now in puppet as of 0.24.3.</p>
]]></content:encoded>
			<wfw:commentRss>http://inodes.org/blog/2008/03/13/puppet-facts-and-certificates/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Amazon EC2 ruby gem and large user_data</title>
		<link>http://inodes.org/blog/2008/02/26/amazon-ec2-ruby-gem-and-large-user_data/</link>
		<comments>http://inodes.org/blog/2008/02/26/amazon-ec2-ruby-gem-and-large-user_data/#comments</comments>
		<pubDate>Tue, 26 Feb 2008 01:05:30 +0000</pubDate>
		<dc:creator>johnf</dc:creator>
		
		<category><![CDATA[Sysadmin]]></category>

		<category><![CDATA[ec2]]></category>

		<category><![CDATA[ruby]]></category>

		<category><![CDATA[vquence]]></category>

		<guid isPermaLink="false">http://inodes.org/blog/2008/02/26/amazon-ec2-ruby-gem-and-large-user_data/</guid>
		<description><![CDATA[When you create an instance in EC2 you can send Amazon some user data that is accessible by your instance. At Vquence we use this to send a script that gets executes at boot up. This script contains some openvpn and puppet RSA keys so its approaching about 10k in size.
This works without any problems [...]]]></description>
			<content:encoded><![CDATA[<p>When you create an instance in EC2 you can send Amazon some user data that is accessible by your instance. At Vquence we use this to send a script that gets executes at boot up. This script contains some openvpn and puppet RSA keys so its approaching about 10k in size.</p>
<p>This works without any problems when using the java based command line tools. However I was getting the following error when using the <a href="http://amazon-ec2.rubyforge.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/amazon-ec2.rubyforge.org');">EC2 Ruby GEM</a>. </p>
<pre name="code" class="ruby">
/usr/lib/ruby/1.8/net/protocol.rb:133:in `sysread': Connection reset by peer (Errno::ECONNRESET)
	from /usr/lib/ruby/1.8/net/protocol.rb:133:in `rbuf_fill'
	from /usr/lib/ruby/1.8/timeout.rb:56:in `timeout'
	from /usr/lib/ruby/1.8/timeout.rb:76:in `timeout'
	from /usr/lib/ruby/1.8/net/protocol.rb:132:in `rbuf_fill'
	from /usr/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'
	from /usr/lib/ruby/1.8/net/protocol.rb:126:in `readline'
	from /usr/lib/ruby/1.8/net/http.rb:2020:in `read_status_line'
	from /usr/lib/ruby/1.8/net/http.rb:2009:in `read_new'
	 ... 6 levels...
	from ./lib/ec2helpers.rb:43:in `start_instance'
	from ./ec2-puppet:107
	from ./ec2-puppet:89:in `each_pair'
	from ./ec2-puppet:89
</pre>
<p>Doing some tcpdumping indicated that after receiving the request Amazon waits for a while and then sends a TCP RESET. Not very nice at all. My next step was to use ngrep to compare the output from the command line tools and the ruby gem. This got nowhere fast since the command line tools use the SOAP API while the ruby gem uses the Query API.</p>
<p>What I did notice however is that while the command line tools performed a POST the ruby library performed a GET. At this stage I decided to test how much data I could send. So I started trying different user data sizes. The offending amount was around 7.8k, suspiciously close to exactly 8k.</p>
<p>The <a href="http://www.ietf.org/rfc/rfc2616.txt" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.ietf.org');">HTTP/1.1</a> spec doesn&#8217;t place an actual limit on the length but leaves it up to the server.<br />
<cite><br />
   The HTTP protocol does not place any a priori limit on the length of<br />
   a URI. Servers MUST be able to handle the URI of any resource they<br />
   serve, and SHOULD be able to handle URIs of unbounded length if they<br />
   provide GET-based forms that could generate such URIs. A server<br />
   SHOULD return 414 (Request-URI Too Long) status if a URI is longer<br />
   than the server can handle (see section 10.4.15).<br />
</cite></p>
<p><cite><br />
      Note: Servers ought to be cautious about depending on URI lengths<br />
      above 255 bytes, because some older client or proxy<br />
      implementations might not properly support these lengths.<br />
</cite></p>
<p>Apache for example limits this by default to 8190 bytes including the method and the protocol. You can change this using the <a href="http://httpd.apache.org/docs/2.0/mod/core.html#limitrequestline" onclick="javascript:pageTracker._trackPageview('/outbound/article/httpd.apache.org');">LimitRequestLine</a> directive.</p>
<p>I created a patch to modify the EC2 Gem to use a POST instead of a GET which has no such limitations. You can find the git tree for it at http://inodes.org/~johnf/git/amazon-ec2</p>
]]></content:encoded>
			<wfw:commentRss>http://inodes.org/blog/2008/02/26/amazon-ec2-ruby-gem-and-large-user_data/feed/</wfw:commentRss>
		</item>
		<item>
		<title>EC2UI extension for Firefox 3</title>
		<link>http://inodes.org/blog/2008/02/25/ec2ui-extension-for-firefox-3/</link>
		<comments>http://inodes.org/blog/2008/02/25/ec2ui-extension-for-firefox-3/#comments</comments>
		<pubDate>Mon, 25 Feb 2008 01:47:51 +0000</pubDate>
		<dc:creator>johnf</dc:creator>
		
		<category><![CDATA[FOSS]]></category>

		<guid isPermaLink="false">http://inodes.org/blog/2008/02/25/ec2ui-extension-for-firefox-3/</guid>
		<description><![CDATA[I&#8217;ve been doing some work with Amazon EC2 the last few days. An invaluable tool is the EC2UI firefox extension that Amazon have written. This provides you with a simple GUI inside the firefox chrome which makes it really easy to manipulate your EC2 instances.
A few weeks ago Hardy moved to using firefox 3. This [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been doing some work with Amazon EC2 the last few days. An invaluable tool is the <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=609" onclick="javascript:pageTracker._trackPageview('/outbound/article/developer.amazonwebservices.com');">EC2UI</a> firefox extension that Amazon have written. This provides you with a simple GUI inside the firefox chrome which makes it really easy to manipulate your EC2 instances.</p>
<p>A few weeks ago Hardy moved to using firefox 3. This meant, amongst other things, that the amazon plugin stopped working. The firefox guys have a webpage up that explains how to <a href="http://developer.mozilla.org/en/docs/Updating_extensions_for_Firefox_3" onclick="javascript:pageTracker._trackPageview('/outbound/article/developer.mozilla.org');">update extensions for Firefox 3</a>.</p>
<p>The main problem was with changes to the password manager. You can find my changes on my <a href="http://inodes.org/~johnf/bzr/elasticfox/ff3/" >bzr branch</a> and a packaged up version of the extension <a href="http://inodes.org/blog/wp-content/uploads/2008/03/ec2ui.xpi"title="EC2UI for Firefox 3.0b4"  >EC2UI for Firefox 3.0b4</a>.</p>
<p><strong>Update: See comments below for new versions</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://inodes.org/blog/2008/02/25/ec2ui-extension-for-firefox-3/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Squid and Rails caching</title>
		<link>http://inodes.org/blog/2008/01/15/squid-and-rails-caching/</link>
		<comments>http://inodes.org/blog/2008/01/15/squid-and-rails-caching/#comments</comments>
		<pubDate>Tue, 15 Jan 2008 13:04:35 +0000</pubDate>
		<dc:creator>johnf</dc:creator>
		
		<category><![CDATA[Sysadmin]]></category>

		<category><![CDATA[cache]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[squid]]></category>

		<guid isPermaLink="false">http://inodes.org/blog/2008/01/15/squid-and-rails-caching/</guid>
		<description><![CDATA[At Vquence our Rails setup looks something like this.

------------     ---------     ------------
&#124; Internet &#124;---->&#124; Squid &#124;---->&#124; Mongrels &#124;
------------     ---------     ------------

(Who needs Inkscape when you have ASCII art)
This infrastructure is hosted in the US and up until recently squid hadn&#8217;t been [...]]]></description>
			<content:encoded><![CDATA[<p>At Vquence our Rails setup looks something like this.</p>
<pre>
------------     ---------     ------------
| Internet |---->| Squid |---->| Mongrels |
------------     ---------     ------------
</pre>
<p>(Who needs Inkscape when you have ASCII art)</p>
<p>This infrastructure is hosted in the US and up until recently squid hadn&#8217;t been doing much of anything except really sitting there.</p>
<p>Now a few months ago when we signed a contract with an Australian customer we decided we needed to place a squid cache in Australia which would actually cache content. For two reasons, firstly the US is a long way away and the 300ms latency is really noticeable and secondly because some of our pages involving graphs have long statistical calculations which can take minutes to render. (OK its really because no one has had a chance to optimise them yet but lets pretend that&#8217;s not the case). So we changed the above setup for the Australian customers to look like the following.</p>
<pre>
------------     ------------     ------------     ------------
| Internet |---->| Squid AU |---->| Squid US |---->| Mongrels |
------------     ------------     ------------     ------------
</pre>
<p>We hand out urls like http://www.client.b2b.vquence.com/widget to Australian customers and the rails backend is smart enough to make sure all the URLs look similar (I&#8217;ll blog about how I did that another time).</p>
<p>Without much time to look into thing properly I did some really nasty things on the AU squid cache to make sure it cached the pages.</p>
<pre name="code">
refresh_pattern /client/graph  1440    0%    1440    ignore-no-cache ignore-reload
refresh_pattern /client/static 1440    0%    1440    ignore-no-cache ignore-reload
refresh_pattern /client/video  1440    0%    1440    ignore-no-cache ignore-reload
</pre>
<p>This is evil, breaks a whole heap of RFCs but it did the trick and got us out of a bind quickly.</p>
<p>A few weeks ago I moved the production site to Rails 2.0, I noticed around this time that the caching had stopped working. The client was no longer using our services as their campaign had finished so it wasn&#8217;t an urgent concern.</p>
<p>It seems that Rails 2.0 goes one step further to ensure that caches don&#8217;t cache content and instead of just sending</p>
<pre name="code">
Cache-Control: no-cache
</pre>
<p>it now sends</p>
<pre name="code">
Cache-Control: private, max-age=0, must-revalidate
</pre>
<p>I tried adding <b>ignore-private</b>, since if you&#8217;re breaking some aspects of the RFC you may as well break a couple more, but squid still refused to cache the content. After struggling with this for a bit I decided that the universe was trying to tell me I should actually do things properly.</p>
<p>So with squid set back to its defaults I went exploring how to accomplish this. Google wasn&#8217;t all that helpful at first since most Rails caching articles talk about caching to static files as most sites don&#8217;t implement reverse proxying for caching. It turns out however its fairly simple. In the appropriate actions in your controllers simply do the following.</p>
<pre name="code" class="ruby">
class VideoController < ApplicationController

    def vquence
        # Lots of code here

        expires_in 8.hours, :private => false
        render :template => &#8220;videos/vquence&#8221;
    end

end
</pre>
<p>This will send the following header and cache the page for 8 hours.</p>
<pre name="code">
Cache-Control: max-age=28800
</pre>
<p>Now everything is much faster!!</p>
]]></content:encoded>
			<wfw:commentRss>http://inodes.org/blog/2008/01/15/squid-and-rails-caching/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
