<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>chao's clips tagged capistrano</title>
    <description>Clips and Links</description>
    <link>http://www.clipclip.org/chao/clips/tag/capistrano</link>
    <item>
      <title>Capistrano &amp; EC2 Sitting in a Tree, K I S S I N G « Niblets….Simple. Less.</title>
      <link>http://www.clipclip.org/chao/clips/detail/14231</link>
      <category>capistrano, ec2, s3</category>
      <pubDate>Thu, 15 Feb 2007 04:51:37 -0000</pubDate>
      <guid>http://www.clipclip.org/chao/clips/detail/14231</guid>
      <description>&lt;div&gt;Clipped by &lt;a href="http://www.clipclip.org/chao"&gt;chao&lt;/a&gt; to &lt;span class='c2_activity_link'&gt;&lt;a href="http://www.clipclip.org/activity/view/1307/play-with-amazons-ec2"&gt;play with amazon's ec2&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;hr /&gt;    &lt;div&gt;
&lt;div id='page'&gt;
&lt;div class='content'&gt;
&lt;div class='primary'&gt;
&lt;div style='caption-side : top;color : rgb(0, 0, 0);cursor : auto;direction : ltr;empty-cells : show;font-family : &amp;apos;Lucida Grande&amp;apos;,Verdana,Arial,Sans-Serif;font-size : 11px;font-size-adjust : none;font-style : normal;font-variant : normal;font-weight : 400;letter-spacing : normal;line-height : normal;list-style-image : none;list-style-position : outside;list-style-type : disc;text-align : left;text-indent : 0px;text-transform : none;white-space : normal;word-spacing : normal;background-color: rgb(255, 255, 255);' class='item entry' id='post-13' clipisparent='true'&gt;
              &lt;!--Start Snippet
              --&gt;
&lt;div class='itemhead'&gt;
&lt;h3&gt;
                  &lt;a href='http://niblets.wordpress.com/2007/02/12/capistrano-ec2-sitting-in-a-tree-k-i-s-s-i-n-g/' title='Permanent Link to &amp;quot;Capistrano &amp;amp; EC2 Sitting in a Tree, K I S S I N&amp;nbsp;G&amp;quot;' rel='bookmark'&gt;
Capistrano &amp;amp; EC2 Sitting in a Tree, K I S S I N&amp;nbsp;G&lt;/a&gt;
                &lt;/h3&gt;
&lt;div class='chronodata'&gt;12Feb07&lt;/div&gt;
                &lt;!-- The following two sections are for a noteworthy plugin currently in alpha. They'll get cleaned up and integrated better 
                --&gt;
              &lt;/div&gt;
&lt;div class='itemtext'&gt;
&lt;div class='snap_preview'&gt;
&lt;p&gt;I am using &lt;a href='http://www.google.com/url?sa=t&amp;amp;ct=res&amp;amp;cd=1&amp;amp;url=http%3A%2F%2Faws.amazon.com%2Fec2&amp;amp;ei=UGHQRa_jC4KIgASjnfjuAQ&amp;amp;usg=__XpnmdcvMg8ZzXrEkjLsW-XapHKE=&amp;amp;sig2=b4Zf1Dnwj7fsy-lrI5Zq7g'&gt;
EC2&lt;/a&gt; to host my soon-to-launch &lt;a href='http://www.quizical.net/' title='Quizical'&gt;Quizical.net&lt;/a&gt;
application. Its great.&lt;/p&gt;
&lt;p&gt;I use &lt;a href='http://www.google.com/url?sa=t&amp;amp;ct=res&amp;amp;cd=3&amp;amp;url=http%3A%2F%2Fwiki.rubyonrails.org%2Frails%2Fpages%2FCapistrano&amp;amp;ei=5GDQReD3C4mCgASmz7XnAQ&amp;amp;usg=__XlT-06l9btMt_M8HeV4XegnLdnk=&amp;amp;sig2=2Q6cwWCRgQpLCLWawbe4CQ'&gt;
capistrano&lt;/a&gt; to manage these EC2 instances. With these tasks, I
have automated many sets of EC2 commands into simple rake
tasks.&lt;/p&gt;
&lt;p&gt;For instance, to launch an instance, I can type…&lt;/p&gt;
&lt;p&gt;
                    &lt;code&gt;rake ec2:run id=ami-61a54008&lt;/code&gt;
                  &lt;/p&gt;
&lt;p&gt;. ..and a minute or two later I have a new instance running.&lt;/p&gt;
&lt;p&gt;Then to install my rails app, I type…&lt;/p&gt;
&lt;p&gt;
                    &lt;code&gt;cap initial_install&lt;/code&gt;
                  &lt;/p&gt;
