<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>David on Laptop - Home</title>
  <id>tag:www.davidlauzon.net,2008:mephisto/</id>
  <generator uri="http://mephistoblog.com" version="0.8.0">Mephisto Drax</generator>
  <link href="http://www.davidlauzon.net/feed/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://www.davidlauzon.net/" rel="alternate" type="text/html"/>
  <updated>2008-12-09T07:20:58Z</updated>
  <entry xml:base="http://www.davidlauzon.net/">
    <author>
      <name>david</name>
    </author>
    <id>tag:www.davidlauzon.net,2008-06-30:2</id>
    <published>2008-06-30T23:36:00Z</published>
    <updated>2008-12-09T07:20:58Z</updated>
    <category term="Linux"/>
    <category term="Ruby on Rails"/>
    <category term="capistrano"/>
    <category term="dreamhost"/>
    <category term="linux"/>
    <category term="rubyonrails"/>
    <link href="http://www.davidlauzon.net/2008/6/30/capistrano-2-recipe-for-dreamhost-shared-hosting-and-mod_rails" rel="alternate" type="text/html"/>
    <title>Capistrano 2 Recipe for Dreamhost Shared Hosting and mod_rails</title>
<content type="html">
            &lt;h4&gt;Introduction&lt;/h4&gt;
&lt;p&gt;I could not find an updated documentation on how to setup properly a rails application on Dreamhost, so I thought I'd share the information I gathered.. First off, thanks to the Phusion team, with &lt;a href=&quot;http://www.modrails.com/&quot;&gt;Passenger (a.k.a. mod_rails)&lt;/a&gt;, it's now very convenient, easy, and cheap to run a rails application on Dreamhost.&lt;/p&gt;

&lt;p&gt;Also, special thanks to &lt;a href=&quot;http://gabrito.com/&quot;&gt;Todd Huss&lt;/a&gt; for discovering   the &lt;a href=&quot;http://gabrito.com/post/ruby-on-rails-dreamhost-plugin&quot;&gt;multi dreamhost user hack&lt;/a&gt;. Basically, you need to run each of your rails application on Dreamhost under a different shell user. Their process monitor, will start killing your processes when the total memory per user exceeds 200 MB of virtual memory (VSZ).&lt;/p&gt;

&lt;p&gt;So here's the guide, even perfect newbees and skript-kiddies should be able to follow :&lt;/p&gt;


