<?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; Media Temple</title>
	<atom:link href="http://blog.alastairdawson.com/category/media-temple/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>Mosso offers &#8216;new&#8217; cloud hosting</title>
		<link>http://blog.alastairdawson.com/2008/02/19/mosso-offers-new-cloud-hosting/</link>
		<comments>http://blog.alastairdawson.com/2008/02/19/mosso-offers-new-cloud-hosting/#comments</comments>
		<pubDate>Tue, 19 Feb 2008 17:01:32 +0000</pubDate>
		<dc:creator>Alastair</dc:creator>
				<category><![CDATA[Media Temple]]></category>
		<category><![CDATA[Mosso]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[SliceHost]]></category>

		<guid isPermaLink="false">http://blog.vixiom.com/2008/02/19/mosso-offers-new-cloud-hosting/</guid>
		<description><![CDATA[I got all excited this morning reading TechCrunch with their post about Rackspace Offerering Cloud Computing with Mosso. Once I clicked through to investigate further it seems the &#8216;new&#8217; cloud hosting is just their old hosting plan with 30GB of storage slashed off (down to 50GB) so they can charge you 0.50/GB a month for [...]]]></description>
			<content:encoded><![CDATA[<p>I got all excited this morning reading TechCrunch with their post about <a href="http://www.techcrunch.com/2008/02/19/rackspace-offers-cloud-computing-with-mosso/">Rackspace Offerering Cloud Computing with Mosso</a>. Once I clicked through to investigate further it seems the &#8216;new&#8217; <a href="http://www.mosso.com/cloud.jsp">cloud hosting</a> is just their old hosting plan with 30GB of storage slashed off (down to 50GB) so they can charge you 0.50/GB a month for any overage.</p>
<p>It&#8217;s the deal of the century!? a bonus $15/month to get back to their old limit of 80GB. Still no shell access, and still $25-85/month per Rails site.</p>
<p>I had high hopes for Mosso and Rails but after trying them I felt I was being <a href="http://www.mosso.com/pricing.jsp">nickeled and dimed</a>, the lack of SSH didn&#8217;t bother me as they&#8217;re good about installing stuff for you, the kicker was $20/month if you wanted to add SSL. I also didn&#8217;t see marked speed improvements over shared (or grid) hosts like <a href="http://www.mediatemple.com">Media Temple</a> (who host this blog, but not on the grid on a VPS).</p>
<p>All my Rails sites continue to be hosted on <a href="http://www.slicehost.com">SliceHost</a>, actually my secret recipe is a combo of Media Temple for email, FTP, and static stuff then either DNS trickery or .htaccess rewrites to apps on SliceHost. The best of both worlds.</p>
<p>Anyway I call shenanigans on Mosso.</p>
<p><embed FlashVars='videoId=103481' src='http://southpark.comedycentral.com/sitewide/video_player/view/default/swf.jhtml' quality='high' bgcolor='#cccccc' width='332' height='316' name='comedy_central_player' align='middle' allowScriptAccess='always' allownetworking='external' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.alastairdawson.com/2008/02/19/mosso-offers-new-cloud-hosting/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Rails on Mosso</title>
		<link>http://blog.alastairdawson.com/2007/10/03/rails-on-mosso/</link>
		<comments>http://blog.alastairdawson.com/2007/10/03/rails-on-mosso/#comments</comments>
		<pubDate>Thu, 04 Oct 2007 02:06:38 +0000</pubDate>
		<dc:creator>Alastair</dc:creator>
				<category><![CDATA[Media Temple]]></category>
		<category><![CDATA[Mosso]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://blog.vixiom.com/2007/10/03/rails-on-mosso/</guid>
		<description><![CDATA[My non-stop quest to find decent shared Rails hosting may be complete. I was pretty pumped about Media Temple&#8217;s Grid supporting Rails but each of the half-dozen RoR sites I&#8217;ve deployed to the Grid haven&#8217;t been ripping it up performance wise. An issue with an unresolved grid error  when trying to cache pages had [...]]]></description>
			<content:encoded><![CDATA[<p>My non-stop quest to find decent shared Rails hosting may be complete. I was <a href="http://blog.vixiom.com/2006/10/12/media-temple-tames-the-beast-new-ruby-on-rails-hosting-service-with-mongrel/">pretty pumped</a> about Media Temple&#8217;s Grid supporting Rails but each of the half-dozen RoR sites I&#8217;ve deployed to the Grid haven&#8217;t been ripping it up performance wise. An issue with an <a href="http://railsforum.com/viewtopic.php?pid=14470">unresolved grid error</a>  when trying to cache pages had me scrambling to SliceHost. However SliceHost is bare bones, and system administration makes me want to shoot myself in the noggin. SliceHost did introduce me to LiteSpeed which &#8211; in my opinion &#8211; is the easiest and most stable way to deploy Rails. If I only had one app that I was working on full time SliceHost would be fine,  I use Rails mainly to build CMS solutions for my clients so I still need email, stats, ftp etc. to be easy for them (not me) to manage. The brief was to find a shared host with all the bells and whistles that runs Rails on LiteSpeed with a healthy RAM allocation. </p>
<p>The choices came down to a VPS with <a href="http://www.eleven2.com/">Eleven2</a> or <a href="http://www.mosso.com/">Mosso</a>.</p>
<p>Why I didn&#8217;t go with Eleven2: they use Cpanel, hate it. They bat .500 with user&#8217;s hosting reviews, and I&#8217;m not sure which is worse; <a href="http://forum.eleven2.com/forumdisplay.php?f=23">non-functioning forum</a>, <a href="http://forum.eleven2.com/forumdisplay.php?f=18">non-functioning server-status</a>, or a <a href="http://www.eleven2.com/kb/">knowledege base</a> that has a grand total of 17 non-sales answers, hey at least the <a href="http://www.eleven2.com/live/">office cam</a> was working (tip&#8217;o'the day: if your office cam resembles a 24/7 voyeur porn site it&#8217;s probably not boosting sales).</p>
<p>Why I went with Mosso: their custom control panel is as good as (mt)&#8217;s, rave reviews from a friend in the business, they can bill your clients directly for recurring hosting fees (second on my headache list after sysadmin), and so far their support rocks.</p>
<p>A hosting company is only as good as their support and in the first couple of days I haven&#8217;t been on hold once, two rings and in. On other hosts as soon as I uttered the words &quot;Ruby on&#8230;&quot; the fear in their voice would grow. Now not everyone at Mosso is a Rails expert, but when they said an expert would look into my problem they weren&#8217;t just trying to get me to go away. This afternoon I needed to get ImageMagick working on a Rails site, I called up support and within one hour ImageMagick was not only installed for my Rails site but for all Rails sites system wide (it should have been already, but that&#8217;s still pretty impressive!).</p>
<p>I&#8217;ll be keeping my SliceHost server for the heavy apps but everything else will make it over to Mosso (Rails, PHP, and even the two stray .NET sites I still have). $100/month plus $25 per Rails app seems expensive until you realize that any site that uses Rmagick or Typo/Mephisto on (mt) is going to require the $25 128mb upgrade anyways.</p>
<p>We&#8217;ll see how it goes but so far it&#8217;s been &quot;set it and forget it&quot; with Mosso.</p>
<p><img src="http://blog.vixiom.com/uploads/ronpopeil.jpg" width="250" height="243" /></p>
<p>PS deploying a Rails app on Mosso is pretty simple</p>
<p>1. Freeze Rails and any gems (which you should do on all shared hosts)</p>
<p>2. Upload</p>
<p>3. Reload your app in the control panel</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.alastairdawson.com/2007/10/03/rails-on-mosso/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Rails on a Media Temple (dv) server</title>
		<link>http://blog.alastairdawson.com/2007/05/26/rails-on-a-media-temple-dv-server/</link>
		<comments>http://blog.alastairdawson.com/2007/05/26/rails-on-a-media-temple-dv-server/#comments</comments>
		<pubDate>Sat, 26 May 2007 22:28:42 +0000</pubDate>
		<dc:creator>Alastair</dc:creator>
				<category><![CDATA[Media Temple]]></category>
		<category><![CDATA[Mongrel]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://blog.vixiom.com/2007/05/26/rails-on-a-media-temple-dv-server/</guid>
		<description><![CDATA[Tom at the wishlisting.com blog has a comprehensive tutorial on setting up Ruby on Rails (with a load balancer and Rmagick) on a Media Temple (dv) server. He deserves praise for installing ImageMagick without a package manager, which can turn into a marathon event of yak-shaving.
]]></description>
			<content:encoded><![CDATA[<p>Tom at the wishlisting.com blog has <a href="http://blog.wishlisting.com/?p=20">a comprehensive tutorial</a> on setting up Ruby on Rails (with a load balancer and Rmagick) on a Media Temple (dv) server. He deserves praise for installing ImageMagick without a package manager, which can turn into a marathon event of <a href="http://projects.csail.mit.edu/gsb/old-archive/gsb-archive/gsb2000-02-11.html">yak-shaving</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.alastairdawson.com/2007/05/26/rails-on-a-media-temple-dv-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stop uploaded files getting &#8216;deleted&#8217; with Capistrano</title>
		<link>http://blog.alastairdawson.com/2007/03/13/stop-uploaded-files-getting-deleted-with-capistrano/</link>
		<comments>http://blog.alastairdawson.com/2007/03/13/stop-uploaded-files-getting-deleted-with-capistrano/#comments</comments>
		<pubDate>Tue, 13 Mar 2007 18:46:27 +0000</pubDate>
		<dc:creator>Alastair</dc:creator>
				<category><![CDATA[Capistrano]]></category>
		<category><![CDATA[Media Temple]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://blog.vixiom.com/2007/03/13/stop-uploaded-files-getting-deleted-with-capistrano/</guid>
		<description><![CDATA[Here&#8217;s how to stop your site&#8217;s uploads or other static file directories disappering after doing a &#8216;cap deploy&#8217; with Capistrano. Capistrano is actually behaving exactly as it should. The problem is that the &#8216;uploads&#8217; directory is being left behind in release purgatory while the other files happily move on up to the castle in the [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s how to stop your site&#8217;s uploads or other static file directories disappering after doing a &#8216;cap deploy&#8217; with Capistrano. Capistrano is actually behaving exactly as it should. The problem is that the &#8216;uploads&#8217; directory is being left behind in release purgatory while the other files happily move on up to the castle in the sky that is the current release.</p>
<p>The solution is to have all uploads stored in a directory outside of the release system. As usual the smart folks who made Capistrano are way ahead of us, if you do a &#8216;ls&#8217; in your apps path (on your remote machine) you&#8217;ll see four directories</p>
<pre class="textmate-source"><code><span class="text text_plain"><span class="meta meta_paragraph meta_paragraph_text">$ ls
current  releases  revisions.log  shared</span></span></code></pre>
<p>&#8216;cd&#8217; into shared/system (cd shared/system) and create an uploads directory (mkdir uploads). Next create a Capistrano task in config/deploy.rb (on your local machine) that symlinks the public uploads directory in the latest release to the shared/system/uploads directory. The example below would be the task for <a href="http://blog.vixiom.com/2007/02/18/mt-ror-a-z-the-complete-guide-to-getting-rails-running-on-media-temple/" target="_blank">using Capistrano on Media Temple&#8217;s Grid Server </a>&#8230; </p>
<pre class="textmate-source"><code><span class="source source_ruby source_ruby_rails">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_update_code</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">&quot;ln -nfs /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">}</span></span>/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></span>/shared/system/uploads <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>release_path<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}</span></span>/public/uploads<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">&quot;</span></span>
<span class="keyword keyword_control keyword_control_ruby">end</span></span></code></pre>
<p>That&#8217;s it! Your uploads are now release agnostic.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.alastairdawson.com/2007/03/13/stop-uploaded-files-getting-deleted-with-capistrano/feed/</wfw:commentRss>
		<slash:comments>7</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>