&lt;p&gt;…which&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;patches this instance with things I need;&lt;/li&gt;
&lt;li&gt;starts my litespeed web server;&lt;/li&gt;
&lt;li&gt;installs my app from subversion;&lt;/li&gt;
&lt;li&gt;creates my databases;&lt;/li&gt;
&lt;li&gt;writes my database.yaml&lt;/li&gt;
&lt;li&gt;runs my migrations&lt;/li&gt;
&lt;li&gt;imports my database from S3&lt;/li&gt;
&lt;li&gt;restarts my server&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So in a few minutes, I’ve got my app running on a newly
commissioned server! Awesome.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
              &lt;!--End Snippet
              --&gt;
            &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;style type='text/css'&gt;
/* Start import from: http://s.wordpress.com/wp-content/themes/pub/unsleepable/style.css */

div#c2_inner_14050  h3{
font-family: &amp;apos;Lucida Grande&amp;apos;, Verdana, Arial, Sans-Serif; 
}
div#c2_inner_14050 .primary h3{ 
font-size: 2.2em;
font-weight: normal;
letter-spacing: -1px;
display: inline;
}
div#c2_inner_14050 .itemhead {
margin-top: 10px;
}
div#c2_inner_14050 .chronodata {
margin-left: 3px !important;
padding: 0;
color: #ccc !important;
font-family: Helvetica, Arial, Sans-Serif !important;
letter-spacing: -1px;
font-weight: bold;
font-size: 23px;
text-transform: lowercase;
display: inline;
}
div#c2_inner_14050 .primary .item .itemtext {
font: 1.2em Trebuchet MS ; 
text-align: left;
color: #333;
padding-bottom: 1px;
background: url(&amp;apos;images/break.gif&amp;apos;) bottom left repeat-x;
line-height: 150% !important;
margin-bottom: 2px;
}
div#c2_inner_14050 a {
color: #DA1071;
border-bottom: none;
text-decoration: none !important;
}
div#c2_inner_14050 .itemtext a{
color: #DA1071;
text-decoration: none !important;
font-weight: normal;
}
div#c2_inner_14050 .itemtext a:hover{
color: #DA1071!important;
text-decoration: underline!important;
font-weight: normal;
}
div#c2_inner_14050 code {
font: 1.3em &amp;apos;Courier New&amp;apos;, Courier, Fixed;
display:block; 
overflow:auto; 
text-align:left; 
background:#efefef; 
border:1px solid #A6B0BF; 
}
div#c2_inner_14050 .itemtext ul{
list-style-type: none !important;
}
div#c2_inner_14050 .itemtext ul li{
list-style-type: none !important;
}

/* End import from: http://s.wordpress.com/wp-content/themes/pub/unsleepable/style.css */
&lt;/style&gt;
    &lt;/div&gt;


</description>
      <author>chao</author>
    </item>
    <item>
      <title>Testing and Debugging Ruby on Rails: Running Tests on Deploy with Capistrano</title>
      <link>http://www.clipclip.org/chao/clips/detail/8349</link>
      <category>capistrano, testing</category>
      <pubDate>Tue, 05 Sep 2006 02:24:15 -0000</pubDate>
      <guid>http://www.clipclip.org/chao/clips/detail/8349</guid>
      <description>&lt;div&gt;Clipped by &lt;a href="http://www.clipclip.org/chao"&gt;chao&lt;/a&gt; to &lt;span class='c2_activity_link'&gt;&lt;a href="http://www.clipclip.org/activity/view/44/develop-a-ruby-on-rails-web-app"&gt;develop a ruby on rails web app&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;hr /&gt;
&lt;div&gt;
&lt;div class="single-post" id="primary"&gt;
&lt;div class="inside"&gt;
&lt;div class="primary" clipisparent="true" style="caption-side : top;color : rgb(51, 51, 51);cursor : auto;direction : ltr;empty-cells : show;font-family : &amp;quot;Lucida Grande&amp;quot;,&amp;quot;Lucida Sans Unicode&amp;quot;,&amp;quot;Lucida Sans&amp;quot;,Verdana,Arial,sans-serif;font-size : 11px;font-size-adjust : none;font-style : normal;font-variant : normal;font-weight : 400;letter-spacing : normal;line-height : normal;list-style-image : none;list-style-position : outside;list-style-type : disc;text-align : start;text-indent : 0px;text-transform : none;white-space : normal;word-spacing : normal;background-color: rgb(255, 255, 255);"&gt;
                            &lt;!--Start Snippet
              --&gt;
&lt;p&gt;I was shocked to discover that Capistrano doesn’t run the tests
by default on deploy. The coolest part of capistrano isn’t even
turned on. Beyond that, it’s not even documented in &lt;a href="http://manuals.rubyonrails.com/read/book/17"&gt;the capistrano
manual&lt;/a&gt;. So, i’m here to fill the gap.&lt;/p&gt;
The first thing to do is a task for running the tests.
&lt;pre&gt;
&lt;code&gt;
desc "Run the full tests on the deployed app." 
task :run_tests do
 run "cd #{release_path} &amp;amp;&amp;amp; rake db:test:prepare" 
 run "cd #{release_path} &amp;amp;&amp;amp; rake" 
