<?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; Capistrano</title>
	<atom:link href="http://whomwah.com/tag/capistrano/feed/" rel="self" type="application/rss+xml" />
	<link>http://whomwah.com</link>
	<description>The website of Duncan Robertson, currently computing for the BBC</description>
	<lastBuildDate>Fri, 06 Jan 2012 12:55:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<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>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>5</slash:comments>
		</item>
		<item>
		<title>Switchtower gets new name</title>
		<link>http://whomwah.com/2006/03/06/switchtower-gets-new-name/</link>
		<comments>http://whomwah.com/2006/03/06/switchtower-gets-new-name/#comments</comments>
		<pubDate>Mon, 06 Mar 2006 08:02:05 +0000</pubDate>
		<dc:creator>Duncan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Capistrano]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://whomwah.com/?p=210</guid>
		<description><![CDATA[Due to a &#8220;cease and desist&#8221; from Raindance Communications, Inc. over the use of their registered trademark SWITCHTOWER on Friday, the guys have had to come up with a new name. The name Capistrano was chosen after much deliberation. They will be making new Gems available in the next couple of days. You will now [...]]]></description>
			<content:encoded><![CDATA[<p>Due to a &ldquo;cease and desist&rdquo; from Raindance Communications, Inc. over the use of their registered trademark SWITCHTOWER on Friday, the guys have had to come up with a new name. The name <em>Capistrano</em> was chosen after much <a href="http://jamis.jamisbuck.org/articles/2006/03/06/switchtower-renamed">deliberation</a>.</p>
<p>They will be making new Gems available in the next couple of days. You will now use:</p>

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

<p>instead of the old</p>

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

]]></content:encoded>
			<wfw:commentRss>http://whomwah.com/2006/03/06/switchtower-gets-new-name/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

