<?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>A Tempest of Thoughts &#187; Drupal</title>
	<atom:link href="http://tempe.st/category/drupal/feed/" rel="self" type="application/rss+xml" />
	<link>http://tempe.st</link>
	<description>aka blog.to_int(:inig)</description>
	<lastBuildDate>Thu, 07 Apr 2011 08:24:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>Deploy Drupal with Capistrano, a year later</title>
		<link>http://tempe.st/2009/06/deploy-drupal-with-capistrano-a-year-later/</link>
		<comments>http://tempe.st/2009/06/deploy-drupal-with-capistrano-a-year-later/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 14:07:52 +0000</pubDate>
		<dc:creator>Giovanni Intini</dc:creator>
				<category><![CDATA[Capistrano]]></category>
		<category><![CDATA[Drupal]]></category>
		<category><![CDATA[mikamai]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://tempe.st/?p=295</guid>
		<description><![CDATA[Here&#8217;s the slides for the presentation I gave at the latest Ruby Social Club in Milano. Deploy Drupal With Capistrano A Year LaterView more PDF documents from intinig.]]></description>
			<content:encoded><![CDATA[	<p>Here&#8217;s the slides for the presentation I gave at the latest Ruby Social Club in Milano.</p>
<div style="width:425px;text-align:left" id="__ss_1603333"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/intinig/deploy-drupal-with-capistrano-a-year-later?type=presentation" title="Deploy Drupal With Capistrano A Year Later">Deploy Drupal With Capistrano A Year Later</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=deploydrupalwithcapistranoayearlater-090618090126-phpapp02&#38;rel=0&#38;stripped_title=deploy-drupal-with-capistrano-a-year-later" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=deploydrupalwithcapistranoayearlater-090618090126-phpapp02&#38;rel=0&#38;stripped_title=deploy-drupal-with-capistrano-a-year-later" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object><div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">PDF documents</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/intinig">intinig</a>.</div></div>

 ]]></content:encoded>
			<wfw:commentRss>http://tempe.st/2009/06/deploy-drupal-with-capistrano-a-year-later/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Two improvements to your Capfiles</title>
		<link>http://tempe.st/2008/10/two-improvements-to-your-capfiles/</link>
		<comments>http://tempe.st/2008/10/two-improvements-to-your-capfiles/#comments</comments>
		<pubDate>Thu, 02 Oct 2008 17:45:36 +0000</pubDate>
		<dc:creator>Giovanni Intini</dc:creator>
				<category><![CDATA[Capistrano]]></category>
		<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[capfile]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[recipes]]></category>

		<guid isPermaLink="false">http://tempe.st/?p=251</guid>
		<description><![CDATA[I have lately started using a pattern that has become quite common among capistrano users: setting the server names and locations in a task. Doing this allows you to have multiple deployment environments, like development, staging, production, and so on. desc &#34;deploy to development environment&#34; task :development do set :deploy_to, &#34;/var/apps/#{application}&#34; &#160; role :web, &#34;servername.mikamai.com&#34;, [...]]]></description>
			<content:encoded><![CDATA[	<p>I have lately started using a pattern that has become quite common among capistrano users: setting the server names and locations in a task. Doing this allows you to have multiple deployment environments, like <em>development</em>, <em>staging</em>, <em>production</em>, and so on.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">desc <span style="color:#996600;">&quot;deploy to development environment&quot;</span>
task <span style="color:#ff3333; font-weight:bold;">:development</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  set <span style="color:#ff3333; font-weight:bold;">:deploy_to</span>, <span style="color:#996600;">&quot;/var/apps/#{application}&quot;</span>
&nbsp;
  role <span style="color:#ff3333; font-weight:bold;">:web</span>, <span style="color:#996600;">&quot;servername.mikamai.com&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:primary</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span>
  role <span style="color:#ff3333; font-weight:bold;">:app</span>, <span style="color:#996600;">&quot;servername.mikamai.com&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:primary</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span>
  role <span style="color:#ff3333; font-weight:bold;">:db</span>, <span style="color:#996600;">&quot;servername.mikamai.com&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:primary</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span>
&nbsp;
  set <span style="color:#ff3333; font-weight:bold;">:user</span>, <span style="color:#996600;">&quot;username&quot;</span>
  set <span style="color:#ff3333; font-weight:bold;">:password</span>, <span style="color:#996600;">&quot;secr3t&quot;</span>
  set <span style="color:#ff3333; font-weight:bold;">:remote_mysqldump</span>, <span style="color:#996600;">&quot;/usr/bin/mysqldump&quot;</span>
&nbsp;
  set <span style="color:#ff3333; font-weight:bold;">:db_user</span>, <span style="color:#996600;">&quot;username&quot;</span>
  set <span style="color:#ff3333; font-weight:bold;">:db_password</span>, <span style="color:#996600;">&quot;secre7&quot;</span>
  set <span style="color:#ff3333; font-weight:bold;">:db_name</span>, <span style="color:#996600;">&quot;db_name&quot;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

	<p>This technique has proven itself to be really useful, especially when clients start to ask for deployments on their test servers, and you still want to be able to deploy to your development servers.</p>
	<p>While refactoring my Capfiles I also took the time to rewrite the <strong>drupal:db</strong> namespace, adding the much needed tasks that allow you dump the remote databases and download them to your development box.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  namespace <span style="color:#ff3333; font-weight:bold;">:db</span> <span style="color:#9966CC; font-weight:bold;">do</span>    
    namespace <span style="color:#ff3333; font-weight:bold;">:dump</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      desc <span style="color:#996600;">&quot;Deletes old database dumps, leaves only the latest on the server&quot;</span>
      task <span style="color:#ff3333; font-weight:bold;">:cleanup</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;">:db</span> <span style="color:#9966CC; font-weight:bold;">do</span>
        dumps = capture<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;ls -xt #{shared_path}/dumps&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#CC0066; font-weight:bold;">split</span>.<span style="color:#9900CC;">reverse</span>
        run <span style="color:#996600;">&quot;cd #{shared_path}/dumps; rm #{dumps[0..-2].join(&quot;</span> <span style="color:#996600;">&quot;)}&quot;</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
      desc <span style="color:#996600;">&quot;Dumps the local database&quot;</span>
      task <span style="color:#ff3333; font-weight:bold;">:local</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;">:db</span> <span style="color:#9966CC; font-weight:bold;">do</span>
        <span style="color:#CC0066; font-weight:bold;">raise</span> <span style="color:#CC00FF; font-weight:bold;">RuntimeError</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;failed dump&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">unless</span> <span style="color:#CC0066; font-weight:bold;">system</span> <span style="color:#996600;">&quot;#{local_mysqldump} -u #{local_db_user} --password=#{local_db_password} #{local_db_name} &gt; dump.sql&quot;</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
      namespace <span style="color:#ff3333; font-weight:bold;">:remote</span> <span style="color:#9966CC; font-weight:bold;">do</span>
        desc <span style="color:#996600;">&quot;Dumps the remote database&quot;</span>
        task <span style="color:#ff3333; font-weight:bold;">:default</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;">:db</span> <span style="color:#9966CC; font-weight:bold;">do</span>
          filename = <span style="color:#996600;">&quot;#{Time.now.to_i.to_s}.dump.sql&quot;</span>
          run <span style="color:#996600;">&quot;cd #{shared_path}/dumps; #{remote_mysqldump} -u #{db_user} --password=#{db_password} #{db_name} &gt; #{filename}&quot;</span>
          run <span style="color:#996600;">&quot;cd #{shared_path}/dumps; bzip2 #{filename}&quot;</span>
        <span style="color:#9966CC; font-weight:bold;">end</span>          
&nbsp;
        namespace <span style="color:#ff3333; font-weight:bold;">:download</span> <span style="color:#9966CC; font-weight:bold;">do</span>
          desc <span style="color:#996600;">&quot;Dumps and downloads the remote database&quot;</span>
          task <span style="color:#ff3333; font-weight:bold;">:default</span> <span style="color:#9966CC; font-weight:bold;">do</span>
            drupal::db::dump::remote::default
            latest
          <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
          desc <span style="color:#996600;">&quot;Downloads the latest database dump&quot;</span>
          task <span style="color:#ff3333; font-weight:bold;">:latest</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;">:db</span> <span style="color:#9966CC; font-weight:bold;">do</span>
            dumps = capture<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;ls -xt #{shared_path}/dumps&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#CC0066; font-weight:bold;">split</span>.<span style="color:#9900CC;">reverse</span>
            get<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;#{shared_path}/dumps/#{dumps.last}&quot;</span>, <span style="color:#996600;">&quot;./#{dumps.last}&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
          <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
        <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
      <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>



 ]]></content:encoded>
			<wfw:commentRss>http://tempe.st/2008/10/two-improvements-to-your-capfiles/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to ease Drupal development with Capistrano</title>
		<link>http://tempe.st/2008/07/how-to-ease-drupal-development-with-capistrano/</link>
		<comments>http://tempe.st/2008/07/how-to-ease-drupal-development-with-capistrano/#comments</comments>
		<pubDate>Tue, 22 Jul 2008 07:12:58 +0000</pubDate>
		<dc:creator>Giovanni Intini</dc:creator>
				<category><![CDATA[Capistrano]]></category>
		<category><![CDATA[Drupal]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://tempe.st/?p=240</guid>
		<description><![CDATA[Drupal is a great piece of software, unfortunately it stores so much stuff in the db that people struggle keeping in sync the development server/box and a staging server to show their customers how the work is proceeding. Today I will share the Capistrano tasks I use to sync my development box with the staging [...]]]></description>
			<content:encoded><![CDATA[	<p>Drupal is a great piece of software, unfortunately it stores so much stuff in the db that people struggle keeping in sync the development server/box and a staging server to show their customers how the work is proceeding.</p>
	<p>Today I will share the Capistrano tasks I use to sync my development box with the staging server. What I basically do is dumping the development db, sending it to the server via capistrano and then use the dump to replace the server&#8217;s database.</p>
	<p>The following tasks should be used together with the tasks in my <a href="http://tempe.st/2008/07/deploying-drupal-with-capistrano/">Deploying drupal with Capistrano</a> article. I took advantage of deploy:cold not being needed with Drupal, and added a callback to it, so if you want to do a deploy that also updated the database you should use deploy:cold.</p>
	<p>You should also have two settings files (usually stored in drupal_root/sites/default), one called settings.development.php, with your local database setup and one called settings.production.php with the remote database setup, the capistrano tasks will take care of choosing the correct one.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># Callbacks</span>
before <span style="color:#996600;">'deploy:start'</span>, <span style="color:#996600;">'drupal:db:import:production'</span>
before <span style="color:#996600;">'deploy:restart'</span>, <span style="color:#996600;">'drupal:configure:production'</span>
before <span style="color:#996600;">'deploy:start'</span>, <span style="color:#996600;">'drupal:configure:production'</span>
before <span style="color:#996600;">'deploy:cold'</span>, <span style="color:#996600;">'drupal:db:dump:development'</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># DB Stuff</span>
set <span style="color:#ff3333; font-weight:bold;">:mysqldump</span>, <span style="color:#996600;">&quot;/path/to/mysqldump&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:local_db_user</span>, <span style="color:#996600;">&quot;local_mysql_username&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:local_db_password</span>, <span style="color:#996600;">&quot;local_mysql_password&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:local_db_name</span>, <span style="color:#996600;">&quot;local_db_name&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:db_user</span>, <span style="color:#996600;">&quot;remote_mysql_username&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:db_password</span>, <span style="color:#996600;">&quot;remote_mysql_password&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:db_name</span>, <span style="color:#996600;">&quot;remote_db_name&quot;</span>
&nbsp;
namespace <span style="color:#ff3333; font-weight:bold;">:drupal</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  namespace <span style="color:#ff3333; font-weight:bold;">:configure</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    task <span style="color:#ff3333; font-weight:bold;">:production</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      sudo <span style="color:#996600;">&quot;cp #{latest_release}/sites/default/settings.production.php #{latest_release}/sites/default/settings.php&quot;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    task <span style="color:#ff3333; font-weight:bold;">:development</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      sudo <span style="color:#996600;">&quot;cp #{latest_release}/sites/default/settings.development.php #{latest_release}/sites/default/settings.php&quot;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  namespace <span style="color:#ff3333; font-weight:bold;">:db</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    namespace <span style="color:#ff3333; font-weight:bold;">:dump</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      task <span style="color:#ff3333; font-weight:bold;">:development</span> <span style="color:#9966CC; font-weight:bold;">do</span>
        <span style="color:#CC0066; font-weight:bold;">raise</span> <span style="color:#CC00FF; font-weight:bold;">RuntimeError</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;failed dump&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">unless</span> <span style="color:#CC0066; font-weight:bold;">system</span> <span style="color:#996600;">&quot;#{mysqldump} -u #{local_db_user} --password=#{local_db_password} #{local_db_name} &gt; dump.sql&quot;</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    namespace <span style="color:#ff3333; font-weight:bold;">:import</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      task <span style="color:#ff3333; font-weight:bold;">:production</span> <span style="color:#9966CC; font-weight:bold;">do</span>
        ENV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;FILES&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#996600;">&quot;dump.sql&quot;</span>
        deploy::upload
        run <span style="color:#996600;">&quot;mysql -u #{db_user} --password=#{db_password} #{db_name} &lt; #{latest_release}/dump.sql&quot;</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>



 ]]></content:encoded>
			<wfw:commentRss>http://tempe.st/2008/07/how-to-ease-drupal-development-with-capistrano/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deploying Drupal with Capistrano</title>
		<link>http://tempe.st/2008/07/deploying-drupal-with-capistrano/</link>
		<comments>http://tempe.st/2008/07/deploying-drupal-with-capistrano/#comments</comments>
		<pubDate>Thu, 17 Jul 2008 21:02:48 +0000</pubDate>
		<dc:creator>Giovanni Intini</dc:creator>
				<category><![CDATA[Capistrano]]></category>
		<category><![CDATA[Drupal]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://tempe.st/?p=230</guid>
		<description><![CDATA[Mikamai, the company I work for, has just released Montalbano.tv, the companion site to one of the most successful TV shows in Italy. I was the technical director of this Drupal based project, and while I was happy we chose Drupal, because it allowed us to deliver all the features they needed on time, I [...]]]></description>
			<content:encoded><![CDATA[	<p><a href="http://mikamai.com">Mikamai</a>, the company I work for, has just released <a href="http://montalbano.tv">Montalbano.tv</a>, the companion site to one of the most successful TV shows in Italy.</p>
	<p>I was the technical director of this Drupal based project, and while I was happy we chose Drupal, because it allowed us to deliver all the features they needed on time, I almost panicked when they told us the production setup would have two servers, both with database and web serving duties.</p>
	<p>The database replication was standard MySql master-master setup, but I had to develop a strategy to keep the two code-bases on the two servers synchronized. </p>
	<p>Being a Ruby programmer at heart, I selected the only tool that never fails me in circumstances like the one we had: <a href="http://capify.org">Capistrano</a>.</p>
	<p>Unfortunately, while Capistrano is all easy to use with Rails, I had to write a custom Drupal-tailored Capfile.</p>
	<p>Here it is, in its entirety, in case you ever need to  deploy Drupal with cap (now I always deploy Drupal with cap, since I have the recipe ready <img src='http://tempe.st/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ):</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">load</span> <span style="color:#996600;">'deploy'</span> <span style="color:#9966CC; font-weight:bold;">if</span> respond_to?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:namespace</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#008000; font-style:italic;"># cap2 differentiator</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Standard configuration</span>
set <span style="color:#ff3333; font-weight:bold;">:user</span>, <span style="color:#996600;">&quot;username&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:password</span>, <span style="color:#996600;">&quot;password&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:application</span>, <span style="color:#996600;">&quot;application.name&quot;</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># I like to deploy the code in /var/apps</span>
<span style="color:#008000; font-style:italic;"># and then link it to the webserver directory</span>
set <span style="color:#ff3333; font-weight:bold;">:deploy_to</span>, <span style="color:#996600;">&quot;/var/apps/#{application}&quot;</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># SCM Stuff configure to taste, just remember the repository</span>
<span style="color:#008000; font-style:italic;"># here I used github as main repository</span>
set <span style="color:#ff3333; font-weight:bold;">:repository</span>,  <span style="color:#996600;">&quot;git@github.com:username/project.git&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:scm</span>, <span style="color:#ff3333; font-weight:bold;">:git</span>
set <span style="color:#ff3333; font-weight:bold;">:branch</span>, <span style="color:#996600;">&quot;master&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:repository_cache</span>, <span style="color:#996600;">&quot;git_master&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:deploy_via</span>, <span style="color:#ff3333; font-weight:bold;">:remote_cache</span>
set <span style="color:#ff3333; font-weight:bold;">:scm_verbose</span>,  <span style="color:#0000FF; font-weight:bold;">true</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Two servers, double fun</span>
<span style="color:#008000; font-style:italic;"># You really don't need app, web and db here,</span>
<span style="color:#008000; font-style:italic;"># but I used all of them just to be sure.</span>
<span style="color:#008000; font-style:italic;"># Usually only web is ok.</span>
role <span style="color:#ff3333; font-weight:bold;">:app</span>, <span style="color:#996600;">&quot;first.server.address.com&quot;</span>
role <span style="color:#ff3333; font-weight:bold;">:app</span>, <span style="color:#996600;">&quot;second.server.address.com&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:primary</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span>
role <span style="color:#ff3333; font-weight:bold;">:web</span>, <span style="color:#996600;">&quot;first.server.address.com&quot;</span>
role <span style="color:#ff3333; font-weight:bold;">:web</span>, <span style="color:#996600;">&quot;second.server.address.com&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:primary</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span>
role <span style="color:#ff3333; font-weight:bold;">:db</span>, <span style="color:#996600;">&quot;first.server.address.com&quot;</span>
role <span style="color:#ff3333; font-weight:bold;">:db</span>, <span style="color:#996600;">&quot;second.server.address.com&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:primary</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span>
&nbsp;
after <span style="color:#996600;">'deploy:setup'</span>, <span style="color:#996600;">'drupal:setup'</span> <span style="color:#008000; font-style:italic;"># Here we setup the shared files directory</span>
after <span style="color:#996600;">'deploy:symlink'</span>, <span style="color:#996600;">'drupal:symlink'</span> <span style="color:#008000; font-style:italic;"># After symlinking the code we symlink the shared dirs</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Before restarting the webserver we fix all the </span>
<span style="color:#008000; font-style:italic;"># permissions and then symlink it to production</span>
before <span style="color:#996600;">'deploy:restart'</span>, <span style="color:#996600;">'mikamai:permissions:fix'</span>, <span style="color:#996600;">'mikamai:symlink:application'</span>
&nbsp;
&nbsp;
namespace <span style="color:#ff3333; font-weight:bold;">:drupal</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  <span style="color:#008000; font-style:italic;"># shared directories</span>
  task <span style="color:#ff3333; font-weight:bold;">:setup</span>, <span style="color:#ff3333; font-weight:bold;">:except</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:no_release</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span> <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    sudo <span style="color:#996600;">&quot;mkdir -p #{shared_path}/files&quot;</span>
    sudo <span style="color:#996600;">&quot;chown -R #{user}:#{user} #{deploy_to}&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># symlink shared directories</span>
  task <span style="color:#ff3333; font-weight:bold;">:symlink</span>, <span style="color:#ff3333; font-weight:bold;">:except</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:no_release</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span> <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    sudo <span style="color:#996600;">&quot;ln -s #{shared_path}/files #{latest_release}&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
namespace <span style="color:#ff3333; font-weight:bold;">:deploy</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  <span style="color:#008000; font-style:italic;"># adjusted finalize_update, removed non rails stuff</span>
  task <span style="color:#ff3333; font-weight:bold;">:finalize_update</span>, <span style="color:#ff3333; font-weight:bold;">:except</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:no_release</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span> <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    sudo <span style="color:#996600;">&quot;chmod -R g+w #{latest_release}&quot;</span> <span style="color:#9966CC; font-weight:bold;">if</span> fetch<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:group_writable</span>, <span style="color:#0000FF; font-weight:bold;">true</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  task <span style="color:#ff3333; font-weight:bold;">:restart</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    <span style="color:#008000; font-style:italic;"># nothing to do here since we're on mod-php</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
namespace <span style="color:#ff3333; font-weight:bold;">:mikamai</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  <span style="color:#008000; font-style:italic;"># symlinking to production</span>
  namespace <span style="color:#ff3333; font-weight:bold;">:symlink</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    task <span style="color:#ff3333; font-weight:bold;">:application</span>, <span style="color:#ff3333; font-weight:bold;">:except</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:no_release</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span> <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      sudo <span style="color:#996600;">&quot;rm -rf /var/www/montalbano&quot;</span>
      sudo <span style="color:#996600;">&quot;ln -s #{latest_release} /var/www/montalbano&quot;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># change ownership</span>
  namespace <span style="color:#ff3333; font-weight:bold;">:permissions</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    task <span style="color:#ff3333; font-weight:bold;">:fix</span>, <span style="color:#ff3333; font-weight:bold;">:except</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:no_release</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span> <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      sudo <span style="color:#996600;">&quot;chown -R www-data:www-data #{latest_release}&quot;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>



 ]]></content:encoded>
			<wfw:commentRss>http://tempe.st/2008/07/deploying-drupal-with-capistrano/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