end

desc "Run pre-symlink tasks" 
task :before_symlnk do
  run_tests
end&lt;/code&gt;
&lt;/pre&gt;
              &lt;!--End Snippet
              --&gt;
            &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;div#c2_inner_8336  p, div#c2_inner_8336  pre{ margin: 1em 0pt; }
div#c2_inner_8336 a { color: rgb(153, 0, 0); }
div#c2_inner_8336 p { line-height: 1.75em; }&lt;/style&gt;
    </description>
      <author>chao</author>
    </item>
    <item>
      <title>Capistrano - shared resources</title>
      <link>http://www.clipclip.org/chao/clips/detail/8262</link>
      <category>capistrano</category>
      <pubDate>Sat, 02 Sep 2006 18:02:38 -0000</pubDate>
      <guid>http://www.clipclip.org/chao/clips/detail/8262</guid>
      <description>&lt;div&gt;Clipped by &lt;a href="http://www.clipclip.org/chao"&gt;chao&lt;/a&gt; to &lt;span class='c2_activity_link'&gt;&lt;a href="http://www.clipclip.org/activity/view/44/develop-a-ruby-on-rails-web-app"&gt;develop a ruby on rails web app&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;hr /&gt;
&lt;div&gt;
&lt;div id="container"&gt;
&lt;div id="page"&gt;
&lt;div id="content"&gt;
&lt;div class="atomentry" id="article-68" clipisparent="true" style="caption-side : top;color : rgb(0, 0, 0);cursor : auto;direction : ltr;empty-cells : show;font-family : &amp;quot;lucida grande&amp;quot;,verdana,arial,helvetica,sans-serif;font-size : 12px;font-size-adjust : none;font-style : normal;font-variant : normal;font-weight : 400;letter-spacing : normal;line-height : normal;list-style-image : none;list-style-position : outside;list-style-type : disc;text-align : left;text-indent : 0px;text-transform : none;white-space : normal;word-spacing : normal;"&gt;
                &lt;!--Start Snippet
                --&gt;
&lt;h2 class="title"&gt;
                  &lt;a href="http://6brand.com/articles/2006/08/03/converting-a-rails-app-to-capistrano-deployment"&gt;
Converting a Rails App to Capistrano deployment&lt;/a&gt;
                &lt;/h2&gt;
&lt;p class="author"&gt;Posted by &lt;cite&gt;Danger&lt;/cite&gt; &lt;abbr class="published" title="2006-08-03T13:27:00-07:00"&gt;
                    &lt;span class="typo_date" title="Thu, 03 Aug 2006 20:27:00 GMT"&gt;29 days
ago&lt;/span&gt;
                  &lt;/abbr&gt;
                &lt;/p&gt;
&lt;div class="admin-tools" id="admin-tools-post" style="display: none;"&gt;
                  &lt;a href="http://6brand.com/admin/content/edit" name="admin_article" class="admintools" id="admin_article"&gt;Edit
this post&lt;/a&gt;
                &lt;/div&gt;

&lt;div class="content"&gt;
&lt;p&gt;I’ve got one client for whom I’m building a Rails app and I
started it long before I knew anything about Capistrano. Mostly
things are pretty straightforward and all is working as it should -
but there are a couple of hangups.&lt;/p&gt;
&lt;h1&gt;Shared Resources&lt;/h1&gt;
&lt;p&gt;My site allows users to upload portraits of themselves. These
are kept right in the open in the public directory under a folder
named “portraits”. They can also upload films, documents, etc.
using the model Documents which stores its stuff in
./public/documents.&lt;/p&gt;
&lt;p&gt;The first real hassle of converting to capistrano was dealing
with these because up until now I’ve kept them in the SVN
repository for fear of losing any data and pisisng off a user. With
the number of deployments I do I no longer want to put these files
in the repository but that would remove them from the site.
Capistrano does a fresh checkout each time it deploys and if
something’s not in SVN then it just plain doesn’t make it back into
the app.&lt;/p&gt;
&lt;p&gt;Capistrano does allow the use of a shared folder located above
the live app directory. The trick is getting stuff into there and
making sure that capistrano can recognize it every time I
deploy.&lt;/p&gt;
&lt;h1&gt;My Solution&lt;/h1&gt;
&lt;div class="extended"&gt;
&lt;p&gt;It turns out the Capistrano allows highly configurable
deployment options. All I needed to do was to move the folders out
of ./public and into shared&lt;/p&gt;
&lt;div class="typocode"&gt;
&lt;pre&gt;
&lt;code class="typocode_default"&gt;mv ./public/documents ../shared/
mv ./public/portraits ../shared/&lt;/code&gt;
&lt;/pre&gt;
                    &lt;/div&gt;
