<?xml version="1.0" encoding="UTF-8"?>
<OAI-PMH xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.openarchives.org/OAI/2.0/">
  <responseDate>2010-03-11T05:57:17Z</responseDate>
  <request identifier="oai:kete.net.nz:documentation:Topic:130" verb="GetRecord" metadataPrefix="oai_dc">http://kete.net.nz/documentation/topics/show/130-deploy-to-your-production-host-with-capistrano</request>
  <GetRecord>
    <record>
      <header>
        <identifier>oai:kete.net.nz:documentation:Topic:130</identifier>
        <datestamp>2009-05-15T02:14:21Z</datestamp>
      </header>
      <metadata>
        <oai_dc:dc xmlns:dcterms="http://purl.org/dc/terms/" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/">
          <dc:identifier>http://kete.net.nz/documentation/topics/show/130-deploy-to-your-production-host-with-capistrano</dc:identifier>
          <dc:title>Deploy to Your Production Host with Capistrano</dc:title>
          <dc:publisher>kete.net.nz</dc:publisher>
          <dc:description><![CDATA[Optional, but recommended best practice for Kete applications. After setting up your production host to be ready to be deployed to, the steps necessary to use Capistrano to deploy to your production host.]]></dc:description>
          <dc:description><![CDATA[Originally written by Walter McGinnis, Kete Project Lead for Katipo Communications, Ltd.
Part of the Installation Guide

This step assumes you have done all previous steps to prepare your production host, or "target" in Capistrano lingo.  You might also want to check out capify.org for reference, specifically Getting Started: Rails.  There is also a wiki that may be useful as a reference.
One key thing to remember, it's the point of Capistrano really, is that you are running all the commands in your_app directory on your development machine, unless otherwise noted.
But enough reading, let's get to it.
First up, capify your app.  This usually means running one command, then editing the resulting deploy.rb file to point at your svn repository, production host, etc.  However, Kete includes a partially preconfigured  Capistrano 2 Capfile and config/deploy.rb to simplify the process. You will still need to edit config/deploy.rb with a text editor and change the following settings to make sense for you:
:application # i.e. your_app, corresponds to directory name you are deploying from
:repository # this is your project subversion repository, i.e. ssh://your_git_host/your_path_to_your_repository/your_app.gitrole :app # your host address, ip or domain
role :web # same if you are deploying to only one host as i assume you are
role :db # same if you are deploying to only one host as i assume you are
:mongrel_servers # this is how many mongrel instances in your mongrel cluster, see note below about nginx and mongrel
Important Note: remember to match your mongrel settings in deploy.rb to what you have set up in  your Nginx conf file!
Also note that for ssh you will probably want to set up ssh key in the repository host's user account.  So you'll need to do a keygen on your target and copy that to your repository user's .ssh/authorized_keys for your target host and user.
Because our target hasn't been deployed to before, we have a few extra steps than normal to get our environment on that machine setup, but these are all wrapped up in one command (although it may take quite awhile):
You'll want to commit your config/deploy.rb to version control, then your ready to deploy:
$ git add config/deploy.rb$ git commit -m "adding our project's specific deployment configuration details"$ git push origin master$ cap deploy:first_time
From now on (there are exceptions, for example if you have to install new gems or editing your mongrel settings), you just do the following to update your target (from your_app directory on your development machine):
$ cap deploy:update
You are now ready to visit your new site!  Proceed to Configuration.]]></dc:description>
          <dc:date>2008-01-06T16:54:41Z</dc:date>
          <dc:creator>Walter McGinnis</dc:creator>
          <dc:creator>walter</dc:creator>
          <dc:contributor>Walter McGinnis</dc:contributor>
          <dc:contributor>walter</dc:contributor>
          <dc:contributor>Kieran P</dc:contributor>
          <dc:contributor>kieran</dc:contributor>
          <dc:contributor>James Stradling</dc:contributor>
          <dc:contributor>jstradling</dc:contributor>
          <dc:description/>
          <dc:subject><![CDATA[Re: cap deploy]]></dc:subject>
          <dc:relation>http://kete.net.nz/documentation/comments/show/52</dc:relation>
          <dc:subject><![CDATA[Deploying to a server with an SSH that isn't 22]]></dc:subject>
          <dc:relation>http://kete.net.nz/documentation/comments/show/91</dc:relation>
          <dc:subject><![CDATA[Debug Capistrano connections with Capistrano Shell]]></dc:subject>
          <dc:relation>http://kete.net.nz/documentation/web_links/show/74</dc:relation>
          <dc:subject><![CDATA[Installation]]></dc:subject>
          <dc:relation>http://kete.net.nz/documentation/topics/show/114</dc:relation>
          <dc:type>InteractiveResource</dc:type>
          <dc:subject><![CDATA[Kete]]></dc:subject>
          <dc:subject><![CDATA[Installation]]></dc:subject>
          <dc:subject><![CDATA[install]]></dc:subject>
          <dc:subject><![CDATA[setup]]></dc:subject>
          <dc:subject><![CDATA[documentation]]></dc:subject>
          <dc:subject><![CDATA[deployment]]></dc:subject>
          <dc:subject><![CDATA[capistrano]]></dc:subject>
          <dc:subject><![CDATA[production]]></dc:subject>
          <dc:subject><![CDATA[svn]]></dc:subject>
          <dc:subject><![CDATA[ssh]]></dc:subject>
          <dc:rights>http://creativecommons.org/licenses/by-sa/3.0/nz/</dc:rights>
          <dc:format>text/html</dc:format>
          <dc:coverage>Topic</dc:coverage>
        </oai_dc:dc>
      </metadata>
      <kete>
        <related_items comments="2" topics="1" web_links="1"/>
      </kete>
    </record>
  </GetRecord>
</OAI-PMH>
