<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Whomwah.com &#187; Wordpress</title>
	<atom:link href="http://whomwah.com/tag/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://whomwah.com</link>
	<description>The website of Duncan Robertson, currently working for the BBC in London, Uk</description>
	<lastBuildDate>Thu, 29 Jul 2010 19:51:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>RevCanonical 1.2, Customise your link tag plus a little more</title>
		<link>http://whomwah.com/2009/04/23/revcanonical-updates-customise-your-link-tag-plus-more/</link>
		<comments>http://whomwah.com/2009/04/23/revcanonical-updates-customise-your-link-tag-plus-more/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 10:33:34 +0000</pubDate>
		<dc:creator>Duncan</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[revcanonical]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://whomwah.com/?p=1451</guid>
		<description><![CDATA[I&#8217;ve made a few updates to the RevCanonical WordPress plugin I built. These updates add a bit of extra functionality, and also allowed me to tidy up the documentation, so that people know what they&#8217;re getting. First update, is the ability to customise how the link tag is constructed within the head of your page. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve made a few updates to the <a href="http://whomwah.github.com/revcanonical/">RevCanonical WordPress plugin</a> I built. These updates add a bit of extra functionality, and also allowed me to tidy up the documentation, so that people know what they&#8217;re getting.</p>
<p>First update, is the ability to customise how the link tag is constructed within the head of your page.  This is due to the large amount of people who have contacted me, asking why I choose to use rev=canonical and not rel= shorturl, rel=shorturl or rel=short_url etc. As I told them, the reason I chose <a href="http://laughingmeme.org/p/4216">rev=canonical</a> was to be honest simply because I liked it, and <a href="http://flickr.com/">many</a> of my <a href="http://dopplr.com/">peers</a> were <a href="http://simonwillison.net/2009/Apr/11/revcanonical/">already</a> using this method on their sites. Simple.</p>
<p>So currently with the plugin you get this out of the box:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;link rev=&quot;canonical&quot; type=&quot;text/html&quot;  href=&quot;http://your-domain.com/p12p&quot; /&gt;</pre></div></div>

<p>but you could customise it to be like this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;link rel=&quot;shorturl&quot; href=&quot;http://y-doma.in/p12p&quot; /&gt;</pre></div></div>

<p>The reason for this extra customisation is to try and stop people being distracted by the <em>what attribute should I use</em> conversation, and start getting them hosting their own short links they can use. This at least starts solving one problem. When a general consensus, or in deed a standard appears about the attributes, you can simple update and you&#8217;re good-to-go.</p>
<p>At the moment the only place you can see the shortened url is either by looking in the source, or using a <a href="http://simonwillison.net/2009/Apr/11/revcanonical/">bookmarklet</a> like the one <a href="http://simonwillison.net/">Simon</a> wrote. I guess I could of injected the url into the admin interface somewhere, but I generally don&#8217;t want to see it. The idea is, it&#8217;s there for <a href="http://revcanonical.appspot.com/">machines to see</a> if they need to, and if I really need to pass it around I&#8217;ll just use the <a href="http://simonwillison.net/2009/Apr/11/revcanonical/">bookmarklet</a>.</p>
<p>If you want more flexibility, I have added a of a couple of tags you can use in your templates. These simply let you display the shortened url for a specific post.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># echo the shortened url to the screen
&lt;?php get_revcanonical_shorturl($post_id); ?&gt;
&nbsp;
# assign the shortened url to a variable
&lt;?php $url = revcanonical_shorturl($post_id); ?&gt;</pre></div></div>

<p>Oh and finally, just a reminder that this plugin plays well with the <a href="http://whomwah.github.com/tweetme/">TweetMe plugin</a> I wrote that tweets to <a href="http://twitter.com/">Twitter.com</a> when you publish a post, and will check to see if you have the <a href="http://whomwah.github.com/revcanonical/"> RevCanonical plugin</a> installed. If you do, it will use your own shortened url instead of the <a href="http://bit.ly/">bit.ly</a> version.</p>
]]></content:encoded>
			<wfw:commentRss>http://whomwah.com/2009/04/23/revcanonical-updates-customise-your-link-tag-plus-more/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Revcanonical, a rev=canonical WordPress plugin</title>
		<link>http://whomwah.com/2009/04/14/revcanonical-a-revcanonical-wordpress-plugin/</link>
		<comments>http://whomwah.com/2009/04/14/revcanonical-a-revcanonical-wordpress-plugin/#comments</comments>
		<pubDate>Tue, 14 Apr 2009 11:06:41 +0000</pubDate>
		<dc:creator>Duncan</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://whomwah.com/?p=1410</guid>
		<description><![CDATA[UPDATE [15:06 April 14th 2009] Revcanonical is a WordPress plugin that creates localised shortened urls, and adds support for the rev=canonical link tag. Revcanonical came about after seeing a post on Mr Willison&#8217;s website a few days ago. I&#8217;d seen mutterings around the web from Joshua Schachter, Dave Winer and Chris Shiflett about how url [...]]]></description>
			<content:encoded><![CDATA[<p class="update"><a href="#update-one">UPDATE [15:06 April 14th 2009]</a></p>
<p><a href="http://wordpress.org/extend/plugins/revcanonical/">Revcanonical</a> is a <a href="http://wordpress.org/">WordPress</a> plugin that creates localised shortened urls, and adds support for the <a href="http://revcanonical.appspot.com/">rev=canonical</a> link tag.</p>
<p><a href="http://wordpress.org/extend/plugins/revcanonical/">Revcanonical</a> came about after seeing <a href="http://swtiny.eu/EZa">a post on Mr Willison&#8217;s website</a> a few days ago. I&#8217;d seen mutterings around the web from <a href="http://joshua.schachter.org/2009/04/on-url-shorteners.html">Joshua Schachter</a>, <a href="http://www.scripting.com/stories/2009/03/07/solvingTheTinyurlCentraliz.html">Dave Winer</a> and <a href="http://shiflett.org/blog/2009/apr/save-the-internet-with-rev-canonical">Chris Shiflett</a> about how url shortening services are not great for the web for amongst many reasons, the persistence of the link becomes questionable, because you are relying on that service actually being around in 20 years.</p>
<p>It seems that <a href="http://laughingmeme.org/2009/04/03/url-shortening-hinting/">clever people have taken the conversation further</a> and have actually started to come up with possible solutions. One such solution is <a href="http://laughingmeme.org/2009/04/03/url-shortening-hinting/">rev= canonical</a>, and is the one I liked and hence wanted to implement into my site. In fact, some of the big players have already added rev=canonical to their sites. <a href="http://flickr.com">Flickr</a>, <a href="http://dopplr.com">Dopplr</a> and <a href="http://php.net">php.net</a> already have pages that use it and there&#8217;s even <a href="http://revcanonical.appspot.com/">a rev= canonical web service</a>. That&#8217;s millions of pages already out there.</p>
<p>By default, once you install the plugin to your WordPress blog, you will get a tag added to the source of your page that will contain a shortened version of the url for the page it sits in.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;link rev=&quot;canonical&quot; type=&quot;text/html&quot; href=&quot;http://whomwah.com/p12p&quot; /&gt;</pre></div></div>

<p>That&#8217;s it! You can now, not only use this url in sites like <a href="http://twitter.com">Twitter</a> without having to go via a url shortening service, but services or people that understand the rev=canonical link tag, will be able to use this shortened version over the longer canonical version. For example, <a href="http://simonwillison.net">Simon</a> has build a great <a href="http://simonwillison.net/2009/Apr/11/revcanonical/">bookmarklet</a> that does just this. You can use it when you are on a url you&#8217;d like to share. It will return the shortened version of the url if it&#8217;s available, otherwise it will use a shortening service as a last resort. This means that if I go to this page:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">http://whomwah.com/2009/04/14/revcanonical-a-revcanonical-wordpress-plugin</pre></div></div>

<p>And I want to share this link on Twitter for example. The <a href="http://simonwillison.net/2009/Apr/11/revcanonical/">bookmarklet</a> would see I have implemented rev=canonical and would fetch the shortened url.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">http://whomwah.com/p136</pre></div></div>

<p>In fact, you would in reality get this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">http://littl.me/p136</pre></div></div>

<p>as the plugin allows you to add your own shortened domain (and I bought one). It&#8217;s up to you though point this new domain to the right place.</p>
<p>So, this means that I still get a short url to share, that works on my website, but also means that it&#8217;s persistence is down to me, and not to a 3rd party. It also means that if people to <a href="http://littl.me">http://littl.me</a>, it redirects to <a href="http://whomwah.com">my website</a>, so hopefully there&#8217;s a little more trust in the shortened url final destination.</p>
<p>Some final tech bits. It uses a base36 encoded post ID (made sense and was simple to implement) in the shortened url with the letter p to namespace. It also creates a 301 as <a href="http://twitter.com/simonw/status/1496864191">the general consensus agreed</a>.</p>
<p>Oh and if you use the <a href="http://whomwah.github.com/tweetme/">TweetMe</a> plugin I wrote then I&#8217;m just in the process of deploying a new version that will use your localised shortened link if it&#8217;s available.</p>
<p class="note" id="update-one">[UPDATE] I&#8217;m getting lots of people asking why I went for rev=canonical and not rel=shortlink etc. The truth is no particular reason, other than more people I knew and trusted have gone for the former. There appears to be no definitive correct way yet as far as I can see, so until there is I&#8217;ll have to make an executive choice.</p>
]]></content:encoded>
			<wfw:commentRss>http://whomwah.com/2009/04/14/revcanonical-a-revcanonical-wordpress-plugin/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Deploying WordPress to SliceHost using Capistrano and Git</title>
		<link>http://whomwah.com/2009/02/01/deploying-wordpress-to-slicehost-using-capistrano-and-git/</link>
		<comments>http://whomwah.com/2009/02/01/deploying-wordpress-to-slicehost-using-capistrano-and-git/#comments</comments>
		<pubDate>Sun, 01 Feb 2009 12:00:37 +0000</pubDate>
		<dc:creator>Duncan</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Capistrano]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[slicehost]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://whomwah.com/?p=508</guid>
		<description><![CDATA[Skip straight to the how-to if you don&#8217;t care about an introduction. This post has been in my drafts folder for about 6 months, and I intended to be much more detailed, but I don&#8217;t think I&#8217;m gonna ever get round to it, so here is the shortened version. I did a post a while [...]]]></description>
			<content:encoded><![CDATA[<p class="note">Skip <a href="#step1">straight to the how-to</a> if you don&#8217;t care about an introduction.</p>
<p>This post has been in my drafts folder for about 6 months, and I intended to be much more detailed, but I don&#8217;t think I&#8217;m gonna ever get round to it, so here is the shortened version.</p>
<p>I did a post a while back on <a href="http://whomwah.com/2006/05/21/deploying-wordpress-using-capistrano/">how to deploy WordPress to TextDrive using Capistrano</a>, which people seemed to find useful. I still use <a href="http://wordpress.org/">WordPress</a>, and I still find <a href="http://www.capify.org/">Capistrano</a> perfect for deployment in this situation. They&#8217;re the only two constants though, as I have now changed hosts, changed source control systems, oh and Capistrano has jumped up a major release and many minor releases, so the interface is slightly different.</p>
<p>I moved over to <a href="http://www.slicehost.com/">SliceHost</a> because I wanted the control that virtual hosting gives you, and those guys are cheap, as well as having an awesome service thus far.</p>
<p>The actual <a href="http://articles.slicehost.com/2008/2/6/centos-installing-apache-and-php5">installation of Apache, MySQL and PHP</a> is quite simple through YUM and well documented via the <a href="http://articles.slicehost.com/">Slicehost support area</a> so I won&#8217;t repeat this. I also moved over to <a href="http://git.or.cz/">Git</a> a while back, after researching distributed source control systems, and playing with <a href="http://www.selenic.com/mercurial/wiki/">Mercurial</a> for a while. Git just seemed to tick more boxes for my current needs both at work, and home play.</p>
<h3 id="step1">1. Assumptions </h3>
<p>I have based the post on the fact I choose to put all the sites I deploy in a my home directory. Some other assumptions are:</p>
<ul>
<li>You have Apache, MySQL and PHP installed</li>
<li>You have an account on the machine with sudo access</li>
<li>You have a Git installed on the machine you will be deploying from</li>
</ul>
<p>Now you need to organise your wordpress source into this structure:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">README
Capfile
public/
    + index.php
    + wp-admin/
    + wp-xxxx
     etc ....</pre></div></div>

<h3 id="step2">2. Configure Capistrano</h3>
<p>You can <a href="http://code.whomwah.com/ruby/capistrano2/Capfile">download my basic Capfile</a> that should help get you started. The only things you will need to change are <em>:domain</em> and <em>:user</em>. For example, for my site I may use:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">set <span style="color:#ff3333; font-weight:bold;">:domain</span>, <span style="color:#996600;">&quot;whomwah.com&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:user</span>, <span style="color:#996600;">&quot;websites&quot;</span></pre></div></div>

<p>This would mean that I can normally access my server using:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">ssh websites@whomwah.com</pre></div></div>

<h3 id="step3">3. Initialise your Git repo</h3>
<p>I kind of expect you to have already done this, but if you haven&#8217;t, change into the root directory (The one with the Capfile in it) and run:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">git init
git add .
git commit -a -m 'initial import into Git'</pre></div></div>

<h3 id="step4">4. Deploy</h3>
<p>You should now have enough initial information to let Capistrano deploy WP to your server. First though, you need to run the Capistrano setup command to stick a bunch of folders on your server ready to hold your site. This is a good test command too as it lets you know if you have setup your :domain and :user ok.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">cap deploy:setup</pre></div></div>

<p>If that went ok, then you can now run the mighty:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">cap deploy</pre></div></div>

<p>That&#8217;s it! you should now have your blog deploying to your server. </p>
<h3 id="step5">5. Apache setup</h3>
<p>All you need to do now is setup Apache to point to the folder. You can use <a href="http://code.whomwah.com/wordpress/vhosts/vh_whomwah.conf">this vhost file</a>. Rename it and edit it&#8217;s contents to suit your site, then stick it in your</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">/etc/httpd/conf.d/</pre></div></div>

<p>folder. Restart Apache:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">sudo /sbin/services httpd restart</pre></div></div>

<p>Now browse to your sites url and to the admin area and setup your blog as per the WordPress instructions. Best of luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://whomwah.com/2009/02/01/deploying-wordpress-to-slicehost-using-capistrano-and-git/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>TweetMe &#8211; Another simple WordPress plugin that Twitters</title>
		<link>http://whomwah.com/2009/01/24/tweetme/</link>
		<comments>http://whomwah.com/2009/01/24/tweetme/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 18:37:18 +0000</pubDate>
		<dc:creator>Duncan</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://whomwah.com/?p=952</guid>
		<description><![CDATA[[UPDATE] If you install my new revcanonical plugin, then TweetMe will use auto generated short urls from your own website, instead of going to a 3rd party site. I&#8217;ve written a simple little WordPress Plugin to get me moving again. TweetMe posts a tweet to Twitter when you publish a blog post. If you do [...]]]></description>
			<content:encoded><![CDATA[<p class="update">[UPDATE] If you install my new <a href="http://wordpress.org/extend/plugins/revcanonical/">revcanonical plugin</a>, then TweetMe will use auto generated short urls from your own website, instead of going to a 3rd party site.</p>
<p>I&#8217;ve written a simple little <a href="http://wordpress.org/extend/plugins/">WordPress Plugin</a> <a href="http://whomwah.com/2009/01/19/nothing-then-4-come-along-at-once/">to get me moving again</a>. <a href="http://whomwah.github.com/tweetme/">TweetMe</a> posts a tweet to <a href="http://twitter.com/">Twitter</a> when you publish a blog post.</p>
<p><a href="http://www.flickr.com/photos/duncanponting/3222967486/"><img src="http://farm4.static.flickr.com/3332/3222967486_6f247c1042.jpg?v=0" alt="TweetMe" /></a></p>
<p>If you do <a href="http://www.google.co.uk/search?hl=en&#038;q=twitter+wordpress+plugins&#038;btnG=Google+Search&#038;meta=">a search on Google</a> there are loads of similar plugins out there. The problem is after trying a few, none of them did what I wanted, and many of them seemed far to complex for the task in hand. I simply wanted this. Nothing more, nothing less:</p>
<ul>
<li>I enter my <a href="http://twitter.com">Twitter</a> credentials once and they get validated.</li>
<li>I decide how I want my tweet to look.</li>
<li>When I publish a new blog post, it gets sent to Twitter.</li>
<li>If I update that post, I don&#8217;t want it resent, unless I choose.</li>
<li>That&#8217;s it&#8230;.</li>
</ul>
<p>So that&#8217;s all TweetMe does.</p>
<ul>
<li><a href="http://whomwah.github.com/tweetme/">Visit the TweetMe project page</a></li>
<li><a href="http://wordpress.org/extend/plugins/tweetme/">Download TweetMe from wordpress.org</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://whomwah.com/2009/01/24/tweetme/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Updated to WordPress 2.6</title>
		<link>http://whomwah.com/2008/08/01/updated-to-wordpress-26/</link>
		<comments>http://whomwah.com/2008/08/01/updated-to-wordpress-26/#comments</comments>
		<pubDate>Fri, 01 Aug 2008 12:11:17 +0000</pubDate>
		<dc:creator>Duncan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://whomwah.com/?p=389</guid>
		<description><![CDATA[It&#8217;s that time again. I knew I had to upgrade at some point, due to the fact I was running WP 2.0.2 which is getting very old. The problem was that migrating was going to be a real pain as the DB had changed quite a bit, and there is no export feature on 2.0.2. [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s that time again. I knew I had to upgrade at some point, due to the fact I was running WP 2.0.2 which is getting very old. The problem was that migrating was going to be a real pain as the DB had changed quite a bit, and there is no export feature on 2.0.2.</p>
<p>Anyway, it&#8217;s done now, and I&#8217;ve given the site a bit of a refresh and dressing down. I liked the new look straight away, which is a change. The <a href="http://github.com/whomwah/wp-theme-whomwah/tree">theme is available to download (v1.0.1)</a> from <a href="http://github.com/">gitHub</a>.</p>
<p>You can get the scripts I used to upgrade if you like. They are not supported and might not make too much sense, but they might be a good starting point if you need to do a similar migration. </p>
<ul>
<li><a href="/code/wordpress/">Migrate wordpress 2.0.2 to 2.6 scripts</a></li>
</ul>
<p>Any comments about the new design, or bugs etc, duncan @ the name of this site </p>
]]></content:encoded>
			<wfw:commentRss>http://whomwah.com/2008/08/01/updated-to-wordpress-26/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deploying wordpress using capistrano</title>
		<link>http://whomwah.com/2006/05/21/deploying-wordpress-using-capistrano/</link>
		<comments>http://whomwah.com/2006/05/21/deploying-wordpress-using-capistrano/#comments</comments>
		<pubDate>Sun, 21 May 2006 13:47:57 +0000</pubDate>
		<dc:creator>Duncan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Capistrano]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://whomwah.com/?p=242</guid>
		<description><![CDATA[[update] I have written a new post called Deploying WordPress to SliceHost using Capistrano and Git, which uses new versions of Capinstano and WordPress, and although also now uses Git as the SCM, may still be useful. So I was running typo up until last week. I was gradually getting more and more hacked off [...]]]></description>
			<content:encoded><![CDATA[<p class="update"><strong>[update]</strong> I have written a new post called <a href="http://whomwah.com/2009/02/01/deploying-wordpress-to-slicehost-using-capistrano-and-git/">Deploying WordPress to SliceHost using Capistrano and Git</a>, which uses new versions of Capinstano and WordPress, and although also now uses Git as the SCM, may still be useful.</p>
<p>So I was running <a href="http://www.typosphere.org/">typo</a> up until last week. I was gradually getting more and more hacked off with it&#8217;s problems, and decided to change over to <a href="http://wordpress.org/">WordPress</a>. I feel like I&#8217;ve ran every blogging tool out there, but WordPress is the most polished I&#8217;ve seen so far, and I&#8217;ve a <a href="www.php.net/">PHP</a> background which helps.</p>
<p>Don&#8217;t get me wrong, I&#8217;m loving <a href="www.ruby-lang.org/">Ruby</a> and <a href="www.rubyonrails.org/">RoR</a> ( Hell, it&#8217;s all I&#8217;m doing at the moment at work ) but I just want to post stuff up <em>fast and easily</em>, and also make changes to the blog and post them up <em>fast and easily</em>. After reading this article on <a href="http://nubyonrails.topfunky.com/articles/2006/03/09/using-capistrano-with-perl-or-php">nubby on rails</a>, I decided to try it with wordpress. I&#8217;d been using <a href="manuals.rubyonrails.com/read/book/17">Capistrano</a> to deploy my old Typo blog and at <a href="http://www.bbc.co.uk/music">work</a> we use it to deploy all our apps. It really is a clever bit of kit and I wanted to continue to use it even though I was not gonna be running a RoR app.</p>
<p>Well, no problem. Although Capistrano makes a bunch of assumtions i.e. you are running a RoR app, you are using Fast CGI etc you can overide all this stuff.</p>
<p>First, what I wanted from all this:</p>
<ol>
<li>Easy deploy and re-deploy of my WordPress blog</li>
<li>The image uploads when posting stuff to be seperate from the app. This is so I could override the app whenever I wanted without having to worry about overwriting all the images</li>
</ol>
<h3>Step 1.</h3>
<p>Created a folder called wp_&lt;app_name> and stick a public and config folder in there. Put all the files and folders that make up wordpress into the public folder. In the config folder you put the deploy script. You can either use one created in a rails app ( this gives you lots of comments on what the various sections do ) or you can just create a file called deploy.rb and stick all the code in Step 2. inside. How I got this file the long was was creating a dummy rails app and running cap -A . inside to get the default deploy.rb created for me in /config/deploy.rb.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">rails dummy_app
cd dummy_app
cap <span style="color:#006600; font-weight:bold;">-</span>A .
<span style="color:#9900CC;">mv</span> config<span style="color:#006600; font-weight:bold;">/</span>deploy.<span style="color:#9900CC;">rb</span> <span style="color:#006600; font-weight:bold;">/</span>path<span style="color:#006600; font-weight:bold;">/</span>to<span style="color:#006600; font-weight:bold;">/</span>wp_app_name<span style="color:#006600; font-weight:bold;">/</span>config<span style="color:#006600; font-weight:bold;">/</span>
cd ..
<span style="color:#9900CC;">rm</span> <span style="color:#006600; font-weight:bold;">-</span>rf dummy_app</pre></div></div>

<p>Now you should have the file/folder structure as below. This is mine:</p>
<p>wp_whomwah<br />
&nbsp;&nbsp;|- config<br />
&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;|- deploy.rb<br />
&nbsp;&nbsp;|- public<br />
&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;|- &lt;your wordpress files> </p>
<h3>Step 2.</h3>
<p>Edit the deploy.rb file to suit your setup. I changed the information in the various sections as seen below:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">set <span style="color:#ff3333; font-weight:bold;">:domain</span>, <span style="color:#996600;">&quot;www.whomwah.com&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:application</span>, <span style="color:#996600;">&quot;wp_whomwah&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:user</span>, <span style="color:#996600;">&quot;duncan&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:repository</span>, <span style="color:#996600;">&quot;http://#{domain}/svn/repos/trunk/#{application}/&quot;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">role <span style="color:#ff3333; font-weight:bold;">:web</span>, <span style="color:#996600;">&quot;#{domain}&quot;</span>
role <span style="color:#ff3333; font-weight:bold;">:app</span>, <span style="color:#996600;">&quot;#{domain}&quot;</span>
role <span style="color:#ff3333; font-weight:bold;">:db</span>,  <span style="color:#996600;">&quot;#{domain}&quot;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">set <span style="color:#ff3333; font-weight:bold;">:deploy_to</span>, <span style="color:#996600;">&quot;/users/home/#{user}/sites/#{application}&quot;</span>
<span style="color:#008000; font-style:italic;"># setting use_sudo to false means you can use</span>
<span style="color:#008000; font-style:italic;"># cap cleanup ok without needing to be a sudoer</span>
set <span style="color:#ff3333; font-weight:bold;">:use_sudo</span>, <span style="color:#0000FF; font-weight:bold;">false</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">desc <span style="color:#996600;">&quot;This is here to overide the original :restart&quot;</span>
task <span style="color:#ff3333; font-weight:bold;">:restart</span>, <span style="color:#ff3333; font-weight:bold;">:roles</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:app</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  <span style="color:#008000; font-style:italic;"># do nothing but overide the default</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># create a symlink to where I store all my images on</span>
<span style="color:#008000; font-style:italic;"># the server. </span>
desc <span style="color:#996600;">'Link to central uploads folder'</span>
task <span style="color:#ff3333; font-weight:bold;">:after_symlink</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  run <span style="color:#996600;">&quot;ln -nfs #{deploy_to}/#{shared_dir}/uploads/&quot;</span> 
    <span style="color:#996600;">&quot;#{deploy_to}/#{current_dir}/public/wp-content/uploads&quot;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<h3>Step 3.</h3>
<p>You should now be ready to go. Check all this stuff back into SVN and the you should be able to run:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">cap setup</pre></div></div>

<p>You might want to look on your server to make sure capistrano has created your app and all the folders in your :application path as stated above. Once you are happy it&#8217;s there and in the correct place you can run:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">cap deploy</pre></div></div>

<p>this should then checkout a copy of your app from subversion and stick it in the releases folder. It will also create a symlink called current, pointing to the latest deployment. It is this current folder that you need to point the server at when displaying your site.<br />
<strong>Update:</strong> I have stuck up a <a href="http://code.whomwah.com/ruby/capistrano1/deploy.rb">copy of the deploy.rb file I use</a>. It differs slighly from the one above. When you run the cap deply line it will:</p>
<ol>
<li>deploy app</li>
<li>symlink uploads folder</li>
<li>dump a backup of the db</li>
<li>run cleanup to leave a max of 5 releases</li>
</ol>
<p>Happy Deploying!</p>
]]></content:encoded>
			<wfw:commentRss>http://whomwah.com/2006/05/21/deploying-wordpress-using-capistrano/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
