<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>railsify =&#62; true</title>
	<atom:link href="http://codalicious.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://codalicious.wordpress.com</link>
	<description>Coding examples from my projects.</description>
	<lastBuildDate>Tue, 12 Oct 2010 10:40:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='codalicious.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>railsify =&#62; true</title>
		<link>http://codalicious.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://codalicious.wordpress.com/osd.xml" title="railsify =&#62; true" />
	<atom:link rel='hub' href='http://codalicious.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Upgrading to Ruby 1.9.2 with rvm (1st step in moving to rails 3)</title>
		<link>http://codalicious.wordpress.com/2010/10/07/upgrading-to-ruby-1-9-2-via-rvm/</link>
		<comments>http://codalicious.wordpress.com/2010/10/07/upgrading-to-ruby-1-9-2-via-rvm/#comments</comments>
		<pubDate>Thu, 07 Oct 2010 10:24:13 +0000</pubDate>
		<dc:creator>frixl</dc:creator>
				<category><![CDATA[Server and Deployment]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rvm]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[upgrade]]></category>
		<category><![CDATA[version 1.9.2]]></category>

		<guid isPermaLink="false">http://codalicious.wordpress.com/?p=92</guid>
		<description><![CDATA[A short walkthrough on how to install rvm and upgrade ruby to 1.9.2 in preparation to upgrading a rails app to 3.0<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codalicious.wordpress.com&amp;blog=13468218&amp;post=92&amp;subd=codalicious&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you have read my previous posts, you know I installed ruba 1.9.1, which as it turns out has some issues. To be honest, I had a lot of trouble with my rails 2.3.8 app running on ruby 1.9.1, especially when it came to encoding. I know there are many ideas how to solve that, but none really worked for me.</p>
<p>I will gladly upgrade my ruby to 1.9.2 which is one of the rubies on which rails 3.0.0 is supoorted.</p>
<p>Check my ruby version:</p>
<p><pre class="brush: plain;">
~# ruby -v
ruby 1.9.1p378 (2010-01-10 revision 26273) [i686-linux]
</pre></p>
<p>HINT: Don&#8217;t do this as root, as the paths we are using are user path which are slightly different for root! (But do it with sufficient privileges)</p>
<p>Install rvm:</p>
<p><em>Following two recipes: http://rvm.beginrescueend.com/rvm/install/  |   http://beyondtc.wordpress.com/2010/04/06/installing-rvm-on-debian-lenny/</em></p>
<p><pre class="brush: plain;">
~# &lt;em&gt;bash &lt; &lt;(curl  http://rvm.beginrescueend.com/releases/rvm-install-latest) &lt;/em&gt;
</pre></p>
<p>This give you some installation related output and an OS-specific readme. On a MAC you will have to add a lign at the bottom of your .bashrc or.bash_profile file depending on your setup. (my .bashrc was in etc/). Here I am working on my Server and so I get the notes for linux. Basically rvm requires git and curl. I do have those. You&#8217;ll get more instructions for using JRUBY, MRI &amp; ree and IronRuby. I don&#8217;t care for now. Let&#8217;s go on and be shure rvm is the freshest version available:</p>
<p><pre class="brush: plain;">
~# rvm update
~# rvm reload
</pre></p>
<p>Now we need to need to edit our .bashrc to correctly load the rvm scripts:</p>
<p>If you havent done anything different you should already be in <code>/home/&lt;username&gt;/</code></p>
<p>check if your .bashrc is where it is supposed to:</p>
<p><pre class="brush: plain;">
~# cat .bashrc
</pre></p>
<p>If it is there, edit it:</p>
<p><pre class="brush: plain;">
~# nano .bashrc
</pre></p>
<p>On debian you will find the following line:</p>
<p><pre class="brush: plain;">
[ -z &quot;$PS1&quot; ] &amp;&amp; return
</pre></p>
<p>Comment the out and add the following at the end of the file:</p>
<p><pre class="brush: plain;">
if [[ -s /home/&lt;YOUR-USERNAME&gt;/.rvm/scripts/rvm ]]; then
 source /home/&lt;YOUR-USERNAME&gt;/.rvm/scripts/rvm
fi
</pre></p>
<p>now logout and in again&#8230;</p>
<p>To check your setup try this:<br />
<pre class="brush: plain;">
~# type rvm | head -n1
rvm is a function
</pre></p>
<p>If you see something different go over the instructions on http://rvm.beginrescueend.com/rvm/install/</p>
<p>Run</p>
<p><pre class="brush: plain;">

~# rvm notes
</pre></p>
<p>to install the dependencies for you OS.</p>
<p>You should be all set!</p>
<p>Installing a new ruby is as easy as:<br />
<pre class="brush: plain;">
rvm install ruby-1.9.2-p0</pre></p>
<p> Check all rubies managed by rvm:<br />
<pre class="brush: plain;">~# rvm list
rvm rubies

=&gt; ruby-1.9.2-p0 [ i386 ]
</pre></p>
<p>current ruby:</p>
<p><pre class="brush: plain;">~# ruby -v
ruby 1.9.1p378 (2010-01-10 revision 26273) [i686-linux]
</pre></p>
<p>Switch ruby</p>
<p><pre class="brush: plain;">~# rvm 1.9.2
</pre></p>
<p><pre class="brush: plain;">~# ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]
</pre></p>
<p> Now be aware, that each version of ruby has its own set of gems.<br />
<pre class="brush: plain;">~# gem list

*** LOCAL GEMS ***

bundler (1.0.2)
rake (0.8.7)

</pre></p>
<p> That&#8217;s all we have. Now set the new default:<br />
<pre class="brush: plain;">~# rvm --default 1.9.2

~# rvm list default
Default Ruby (for new shells)

 ruby-1.9.2-p0 [ i386 ]
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codalicious.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codalicious.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codalicious.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codalicious.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codalicious.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codalicious.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codalicious.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codalicious.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codalicious.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codalicious.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codalicious.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codalicious.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codalicious.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codalicious.wordpress.com/92/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codalicious.wordpress.com&amp;blog=13468218&amp;post=92&amp;subd=codalicious&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codalicious.wordpress.com/2010/10/07/upgrading-to-ruby-1-9-2-via-rvm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e24e1775b6922227c27031fee61ae21c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">frixl</media:title>
		</media:content>
	</item>
		<item>
		<title>Setup a VPS for Rails – Part 4: Deploy with Capistrano</title>
		<link>http://codalicious.wordpress.com/2010/06/21/setup-a-vps-for-rails-%e2%80%93-part-4-deploy-with-capistrano/</link>
		<comments>http://codalicious.wordpress.com/2010/06/21/setup-a-vps-for-rails-%e2%80%93-part-4-deploy-with-capistrano/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 10:57:35 +0000</pubDate>
		<dc:creator>frixl</dc:creator>
				<category><![CDATA[Server and Deployment]]></category>

		<guid isPermaLink="false">http://codalicious.wordpress.com/?p=31</guid>
		<description><![CDATA[We had capistrano installed already, right? Cool, so all we need is our remote repository and capistrano. I am strictly following the basic instructions here: http://www.capify.org/index.php/From_The_Beginning However, I already have a populated db, so I am leaving out that part. I end up with a very basic Capfile: The deploy.rb file has all the magic:<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codalicious.wordpress.com&amp;blog=13468218&amp;post=31&amp;subd=codalicious&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>We had capistrano installed already, right? Cool, so all we need is our remote repository and capistrano.</p>
<p>I am strictly following the basic instructions here: http://www.capify.org/index.php/From_The_Beginning</p>
<p>However, I already have a populated db, so I am leaving out that part.</p>
<p>I end up with a very basic Capfile:</p>
<p><pre class="brush: ruby;">
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }

load 'config/deploy' # remove this line to skip loading any of the default tasks
</pre></p>
<p>The deploy.rb file has all the magic:</p>
<p><pre class="brush: ruby;">
set :application, &quot;my_app&quot;

set :scm, :git
set :repository,  &quot;git@github.com:username/softwareclick.git&quot;
set :scm_username, &quot;username&quot;
set :scm_passphrase, &quot;Password!&quot;

set :deploy_to, &quot;/path_to_my_app&quot;

set :server_name, &quot;123.456.78.9&quot;
server &quot;123.456.78.9&quot;, :app, :web, :db, :primary =&gt; true

set :user, &quot;root&quot;
set :use_sudo, false

# If you are using Passenger mod_rails uncomment this:
# if you're still using the script/reapear helper you will need
# these http://github.com/rails/irs_process_scripts

namespace :deploy do
   task :start do ; end
   task :stop do ; end
   task :restart, :roles =&gt; :app, :except =&gt; { :no_release =&gt; true } do
     run &quot;#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}&quot;
   end
end
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codalicious.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codalicious.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codalicious.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codalicious.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codalicious.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codalicious.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codalicious.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codalicious.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codalicious.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codalicious.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codalicious.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codalicious.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codalicious.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codalicious.wordpress.com/31/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codalicious.wordpress.com&amp;blog=13468218&amp;post=31&amp;subd=codalicious&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codalicious.wordpress.com/2010/06/21/setup-a-vps-for-rails-%e2%80%93-part-4-deploy-with-capistrano/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e24e1775b6922227c27031fee61ae21c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">frixl</media:title>
		</media:content>
	</item>
		<item>
		<title>ArgumentError: A key is required to write a cookie</title>
		<link>http://codalicious.wordpress.com/2010/06/21/argumenterror-a-key-is-required-to-write-a-cookie/</link>
		<comments>http://codalicious.wordpress.com/2010/06/21/argumenterror-a-key-is-required-to-write-a-cookie/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 08:53:00 +0000</pubDate>
		<dc:creator>frixl</dc:creator>
				<category><![CDATA[Server and Deployment]]></category>

		<guid isPermaLink="false">http://codalicious.wordpress.com/?p=80</guid>
		<description><![CDATA[If you get this, when starting up your first http request: &#62;&#62; app.get(&#8220;/&#8221;) ArgumentError: A key is required to write a cookie containing the session data. Use config.action_controller.session = { :key =&#62; &#8220;_myapp_session&#8221;, :secret =&#62; &#8220;some secret phrase&#8221; } in config/environment.rb &#8230;you are a victim of missing cookie session storage information in your environment.rb. 1. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codalicious.wordpress.com&amp;blog=13468218&amp;post=80&amp;subd=codalicious&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you get this, when starting up your first http request:</p>
<p>&gt;&gt; app.get(&#8220;/&#8221;)<br />
ArgumentError: A key is required to write a cookie containing the session data. Use config.action_controller.session = { :key =&gt; &#8220;_myapp_session&#8221;, :secret =&gt; &#8220;some secret phrase&#8221; } in config/environment.rb</p>
<p>&#8230;you are a victim of missing cookie session storage information in your environment.rb.<br />
1. Get a cool secret key:<br />
<pre class="brush: plain;">
rake secret
</pre></p>
<p>2. Throw this in your environment.rb<br />
<pre class="brush: ruby;">
# A key is required to write a cookie containing the session data. 
  config.action_controller.session = { :key =&gt; &quot;_appname_session&quot;, :secret =&gt; &quot;the_secret_key_rake_gave_ya&quot; }
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codalicious.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codalicious.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codalicious.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codalicious.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codalicious.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codalicious.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codalicious.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codalicious.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codalicious.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codalicious.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codalicious.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codalicious.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codalicious.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codalicious.wordpress.com/80/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codalicious.wordpress.com&amp;blog=13468218&amp;post=80&amp;subd=codalicious&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codalicious.wordpress.com/2010/06/21/argumenterror-a-key-is-required-to-write-a-cookie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e24e1775b6922227c27031fee61ae21c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">frixl</media:title>
		</media:content>
	</item>
		<item>
		<title>Upgrade git on server from source (tar.gz) &#8211; Get rid of the &#8220;Usage Eror&#8221; when deploying your app</title>
		<link>http://codalicious.wordpress.com/2010/06/21/upgrade-git-on-server-from-source-tar-gz-get-rid-of-the-usage-eror-when-deploying-your-app/</link>
		<comments>http://codalicious.wordpress.com/2010/06/21/upgrade-git-on-server-from-source-tar-gz-get-rid-of-the-usage-eror-when-deploying-your-app/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 08:11:30 +0000</pubDate>
		<dc:creator>frixl</dc:creator>
				<category><![CDATA[Server and Deployment]]></category>

		<guid isPermaLink="false">http://codalicious.wordpress.com/?p=66</guid>
		<description><![CDATA[So this is from the long list of tiny troubles you can run into on your way to deploying your app: Once you ran cap deploy:update (more about the steps to deployment later) you might find this in your output: In my case, it was a git version problem. The debian default at the time [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codalicious.wordpress.com&amp;blog=13468218&amp;post=66&amp;subd=codalicious&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So this is from the long list of tiny troubles you can run into on your way to deploying your app:</p>
<p>Once you ran cap deploy:update (more about the steps to deployment later) you might find this in your output:<br />
<pre class="brush: plain;">

...

** [216.194.126.4 :: out] Usage: /usr/bin/git-checkout [-f] [-b &amp;lt;new_branch&amp;gt;] [-m] [&amp;lt;branch&amp;gt;] [&amp;lt;paths&amp;gt;...]
command finished
*** [deploy:update_code] rolling back
...

</pre><br />
In my case, it was a git version problem. The debian default at the time of writing was 1.4.4 and that seems to not understand my syntax. No worries! Just upgrade!</p>
<p>First remove the old version:<br />
<pre class="brush: plain;">
apt-get remove git-core git-svn git-doc
</pre></p>
<p>Then install the latest version (it&#8217;s 1.7.1 at the time of writing but check for yourself on http://git-scm.com/)<br />
<pre class="brush: plain;">
aptitude install build-essential gettext
wget http://kernel.org/pub/software/scm/git/git-1.7.1.tar.gz
tar xvzf git-1.7.1.tar.gz
cd git-1.7.1
./configure
make
make install
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codalicious.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codalicious.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codalicious.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codalicious.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codalicious.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codalicious.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codalicious.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codalicious.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codalicious.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codalicious.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codalicious.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codalicious.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codalicious.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codalicious.wordpress.com/66/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codalicious.wordpress.com&amp;blog=13468218&amp;post=66&amp;subd=codalicious&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codalicious.wordpress.com/2010/06/21/upgrade-git-on-server-from-source-tar-gz-get-rid-of-the-usage-eror-when-deploying-your-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e24e1775b6922227c27031fee61ae21c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">frixl</media:title>
		</media:content>
	</item>
		<item>
		<title>Product RSS-Feed for Google Base</title>
		<link>http://codalicious.wordpress.com/2010/06/16/product-rss-feed-for-google-base/</link>
		<comments>http://codalicious.wordpress.com/2010/06/16/product-rss-feed-for-google-base/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 20:56:36 +0000</pubDate>
		<dc:creator>frixl</dc:creator>
				<category><![CDATA[Rails Coding]]></category>

		<guid isPermaLink="false">http://codalicious.wordpress.com/?p=48</guid>
		<description><![CDATA[So this is somewhat in the middle of a project. I have a product db which is all activerecord. Creating an RSS &#8211; Feed out of that is really easy: Since Rails 2.0 there is no more need for the respond_to block in your controller. Just name the view accordingly to conventions: e.g: index.xml.builder (if [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codalicious.wordpress.com&amp;blog=13468218&amp;post=48&amp;subd=codalicious&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So this is somewhat in the middle of a project. I have a product db which is all activerecord. Creating an RSS &#8211; Feed out of that is really easy:</p>
<p>Since Rails 2.0 there is no more need for the respond_to block in your controller. Just name the view accordingly to conventions:</p>
<p>e.g: index.xml.builder (if you just create an rss feed go for index.rss.builder! google just requires the filename to end on xml, that&#8217;s why)</p>
<p>The only slightly wicked thing in this is the declaration of the google namespace (line 3) and the use of that namespace in the attributes.</p>
<p><pre class="brush: ruby;">
xml.instruct! :xml, :version =&amp;gt; &quot;1.0&quot;, :encoding =&amp;gt; &quot;UTF-8&quot;
  xml.rss(:version =&amp;gt; '2.0', :&quot;xmlns:g&quot;=&amp;gt;&quot;http://base.google.com/ns/1.0&quot;) do
    xml.channel do
      xml.title 'Software-Click_Products'
      xml.link 'http://www.software-click.com'
      xml.description 'Software-Click offers a broad range of software products.'
      xml.language &quot;en_us&quot;
      xml.ttl &quot;40&quot;
      xml.pubDate(Time.now.strftime(&quot;%a, %d %b %Y %H:%M:%S %Z&quot;))
      @products.each do |product|
        xml.item do
          xml.description(product.desc_en)
          xml.g :id, &quot;#{product.id}&quot;
          xml.link(product.url)
          xml.g :price, &quot;#{product.price}&quot;
          xml.title(product.name)
          xml.g :brand, &quot;#{product.vendor}&quot;
          xml.g :imagelink, &quot;#{product.box}&quot;
          xml.g :product_type, &quot;software &amp;gt; #{product.category_id}&quot;
          xml.g :format, 'download'
          xml.g :condition, 'new'
       end
     end
  end
end
</pre></p>
<p>For completeness-sake this is the index &#8211; action in my controller (the limit is just for testing):</p>
<p><pre class="brush: ruby;">
def index
 @products = Product.find(:all, :limit =&gt; 2)
end
&lt;pre&gt;</pre></p>
<p>That is all that&#8217;s needed. And I thought it would be far more time consuming than that.<br />
Loving Rails for that!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codalicious.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codalicious.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codalicious.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codalicious.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codalicious.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codalicious.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codalicious.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codalicious.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codalicious.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codalicious.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codalicious.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codalicious.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codalicious.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codalicious.wordpress.com/48/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codalicious.wordpress.com&amp;blog=13468218&amp;post=48&amp;subd=codalicious&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codalicious.wordpress.com/2010/06/16/product-rss-feed-for-google-base/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e24e1775b6922227c27031fee61ae21c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">frixl</media:title>
		</media:content>
	</item>
		<item>
		<title>Setup a VPS for Rails – Part 4: Setup SFTP (group and user) on your debian shared host</title>
		<link>http://codalicious.wordpress.com/2010/06/15/setup-sftp_on_debian_shared_host/</link>
		<comments>http://codalicious.wordpress.com/2010/06/15/setup-sftp_on_debian_shared_host/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 09:17:34 +0000</pubDate>
		<dc:creator>frixl</dc:creator>
				<category><![CDATA[Server and Deployment]]></category>

		<guid isPermaLink="false">http://codalicious.wordpress.com/?p=38</guid>
		<description><![CDATA[To make work a little more convenient let&#8217;s use sftp on the shared host. Create a sft user group hostname:~# groupadd sftp-users Create the user that will be added to that group hostname:~# adduser sftp-misterx Add the new user to the sftp group hostname:~# adduser sftp-username sftp_users # We installed open-ssh earlier, if you haven&#8217;t: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codalicious.wordpress.com&amp;blog=13468218&amp;post=38&amp;subd=codalicious&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="color:#999999;">To make work a little more convenient let&#8217;s use sftp on the shared host.</span></p>
<h4><span style="color:#999999;"><span style="color:#000000;">Create a sft user group</span><br />
</span></h4>
<p><span style="color:#000000;">hostname:~#</span> <span style="color:#ff0000;">groupadd sftp-users</span></p>
<h4><span style="color:#000000;">Create the user that will be added to that group</span></h4>
<p><span style="color:#000000;">hostname:~#</span> <span style="color:#ff0000;">adduser sftp-misterx</span></p>
<h4><span style="color:#000000;">Add the new user to the sftp group</span></h4>
<p>hostname:~# <span style="color:#ff0000;">adduser sftp-username sftp_users</span></p>
<p><span style="color:#999999;"># We installed open-ssh earlier, if you haven&#8217;t: </span></p>
<p><span style="color:#999999;"># apt-get install  openssh-server</span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codalicious.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codalicious.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codalicious.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codalicious.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codalicious.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codalicious.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codalicious.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codalicious.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codalicious.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codalicious.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codalicious.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codalicious.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codalicious.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codalicious.wordpress.com/38/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codalicious.wordpress.com&amp;blog=13468218&amp;post=38&amp;subd=codalicious&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codalicious.wordpress.com/2010/06/15/setup-sftp_on_debian_shared_host/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e24e1775b6922227c27031fee61ae21c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">frixl</media:title>
		</media:content>
	</item>
		<item>
		<title>Setup a VPS for Rails – Part 3: Postgresql Restore the old tables</title>
		<link>http://codalicious.wordpress.com/2010/05/05/setup-a-vps-for-rails-%e2%80%93-part-3-postgresql-restore-the-old-tables/</link>
		<comments>http://codalicious.wordpress.com/2010/05/05/setup-a-vps-for-rails-%e2%80%93-part-3-postgresql-restore-the-old-tables/#comments</comments>
		<pubDate>Wed, 05 May 2010 20:01:27 +0000</pubDate>
		<dc:creator>frixl</dc:creator>
				<category><![CDATA[Server and Deployment]]></category>

		<guid isPermaLink="false">http://codalicious.wordpress.com/?p=16</guid>
		<description><![CDATA[If you are like me, you started out on a shared host and already have some data. (90K+ in my case &#8230;) Hopefully you created a dump from the old Postgres DB which holds the structure and data. I was using the export feature of phpPgAdmin to get my dump. In order to get all [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codalicious.wordpress.com&amp;blog=13468218&amp;post=16&amp;subd=codalicious&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><em><span style="color:#888888;">If you are like me, you started out on a shared host and already have some data. (90K+ in my case &#8230;)<br />
</span></em></p>
<p><em><span style="color:#888888;">Hopefully you created a dump from the old Postgres DB which holds the structure and data. I was using the export feature of phpPgAdmin to get my dump. In order to get all structure and sequences you need to dump the entire db, not just the tables.<br />
</span></em></p>
<p><em><span style="color:#888888;">This is the basic command that did it for me:<br />
</span></em></p>
<pre>postgres@hostname:/home/dumps$ <span style="color:#ff0000;">psql swc_prod &lt; /home/dumps/dump.sql<em>
</em></span>
<em><span style="color:#808080;">Please make sure you create the same user
and role on the new server as used in the dump befor you start the import.

So now, let's see what we got!
1. Show list of users for the postgres database:
</span></em>postgres@hostname:/root$ <span style="color:#ff0000;">psql -d dbname_prod</span>
dbname_prod-# <span style="color:#ff0000;">\du</span><img src="///tmp/Terminal%20%E2%80%94%20ssh%20%E2%80%94%2080%C3%9724.jpg" alt="" />

<a href="http://codalicious.files.wordpress.com/2010/05/terminal-e28094-ssh-e28094-80c39724-1.jpg"><img class="alignleft size-medium wp-image-25" title="Postgres - psql : List of db users" src="http://codalicious.files.wordpress.com/2010/05/terminal-e28094-ssh-e28094-80c39724-1.jpg?w=300&#038;h=75" alt="Postgres - psql : List of db users" width="300" height="75" /></a>

<em><span style="color:#808080;">

Now list the tables:</span></em>
<pre>dbname_prod-# <span style="color:#ff0000;">\dt

<a href="http://codalicious.files.wordpress.com/2010/05/terminal-e28094-ssh-e28094-80c39724-2.jpg"><img class="alignleft size-full wp-image-26" title="Postgresql - psql: list tables in db" src="http://codalicious.files.wordpress.com/2010/05/terminal-e28094-ssh-e28094-80c39724-2.jpg?w=630" alt="Postgresql - psql: list tables in db"   /></a></span></pre>
<p><em><span style="color:#888888;"></p>
<p></span></em><br />
<em><span style="color:#888888;"><br />
</span></em></p>
<p><em><span style="color:#888888;"></span></em></p>
<p><em><span style="color:#888888;"># For those who hack: I have actually re-done</span></em></p>
<p><em><span style="color:#888888;">it with different names, users and settings.</span></em><br />
<em> </em></pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codalicious.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codalicious.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codalicious.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codalicious.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codalicious.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codalicious.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codalicious.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codalicious.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codalicious.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codalicious.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codalicious.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codalicious.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codalicious.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codalicious.wordpress.com/16/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codalicious.wordpress.com&amp;blog=13468218&amp;post=16&amp;subd=codalicious&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codalicious.wordpress.com/2010/05/05/setup-a-vps-for-rails-%e2%80%93-part-3-postgresql-restore-the-old-tables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e24e1775b6922227c27031fee61ae21c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">frixl</media:title>
		</media:content>

		<media:content url="http://codalicious.files.wordpress.com/2010/05/terminal-e28094-ssh-e28094-80c39724-1.jpg?w=300" medium="image">
			<media:title type="html">Postgres - psql : List of db users</media:title>
		</media:content>

		<media:content url="http://codalicious.files.wordpress.com/2010/05/terminal-e28094-ssh-e28094-80c39724-2.jpg" medium="image">
			<media:title type="html">Postgresql - psql: list tables in db</media:title>
		</media:content>
	</item>
		<item>
		<title>Setup a VPS for Rails &#8211; Part 2: Install and configure Postgresql</title>
		<link>http://codalicious.wordpress.com/2010/05/04/setup-a-vps-for-rails-part-2-install_and_configure_postgresql/</link>
		<comments>http://codalicious.wordpress.com/2010/05/04/setup-a-vps-for-rails-part-2-install_and_configure_postgresql/#comments</comments>
		<pubDate>Tue, 04 May 2010 16:44:28 +0000</pubDate>
		<dc:creator>frixl</dc:creator>
				<category><![CDATA[Server and Deployment]]></category>

		<guid isPermaLink="false">http://codalicious.wordpress.com/?p=7</guid>
		<description><![CDATA[Install Postgresql hostname:# apt-get install postgresql-8.1 postgresql-server-dev-8.1 Reading package lists&#8230; Done &#8230; After unpacking 14.6MB of additional disk space will be used. Do you want to continue [Y/n]? Y WARNING: The following packages cannot be authenticated! &#8230; Install these packages without verification [y/N]? y &#8230; Give user postgres a password hostname:# su postgres postgres@softwareclick:/root$ psql [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codalicious.wordpress.com&amp;blog=13468218&amp;post=7&amp;subd=codalicious&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Install Postgresql</h2>
<p>hostname:# <span style="color:#ff0000;">apt-get install postgresql-8.1 </span><span style="color:#ff0000;">postgresql-server-dev-8.1</span><br />
<span style="color:#0000ff;">Reading package lists&#8230; Done<br />
&#8230;<br />
After unpacking 14.6MB of additional disk space will be used.</span><br />
Do you want to continue [Y/n]?<span style="color:#ff0000;"> Y</span></p>
<p><span style="color:#0000ff;">WARNING: The following packages cannot be authenticated!<br />
&#8230;</span><br />
Install these packages without verification [y/N]? <span style="color:#ff0000;">y</span></p>
<p><span style="color:#0000ff;">&#8230;</span></p>
<h3><span style="color:#000000;">Give user postgres a password</span></h3>
<p>hostname:# <span style="color:#ff0000;">su postgres</span></p>
<p>postgres@softwareclick:/root$ <span style="color:#ff0000;">psql -d template1 -U postgres</span></p>
<p>could not change directory to &#8220;/root&#8221;</p>
<p>Welcome to psql 8.1.19, the PostgreSQL interactive terminal.</p>
<p>Type:  \copyright for distribution terms</p>
<p>\h for help with SQL commands</p>
<p>\? for help with psql commands</p>
<p>\g or terminate with semicolon to execute query</p>
<p>\q to quit</p>
<p>template1=# <span style="color:#ff0000;">alter user postgres with password &#8216;YOURPW&#8217;</span>;</p>
<p><em><span style="color:#808080;"># Now that feels better, user postgres has a password! </span></em></p>
<p>template1=# <span style="color:#ff0000;">\q</span></p>
<p>postgres@hostname:/root$</p>
<h3><em>Create the db &#8211; user</em></h3>
<h3><em> </em></h3>
<p><span style="color:#999999;"><em># In  case you already have a postgres db running somewhere and you would like to import the dump.sql into the new one, create a user by the same name  as the old one.</em></span></p>
<p>postgres@hostname:/root$ <span style="color:#ff0000;">createuser username</span></p>
<p>Shall the new user be allowed to create databases? (y/n) <span style="color:#ff0000;">y</span><br />
Shall the new user be allowed to create more new users? (y/n) <span style="color:#ff0000;">y</span><br />
<span style="color:#0000ff;">CREATE USER</span></p>
<h3><span style="color:#0000ff;"><span style="color:#000000;">Create a db</span><br />
</span></h3>
<p>postgres@hostname:/root$ <span style="color:#ff0000;">createdb</span><span style="color:#ff0000;"> dbname_prod</span></p>
<p><span style="color:#0000ff;">CREATE DB</span></p>
<h3>Install postgres bindings for rails</h3>
<p>hostname:# <span style="color:#ff0000;">gem install postgres</span></p>
<p><span style="color:#ff0000;"><span style="color:#000000;"><strong>#by default postgres listens on port 5432, there a ways to change that by manipulating postgres.conf. You would also have to mess with the rails activerecord postgres conector. So I would rather make sure that your server has port 5432 open for TCP/IP &#8230;</strong></span><br />
</span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codalicious.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codalicious.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codalicious.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codalicious.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codalicious.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codalicious.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codalicious.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codalicious.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codalicious.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codalicious.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codalicious.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codalicious.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codalicious.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codalicious.wordpress.com/7/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codalicious.wordpress.com&amp;blog=13468218&amp;post=7&amp;subd=codalicious&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codalicious.wordpress.com/2010/05/04/setup-a-vps-for-rails-part-2-install_and_configure_postgresql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e24e1775b6922227c27031fee61ae21c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">frixl</media:title>
		</media:content>
	</item>
		<item>
		<title>Setup a VPS for Rails &#8211; Part 1: Ruby, Rubygems, Rails, Passenger, Nginx</title>
		<link>http://codalicious.wordpress.com/2010/05/04/setup-a-vps-for-rails_ruby_gems_passenger_nginx/</link>
		<comments>http://codalicious.wordpress.com/2010/05/04/setup-a-vps-for-rails_ruby_gems_passenger_nginx/#comments</comments>
		<pubDate>Tue, 04 May 2010 13:10:48 +0000</pubDate>
		<dc:creator>frixl</dc:creator>
				<category><![CDATA[Server and Deployment]]></category>

		<guid isPermaLink="false">http://codalicious.wordpress.com/?p=4</guid>
		<description><![CDATA[I assume the decision is made, a great host is found and the machine is pretty much a raw and has some kind of *ix OS. In my case, I decided for a Silverrack VPS with Debian pre-installed. What I ultimately aim for is a fast, stable and reasonably-easy-to-administrate server delivering an approx. 60K+ pages [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codalicious.wordpress.com&amp;blog=13468218&amp;post=4&amp;subd=codalicious&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I assume the decision is made, a great host is found and the machine is pretty much a raw and has some kind of *ix OS.</p>
<p>In my case, I decided for a Silverrack VPS with Debian pre-installed. What I ultimately aim for is a fast, stable and reasonably-easy-to-administrate server delivering an approx. 60K+ pages website. The choice of DB would be MySQL or Postgres. I definately want to use capistrano for deployment and might consider passenger if it makes sense in my situation.</p>
<p>I&#8217;ll try to be consistent with my code examples:</p>
<ul>
<li><span style="color:#000000;">Black, if the machine wants you to do something</span></li>
<li><span style="color:#0000ff;">Blue if it just does stuff and talks about it</span></li>
<li><span style="color:#ff0000;">Red if I type in something to tell the machine what to do.</span></li>
<li><span style="color:#ff0000;"><em><span style="color:#808080;">Italic and gray for my comments</span></em><br />
</span></li>
</ul>
<p>Alright, here we go:</p>
<h2>1. Login for the first time</h2>
<p style="padding-left:30px;"><span style="color:#000000;">localname$</span> <span style="color:#ff0000;">ssh -l root 123.456.789.1</span><br />
<span style="color:#0000ff;">The authenticity of host &#8217;123.456.789.1 (123.456.789.1)&#8217; can&#8217;t be established.<br />
RSA key fingerprint is &#8230; .</span><br />
<span style="color:#000000;">Are you sure you want to continue connecting (yes/no)?</span> <span style="color:#ff0000;">yes</span><br />
<span style="color:#0000ff;">Warning: Permanently added &#8217;216.194.126.4&#8242; (RSA) to the list of known hosts.</span><br />
<span style="color:#000000;">root@216.194.126.4&#8242;s password:</span><br />
<span style="color:#0000ff;">Linux test1 2.6.18-92.1.1.el5.028stab057.2ent #1 SMP Mon Jul 21 21:48:02 MSD 2008 i686</span></p>
<p style="padding-left:30px;">The programs included with the Debian GNU/Linux system are free software;<br />
the exact distribution terms for each program are described in the<br />
individual files in /usr/share/doc/*/copyright.</p>
<p style="padding-left:30px;">Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent<br />
permitted by applicable law.</p>
<p><em><span style="color:#808080;">Cool, that&#8217;s it! You successfully logged in and added</span> <span style="color:#808080;">the server-rsa to your local list of known hosts. </span></em></p>
<p><em><span style="color:#808080;">For MAC users: If you ever reinstall the server from scratch or reset it to it&#8217;s initial setup you will most likely have to go to /.ssh</span><span style="color:#808080;">/known_hosts and delete the server rsa key from the file.</span></em></p>
<p><em><span style="color:#808080;"># if you haven&#8217;t yet: change your password with a quick &#8220;passwd&#8221;<br />
</span></em></p>
<h2>2. Create a non-root user</h2>
<p><em><span style="color:#808080;">Let&#8217;s add a user called &#8216;grumpy&#8217;</span></em></p>
<p style="padding-left:30px;"><span style="color:#000000;">hostname:~# <span style="color:#ff0000;">adduser grumpy </span></span><br />
<span style="color:#0000ff;">Adding user `grumpy&#8217; &#8230;<br />
Adding new group `grumpy&#8217; (1000) &#8230;<br />
Adding new user `grumpy&#8217; (1000) with group `snoop&#8217; &#8230;<br />
Creating home directory `/home/grumpy&#8217; &#8230;<br />
Copying files from `/etc/skel&#8217; &#8230;</span><br />
<span style="color:#000000;">Enter new UNIX password:<br />
Retype new UNIX password: </span><br />
<span style="color:#0000ff;">passwd: password updated successfully<br />
Changing the user information for grumpy<br />
Enter the new value, or press ENTER for the default</span><br />
<span style="color:#000000;">Full Name []: </span><span style="color:#ff0000;">Dr.  No</span><br />
<span style="color:#000000;">Room Number []:</span> <span style="color:#ff0000;">10</span><span style="color:#000000;"><br />
Work Phone []:</span> <span style="color:#ff0000;">-456</span><br />
<span style="color:#000000;">Home Phone []:</span> <span style="color:#ff0000;">310#####</span><br />
<span style="color:#000000;">Other []:</span> <span style="color:#ff0000;">Only around on Sundays and Mondays.</span><br />
<span style="color:#000000;">Is the information correct? [y/N]</span> <span style="color:#ff0000;">y</span><span style="color:#000000;"><br />
hostname:~#</span> <span style="color:#ff0000;">exit</span><br />
<span style="color:#0000ff;">logout</span></p>
<h2>Install GCC Tools</h2>
<p style="padding-left:30px;"><span style="color:#000000;">hostname:~#</span> <span style="color:#ff0000;">apt-get install build-essential</span></p>
<p style="padding-left:30px;"><span style="color:#0000ff;">Reading package lists&#8230; Done<br />
Building dependency tree&#8230; Done<br />
build-essential is already the newest version.<br />
0 upgraded, 0 newly installed, 0 to remove and 100 not upgraded.<br />
</span></p>
<p style="padding-left:30px;"><span style="color:#0000ff;"><span style="color:#000000;">softwareclick:~# <span style="color:#ff0000;">apt-get update</span></span><br />
Get:1 http://security.debian.org etch/updates Release.gpg [835B]<br />
Hit http://security.debian.org etch/updates Release<br />
Err http://security.debian.org etch/updates Release</span></p>
<p style="padding-left:30px;">Get:2 http://security.debian.org etch/updates Release [37.6kB]  <span style="color:#0000ff;"><br />
Ign http://security.debian.org etch/updates Release<br />
Get:3 http://ftp.se.debian.org etch Release.gpg [1032B]<br />
Ign http://security.debian.org etch/updates/main Packages/DiffIndex<br />
Ign http://security.debian.org etch/updates/contrib Packages/DiffIndex<br />
Hit http://security.debian.org etch/updates/main Packages<br />
Hit http://ftp.se.debian.org etch Release<br />
Err http://ftp.se.debian.org etch Release</span></p>
<p style="padding-left:30px;">Hit http://security.debian.org etch/updates/contrib Packages <span style="color:#0000ff;"><br />
Get:4 http://ftp.se.debian.org etch Release [67.8kB]<br />
Ign http://ftp.se.debian.org etch Release<br />
Ign http://ftp.se.debian.org etch/main Packages/DiffIndex<br />
Ign http://ftp.se.debian.org etch/contrib Packages/DiffIndex<br />
Ign http://ftp.se.debian.org etch/main Sources/DiffIndex<br />
Ign http://ftp.se.debian.org etch/contrib Sources/DiffIndex<br />
Hit http://ftp.se.debian.org etch/main Packages<br />
Hit http://ftp.se.debian.org etch/contrib Packages<br />
Hit http://ftp.se.debian.org etch/main Sources<br />
Hit http://ftp.se.debian.org etch/contrib Sources<br />
Fetched 107kB in 2s (36.8kB/s)<br />
Reading package lists&#8230; Done<br />
W: GPG error: http://security.debian.org etch/updates Release: The following signatures couldn&#8217;t be verified because the public key is not available: NO_PUBKEY 9AA38DCD55BE302B<br />
W: GPG error: http://ftp.se.debian.org etch Release: The following signatures couldn&#8217;t be verified because the public key is not available: NO_PUBKEY 9AA38DCD55BE302B<br />
W: You may want to run apt-get update to correct these problems</span></p>
<p style="padding-left:30px;"><span style="color:#000000;">softwareclick:~#</span> <span style="color:#ff0000;">apt-get upgrade</span></p>
<p style="padding-left:30px;"><span style="color:#0000ff;">Reading package lists&#8230; Done<br />
Building dependency tree&#8230; Done<br />
The following packages have been kept back:<br />
elinks openssh-client openssh-server<br />
The following packages will be upgraded:<br />
apache2 apache2-mpm-worker apache2-utils apache2.2-common apt apt-utils<br />
bind9-host bsdutils cpio debconf debconf-i18n debian-archive-keyring<br />
dhcp3-client dhcp3-common dnsutils dpkg dpkg-dev dselect e2fslibs e2fsprogs<br />
findutils gzip imagemagick initscripts irb1.8 libapr1 libaprutil1 libbind9-0<br />
libblkid1 libc6 libc6-dev libcomerr2 libdbi-perl libdns22 libexpat1<br />
libfreetype6 libgnutls13 libisc11 libisccc0 libisccfg1 libkrb53 liblcms1<br />
liblwres9 libmagick9 libmysqlclient15-dev libmysqlclient15off libnewt0.52<br />
libopenssl-ruby1.8 libpam-modules libpam-runtime libpam0g libpcre3<br />
libperl5.8 libpng12-0 libpq4 libreadline-ruby1.8 libruby1.8 libsasl2<br />
libsasl2-2 libss2 libssl0.9.8 libsvn-ruby libsvn-ruby1.8 libsvn1 libtiff4<br />
libuuid1 libxml2 login mount mysql-client mysql-client-5.0 mysql-common<br />
mysql-server mysql-server-5.0 ntpdate passwd perl perl-base perl-modules<br />
rdoc1.8 rsync ruby1.8 ruby1.8-dev ssh subversion subversion-tools sysv-rc<br />
sysvinit sysvinit-utils tar tzdata unzip util-linux vim-common vim-tiny wget<br />
whiptail<br />
97 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.<br />
Need to get 86.3MB of archives.<br />
After unpacking 1081kB of additional disk space will be used.</span><br />
<span style="color:#000000;">Do you want to continue [Y/n]?</span> <span style="color:#ff0000;">Y</span><br />
<span style="color:#0000ff;">WARNING: The following packages cannot be authenticated!<br />
bsdutils dpkg libc6-dev tzdata libc6 e2fslibs e2fsprogs findutils gzip<br />
libpam-runtime libpam0g libpam-modules login mount perl-modules perl<br />
libperl5.8 perl-base sysvinit tar util-linux sysvinit-utils debconf-i18n<br />
debconf mysql-common mysql-server mysql-client libdbi-perl<br />
libmysqlclient15off mysql-client-5.0 passwd mysql-server-5.0<br />
debian-archive-keyring apt initscripts libblkid1 libcomerr2 libss2 libuuid1<br />
sysv-rc apt-utils cpio dhcp3-client dhcp3-common libgnutls13 libnewt0.52<br />
libsasl2 libsasl2-2 libssl0.9.8 vim-tiny vim-common wget whiptail dselect<br />
libisc11 libdns22 libisccc0 libisccfg1 libbind9-0 liblwres9 bind9-host<br />
dnsutils libkrb53 libpcre3 libapr1 libexpat1 libpq4 libaprutil1<br />
apache2-utils apache2-mpm-worker apache2.2-common apache2 dpkg-dev<br />
libfreetype6 liblcms1 libpng12-0 libtiff4 libxml2 libmagick9 imagemagick<br />
ruby1.8-dev libruby1.8 ruby1.8 libreadline-ruby1.8 irb1.8<br />
libmysqlclient15-dev libopenssl-ruby1.8 subversion libsvn1 libsvn-ruby1.8<br />
libsvn-ruby ntpdate rdoc1.8 rsync unzip ssh subversion-tools</span><br />
<span style="color:#000000;">Install these packages without verification [y/N]?</span> <span style="color:#ff0000;">Y</span></p>
<p style="padding-left:30px;"><span style="color:#0000ff;">Get:1 http://security.debian.org etch/updates/main libc6-dev 2.3.6.ds1-13etch10+b1 [2731kB]</span></p>
<p style="padding-left:30px;"><span style="color:#0000ff;">&#8230;</span></p>
<p style="padding-left:30px;"><span style="color:#0000ff;">Setting up dpkg-dev (1.13.26) &#8230;</span></p>
<h2>Install Ruby with apt</h2>
<p>Debian ships with old ruby versions. if that&#8217;s fine, go for the apt install method:</p>
<p style="padding-left:30px;">hostname:~# <span style="color:#ff0000;">apt-get install ruby ri rdoc irb ri1.8 ruby1.8-dev libzlib-ruby zlib1g</span></p>
<p style="padding-left:30px;"><span style="color:#0000ff;">Reading package lists&#8230; Done<br />
Building dependency tree&#8230; Done<br />
ruby is already the newest version.<br />
irb is already the newest version.<br />
ruby1.8-dev is already the newest version.<br />
zlib1g is already the newest version.<br />
The following NEW packages will be installed:<br />
libzlib-ruby rdoc ri ri1.8<br />
0 upgraded, 4 newly installed, 0 to remove and 3 not upgraded.<br />
Need to get 1257kB of archives.<br />
After unpacking 42.6MB of additional disk space will be used.<br />
WARNING: The following packages cannot be authenticated!<br />
libzlib-ruby rdoc ri1.8 ri<br />
Install these packages without verification [y/N]?</span> <span style="color:#ff0000;">y</span><br />
<span style="color:#0000ff;">Get:1 http://security.debian.org etch/updates/main ri1.8 1.8.5-4etch5 [1246kB]<br />
</span>&#8230;</p>
<p style="padding-left:30px;">softwareclick:~# <span style="color:#ff0000;">ruby -v</span><br />
<span style="color:#0000ff;">ruby 1.8.5 (2006-08-25) [i486-linux]</span></p>
<h2>Install Ruby from source</h2>
<p>If old is not good enough (and some gems depend on something newer than 1.8.5, which is the currently shipped version), then go for the source:</p>
<p>apt-get remove ruby libruby libruby1.8 ruby1.8 irb rdoc ri</p>
<p>apt-get install libssl-dev libreadline-dev</p>
<p>wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.1-p378.tar.gz</p>
<pre>
tar xfz ruby-1.9.1-p378.tar.gz

cd ruby-1.9.1-p378

./configure --prefix=/usr

make

make install
</pre>
<h2>Setup rubygems</h2>
<p style="padding-left:30px;">hostname:~# <span style="color:#ff0000;">wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz</span></p>
<p><em><span style="color:#808080;">(get the latest version from rubyforge if you like, in my case it wouldn&#8217; install with my ruby version, so I went for 1.3.5)</span></em></p>
<p style="padding-left:30px;">hostname:~# <span style="color:#ff0000;">tar xvzf rubygems-1.3.5.tgz</span><br />
<span style="color:#0000ff;">rubygems-1.3.5/<br />
rubygems-1.3.5/.autotest</span></p>
<p style="padding-left:30px;"><span style="color:#0000ff;">&#8230;<br />
rubygems-1.3.5/util/gem_prelude.rb.template</span><br />
hostname:~# <span style="color:#ff0000;">cd rubygems-1.3.5</span><br />
hostname:~/rubygems-1.3.5# <span style="color:#ff0000;">ruby setup.rb</span><br />
<span style="color:#0000ff;">RubyGems 1.3.5 installed</span></p>
<p style="padding-left:30px;">=== 1.3.5 / 2009-07-21</p>
<p style="padding-left:30px;">Bug fixes:</p>
<p style="padding-left:30px;">* Fix use of prerelease gems.<br />
* Gem.bin_path no longer escapes path with spaces. Bug #25935 and #26458.</p>
<p style="padding-left:30px;">Deprecation Notices:</p>
<p style="padding-left:30px;">* Bulk index update is no longer supported (the code currently remains, but not<br />
the tests)<br />
* Gem::manage_gems was removed in 1.3.3.<br />
* Time::today was removed in 1.3.3.</p>
<p style="padding-left:30px;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p style="padding-left:30px;">RubyGems installed the following executables:<br />
/usr/bin/gem1.8</p>
<p style="padding-left:30px;">hostname:~/rubygems-1.3.5# <span style="color:#ff0000;">cd ..</span><br />
hostname:~# <span style="color:#ff0000;">rm -rf rubygems-1.3.5*</span></p>
<h3><span style="color:#ff0000;"><span style="color:#000000;">Fixing the manage_gems Error</span><br />
</span></h3>
<p><em><span style="color:#808080;">Now, when you try to do a &#8220;gem install&#8221; or anything usefull that has to do with &#8220;manage_gems&#8221; (see output when installing rubygems) You will get an error like this:</span></em></p>
<p style="padding-left:30px;">hostname:~# <span style="color:#ff0000;">gem install rails &#8211;no-rdoc &#8211;no-ri</span></p>
<p style="padding-left:30px;"><span style="color:#0000ff;">/usr/bin/gem:10: undefined method `manage_gems&#8217; for Gem:Module (NoMethodError)</span></p>
<p><em><span style="color:#808080;">Uhhh, to be honest, I did not really look into the reasoning of deprecating &#8216;manage_gems&#8217; or figure out my own solution. I just followed  <a title="Martin Videc - Blog Entry" href="http://www.videc.at/2010/03/25/rubygems-undefined-method-%E2%80%98manage_gems%E2%80%99-for-gemmodule-nomethoderror-easy-fix/" target="_blank">Martin Videc:</a></span></em></p>
<p style="padding-left:30px;">hostname:~# <span style="color:#ff0000;">mv /usr/bin/gem /usr/bin/gem-backup</span></p>
<p style="padding-left:30px;">hostname:~# <span style="color:#ff0000;">ln -s /usr/bin/gem1.8 /usr/bin/gem</span></p>
<p><em><span style="color:#808080;">It did the job for me so now we can &#8230;. drum-roll &#8230;</span></em></p>
<h2>Install Rails</h2>
<p style="padding-left:30px;">hostname:~# <span style="color:#ff0000;">gem install rails &#8211;no-rdoc &#8211;no-ri</span></p>
<p><span style="color:#ff0000;"><em><span style="color:#808080;">So now it&#8217;s time to have coffee and call mum, take a walk and maybe kick back and have a good read. On my server it took so long &#8230; I almost got nervous and stopped it.</span></em></span></p>
<p><em><span style="color:#808080;">Ahhh there we go:</span></em></p>
<p style="padding-left:30px;"><span style="color:#0000ff;">Successfully installed rails-2.3.5<br />
1 gem installed</span></p>
<h2>Install a WebServer</h2>
<p><em><span style="color:#808080;">First a decision has to be made: which server suites my needs?</span></em></p>
<p><em><span style="color:#808080;">I personally need a fast and reliable solution, that is fairly easy to configure and makes deployment a snap.<br />
</span></em></p>
<p><em><span style="color:#808080;">Dealing with rails you can choose from mongrel, apache2, nginx and lighthttpd. </span></em></p>
<p><em><span style="color:#808080;"><strong>Nginx</strong> is probably the leanest and meanest among those, but seems to have a pretty basic documentation. <strong>Apache</strong> can easily become a brick in your throat. configuration is just nerve wrecking and performance is just ok, not great. <strong>Lighttpd</strong> seems to be highly performant, stable and scalable solution. However I was a bit overwhelmed with the options and decided to use mongrel. <strong>Mongrel</strong> is to my knowledge the standard use for rails websites and is pretty well documented. BUT: If you are lazy like me you want the easy &amp; fast setup and deployment. As I mentioned earlier, I want to use capistrano in deployment. It has done a great job for me when I was running it with passenger and apache2 on a shared host. So imagine my delight, when I found out there is a <strong>nginx installation packaged in passenger</strong>, if you like. Now we are talking!</span><br />
</em></p>
<h2>Install passenger with nginx</h2>
<p><span style="color:#808080;"><em>This is pretty much what this <a href="http://www.modrails.com/videos/passenger_nginx.mov" target="_blank">video tutorial</a> does.<br />
</em></span></p>
<p style="padding-left:30px;">hostname:~# <span style="color:#ff0000;">gem install passenger</span><br />
<span style="color:#0000ff;">Building native extensions.  This could take a while&#8230;<br />
Successfully installed passenger-2.2.11<br />
1 gem installed<br />
Installing ri documentation for passenger-2.2.11&#8230;<br />
Installing RDoc documentation for passenger-2.2.11&#8230;<br />
</span></p>
<p style="padding-left:30px;">hostname:~# <span style="color:#ff0000;">passenger-install-nginx-module</span><br />
<span style="color:#0000ff;">Welcome to the Phusion Passenger Nginx module installer, v2.2.11.</span></p>
<p style="padding-left:30px;">This installer will guide you through the entire installation process. It<br />
shouldn&#8217;t take more than 5 minutes in total.</p>
<p style="padding-left:30px;">Here&#8217;s what you can expect from the installation process:</p>
<p style="padding-left:30px;">1. This installer will compile and install Nginx with Passenger support.<br />
2. You&#8217;ll learn how to configure Passenger in Nginx.<br />
3. You&#8217;ll learn how to deploy a Ruby on Rails application.</p>
<p style="padding-left:30px;">Don&#8217;t worry if anything goes wrong. This installer will advise you on how to<br />
solve any problems.</p>
<p style="padding-left:30px;">Press Enter to continue, or Ctrl-C to abort.</p>
<p style="padding-left:30px;"><span style="color:#0000ff;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</span></p>
<p style="padding-left:30px;">Checking for required software&#8230;</p>
<p style="padding-left:30px;">* GNU C++ compiler&#8230; found at /usr/bin/g++<br />
* Ruby development headers&#8230; found<br />
* OpenSSL support for Ruby&#8230; found<br />
* RubyGems&#8230; found<br />
* Rake&#8230; found at /usr/bin/rake<br />
* rack&#8230; found<br />
* OpenSSL development headers&#8230; found<br />
* Zlib development headers&#8230; found<br />
* fastthread&#8230; found</p>
<p style="padding-left:30px;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p style="padding-left:30px;">Automatically download and install Nginx?</p>
<p style="padding-left:30px;">Nginx doesn&#8217;t support loadable modules such as some other web servers do,<br />
so in order to install Nginx with Passenger support, it must be recompiled.</p>
<p style="padding-left:30px;">Do you want this installer to download, compile and install Nginx for you?</p>
<p style="padding-left:30px;">1. Yes: download, compile and install Nginx for me. (recommended)<br />
The easiest way to get started. A stock Nginx 0.7.64 with Passenger<br />
support, but with no other additional third party modules, will be<br />
installed for you to a directory of your choice.</p>
<p style="padding-left:30px;">2. No: I want to customize my Nginx installation. (for advanced users)<br />
Choose this if you want to compile Nginx with more third party modules<br />
besides Passenger, or if you need to pass additional options to Nginx&#8217;s<br />
&#8216;configure&#8217; script. This installer will  1) ask you for the location of<br />
the Nginx source code,  2) run the &#8216;configure&#8217; script according to your<br />
instructions, and  3) run &#8216;make install&#8217;.</p>
<p style="padding-left:30px;">Whichever you choose, if you already have an existing Nginx configuration file,<br />
then it will be preserved.</p>
<p style="padding-left:30px;">Enter your choice (1 or 2) or press Ctrl-C to abort: <span style="color:#ff0000;">1</span></p>
<p style="padding-left:30px;"><span style="color:#0000ff;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</span></p>
<p style="padding-left:30px;">PCRE (required by Nginx) not installed, downloading it&#8230;<br />
# wget -O /tmp/pcre-8.00.tar.gz ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.00.tar.gz</p>
<p style="padding-left:30px;">&#8230;</p>
<p style="padding-left:30px;"><span style="color:#0000ff;">Where do you want to install Nginx to?</span></p>
<p style="padding-left:30px;">Please specify a prefix directory [/opt/nginx]:</p>
<p style="padding-left:30px;"><span style="color:#0000ff;">&#8230;</span></p>
<p style="padding-left:30px;"><span style="color:#0000ff;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</span></p>
<p style="padding-left:30px;">Nginx with Passenger support was successfully installed.</p>
<p style="padding-left:30px;">The Nginx configuration file (/opt/nginx/conf/nginx.conf)<br />
must contain the correct configuration options in order for Phusion Passenger<br />
to function correctly.</p>
<p style="padding-left:30px;">This installer has already modified the configuration file for you! The<br />
following configuration snippet was inserted:</p>
<p style="padding-left:30px;">http {<br />
&#8230;<br />
passenger_root /usr/lib/ruby/gems/1.8/gems/passenger-2.2.11;<br />
passenger_ruby /usr/bin/ruby1.8;<br />
&#8230;<br />
}</p>
<p style="padding-left:30px;">After you start Nginx, you are ready to deploy any number of Ruby on Rails<br />
applications on Nginx.</p>
<p style="padding-left:30px;">Press ENTER to continue.</p>
<p style="padding-left:30px;"><span style="color:#0000ff;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</span></p>
<p style="padding-left:30px;">Deploying a Ruby on Rails application: an example</p>
<p style="padding-left:30px;">Suppose you have a Ruby on Rails application in /somewhere. Add a server block<br />
to your Nginx configuration file, set its root to /somewhere/public, and set<br />
&#8216;passenger_enabled on&#8217;, like this:</p>
<p style="padding-left:30px;">server {<br />
listen 80;<br />
server_name www.yourhost.com;<br />
root /somewhere/public;   # &lt;&#8212; be sure to point to &#8216;public&#8217;!<br />
passenger_enabled on;<br />
}</p>
<p style="padding-left:30px;">And that&#8217;s it! You may also want to check the Users Guide for security and<br />
optimization tips and other useful information:</p>
<p style="padding-left:30px;">/usr/lib/ruby/gems/1.8/gems/passenger-2.2.11/doc/Users guide Nginx.html</p>
<p style="padding-left:30px;">Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>http://www.modrails.com/</p>
<p style="padding-left:30px;">Phusion Passenger is a trademark of Hongli Lai &amp; Ninh Bui.</p>
<p style="padding-left:30px;">hostname:~# <span style="color:#ff0000;">nano /opt/nginx/conf/nginx.conf</span></p>
<p><span style="color:#808080;"><em>Now this will open the nginx.conf file in nano (my current favorite).</em></span></p>
<p><span style="color:#808080;"><em>Add the following lines &#8230;<br />
</em></span></p>
<p><span style="color:#808080;"><em>___________</em></span></p>
<p style="padding-left:30px;"><span style="color:#808080;"><em>server {<br />
listen 80;<br />
server_name www.yourhost.com;<br />
root /somewhere/public;   # &lt;&#8212; be sure to point to &#8216;public&#8217;!<br />
passenger_enabled on;<br />
}</em></span></p>
<p><span style="color:#808080;"><em>__________</em></span></p>
<p>right above the other server config:</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p style="padding-left:30px;"><span style="color:#0000ff;">server {<br />
listen       80;<br />
server_name  localhost;</span></p>
<p style="padding-left:30px;">#charset koi8-r;<br />
#access_log  logs/host.access.log  main;<br />
location / {<br />
root   html;<br />
index  index.html index.htm;<br />
}</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p><em>Hint: If you have an old apache2 installation running get rid of it with:</em></p>
<p style="padding-left:30px;">hostname:~# <span style="color:#ff0000;">dpkg -l | grep apache</span> <em><span style="color:#808080;"># which apache module is installed?</span></em></p>
<p style="padding-left:30px;"><span style="color:#000000;">hostname:~#</span> <span style="color:#ff0000;">locate apache</span> <span style="color:#808080;"><em>#shows what is where</em></span></p>
<p style="padding-left:30px;"><span style="color:#000000;">hostname:~#</span> <span style="color:#ff0000;">/etc/init.d/apache2 stop <span style="color:#808080;"><em>#shuts it down</em></span></span></p>
<p style="padding-left:30px;"><span style="color:#000000;">hostname:~#</span> <span style="color:#ff0000;">apt-get remove apache2 <span style="color:#808080;"><em>#gets rid of it, add other packages if needed<br />
</em></span></span></p>
<p><span style="color:#808080;"><em>Now let&#8217;s start Nginx:</em></span></p>
<p style="padding-left:30px;"><span style="color:#000000;">hostname:~#</span> <span style="color:#ff0000;">/opt/nginx/sbin/nginx</span></p>
<p><span style="color:#ff0000;"><span style="color:#808080;"><em>When you open your browser and go to the hostname you specified in nginx.conf you should see something delivered by ngingx.</em></span></span></p>
<p><span style="color:#ff0000;"><span style="color:#808080;"><em>To smoothly start and restart nginx, we need a script in init.d I used this directive from </em></span></span>http://wiki.rubyonrails.org/deployment/vps-setup-nginx-passenger:</p>
<pre style="padding-left:30px;">wget railsgeek.com/vps/nginx -P /etc/init.d
$ chmod +x /etc/init.d/nginx
$ /etc/init.d/nginx start
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codalicious.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codalicious.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codalicious.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codalicious.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codalicious.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codalicious.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codalicious.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codalicious.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codalicious.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codalicious.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codalicious.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codalicious.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codalicious.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codalicious.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codalicious.wordpress.com&amp;blog=13468218&amp;post=4&amp;subd=codalicious&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codalicious.wordpress.com/2010/05/04/setup-a-vps-for-rails_ruby_gems_passenger_nginx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.modrails.com/videos/passenger_nginx.mov" length="10621251" type="video/quicktime" />
	
		<media:content url="http://0.gravatar.com/avatar/e24e1775b6922227c27031fee61ae21c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">frixl</media:title>
		</media:content>
	</item>
	</channel>
</rss>