&lt;h4&gt;The complete step by step&lt;/h4&gt;
&lt;p&gt;&lt;b&gt;INFO&lt;/b&gt; :  Let Capistrano create the directory structure on the server BEFORE you set the public dir of your application in the edit domain section of the Control Panel. This will avoid you conflicts when Capistrano attemps to create the symlinks.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;p&gt;First, configure your new rails application using Dreamhost Control Panel :

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Create a new repository for your application (&lt;a href=&quot;/assets/2008/6/30/dreamhost_create_repository.jpg&quot;&gt;screenshot&lt;/a&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a new shell / SSH user (read why &lt;a href=&quot;http://gabrito.com/post/ruby-on-rails-dreamhost-plugin&quot;&gt;here&lt;/a&gt;) with the same name as your application  (&lt;a href=&quot;/assets/2008/6/30/dreamhost_create_user.jpg&quot;&gt;screenshot&lt;/a&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a new database (&lt;a href=&quot;/assets/2008/6/30/dreamhost_create_database.jpg&quot;&gt;screenshot&lt;/a&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;Add your application to your repository&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;Create your rails skeleton (if it's done yet), on your local machine (assuming you use *nix, but should be similar on Windows)
&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; rails myrailsapp --freeze&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
&lt;/li&gt;
&lt;li&gt;Add your application to the repository
&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; cd myrailsapp&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; svn mkdir http&lt;span class=&quot;sy&quot;&gt;:/&lt;/span&gt;/svn.myrailsappdomain/myrails/trunk&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; svn checkout http&lt;span class=&quot;sy&quot;&gt;:/&lt;/span&gt;/svn.myrailsappdomain/myrails/trunk ./&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; svn add  *&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; svn commit&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
&lt;/li&gt;

&lt;li&gt;Exclude database configuration, temporary files, and any user upload directory from the source control :
&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; svn copy config/database.yml config/database.yml.example&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; svn remove config/database.yml -f&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; svn propset svn&lt;span class=&quot;sy&quot;&gt;:ignore&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;database.yml&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; config/&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; svn remove tmp/*&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; svn propset svn&lt;span class=&quot;sy&quot;&gt;:ignore&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; tmp/&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# If you need to share unversionned user-uploaded files, between deploys :&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; mkdir public/uploads&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; svn add public/uploads&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; svn propset svn&lt;span class=&quot;sy&quot;&gt;:ignore&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; public/uploads/&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; svn remove log/*&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; svn propset svn&lt;span class=&quot;sy&quot;&gt;:ignore&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; log/&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; svn remove db/*.sqlite3&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; svn propset svn&lt;span class=&quot;sy&quot;&gt;:ignore&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*.sqlite3&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; db/&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; svn commit&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;li&gt;Next, create the Capistrano recipe :
&lt;ol&gt;
&lt;li&gt;Create recipe skeleton :
&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; cd &lt;span class=&quot;rx&quot;&gt;&lt;span class=&quot;dl&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;/&lt;/span&gt;&lt;/span&gt;to/your/myrailsapp&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; capify .&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;er&quot;&gt;[&lt;/span&gt;add] writing &lt;span class=&quot;sh&quot;&gt;&lt;span class=&quot;dl&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;./Capfile'&lt;tt&gt;
&lt;/tt&gt;[add] writing &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;`&lt;/span&gt;&lt;/span&gt;./config/deploy.rb&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;&lt;tt&gt;
&lt;/tt&gt;[done] capified!&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
&lt;/li&gt;

&lt;li&gt;Replace the content of config/deploy.rb with the following :
&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;15&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;16&lt;tt&gt;
&lt;/tt&gt;17&lt;tt&gt;
&lt;/tt&gt;18&lt;tt&gt;
&lt;/tt&gt;19&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;20&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;21&lt;tt&gt;
&lt;/tt&gt;22&lt;tt&gt;
&lt;/tt&gt;23&lt;tt&gt;
&lt;/tt&gt;24&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;25&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;26&lt;tt&gt;
&lt;/tt&gt;27&lt;tt&gt;
&lt;/tt&gt;28&lt;tt&gt;
&lt;/tt&gt;29&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;30&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;31&lt;tt&gt;
&lt;/tt&gt;32&lt;tt&gt;
&lt;/tt&gt;33&lt;tt&gt;
&lt;/tt&gt;34&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;35&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;36&lt;tt&gt;
&lt;/tt&gt;37&lt;tt&gt;
&lt;/tt&gt;38&lt;tt&gt;
&lt;/tt&gt;39&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;40&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;41&lt;tt&gt;
&lt;/tt&gt;42&lt;tt&gt;
&lt;/tt&gt;43&lt;tt&gt;
&lt;/tt&gt;44&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;45&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;46&lt;tt&gt;
&lt;/tt&gt;47&lt;tt&gt;
&lt;/tt&gt;48&lt;tt&gt;
&lt;/tt&gt;49&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;50&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;51&lt;tt&gt;
&lt;/tt&gt;52&lt;tt&gt;
&lt;/tt&gt;53&lt;tt&gt;
&lt;/tt&gt;54&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;c&quot;&gt;#############################################################&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;## General&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;#############################################################&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;set &lt;span class=&quot;sy&quot;&gt;:application&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;myrailsapp&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;#############################################################&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;## Servers &lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;#############################################################&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;set &lt;span class=&quot;sy&quot;&gt;:use_sudo&lt;/span&gt;, &lt;span class=&quot;pc&quot;&gt;false&lt;/span&gt;    &lt;span class=&quot;c&quot;&gt;# Dreamhost does not support sudo&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;set &lt;span class=&quot;sy&quot;&gt;:user&lt;/span&gt;, application  &lt;span class=&quot;c&quot;&gt;# Dreamhost SSH User&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;set &lt;span class=&quot;sy&quot;&gt;:domain&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;myrailsapp.domain.com&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;server domain, &lt;span class=&quot;sy&quot;&gt;:app&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:web&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;role &lt;span class=&quot;sy&quot;&gt;:db&lt;/span&gt;, domain, &lt;span class=&quot;sy&quot;&gt;:primary&lt;/span&gt; =&amp;gt; &lt;span class=&quot;pc&quot;&gt;true&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;#############################################################&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;## Subversion&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;#############################################################&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;set &lt;span class=&quot;sy&quot;&gt;:scm&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:subversion&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;set &lt;span class=&quot;sy&quot;&gt;:scm_user&lt;/span&gt;, application   &lt;span class=&quot;c&quot;&gt;# Sets 'my_svn_user' instead, if you are using different name than your app.&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;set &lt;span class=&quot;sy&quot;&gt;:scm_auth_cache&lt;/span&gt;, &lt;span class=&quot;pc&quot;&gt;true&lt;/span&gt;  &lt;span class=&quot;c&quot;&gt;# Prompts for password once&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;set &lt;span class=&quot;sy&quot;&gt;:scm_password&lt;/span&gt;, &lt;span class=&quot;co&quot;&gt;Proc&lt;/span&gt;.new { &lt;span class=&quot;co&quot;&gt;Capistrano&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;CLI&lt;/span&gt;.password_prompt(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;SCM password for &lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;scm_user&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;) }&lt;tt&gt;
&lt;/tt&gt;set &lt;span class=&quot;sy&quot;&gt;:repository&lt;/span&gt;,  &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;http://svn.myrailsappdomain/&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;application&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/trunk&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;set &lt;span class=&quot;sy&quot;&gt;:deploy_to&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/home/&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;user&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;domain&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# keeps a local checkout of the repository on the server to get faster deployments&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;set &lt;span class=&quot;sy&quot;&gt;:deploy_via&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:remote_cache&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;#############################################################&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;## Tasks&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;#############################################################&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;namespace &lt;span class=&quot;sy&quot;&gt;:deploy&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  desc &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;Restart Application (using tmp/restart.txt)&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  task &lt;span class=&quot;sy&quot;&gt;:restart_passenger&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    run &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;touch &lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;current_path&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/tmp/restart.txt&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;  desc &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;Restarts your application.&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  task &lt;span class=&quot;sy&quot;&gt;:restart&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    restart_passenger&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;  desc &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;Link shared files&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;c&quot;&gt;#task :before_symlink do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  before &lt;span class=&quot;sy&quot;&gt;:symlink&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    run &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;rm -drf &lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;release_path&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/public/uploads&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    run &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;ln -s &lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;shared_path&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/uploads &lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;release_path&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/public/uploads&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    run &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;rm -f &lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;release_path&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/config/database.yml&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    run &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;ln -s &lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;shared_path&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/database.yml &lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;release_path&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/config/database.yml&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
&lt;/li&gt;
&lt;/ol&gt;


&lt;li&gt;Then, prepare the directory structure on the server :
&lt;ol&gt;
&lt;li&gt;Create the Capistrano structure (releases/, shared/), by typing this on your local machine :
&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; cap deploy&lt;span class=&quot;sy&quot;&gt;:setup&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
&lt;/li&gt;

&lt;li&gt;Login to your server to manually create your shared directories and files (if any)
&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; ssh myrailsapp.domain.com&lt;tt&gt;
&lt;/tt&gt;[tootsie]&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; cd myrailsapp/shared&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
&lt;/li&gt;

&lt;li&gt;Configure your database on the server (you don't want this file in your repository) :
&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;15&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;16&lt;tt&gt;
&lt;/tt&gt;17&lt;tt&gt;
&lt;/tt&gt;18&lt;tt&gt;
&lt;/tt&gt;19&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;20&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;c&quot;&gt;# config/database.yml&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;development:&lt;tt&gt;
&lt;/tt&gt;  adapter: sqlite3&lt;tt&gt;
&lt;/tt&gt;  database: db/development.sqlite3&lt;tt&gt;
&lt;/tt&gt;  timeout: &lt;span class=&quot;i&quot;&gt;5000&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;test:&lt;tt&gt;
&lt;/tt&gt;  adapter: sqlite3&lt;tt&gt;
&lt;/tt&gt;  database: db/test.sqlite3&lt;tt&gt;
&lt;/tt&gt;  timeout: &lt;span class=&quot;i&quot;&gt;5000&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;production:&lt;tt&gt;
&lt;/tt&gt;  adapter: mysql&lt;tt&gt;
&lt;/tt&gt;  encoding: utf8&lt;tt&gt;
&lt;/tt&gt;  database: myrailsapp&lt;tt&gt;
&lt;/tt&gt;  username: myrailsapp&lt;tt&gt;
&lt;/tt&gt;  password: [your_db_password]&lt;tt&gt;
&lt;/tt&gt;  host: mysql.&lt;span class=&quot;er&quot;&gt;[&lt;/span&gt;myrailsapp.domain].com&lt;tt&gt;
&lt;/tt&gt;  timeout: &lt;span class=&quot;i&quot;&gt;5000&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
&lt;/li&gt;

&lt;li&gt;Create your upload directory (OPTIONAL) :
&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;[tootsie]&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; mkdir uploads&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
&lt;/li&gt;
&lt;/ol&gt;


&lt;li&gt;Deploy your application. Note : it will only prompt for your SVN password at the first deploy.
&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; cap deploy&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
&lt;/li&gt;

&lt;li&gt;And finally the most important, configure your domain like this :
&lt;img src=&quot;http://www.davidlauzon.net/assets/2008/6/30/dreamhost_edit_rails_domain.jpg&quot; /&gt;
&lt;/li&gt;
&lt;/ol&gt;


&lt;h4&gt;[UPDATE 2008/07/01] &lt;/h4&gt;
&lt;p&gt;If you need to install custom gems on your account, you can find more info &lt;a href=&quot;http://wiki.dreamhost.com/index.php/RubyGems&quot; title=&quot;Dreamhost Wiki : Installing your own gems and RubyGems&quot;&gt;here&lt;/a&gt;, &lt;a href=&quot;http://nateclark.com/articles/2006/10/20/dreamhost-your-own-packages-and-gems&quot; title=&quot;installing your own packages and gems&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://rails.dreamhosters.com/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;References&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://labs.peritor.com/webistrano/wiki/ConfigurationParameter&quot;&gt;http://labs.peritor.com/webistrano/wiki/ConfigurationParameter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://groups.google.ca/group/capistrano/browse_thread/thread/6ef7c7c212547eab&quot;&gt;http://groups.google.ca/group/capistrano/browse_thread/thread/6ef7c7c212547eab (for scm_password)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://groups.google.com/group/capistrano/browse_thread/thread/ae7b16a16abf4e5d&quot;&gt;http://groups.google.com/group/capistrano/browse_thread/thread/ae7b16a16abf4e5d (for task hookups with namespaces)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://groups.google.com/group/capistrano/web/deploying-on-dreamhost&quot;&gt;http://groups.google.com/group/capistrano/web/deploying-on-dreamhost&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://gabrito.com/post/ruby-on-rails-dreamhost-plugin&quot;&gt;http://gabrito.com/post/ruby-on-rails-dreamhost-plugin&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.railsforum.com/viewtopic.php?id=8118&quot;&gt;http://www.railsforum.com/viewtopic.php?id=8118&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://wiki.dreamhost.com/Capistrano&quot;&gt;Dreamhost Wiki : Capistrano&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://wiki.dreamhost.com/Ruby_on_Rails&quot;&gt;Dreamhost Wiki : Ruby_on_Rails&lt;/a&gt;&lt;li&gt;
&lt;li&gt;&lt;a href=&quot;http://manuals.rubyonrails.com/read/chapter/97&quot;&gt;Capistrano Manual&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
          </content>  </entry>
  <entry xml:base="http://www.davidlauzon.net/">
    <author>
      <name>david</name>
    </author>
    <id>tag:www.davidlauzon.net,2008-06-02:1</id>
    <published>2008-06-02T21:29:00Z</published>
    <updated>2008-06-18T21:31:15Z</updated>
    <link href="http://www.davidlauzon.net/2008/6/2/hello" rel="alternate" type="text/html"/>
    <title>Hello !</title>
<content type="html">
            I am David Lauzon, a freelance web developer since February 2005. I am usually based in Montréal (QC, Canada), but I will be blogging from &lt;a href=&quot;http://maps.google.com/maps?f=q&amp;amp;hl=en&amp;amp;q=Chang+Moi,+Thailand&amp;amp;sll=18.798581,98.991451&amp;amp;sspn=0.03697,0.063257&amp;amp;ie=UTF8&amp;amp;cd=2&amp;amp;geocode=0,18.795565,98.998720&amp;amp;ll=18.798418,98.997717&amp;amp;spn=0.03697,0.063257&amp;amp;z=14&amp;amp;iwloc=addr&quot;&gt;Chiang Mai&lt;/a&gt; (Thailand) for the following months.&lt;br /&gt;
&lt;br /&gt;
I will be writing about Ruby on Rails, Web 2.0, Linux, and general IT developments. I also will be releasing open source code here, so stay tuned !
          </content>  </entry>
</feed>
