<?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>Es Tea Double Eye &#187; fabric</title>
	<atom:link href="http://stii.co.za/tag/fabric/feed/" rel="self" type="application/rss+xml" />
	<link>http://stii.co.za</link>
	<description>You&#039;re never too old for a happy childhood</description>
	<lastBuildDate>Fri, 19 Aug 2011 02:20:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<atom:link rel='hub' href='http://stii.co.za/?pushpress=hub'/>
		<item>
		<title>Switched to Python Fabric</title>
		<link>http://stii.co.za/python/switched-to-python-fabric/</link>
		<comments>http://stii.co.za/python/switched-to-python-fabric/#comments</comments>
		<pubDate>Wed, 04 Mar 2009 09:18:24 +0000</pubDate>
		<dc:creator>Stii</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Afrigator]]></category>
		<category><![CDATA[capistrano]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[fabric]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://stii.co.za/?p=497</guid>
		<description><![CDATA[We&#8217;ve been using Capistrano to deploy Afrigator to our various servers for a while now. I can seriously not complain or say anything bad about Capistrano. Thing is, I&#8217;m more familiar with Python than I am with Ruby, thus for me it just makes more sense for me to use Fabric. Here is a small [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve been using <a href="http://www.capify.org/" rel="nofollow">Capistrano</a> to deploy <a href="http://stii.co.za/tag/afrigator">Afrigator</a> to our various servers for a while now. I can seriously not complain or say anything bad about Capistrano. Thing is, I&#8217;m more familiar with <a href="http://stii.co.za/tag/python">Python</a> than I am with <strong>Ruby</strong>, thus for me it just makes more sense for me to use <a href="http://www.nongnu.org/fab/index.html"  rel="nofollow">Fabric</a>.</p>
<p>Here is a small example of how to write a typical <strong>deploy script with Python Fabric</strong>:</p>
<p>First, define your various servers which you need to deploy to. Ideally, you&#8217;ll have a test, staging and live server. Thus you&#8217;ll set them up as follows.</p>
<pre>
def test():
    config.fab_user = 'test_user_name'
    config.fab_hosts = ['test.yourserver.com']

def staging():
    config.fab_user = 'staging_user_name'
    config.fab_hosts = ['staging.yourserver.com']

def live():
    config.fab_user = 'live_user_name'
    config.fab_hosts = ['www1.yourserver.com', \
'www2.yourserver.com', 'www3.yourserver.com']
</pre>
<p>This allows you to deploy your code to the various servers. Please note, you need to setup automatic login for your different servers. See here how to do <a href="http://wp.uberdose.com/2006/10/16/ssh-automatic-login/" rel="nofollow">automatic logins</a>.</p>
<p>Next, write the steps you would take to deploy your site manually:</p>
<pre>
def deploy():
    "Deploy code to servers"
    msg = "deploying"
    require('fab_hosts', provided_by = [test,staging,live])
    local('svn ci -m "$(msg)"')
    run('svn export repos /path/to/repository/export/')
    run('cp -R /path/to/repository/export/* /path/to/your/site/')
</pre>
<p>To deploy to the staging server you can run the following command:</p>
<pre>
$ fab staging let:msg="Reason for check in" deploy
</pre>
<p>To deploy to the 3 live servers, all you do is:</p>
<pre>
$ fab live let:msg="Reason for check in" deploy
</pre>
<p>The command works as follows: <strong>fab</strong> is the command. <strong>live/stating/test</strong> are the environments you would like to load. If you said staging, it will do the commands in <strong>deploy</strong> for the staging server. The last part is the command you want to run. In this instance, <strong>deploy</strong>. </p>
<p>The <strong>let:msg=&#8221;Reason for check in&#8221;</strong> is the coolest bit! It basically allow you to <strong>override Fabric variables</strong>. If you look closely, in my deploy script I&#8217;ve set a variable <strong>msg</strong> to just say &#8220;deploy&#8221;. Now that is a stupid <a href="http://stii.co.za/tag/svn">SVN</a> message for a commit. In order to commit with meaningful messages, I override the msg variable with my own message. Simple, yet very effective!</p>
<p>You may want to write a number of different functions in a single fabfile. If you have 100 commands and you&#8217;re not one hundred percent sure, just do a:</p>
<pre>
$ fab list
</pre>
<p>and all the commands available to you will be printed with their description. <strong>Fabric rocks! <em>Seriously</em>.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://stii.co.za/python/switched-to-python-fabric/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>FTP is crap! So they say in Cape Town</title>
		<link>http://stii.co.za/software/ftp-is-crap/</link>
		<comments>http://stii.co.za/software/ftp-is-crap/#comments</comments>
		<pubDate>Mon, 15 Dec 2008 06:00:32 +0000</pubDate>
		<dc:creator>Stii</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[capistrano]]></category>
		<category><![CDATA[fabric]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://stii.co.za/?p=148</guid>
		<description><![CDATA[FTP is crap. At least someone in Cape Town seems to think so! Found this little gem in a shopping centre in Cape Town. In all fairness, its not that I believe it is crap, its just that there is so much better ways to update sites. My preference at the moment is: Subversion Capistrano [...]]]></description>
			<content:encoded><![CDATA[<p><acronym title="File Transfer Protocol">FTP</acronym> is crap. At least someone in <strong>Cape Town</strong> seems to think so! Found this little gem in a shopping centre in <strong>Cape Town</strong>. </p>
<p><img src="http://stii.co.za/wp-content/uploads/2008/12/ftp.jpg" alt="ftp" title="ftp" width="400" height="533" class="aligncenter size-full wp-image-147" /></p>
<p>In all fairness, its not that I believe it is crap, its just that there is so much better ways to update sites. My preference at the moment is:</p>
<ul>
<li><a href="http://stii.co.za/software-development/i-love-svn/">Subversion</a></li>
<li><a href="http://stii.co.za/general/fabric-capistrano-python/">Capistrano or Python Fabric</a></li>
<li>or SSH and SCP if you don&#8217;t want to or cannot use the above</li>
</ul>
<p>I do understand that if you host sites on a shared host you don&#8217;t always have these options and in lots of instances FTP is the only option available to you. I feel your pain :(</p>
]]></content:encoded>
			<wfw:commentRss>http://stii.co.za/software/ftp-is-crap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fabric, Capistrano in Python</title>
		<link>http://stii.co.za/general/fabric-capistrano-python/</link>
		<comments>http://stii.co.za/general/fabric-capistrano-python/#comments</comments>
		<pubDate>Mon, 24 Nov 2008 14:27:33 +0000</pubDate>
		<dc:creator>Stii</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[capistrano]]></category>
		<category><![CDATA[fabric]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://stii.co.za/?p=38</guid>
		<description><![CDATA[If you still use FTP or SCP or sFTP to deploy projects, you&#8217;re missing out big time on the ease of either Ruby&#8217;s Capistrano or Python&#8217;s Fabric. Capistrano is almost synonymous with Ruby on Rails, though it is simple to setup with any project. We at Afrigator uses Capistrano to deploy changes to the staging [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.nongnu.org/fab/fabric-logo.png" alt="Fabric" style="float:right; margin: 5px;" />If you still use FTP or SCP or sFTP to deploy projects, you&#8217;re missing out big time on the ease of either <a href="http://www.capify.org/">Ruby&#8217;s Capistrano</a> or <a href="http://www.nongnu.org/fab/index.html">Python&#8217;s Fabric</a>. Capistrano is almost synonymous with <a href="http://rubyonrails.org">Ruby on Rails</a>, though it is simple to setup with any project. We at <a href="http://stii.co.za/afrigator/whats-in-a-afrigator-ranking/">Afrigator</a> uses Capistrano to deploy changes to the staging server and to the live servers. It is specially handy if you have to deploy to a cluster of servers. In short, it allows you to execute commands on a remote server(s). For example, you can set it up so that it backs up your files before the deployment or do something and simple and trivial as a directory listing. </p>
<p><img src="http://farm4.static.flickr.com/3248/3055462065_313f684d07_m.jpg" alt="Capistrano" style="display: block; margin: auto;" /></p>
<p>Today I came across <strong>Fabric</strong>, which is a Python version of Capistrano. Now, for the record, my use of Capistrano has been limited. I use it for what I need it. Nothing more. What I&#8217;m trying to say is I didn&#8217;t go into a very advanced setup of Capistrano, so I&#8217;m not really qualified to say which is better. On the Fabric page it says:</p>
<blockquote><p>It is a bit like a dumbed down Capistrano, except it&#8217;s in Python</p></blockquote>
<p>I like it. Its simple and it is easier than Capistrano IMHO. In the end, it comes down to which tool suits you best! Capistrano does support commits and rollbacks which, by the looks of it, Fabric don&#8217;t. </p>
<p>Setting up Capistrano was painless. All I had to do was </p>
<pre>
sudo gem install capistrano
</pre>
<p>Fabric had a few dependency issues, which I had to meet first before I could</p>
<pre>
sudo easy_install Fabric
</pre>
<p>It was looking for <a href="http://www.amk.ca/python/code/crypto">pycrypto</a> which I had to install before I could setup Fabric.</p>
<p>Once installed, using it is as straight forward as Capistrano. All you need to do is to create a <strong>fabfile</strong> which is a simple python file which holds all the config options and commands to execute remotely. The syntax is plain and simple and clean. Here is a simple example executing a directory listing on a remote server:</p>
<pre>
def listing():
    "Outputs a directory listing on the remote server."
    set(fab_user = 'stii')
    set(fab_hosts = ['stii.co.za'])
    run('ls -l /usr/bin')
</pre>
<p>Simple. Apart from the <strong>run</strong> command to execute remote queries, there are also a <strong>sudo</strong> (execute remote commands as a privileged user), <strong>local</strong> (execute commands on your local machine) and <strong>put</strong> (upload files to the remote servers) which is very handy. </p>
<p>I&#8217;m going to use it a bit more and would give you more feedback in a while. If you want, you can check it out!</p>
<p><strong><em>Update</em>:</strong> Here is an example of how to <a href="http://stii.co.za/python/upgrade-wordpress-using-python-fabric/">upgrade WordPress using Python Fabric</a></p>
]]></content:encoded>
			<wfw:commentRss>http://stii.co.za/general/fabric-capistrano-python/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