&lt;p&gt;then edit my deploy script so it links those folders up into
each new public directory&lt;/p&gt;
&lt;div class="typocode"&gt;
&lt;pre&gt;
&lt;code class="typocode_default"&gt;task :after_update_code do
  %w{documents portraits}.each do |share|
    run "ln -s #{shared_path}/#{share} #{release_path}/public/#{share}"
  end
end&lt;/code&gt;
&lt;/pre&gt;
                    &lt;/div&gt;
&lt;p&gt;It didn’t take long for me to realize that I needed to do the
same with any other file that wouldn’t be in SVN. For me, this is
my database.yml file and cofig/environment.rb file&lt;/p&gt;
&lt;div class="typocode"&gt;
&lt;pre&gt;
&lt;code class="typocode_default"&gt;task :after_update_code do
  %w{documents portraits}.each do |share|
    run "ln -s #{shared_path}/#{share} #{release_path}/public/#{share}"
  end
  %w{database.yml environment.rb}.each do |config|
    run "ln -nfs #{shared_path}/#{config} #{release_path}/config/#{config}"
  end
end&lt;/code&gt;
&lt;/pre&gt;
                    &lt;/div&gt;
&lt;p&gt;There’s actually a number of tasks that you could add this code
to. You could put it right into the deploy task by using &lt;code&gt;task
:deploy&lt;/code&gt; or you could make it run immediately after deploy is
run by &lt;code&gt;task :after_deploy&lt;/code&gt;
                    &lt;/p&gt;
&lt;p&gt;So far so good with Capistrano.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
                &lt;!--End Snippet
                --&gt;
              &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;div#c2_inner_8250 #content h1, div#c2_inner_8250  #content h2{ font-family: &amp;quot;lucidamac bold&amp;quot;,&amp;quot;lucida grande&amp;quot;,arial,sans-serif; letter-spacing: -1px; }
div#c2_inner_8250 #content h1 { margin: 0pt 0pt 0.3em; font-size: 24px; }
div#c2_inner_8250 #content h2 { margin: 0pt 0pt 0.3em; font-size: 22px; }
div#c2_inner_8250 #content p { margin: 0pt 0pt 1.2em; line-height: 15px; }
div#c2_inner_8250 #content code { font-family: &amp;quot;bitstream vera sans mono&amp;quot;,monaco,&amp;quot;lucida console&amp;quot;,&amp;quot;courier new&amp;quot;,courier,serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal; }
div#c2_inner_8250 #content pre { margin: 0.9em 0pt; padding: 8px; background: rgb(0, 0, 0) none repeat scroll 0%; overflow: auto; color: rgb(99, 255, 0); -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-family: &amp;quot;bitstream vera sans mono&amp;quot;,monaco,&amp;quot;lucida console&amp;quot;,&amp;quot;courier new&amp;quot;,courier,serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal; }
div#c2_inner_8250 #content .atomentry .title { margin: 0pt; font-size: 24px; line-height: 94%; letter-spacing: -1.5px; }
div#c2_inner_8250 #content .atomentry .title a:link, div#c2_inner_8250  #content .atomentry .title a:visited { color: rgb(153, 51, 0); text-decoration: none; }
div#c2_inner_8250 #content .atomentry .title a:hover, div#c2_inner_8250  #content .atomentry .title a:active { background: transparent none repeat scroll 0%; color: rgb(0, 0, 0); -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; }
div#c2_inner_8250 #content .atomentry .author { margin: 0pt 0pt 1em; color: rgb(187, 187, 187); font-family: &amp;quot;lucidamac bold&amp;quot;,&amp;quot;lucida grande&amp;quot;,arial,verdana,sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 16px; line-height: 14px; font-size-adjust: none; font-stretch: normal; letter-spacing: -1px; }
div#c2_inner_8250 #content .atomentry .author abbr { font-weight: bold; color: rgb(170, 170, 170); }
div#c2_inner_8250 #content .atomentry .content {  }
div#c2_inner_8250   #content pre { background: rgb(238, 238, 238) none repeat scroll 0%; color: rgb(0, 0, 0); -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; }
div#c2_inner_8250 abbr { border: medium none ; }
div#c2_inner_8250 cite { font-style: normal; }
div#c2_inner_8250 a:link, div#c2_inner_8250  a:visited { color: rgb(153, 0, 0); }
div#c2_inner_8250 a:hover, div#c2_inner_8250  a:active { background: transparent none repeat scroll 0%; color: rgb(0, 0, 255); -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; }&lt;/style&gt;
    </description>
      <author>chao</author>
    </item>
  </channel>
</rss>
