<?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>Alastair&#039;s Axioms &#187; svn</title>
	<atom:link href="http://blog.alastairdawson.com/category/svn/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.alastairdawson.com</link>
	<description>Flex, Ruby, etc. etc.</description>
	<lastBuildDate>Thu, 11 Feb 2010 19:28:16 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Subversion with a custom port on OS X</title>
		<link>http://blog.alastairdawson.com/2008/01/02/subversion-with-a-custom-port-on-os-x/</link>
		<comments>http://blog.alastairdawson.com/2008/01/02/subversion-with-a-custom-port-on-os-x/#comments</comments>
		<pubDate>Wed, 02 Jan 2008 21:59:45 +0000</pubDate>
		<dc:creator>Alastair</dc:creator>
				<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://blog.vixiom.com/2008/01/02/subversion-with-a-custom-port-on-os-x/</guid>
		<description><![CDATA[Setting up subversion to checkout and over a custom port number is one of those tasks that I do once every six months, and immediately forget, then I waste time a&#8217;Googling to find it again.
Open up subversion&#8217;s config file
mate /Users/myuser/.subversion/config
Then find the section marked [tunnels], and add a line naming your custom port (replacing &#8216;1234&#8242; [...]]]></description>
			<content:encoded><![CDATA[<p>Setting up subversion to checkout and over a custom port number is one of those tasks that I do once every six months, and immediately forget, then I waste time a&#8217;Googling to find it again.</p>
<p>Open up subversion&#8217;s config file</p>
<pre class="textmate-source"><span class="text text_plain"><span class="meta meta_paragraph meta_paragraph_text">mate /Users/myuser/.subversion/config</span></span></pre>
<p>Then find the section marked [tunnels], and add a line naming your custom port (replacing &#8216;1234&#8242; with the port number)</p>
<pre class="textmate-source"><span class="text text_plain"><span class="meta meta_paragraph meta_paragraph_text">myproject = ssh -p 1234</span></span></pre>
<p>Then when you checkout your project you replace svn+ssh with svn+myproject</p>
<pre class="textmate-source"><span class="text text_plain"><span class="meta meta_paragraph meta_paragraph_text">svn checkout svn+myproject://myuser@mydomain.com/home/myuser/data/svn/myproject/trunk .</span></span></pre>
<p>That&#8217;s it!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.alastairdawson.com/2008/01/02/subversion-with-a-custom-port-on-os-x/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Remove a project from subversion control</title>
		<link>http://blog.alastairdawson.com/2007/06/07/remove-a-project-from-subversion-control/</link>
		<comments>http://blog.alastairdawson.com/2007/06/07/remove-a-project-from-subversion-control/#comments</comments>
		<pubDate>Thu, 07 Jun 2007 16:48:04 +0000</pubDate>
		<dc:creator>Alastair</dc:creator>
				<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://blog.vixiom.com/2007/06/07/remove-a-project-from-subversion-control/</guid>
		<description><![CDATA[About twice a year I need to completely remove a project from svn, I can never find/remember the snippet so I&#8217;m posting it on the internets.
# to remove svn from an existing app
find . -name .svn -print0 &#124; xargs -0 rm -rf
]]></description>
			<content:encoded><![CDATA[<p>About twice a year I need to completely remove a project from svn, I can never find/remember the snippet so I&#8217;m posting it on the internets.</p>
<pre class="textmate-source"><span class="text text_plain"><span class="meta meta_paragraph meta_paragraph_text"># to remove svn from an existing app
find . -name .svn -print0 | xargs -0 rm -rf</span></span></pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.alastairdawson.com/2007/06/07/remove-a-project-from-subversion-control/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to: Ignore all files in a directory (folder) with subversion</title>
		<link>http://blog.alastairdawson.com/2007/02/21/how-to-ignore-all-files-in-a-directory-folder-with-subversion/</link>
		<comments>http://blog.alastairdawson.com/2007/02/21/how-to-ignore-all-files-in-a-directory-folder-with-subversion/#comments</comments>
		<pubDate>Wed, 21 Feb 2007 21:41:35 +0000</pubDate>
		<dc:creator>Alastair</dc:creator>
				<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://blog.vixiom.com/2007/02/21/how-to-ignore-all-files-in-a-directory-folder-with-subversion/</guid>
		<description><![CDATA[The ignore command for subversion can be confusing. Ignoring certain files types is pretty easy:
$ svn propset svn:ignore "*.log" log
but ignoring folders is tricky and was giving me headaches for a while. I was using file_column (in Rails) to save uploaded photos and whenever I did a svn status I would get a list of [...]]]></description>
			<content:encoded><![CDATA[<p>The ignore command for subversion can be confusing. Ignoring certain files types is pretty easy:</p>
<pre class="textmate-source"><span class="text text_plain"><span class="meta meta_paragraph meta_paragraph_text">$ svn propset svn:ignore "*.log" log</span></span></pre>
<p>but ignoring folders is tricky and was giving me headaches for a while. I was using file_column (in Rails) to save uploaded photos and whenever I did a svn status I would get a list of all my test uploads:</p>
<pre class="textmate-source"><span class="text text_plain"><span class="meta meta_paragraph meta_paragraph_text">?      public/photo/filename/106
?      public/photo/filename/116
?      public/photo/filename/126
?      public/photo/filename/117
?      public/photo/filename/127
?      public/photo/filename/128
?      public/photo/filename/129</span></span></pre>
<p>Which made it hard to find files I wanted to add. Here&#8217;s how to ignore a directory:</p>
<pre class="textmate-source"><span class="text text_plain"><span class="meta meta_paragraph meta_paragraph_text">svn propset svn:ignore "*" public/photo/</span></span></pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.alastairdawson.com/2007/02/21/how-to-ignore-all-files-in-a-directory-folder-with-subversion/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>MT GS RoR A-Z: The complete guide to Rails on Media Temple&#8217;s Grid Server</title>
		<link>http://blog.alastairdawson.com/2007/02/18/mt-ror-a-z-the-complete-guide-to-getting-rails-running-on-media-temple/</link>
		<comments>http://blog.alastairdawson.com/2007/02/18/mt-ror-a-z-the-complete-guide-to-getting-rails-running-on-media-temple/#comments</comments>
		<pubDate>Mon, 19 Feb 2007 03:52:08 +0000</pubDate>
		<dc:creator>Alastair</dc:creator>
				<category><![CDATA[Capistrano]]></category>
		<category><![CDATA[Media Temple]]></category>
		<category><![CDATA[Mongrel]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://blog.vixiom.com/2007/02/18/mt-ror-a-z-the-complete-guide-to-getting-rails-running-on-media-temple/</guid>
		<description><![CDATA[This tutorial will walk you through setting up everything you need to deploy Rails apps on Media Temple&#8217;s Grid Server. The information on each part of the setup is available elsewhere but I thought it would be helpful to have it all in one place. The tutorial will cover setting up a rails container, creating [...]]]></description>
			<content:encoded><![CDATA[<p>This tutorial will walk you through setting up everything you need to deploy Rails apps on Media Temple&#8217;s Grid Server. The information on each part of the setup is available elsewhere but I thought it would be helpful to have it all in one place. The tutorial will cover <a href="#setup">setting up a rails container</a>, <a href="#keys">creating ssh keys</a> on the server, <a href="#rails">installing rails</a>, <a href="#svn">creating a subversion repository</a>, and <a href="#cap">deploying your app with Capistrano</a>. </p>
<p>Prerequisites: You have a (gs) hosting account setup, a SSH client (OS X Terminal.app or <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/">PuTTy</a> if you use Windows), and no fear of Unix commands.</p>
<p>Throughout the tutorial I&#8217;ll be calling the rails app &#8216;myapp&#8217; replace that with the name of your application and &#8216;mydomain.com&#8217; replace that with your domain. </p>
<p><a name="setup" id="setup"></a>1. SETUP THE RAILS CONTAINER</p>
<p>Log into your Media Temple account center and click on the &#8216;GridContainers&#8217; control  </p>
<p><img src="http://blog.vixiom.com/uploads/mtgsaz/gridContainers.png" width="254" height="192" /></p>
<p>In the Container List click &#8216;manage&#8217; on the Ruby on Rails container</p>
<p><img src="http://blog.vixiom.com/uploads/mtgsaz/manage.png" alt="" width="755" height="156" /></p>
<p>Enable the container by clicking &#8216;enable container&#8217;</p>
<p><img src="http://blog.vixiom.com/uploads/mtgsaz/enableContainer.png" width="762" height="259" /></p>
<p>Select &#8216;(gs) Container Base&#8217;  if you app will require the base amount of RAM, from experience unless you&#8217;re doing processor intensive things like resizing very large images with RMagick the base container will be fine.</p>
<p><img src="http://blog.vixiom.com/uploads/mtgsaz/baseContainer.png" width="762" height="195" /></p>
<p><img src="http://blog.vixiom.com/uploads/mtgsaz/serverAdmin.png" width="260" height="59" align="right" />Confirm the selection on the next page and then wait for your container to be enabled (takes about 5 min). Once you have the container enabled go back the main control panel, click &#8216;Server Administrator&#8217; and make sure you have SSH enabled. </p>
<p><img src="http://blog.vixiom.com/uploads/mtgsaz/enableSSH.png" width="762" height="230" /></p>
<p><img src="http://blog.vixiom.com/uploads/mtgsaz/manageDatabases.png" width="250" height="58" align="right" />Since this is a Rails app you&#8217;ll most likely need a database, go back to the main control panel and click &#8216;Manage Databases&#8217; </p>
<p>Click &#8216;Add A Database&#8217;</p>
<p><img src="http://blog.vixiom.com/uploads/mtgsaz/add_db.png" width="768" height="75" /></p>
<p> Then in the &#8216;Specify Your Database Name&#8217; field enter &#8216;myapp_production&#8217; it&#8217;s actual name will then be db#{sitenumber}_myapp_production (sitenumber being your MT site number). Choose MySQL or PostgreSQL from &#8216;Select Database Type&#8217; and click next. </p>
<p><img src="http://blog.vixiom.com/uploads/mtgsaz/db.png" alt="" width="763" height="292" /></p>
<p>The container is set up, next up SSH Keys.</p>
<p><a name="keys" id="keys"></a>2. SSH KEYS</p>
<p>SSH keys will allow you to log into your server without a password; &quot;wait, no password, isn&#8217;t that insecure?&quot; actually it&#8217;s more secure as long as you and only you have access to your local machine. Although SSH is very secure it&#8217;s still possible (though unlikely) for your password to be intercepted when you login. Setting up SSH keys, as the name implies, creates a key on the server that maps to your local machine (a known host), you then no longer have to enter your password when you login in which is safer and requires less memorizing and typing (my two least favorite things!).</p>
<p>Fire up the OS X Terminal (or PuTTy), once it launches you&#8217;ll be in your home directory. Type</p>
<pre><code>$ ssh-keygen -t dsa</code></pre>
<p>that will generate the keys on your local machine, change into the .ssh directory</p>
<pre><code>$ cd .ssh</code></pre>
<p>and copy the keys to your server (replacing &#8216;mydomain&#8217; with your domain) </p>
<pre><code>$ scp id_dsa.pub serveradmin%mydomain@mydomain:./id_dsa.pub
</code></pre>
<p>log into your server the old fashioned way </p>
<pre><code>$ ssh serveradmin%mydomain@mydomain</code></pre>
<p>then setup the keys and make sure no other users can read them (each command on a seperate line)</p>
<pre><code>$ mkdir .ssh
$ cd .ssh
$ touch authorized_keys2
$ chmod 600 authorized_keys2
$ cat ../id_dsa.pub &gt;&gt; authorized_keys2
$ rm ../id_dsa.pub</code></pre>
<p>Now when you login you won&#8217;t be asked for your password.</p>
<p><a name="rails" id="rails"></a>3. INSTALL RAILS</p>
<p>Log in (or remain logged in to) the server using you brand new keys.</p>
<p>Then setup another option to save typing your password over and over. </p>
<pre><code>$ mtr generate_config</code></pre>
<p>entering your username (serveradmin%mydomain@mydomain) and password. Then set up ruby gems (each command on a seperate line). </p>
<pre><code>$ mtr setup_rubygems
$ source ~/.bash_profile
$ gem update --system --source=<span class="markup markup_underline markup_underline_link">http://gems.mediatemple.net/</span></code></pre>
<p>then install rails NOTE: running Rails 2.0 as a RubyGem is not yet supported see <a href="http://kb.mediatemple.net/article.php?id=787">this article</a></p>
<pre><code>$ gem install rails -y</code></pre>
<p>and the appropriate database driver, for MySQL</p>
<pre><code>$ gem install mysql --source=<span class="markup markup_underline markup_underline_link">http://gems.mediatemple.net/</span></code></pre>
<p>or for PostgreSQL</p>
<pre><code>$ gem install postgres --source=<span class="markup markup_underline markup_underline_link">http://gems.mediatemple.net/</span></code></pre>
<p>Next install Mongrel</p>
<pre><code>gem install mongrel --source=http://gems.mediatemple.net -v 1.1.1</code></pre>
<p>If you wanted to you  could now create a Rails app on the server, but first we&#8217;ll create a subversion repository&#8230;</p>
<p>  <a name="svn" id="svn"></a>4. SETUP A SUBVERSION REPOSITORY</p>
<p>Subversion is a great tool for tracking changes to an application when working with a team of developers or even or your own. You can roll back code to a previous revision and avoid overwriting another person&#8217;s work. On your Media Temple server change into your home directory then into the &#8216;data&#8217; directory.</p>
<pre><code>$ cd $home
$ cd data</code></pre>
<p>and create a &#8217;svn&#8217; directory.</p>
<pre><code>$ mkdir svn</code></pre>
<p>Subversion is already installed on Media Temple so creating a repository is a one line affair</p>
<pre><code>$ svnadmin create --fs-type fsfs svn/repository</code></pre>
<p>That will create the &#8216;repository&#8217; inside of the svn directory, next we set up the standard directories for Subversion. You need to type the complete path to your repository when adding directories. First find out your site number</p>
<pre><code>$ pwd</code></pre>
<p>This will spit out something like</p>
<pre><code>/home/123/users/.home/data</code></pre>
<p>&#8216;123&#8242; is your site number.  In the command below replace mysitenum with that number (Note: using the backslash character means you can type multiple lines before issuing the command). </p>
<pre><code>$ svn mkdir --message=&quot;Setting up the directories...&quot; &#92;
&gt; file:///home/mysitenum/data/svn/repository/trunk &#92;
&gt; file:///home/mysitenum/data/svn/repository/tags &#92;
&gt; file:///home/mysitenum/data/svn/repository/branches</code></pre>
<p>Running that command also commited your first revision to the repository (that was easy). The &#8211;message option lets others know what changes happened during a revision.</p>
<p>You can now load a rails app into your repository. On your <strong>local machine</strong> change into the rails app for the site you&#8217;re working with.</p>
<pre><code>$ cd path/to/my/app</code></pre>
<p>You&#8217;ll know if you&#8217;re in the right place if you type &#8216;ls&#8217; and get a list of rails folders </p>
<pre><code>$ ls
README          components      doc             public          tmp
Rakefile        config          lib             script          vendor
app             db              log             test</code></pre>
<p>Subversion stores revisions in the &#8216;trunk&#8217; check that out into your rails app (making sure to change mydomain.com and mysitenum to your variables). Note: the &#8216;.&#8217; after trunk is required (it means do this here) </p>
<pre><code>$ svn checkout svn+ssh://serveradmin%<strong>mydomain.com</strong>@<strong>mydomain.com</strong>/home/<strong>mysitenum</strong>/data/svn/repository/trunk .</code></pre>
<p>Before we commit any files to the repository we should set some files to be ignored, like logs. First add all the files </p>
<pre><code>$ svn add *</code></pre>
<p>Then set the files you want to ignore </p>
<pre><code>$ svn propset svn:ignore &quot;*.log&quot; log
$ svn revert log/*</code></pre>
<p>Now you can commit your site to the repository </p>
<pre><code>$ svn commit --message=&quot;Ini Rails App.&quot;</code></pre>
<p>And update your code just to be sure you&#8217;re on the latest revision </p>
<pre><code>$ svn update</code></pre>
<p>You should get a message &#8216;At revision 2.&#8217;. Your app is now under version control! And the best reason to have it under version control is&#8230; Capistrano.</p>
<p><a name="cap" id="cap"></a>5. DEPLOYMENT WITH CAPISTRANO</p>
<p>Capistrano makes deploying your app as easy as typing one line, but first you need to set it up. Again on your <strong>local machine</strong> install Capistrano [UPDATE] Some people have had problems with Capistrano 2.0, I&#8217;ve changed the command to install 1.4  [/UPDATE]</p>
<pre><code>$ sudo gem install capistrano -v 1.4.0</code></pre>
<p>Then install Media Temple&#8217;s Capistrano </p>
<pre><code>$ gem install mt-capistrano --source=<span class="markup markup_underline markup_underline_link">http://gems.mediatemple.net/</span></code></pre>
<p>And apply Capistrano to your app (make sure you&#8217;re in your app&#8217;s directory, note the &#8216;.&#8217; means apply to &#8216;this&#8217; location)</p>
<pre><code>$ cap --apply-to . myapp</code></pre>
<p>Next download the Media Temple deploy recipe from <a href="http://gems.mediatemple.net/deploy.rb" target="_blank">http://gems.mediatemple.net/deploy.rb</a> (overwriting the one Capistrano made in myapp/config)  then open deploy.rb and add your app&#8217;s info (all the lines that begin with &#8217;set&#8217;): </p>
<pre><code><span class="source source_ruby source_ruby_rails"><span class="meta meta_require meta_require_ruby"><span class="keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby">require</span> <span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>mt-capistrano<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span>

set <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>site</span>,         <span class="string string_quoted string_quoted_double string_quoted_double_ruby">&quot;mysitenum&quot;</span>
set <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>application</span>,  <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">&quot;</span>myapp<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">&quot;
set <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>webpath</span>,      <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">&quot;</span>myapp.mydomain.com<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">&quot;
set <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>domain</span>,       <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">&quot;</span>mydomain.com<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">&quot;
set <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>user</span>,         <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">&quot;</span>serveradmin%mydomain.com<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">&quot;
set <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>password</span>,     <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">&quot;</span>xxxxxxxx<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">&quot;

<span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> repository on (gs)
</span>set <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>repository</span>, <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">&quot;</span>svn+ssh://<span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>user<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}@<span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>domain<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}/home/<span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>site<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}/data/svn/repository/trunk<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">&quot;

<span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> repository elsewhere
</span><span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span>set :repository, "svn+ssh://user@other.com/usr/local/svn/repo/app1/trunk"
</span><span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span>set :repository, &quot;https://other.com/usr/local/svn/repo/app1/trunk"
</span><span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span>set :svn_password, "xxxxxxx"
</span>
<span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> these shouldn't be changed
</span>role <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>web</span>, <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">&quot;</span><span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>domain<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">&quot;
role <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>app</span>, <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">&quot;</span><span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>domain<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">&quot;
role <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>db</span>,  <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">&quot;</span><span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>domain<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">&quot;, <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>primary</span> =&gt; <span class="constant constant_language constant_language_ruby">true</span>
set <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>deploy_to</span>,    <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">&quot;</span>/home/<span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>site<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}/containers/rails/<span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>application<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">&quot;

<span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span>set :migrate_env, &quot;VERSION=0&quot;
</span>
<span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span>task :after_update_code, :roles =&gt; :app do
</span><span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span>  put(File.read('deploy/database.yml.mt'), &quot;#{release_path}/config/database.yml&quot;, :mode =&gt; 0444)
</span><span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span>end
</span>
task <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>after_symlink</span>, <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>roles</span> =&gt; <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>app</span> <span class="keyword keyword_control keyword_control_ruby keyword_control_ruby_start-block">do
</span>  run <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">&quot;</span><span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>mtr<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">} -u <span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>user<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">} -p <span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>password<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">} generate_htaccess <span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>application<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">&quot;
<span class="keyword keyword_control keyword_control_ruby">end</code></pre>
<p>save the file and then modify your config/database.yml file to use the Media Temple database for your production environment. </p>
<pre><code>production:
</span>  <span class="meta meta_paragraph meta_paragraph_text">adapter: mysql
  database: db123_myapp_production
  username: db123
  password: xxxxxxxx
  host: internal-db.s123.gridserver.com</code></pre>
<p>then run a subversion status </p>
<pre><code>$ svn status</code></pre>
<p>you should see a couple of new files in there with &#8216;?&#8217; before them, that means subversion doesn&#8217;t know about them. To add them type </p>
<pre><code>$ svn add config/deploy.rb
$ svn add lib/tasks/capistrano.rake</code></pre>
<p>Then commit them to the repository and update your local copy (Note: -m is shorthand for &#8211;message). </p>
<pre><code>$ svn commit -m=&quot;config deploy.rb&quot;
$ svn update</code></pre>
<p>Now we can deploy the app so it will be live on your Grid Server domain. Run each of these commands on one line: </p>
<pre><code>$ cap mt_add
$ cap setup
$ cap update_code
$ cap symlink
$ cap migrate
$ cap mt_create_link
$ cap mt_start</code></pre>
<p>If all the commands ran succesfully go to myapp.mydomain.com and view your site! Now open myapp/public/index.html (the default ruby splash page) and change the header &lt;h1&gt; from &#8216;Welcome aboard&#8217; to &#8216;Welcome to Capistrano Deployment on MT&#8217; save the file and do a svn commit </p>
<pre><code>$ svn commit -m=&quot;welcome page header change&quot;
$ svn update</code></pre>
<p>then with your update safely in the repository you just do &#8216;cap deploy&#8217;</p>
<pre><code>$ cap deploy</code></pre>
<p>Then go check your site and see the change! Any time you make an update you want to push live commit it to subversion and then cap deploy, That&#8217;s it! </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.alastairdawson.com/2007/02/18/mt-ror-a-z-the-complete-guide-to-getting-rails-running-on-media-temple/feed/</wfw:commentRss>
		<slash:comments>85</slash:comments>
		</item>
	</channel>
</rss>
