<?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>Samson&#039;s Weblog &#187; Ruby on Rails</title>
	<atom:link href="http://blog.samsonis.me/category/technique/ruby-on-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.samsonis.me</link>
	<description>天与弗取，反受其咎；时至不行，反受其殃</description>
	<lastBuildDate>Sun, 29 Jan 2012 13:53:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Downgrade Rubygems</title>
		<link>http://blog.samsonis.me/2011/12/downgrade-rubygems/</link>
		<comments>http://blog.samsonis.me/2011/12/downgrade-rubygems/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 13:09:53 +0000</pubDate>
		<dc:creator>Samson Wu</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Share]]></category>
		<category><![CDATA[Technique]]></category>
		<category><![CDATA[RubyGems]]></category>

		<guid isPermaLink="false">http://blog.samsonis.me/?p=3661</guid>
		<description><![CDATA[First let&#8217;s list 2 truths here: Rails 2.3.5 will fail with RubyGems 1.5.0 + Rails 2.3.11 will fail with RubyGems 1.7.0 + So what if you want to deploy or run an application which unfortunately still or initially written in rails 2, given the situation that latest RVM default install rubygems version 1.8.11? It turns ...]]></description>
			<content:encoded><![CDATA[<p>First let&#8217;s list 2 truths here:</p>
<ul>
<li>Rails 2.3.5 will fail with RubyGems 1.5.0 +</li>
<li>Rails 2.3.11 will fail with RubyGems 1.7.0 +</li>
</ul>
<p>So what if you want to deploy or run an application which unfortunately still or initially written in rails 2, given the situation that latest RVM default install rubygems version 1.8.11?</p>
<p>It turns out to be not so painful, cause it&#8217;s as simple as just issue one command (take 1.4.2 for example):</p>
<div class="codecolorer-container ruby railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">gem update <span style="color:#006600; font-weight:bold;">--</span><span style="color:#CC0066; font-weight:bold;">system</span> 1.4.2</div></div>
<p>Just like the China highway train, sometimes what you need to do is just to stop moving so fast.</p>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.samsonis.me/2011/02/rubygems-1-5-2-manual-upgrade/" title="RubyGems 1.5.2 Manual Upgrade (February 16, 2011)">RubyGems 1.5.2 Manual Upgrade</a> (0)</li>
	<li><a href="http://blog.samsonis.me/2011/03/archlinux-rvm-ruby-rails-nginx-passenger-and-you/" title="ArchLinux, RVM, Ruby, Rails, Nginx, Passenger and You (March 30, 2011)">ArchLinux, RVM, Ruby, Rails, Nginx, Passenger and You</a> (3)</li>
	<li><a href="http://blog.samsonis.me/2011/03/stdout-deployment/" title="stdout deployment (March 7, 2011)">stdout deployment</a> (4)</li>
	<li><a href="http://blog.samsonis.me/2011/03/stdout-customization/" title="stdout customization (March 7, 2011)">stdout customization</a> (1)</li>
	<li><a href="http://blog.samsonis.me/2010/02/rubys-python-simplehttpserver/" title="ruby&#8217;s &#8220;python -m SimpleHTTPServer&#8221; (February 21, 2010)">ruby&#8217;s &#8220;python -m SimpleHTTPServer&#8221;</a> (2)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.samsonis.me/2011/12/downgrade-rubygems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ArchLinux, RVM, Ruby, Rails, Nginx, Passenger and You</title>
		<link>http://blog.samsonis.me/2011/03/archlinux-rvm-ruby-rails-nginx-passenger-and-you/</link>
		<comments>http://blog.samsonis.me/2011/03/archlinux-rvm-ruby-rails-nginx-passenger-and-you/#comments</comments>
		<pubDate>Wed, 30 Mar 2011 13:50:08 +0000</pubDate>
		<dc:creator>Samson Wu</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Share]]></category>
		<category><![CDATA[Technique]]></category>
		<category><![CDATA[ArchLinux]]></category>
		<category><![CDATA[Passenger]]></category>
		<category><![CDATA[RVM]]></category>

		<guid isPermaLink="false">http://blog.samsonis.me/?p=2938</guid>
		<description><![CDATA[没看错，就是ArchLinux，怎么，又回来了？其实我一直未曾离开…… i 好了不矫情了，let&#8217;s do business. [Overview] 本文介绍如何在archlinux上快速搭建rails开发环境，其中有很多可能包括我个人的preferences，各位完全可以根据自行需要取舍。 [ArchLinux] 参照Arch自己的 Official Install Guide ii 安装，其实根本不用参照，整个安装wizard做的已经非常非常user friendly了，我觉得。 [RVM] RVM 的安装依赖 git 和 curl： $ sudo pacman -S git curl 装之： $ bash &#60; &#60;&#40; curl http://rvm.beginrescueend.com/releases/rvm-install-head &#41; 注意没有sudo，符合homebrew的philosophy，尽量不要root，何况我们还是作为development环境，rvm官网好像现在已经没有倾向性了，不过我印象中以前也是倾向于装在user的home目录。 同样是非常友好的安装过程，参照提示，在.bash_profile或者.bashrc的最后添加一行 Load 代码（如果你用的是bash的话）： $ echo '[[ -s &#34;$HOME/.rvm/scripts/rvm&#34; ]] &#38;&#38; . &#34;$HOME/.rvm/scripts/rvm&#34;' &#62;&#62; ~/.bashrc 我还喜欢shell补全，如果你也喜欢，再加上一句即可： $ echo '[[ -r ...]]></description>
			<content:encoded><![CDATA[<p>没看错，就是ArchLinux，怎么，又<a href="http://blog.samsonis.me/tag/archlinux/">回来了</a>？其实我一直未曾离开…… <sup><a href="http://blog.samsonis.me/2011/03/archlinux-rvm-ruby-rails-nginx-passenger-and-you/#footnote_0_2938" id="identifier_0_2938" class="footnote-link footnote-identifier-link" title="我有一个arch的liveusb，各种机子上一直保存着至少2+个arch的vm，虽然后来由于太占空间被转移到了移动硬盘，可就是一直舍不得删">i</a></sup></p>
<p>好了不矫情了，let&#8217;s do business.</p>
<p><span style="text-decoration: underline;">[Overview]</span><br />
本文介绍如何在archlinux上快速搭建rails开发环境，其中有很多可能包括我个人的preferences，各位完全可以根据自行需要取舍。</p>
<p><span style="text-decoration: underline;">[ArchLinux]</span><br />
参照Arch自己的 <a href="https://wiki.archlinux.org/index.php/Official_Arch_Linux_Install_Guide">Official Install Guide</a> <sup><a href="http://blog.samsonis.me/2011/03/archlinux-rvm-ruby-rails-nginx-passenger-and-you/#footnote_1_2938" id="identifier_1_2938" class="footnote-link footnote-identifier-link" title="最近老是official, official的&hellip; 你懂的">ii</a></sup> 安装，其实根本不用参照，整个安装wizard做的已经非常非常user friendly了，我觉得。</p>
<p><span style="text-decoration: underline;">[RVM]</span><br />
<a href="http://rvm.beginrescueend.com/">RVM</a> 的安装依赖 git 和 curl：</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> pacman <span style="color: #660033;">-S</span> git curl</div></div>
<p>装之：</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">bash</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight: bold;">&lt;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span> curl http:<span style="color: #000000; font-weight: bold;">//</span>rvm.beginrescueend.com<span style="color: #000000; font-weight: bold;">/</span>releases<span style="color: #000000; font-weight: bold;">/</span>rvm-install-head <span style="color: #7a0874; font-weight: bold;">&#41;</span></div></div>
<p>注意没有sudo，符合homebrew的philosophy，尽量不要root，何况我们还是作为development环境，<a href="http://rvm.beginrescueend.com/rvm/install/">rvm官网</a>好像现在已经没有倾向性了，不过我印象中以前也是倾向于装在user的home目录。<br />
<span id="more-2938"></span><br />
同样是非常友好的安装过程，参照提示，在.bash_profile或者.bashrc的最后添加一行 Load 代码（如果你用的是bash的话）：</p>
<div class="codecolorer-container bash railscasts" style="border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'[[ -s &quot;$HOME/.rvm/scripts/rvm&quot; ]] &amp;&amp; . &quot;$HOME/.rvm/scripts/rvm&quot;'</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bashrc</div></div>
<p>我还喜欢shell补全，如果你也喜欢，再加上一句即可：</p>
<div class="codecolorer-container bash railscasts" style="border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'[[ -r $rvm_path/scripts/completion ]] &amp;&amp; . $rvm_path/scripts/completion'</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bashrc</div></div>
<p>最后查看一下notes，看看所在平台有什么注意事项：</p>
<div class="codecolorer-container bash railscasts" style="border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ rvm notes</div></div>
<p><span style="text-decoration: underline;">[Ruby]</span><br />
这里我们用rvm安装ruby，如果你喜欢也可以pacman -S之，我查了下，arch repo里的ruby是1.9.2，patch level也是最新的180，不过rvm的好处是可以安装好几个ruby版本，且能够非常方便的帮你维护不同的gemset，非常像python里面的<a href="http://pypi.python.org/pypi/virtualenv">virtualenv</a>.</p>
<p>安装最新的ruby 1.9.2:</p>
<div class="codecolorer-container bash railscasts" style="border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ rvm <span style="color: #c20cb9; font-weight: bold;">install</span> 1.9.2</div></div>
<p>如果需要也可以装上1.8.7的：</p>
<div class="codecolorer-container bash railscasts" style="border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ rvm <span style="color: #c20cb9; font-weight: bold;">install</span> 1.8.7</div></div>
<p>下载编译安装完后我们就可以使用了，我喜欢把ruby 1.9.2，gemset rails3作为我的default：</p>
<div class="codecolorer-container bash railscasts" style="border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ rvm use 1.9.2<span style="color: #000000; font-weight: bold;">@</span>rails3 <span style="color: #660033;">--create</span> <span style="color: #660033;">--default</span></div></div>
<p>verify一下我们是否还是 so far so good：</p>
<div class="codecolorer-container bash railscasts" style="border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">which</span> ruby<br />
<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>samson<span style="color: #000000; font-weight: bold;">/</span>.rvm<span style="color: #000000; font-weight: bold;">/</span>rubies<span style="color: #000000; font-weight: bold;">/</span>ruby-1.9.2-p180<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ruby<br />
$ ruby <span style="color: #660033;">-v</span><br />
ruby 1.9.2p180 <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2011</span>-02-<span style="color: #000000;">18</span> revision <span style="color: #000000;">30909</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>x86_64-linux<span style="color: #7a0874; font-weight: bold;">&#93;</span></div></div>
<p><span style="text-decoration: underline;">[Rails]</span><br />
安装rails 3，最新的是3.0.5:</p>
<div class="codecolorer-container bash railscasts" style="border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ gem <span style="color: #c20cb9; font-weight: bold;">install</span> rails</div></div>
<div class="codecolorer-container bash railscasts" style="border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">which</span> rails<br />
<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>samson<span style="color: #000000; font-weight: bold;">/</span>.rvm<span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span>ruby-1.9.2-p180<span style="color: #000000; font-weight: bold;">@</span>rails3<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>rails<br />
$ rails <span style="color: #660033;">-v</span><br />
Rails 3.0.5</div></div>
<p>创建一个project做demo：</p>
<div class="codecolorer-container bash railscasts" style="border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ rails new demo</div></div>
<p>bundle一下，确保所有依赖的gem都已安装，这里会把sqlite3给补上:</p>
<div class="codecolorer-container bash railscasts" style="border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #7a0874; font-weight: bold;">cd</span> demo<br />
$ bundle</div></div>
<p>又一个milestone，测试一下：</p>
<div class="codecolorer-container bash railscasts" style="border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ rails s</div></div>
<p><span style="text-decoration: underline;">[Nginx &#038; Passenger]</span><br />
不用apache，让我们换nginx玩玩；由于passenger的nginx模块安装的时候需要重新编译nginx，所以 pacman -S nginx 似乎是没有意义的，我们这里先skip掉，先安装passenger，然后在编译安装passenger的nginx模块的时候把nginx一并搞定。</p>
<p>安装passenger：</p>
<div class="codecolorer-container bash railscasts" style="border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ gem <span style="color: #c20cb9; font-weight: bold;">install</span> passenger</div></div>
<p>安装passenger的nginx模块，同时安装nginx，默认的nginx安装地址是/opt/nginx（可以修改到不需要root的地址），需要root，我们可以用rvmsudo搞定：</p>
<div class="codecolorer-container bash railscasts" style="border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ rvmsudo passenger-install-nginx-module</div></div>
<p>again，友好至极，装完连配置文件都帮你改好了，不过检查一下总不会错：</p>
<div class="codecolorer-container bash railscasts" style="border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;passenger&quot;</span> nginx.conf<br />
&nbsp; &nbsp; passenger_root <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>samson<span style="color: #000000; font-weight: bold;">/</span>.rvm<span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span>ruby-1.9.2-p180<span style="color: #000000; font-weight: bold;">@</span>rails3<span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span>passenger-3.0.5;<br />
&nbsp; &nbsp; passenger_ruby <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>samson<span style="color: #000000; font-weight: bold;">/</span>.rvm<span style="color: #000000; font-weight: bold;">/</span>wrappers<span style="color: #000000; font-weight: bold;">/</span>ruby-1.9.2-p180<span style="color: #000000; font-weight: bold;">@</span>rails3<span style="color: #000000; font-weight: bold;">/</span>ruby;</div></div>
<p>配置一下，来跑一下之前创建的demo project：</p>
<div class="codecolorer-container bash railscasts" style="border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">server <span style="color: #7a0874; font-weight: bold;">&#123;</span>¬<br />
&nbsp; listen <span style="color: #000000;">80</span>;¬<br />
&nbsp; server_name demo.local;¬<br />
&nbsp; root <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>samson<span style="color: #000000; font-weight: bold;">/</span>code<span style="color: #000000; font-weight: bold;">/</span>demo<span style="color: #000000; font-weight: bold;">/</span>public;¬<br />
&nbsp; passenger_enabled on;¬<br />
&nbsp; rails_env development;¬<br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span>¬</div></div>
<div class="codecolorer-container bash railscasts" style="border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>nginx</div></div>
<p>我取的server name时demo.local，所以在hosts里面加上这条entry后，我们就可以用browser访问 http://demo.local 了.</p>
<p>如果遇到403 forbidden，在nginx.conf里面改下user即可：</p>
<div class="codecolorer-container bash railscasts" style="border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">user samson <span style="color: #c20cb9; font-weight: bold;">users</span>;</div></div>
<p>reload, welcome aboard!</p>
<div class="codecolorer-container bash railscasts" style="border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>nginx <span style="color: #660033;">-s</span> reload</div></div>
[Footnotes]<ol class="footnotes"><li id="footnote_0_2938" class="footnote">我有一个arch的liveusb，各种机子上一直保存着至少2+个arch的vm，虽然后来由于太占空间被转移到了移动硬盘，可就是一直舍不得删</li><li id="footnote_1_2938" class="footnote">最近老是official, official的… 你懂的</li></ol>
	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.samsonis.me/2009/06/redmine-on-archlinux/" title="Redmine on Archlinux (June 30, 2009)">Redmine on Archlinux</a> (6)</li>
	<li><a href="http://blog.samsonis.me/2009/06/install-ruby-on-rails-on-archlinux/" title="Install Ruby on Rails on Archlinux (June 30, 2009)">Install Ruby on Rails on Archlinux</a> (0)</li>
	<li><a href="http://blog.samsonis.me/2009/05/safeboot%e5%8f%8c%e7%b3%bb%e7%bb%9f%e5%bc%95%e5%af%bc/" title="SafeBoot双系统引导 (May 12, 2009)">SafeBoot双系统引导</a> (29)</li>
	<li><a href="http://blog.samsonis.me/2011/12/downgrade-rubygems/" title="Downgrade Rubygems (December 5, 2011)">Downgrade Rubygems</a> (0)</li>
	<li><a href="http://blog.samsonis.me/2009/02/archlinux%e4%b8%8b%e7%9a%84%e6%97%b6%e9%97%b4%e6%97%b6%e5%8c%ba%e8%ae%be%e7%bd%ae/" title="Archlinux下的时间时区设置 (February 13, 2009)">Archlinux下的时间时区设置</a> (15)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.samsonis.me/2011/03/archlinux-rvm-ruby-rails-nginx-passenger-and-you/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>stdout customization</title>
		<link>http://blog.samsonis.me/2011/03/stdout-customization/</link>
		<comments>http://blog.samsonis.me/2011/03/stdout-customization/#comments</comments>
		<pubDate>Mon, 07 Mar 2011 10:16:15 +0000</pubDate>
		<dc:creator>Samson Wu</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Share]]></category>
		<category><![CDATA[Technique]]></category>
		<category><![CDATA[HostMonster]]></category>
		<category><![CDATA[stdout]]></category>

		<guid isPermaLink="false">http://blog.samsonis.me/?p=2805</guid>
		<description><![CDATA[前面介绍完了deployment，接下来该轮到customization了，这个也同样重要。我目前所能想到的需要customize的地方主要有5个地方，都集中在两个文件，并没有想象中的复杂，且听我一一道来： [page title] Location: RAILS_ROOT/app/views/layouts/application.html.erb, line 6 &#60;title&#62;$ cat /dev/stdin &#62;&#62; /dev/stdout &#124; tee stdout.samsonw.info&#60;/title&#62; change to whatever text you want. [header title，sub-title] Location: RAILS_ROOT/app/views/activities/index.html.erb, line 2, 3 &#60;div id=&#34;title&#34; class=&#34;grid_24&#34;&#62;$ cat /dev/stdin &#62;&#62; /dev/stdout &#124; tee stdout.samsonw.info&#60;/div&#62; &#60;div id=&#34;sub_title&#34; class=&#34;grid_24&#34;&#62;Don't Panic: fatal system error, core dump file not generated ...&#60;/div&#62; change to whatever text ...]]></description>
			<content:encoded><![CDATA[<p>前面介绍完了<a href="http://blog.samsonis.me/2011/03/stdout-deployment/">deployment</a>，接下来该轮到customization了，这个也同样重要。我目前所能想到的需要customize的地方主要有5个地方，都集中在两个文件，并没有想象中的复杂，且听我一一道来：</p>
<p><span style="text-decoration: underline;">[page title]</span></p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Location: RAILS_ROOT<span style="color: #000000; font-weight: bold;">/</span>app<span style="color: #000000; font-weight: bold;">/</span>views<span style="color: #000000; font-weight: bold;">/</span>layouts<span style="color: #000000; font-weight: bold;">/</span>application.html.erb, line <span style="color: #000000;">6</span></div></div>
<div class="codecolorer-container ruby railscasts" style="border:1px solid #9F9F9F;width:100%;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#006600; font-weight:bold;">&lt;</span>title<span style="color:#006600; font-weight:bold;">&gt;</span>$ cat <span style="color:#006600; font-weight:bold;">/</span>dev<span style="color:#006600; font-weight:bold;">/</span>stdin <span style="color:#006600; font-weight:bold;">&gt;&gt;</span> <span style="color:#006600; font-weight:bold;">/</span>dev<span style="color:#006600; font-weight:bold;">/</span>stdout <span style="color:#006600; font-weight:bold;">|</span> tee stdout.<span style="color:#9900CC;">samsonw</span>.<span style="color:#9900CC;">info</span><span style="color:#006600; font-weight:bold;">&lt;/</span>title<span style="color:#006600; font-weight:bold;">&gt;</span></div></div>
<p>change to whatever text you want.</p>
<p><span style="text-decoration: underline;">[header title，sub-title]</span></p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Location: RAILS_ROOT<span style="color: #000000; font-weight: bold;">/</span>app<span style="color: #000000; font-weight: bold;">/</span>views<span style="color: #000000; font-weight: bold;">/</span>activities<span style="color: #000000; font-weight: bold;">/</span>index.html.erb, line <span style="color: #000000;">2</span>, <span style="color: #000000;">3</span></div></div>
<div class="codecolorer-container ruby railscasts" style="border:1px solid #9F9F9F;width:100%;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#006600; font-weight:bold;">&lt;</span>div id=<span style="color:#996600;">&quot;title&quot;</span> <span style="color:#9966CC; font-weight:bold;">class</span>=<span style="color:#996600;">&quot;grid_24&quot;</span><span style="color:#006600; font-weight:bold;">&gt;</span>$ cat <span style="color:#006600; font-weight:bold;">/</span>dev<span style="color:#006600; font-weight:bold;">/</span>stdin <span style="color:#006600; font-weight:bold;">&gt;&gt;</span> <span style="color:#006600; font-weight:bold;">/</span>dev<span style="color:#006600; font-weight:bold;">/</span>stdout <span style="color:#006600; font-weight:bold;">|</span> tee stdout.<span style="color:#9900CC;">samsonw</span>.<span style="color:#9900CC;">info</span><span style="color:#006600; font-weight:bold;">&lt;/</span>div<span style="color:#006600; font-weight:bold;">&gt;</span><br />
<span style="color:#006600; font-weight:bold;">&lt;</span>div id=<span style="color:#996600;">&quot;sub_title&quot;</span> <span style="color:#9966CC; font-weight:bold;">class</span>=<span style="color:#996600;">&quot;grid_24&quot;</span><span style="color:#006600; font-weight:bold;">&gt;</span>Don<span style="color:#996600;">'t Panic: fatal system error, core dump file not generated ...&lt;/div&gt;</span></div></div>
<p>change to whatever text you want.<br />
<span id="more-2805"></span><br />
<span style="text-decoration: underline;">[footer]</span></p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Location: RAILS_ROOT<span style="color: #000000; font-weight: bold;">/</span>app<span style="color: #000000; font-weight: bold;">/</span>views<span style="color: #000000; font-weight: bold;">/</span>activities<span style="color: #000000; font-weight: bold;">/</span>index.html.erb, line <span style="color: #000000;">23</span>~<span style="color: #000000;">27</span></div></div>
<div class="codecolorer-container ruby railscasts" style="border:1px solid #9F9F9F;width:100%;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#006600; font-weight:bold;">&lt;</span>div id=<span style="color:#996600;">&quot;copyright&quot;</span> <span style="color:#9966CC; font-weight:bold;">class</span>=<span style="color:#996600;">&quot;grid_21&quot;</span><span style="color:#006600; font-weight:bold;">&gt;</span><br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&lt;</span>p<span style="color:#006600; font-weight:bold;">&gt;</span>卢瑟出品，必属废品<span style="color:#006600; font-weight:bold;">&amp;</span>trade;<span style="color:#006600; font-weight:bold;">&amp;</span>nbsp;<span style="color:#006600; font-weight:bold;">&amp;</span>nbsp;Copyright <span style="color:#006600; font-weight:bold;">&amp;</span>copy; <span style="color:#006666;">2010</span><span style="color:#006600; font-weight:bold;">&amp;</span>ndash;<span style="color:#006666;">2011</span> by <span style="color:#006600; font-weight:bold;">&lt;</span>span <span style="color:#9966CC; font-weight:bold;">class</span>=<span style="color:#996600;">&quot;losers&quot;</span><span style="color:#006600; font-weight:bold;">&gt;</span><span style="color:#996600;">&quot;Losers&quot;</span><span style="color:#006600; font-weight:bold;">&lt;/</span>span<span style="color:#006600; font-weight:bold;">&gt;</span> Corporation.<span style="color:#006600; font-weight:bold;">&amp;</span>nbsp;<span style="color:#006600; font-weight:bold;">&amp;</span>nbsp;All Rights Already <span style="color:#006600; font-weight:bold;">&lt;</span>span <span style="color:#9966CC; font-weight:bold;">class</span>=<span style="color:#996600;">&quot;losers&quot;</span><span style="color:#006600; font-weight:bold;">&gt;</span>Lost<span style="color:#006600; font-weight:bold;">&lt;/</span>span<span style="color:#006600; font-weight:bold;">&gt;</span>.<span style="color:#006600; font-weight:bold;">&lt;/</span>p<span style="color:#006600; font-weight:bold;">&gt;</span><br />
<span style="color:#006600; font-weight:bold;">&lt;/</span>div<span style="color:#006600; font-weight:bold;">&gt;</span><br />
<span style="color:#006600; font-weight:bold;">&lt;</span>div <span style="color:#9966CC; font-weight:bold;">class</span>=<span style="color:#996600;">&quot;grid_3&quot;</span><span style="color:#006600; font-weight:bold;">&gt;</span><br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&lt;</span>div id=<span style="color:#996600;">&quot;curation&quot;</span><span style="color:#006600; font-weight:bold;">&gt;</span>Curated by <span style="color:#006600; font-weight:bold;">&lt;</span>a id=<span style="color:#996600;">&quot;avatar&quot;</span> href=<span style="color:#996600;">&quot;http://blog.samsonis.me/&quot;</span> target=<span style="color:#996600;">&quot;_blank&quot;</span><span style="color:#006600; font-weight:bold;">&gt;&lt;</span>img src=<span style="color:#996600;">&quot;/images/avatar.jpg&quot;</span> alt=<span style="color:#996600;">&quot;Avatar&quot;</span> title=<span style="color:#996600;">&quot;Samson Wu&quot;</span><span style="color:#006600; font-weight:bold;">&gt;&lt;/</span>a<span style="color:#006600; font-weight:bold;">&gt;&lt;/</span>div<span style="color:#006600; font-weight:bold;">&gt;</span><br />
<span style="color:#006600; font-weight:bold;">&lt;/</span>div<span style="color:#006600; font-weight:bold;">&gt;</span></div></div>
<p>change to whatever text you want.</p>
<p><span style="text-decoration: underline;">[Disqus]</span><br />
到<a href="http://disqus.com/">Disqus</a> register site和profile，然后拿到universal的javascript code，替换我的javascript code，具体位置在：</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Location: RAILS_ROOT<span style="color: #000000; font-weight: bold;">/</span>app<span style="color: #000000; font-weight: bold;">/</span>views<span style="color: #000000; font-weight: bold;">/</span>layouts<span style="color: #000000; font-weight: bold;">/</span>application.html.erb, line <span style="color: #000000;">27</span>~<span style="color: #000000;">42</span></div></div>
<p><span style="text-decoration: underline;">[Google Analytics]</span><br />
同Disqus类似，到<a href="http://www.google.com/analytics/">Google Analytics</a>注册添加site，然后获得javascript code，替换默认的javascript code，位置在：</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Location: RAILS_ROOT<span style="color: #000000; font-weight: bold;">/</span>app<span style="color: #000000; font-weight: bold;">/</span>views<span style="color: #000000; font-weight: bold;">/</span>layouts<span style="color: #000000; font-weight: bold;">/</span>application.html.erb, line <span style="color: #000000;">12</span>~<span style="color: #000000;">22</span></div></div>
<p>Enjoy and have fun!</p>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.samsonis.me/2011/03/stdout-deployment/" title="stdout deployment (March 7, 2011)">stdout deployment</a> (4)</li>
	<li><a href="http://blog.samsonis.me/2011/03/stdout-on-github/" title="stdout on github (March 7, 2011)">stdout on github</a> (0)</li>
	<li><a href="http://blog.samsonis.me/2009/06/redmine-on-archlinux/" title="Redmine on Archlinux (June 30, 2009)">Redmine on Archlinux</a> (6)</li>
	<li><a href="http://blog.samsonis.me/2009/06/install-ruby-on-rails-on-archlinux/" title="Install Ruby on Rails on Archlinux (June 30, 2009)">Install Ruby on Rails on Archlinux</a> (0)</li>
	<li><a href="http://blog.samsonis.me/2011/12/downgrade-rubygems/" title="Downgrade Rubygems (December 5, 2011)">Downgrade Rubygems</a> (0)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.samsonis.me/2011/03/stdout-customization/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>stdout deployment</title>
		<link>http://blog.samsonis.me/2011/03/stdout-deployment/</link>
		<comments>http://blog.samsonis.me/2011/03/stdout-deployment/#comments</comments>
		<pubDate>Mon, 07 Mar 2011 08:11:33 +0000</pubDate>
		<dc:creator>Samson Wu</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Share]]></category>
		<category><![CDATA[Technique]]></category>
		<category><![CDATA[HostMonster]]></category>
		<category><![CDATA[stdout]]></category>

		<guid isPermaLink="false">http://blog.samsonis.me/?p=2785</guid>
		<description><![CDATA[首先值得一提的是为了支持HostMonster的fastcgi，我人为copy了几个以raild -D生成的项目结构里面的dispatch文件以及create了一个.htaccess文件，如果你不用fastcgi（通常情况下你不需要，而且也不推荐），你可以简单的删除它们（以下RAILS_ROOT是指rails app的根目录）： RAILS_ROOT/config.ru RAILS_ROOT/public/dispatch.cgi RAILS_ROOT/public/dispatch.fcgi RAILS_ROOT/public/dispatch.rb RAILS_ROOT/public/.htaccess [Development Environment] Assume你的os已经装好ruby，如果没有请自行google，这里不再赘述。 首先update一下rubygems，最近rubygems貌似打了鸡血，更新极其频繁… 且bug具多…如果出了问题建议rollback到1.4.2… [Note: 由于我使用rvm，所以以下command都没有sudo，根据你的情况你可能需要加上sudo] $ gem update --system 从github上checkout一份最新的code，rails 2.3.11已经freeze进了source code，所以安装rails并不是必须的： $ git clone git://github.com/samsonw/stdout.git $ cd stdout 复制一份database.yml，不需要什么特别的修改，默认的dev环境配置是使用sqlite3的database： $ cp config/database.yml.example config/database.yml 运行rake db:migrate之前确保已经装好了sqlite3-ruby gem和parse_feeds.rake所依赖的gem，不然rake可能会报错: $ gem install sqlite3-ruby $ gem install base64 json rest-client twitter nokogiri open-uri $ rake db:migrate 如果没有报错，database应该已经建好，接下来我们需要给database populate ...]]></description>
			<content:encoded><![CDATA[<p>首先值得一提的是为了支持HostMonster的fastcgi，我人为copy了几个以raild -D生成的项目结构里面的dispatch文件以及create了一个.htaccess文件，如果你不用fastcgi（通常情况下你不需要，而且也不推荐），你可以简单的删除它们（以下RAILS_ROOT是指rails app的根目录）：</p>
<div class="codecolorer-container ruby railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">RAILS_ROOT<span style="color:#006600; font-weight:bold;">/</span>config.<span style="color:#9900CC;">ru</span><br />
RAILS_ROOT<span style="color:#006600; font-weight:bold;">/</span>public<span style="color:#006600; font-weight:bold;">/</span>dispatch.<span style="color:#9900CC;">cgi</span><br />
RAILS_ROOT<span style="color:#006600; font-weight:bold;">/</span>public<span style="color:#006600; font-weight:bold;">/</span>dispatch.<span style="color:#9900CC;">fcgi</span><br />
RAILS_ROOT<span style="color:#006600; font-weight:bold;">/</span>public<span style="color:#006600; font-weight:bold;">/</span>dispatch.<span style="color:#9900CC;">rb</span><br />
RAILS_ROOT<span style="color:#006600; font-weight:bold;">/</span>public<span style="color:#006600; font-weight:bold;">/</span>.<span style="color:#9900CC;">htaccess</span></div></div>
<p><span style="text-decoration: underline;">[Development Environment]</span><br />
Assume你的os已经装好ruby，如果没有请自行google，这里不再赘述。</p>
<p>首先update一下rubygems，最近rubygems貌似打了鸡血，更新极其频繁… 且bug具多…如果出了问题建议rollback到1.4.2…<br />
[Note: 由于我使用<a href="http://rvm.beginrescueend.com/">rvm</a>，所以以下command都没有sudo，根据你的情况你可能需要加上sudo]</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ gem update <span style="color: #660033;">--system</span></div></div>
<p><span id="more-2785"></span><br />
从github上checkout一份最新的code，rails 2.3.11已经freeze进了source code，所以安装rails并不是必须的：</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ git clone git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>samsonw<span style="color: #000000; font-weight: bold;">/</span>stdout.git<br />
$ <span style="color: #7a0874; font-weight: bold;">cd</span> stdout</div></div>
<p>复制一份database.yml，不需要什么特别的修改，默认的dev环境配置是使用sqlite3的database：</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">cp</span> config<span style="color: #000000; font-weight: bold;">/</span>database.yml.example config<span style="color: #000000; font-weight: bold;">/</span>database.yml</div></div>
<p>运行rake db:migrate之前确保已经装好了sqlite3-ruby gem和parse_feeds.rake所依赖的gem，不然rake可能会报错:</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ gem <span style="color: #c20cb9; font-weight: bold;">install</span> sqlite3-ruby<br />
$ gem <span style="color: #c20cb9; font-weight: bold;">install</span> base64 json rest-client twitter nokogiri open-uri<br />
$ rake db:migrate</div></div>
<p>如果没有报错，database应该已经建好，接下来我们需要给database populate some data，首先来搞Source表，编辑RAILS_ROOT/db/seeds.rb文件，修改blog的link或者删除某些不需要的link，也可以加上你需要的source，我默认加了4个source：</p>
<div class="codecolorer-container ruby railscasts" style="border:1px solid #9F9F9F;width:100%;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Source.<span style="color:#9900CC;">find_or_create_by_name</span> <span style="color:#ff3333; font-weight:bold;">:name</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#996600;">&quot;blog&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:display_name</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#996600;">&quot;Weblog&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:url</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#996600;">&quot;http://blog.samsonis.me/&quot;</span><br />
Source.<span style="color:#9900CC;">find_or_create_by_name</span> <span style="color:#ff3333; font-weight:bold;">:name</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#996600;">&quot;twitter&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:display_name</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#996600;">&quot;Twitter&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:url</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#996600;">&quot;http://twitter.com/&quot;</span><br />
Source.<span style="color:#9900CC;">find_or_create_by_name</span> <span style="color:#ff3333; font-weight:bold;">:name</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#996600;">&quot;sina&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:display_name</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#996600;">&quot;新浪微博&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:url</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#996600;">&quot;http://t.sina.com.cn/&quot;</span><br />
Source.<span style="color:#9900CC;">find_or_create_by_name</span> <span style="color:#ff3333; font-weight:bold;">:name</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#996600;">&quot;douban&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:display_name</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#996600;">&quot;豆瓣&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:url</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#996600;">&quot;http://www.douban.com/&quot;</span></div></div>
<p>完成后我们就可以populate database：</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ rake db:seed</div></div>
<p>接下来来搞Activity表，这个表是需要实时更新的（我在production上是半小时一次），数据的更新是通过RAILS_ROOT/lib/tasks/parse_feeds.rake脚本完成的，根据你的需要你需要修改一下这个文件，比如blog的feed地址，sina的username/password，douban的miniblogs feed地址以及twitter的帐号（请自行注意翻墙），根据需要也可以删除或添加新的rake tasks，完成修改后，务必做下测试，我用一个vitual task stdout以简化运行（也为了之后方便cron job配置）：</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ rake stdout</div></div>
<p>如果需要，你也可以执行单个task：</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ rake feeds:parse<br />
$ rake twitter:parse<br />
$ rake sina:parse<br />
$ rake douban:parse</div></div>
<p>如果一切正常，database应该已经populate完成，大功告成，server start，http://localhost:3000/, welcome abroad：</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ script<span style="color: #000000; font-weight: bold;">/</span>server</div></div>
<p><span style="text-decoration: underline;">[Production Environment]</span><br />
完成了开发环境的搭建，Production的deployment就会简单很多（当然用fastcgi的不算），因为本质上是差不多的，区别可能只在database和web server的配置之上（我们是卢瑟，没有多少点击率的小site根本不需要load balance，不需要cdn，不需要nosql，不需要distributed）.</p>
<p>database的配置请修改database.yml的production section，比如我们要用mysql database（最新driver是mysql2，不过as you may already know，HostMonser支持只支持mysql，你可以根据你的需要使用mysql2）：</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ gem <span style="color: #c20cb9; font-weight: bold;">install</span> mysql</div></div>
<div class="codecolorer-container ruby railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">production:<br />
&nbsp; adapter: mysql<br />
&nbsp; encoding: utf8<br />
&nbsp; database: MYSQL_DATABASE_NAME<br />
&nbsp; pool: <span style="color:#006666;">5</span><br />
&nbsp; username: MYSQL_USER<br />
&nbsp; password: PASSWORD<br />
&nbsp; host: localhost</div></div>
<p>web/app server建议使用passenger，然后apache抑或nginx，这里不再赘述；当然你也可以直接mongrel或是webrick抑或fastcgi.</p>
<p>最后你还需要配置一个cron job，定时更新数据，我在Production上每30分钟更新一次，你可以根据你的需要配置，比如某些话捞可能需要15分钟一次甚至5分钟一次：</p>
<div class="codecolorer-container bash railscasts" style="border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000;">15</span>,<span style="color: #000000;">45</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> &nbsp;<span style="color: #7a0874; font-weight: bold;">cd</span> RAILS_ROOT <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> rake <span style="color: #007800;">RAILS_ENV</span>=<span style="color: #ff0000;">&quot;production&quot;</span> stdout <span style="color: #000000; font-weight: bold;">&gt;/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span></div></div>
<p>能回忆记起的大致就这些了，如果deploy中有问题请留言，I&#8217;m more than happy to assist.</p>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.samsonis.me/2011/03/stdout-customization/" title="stdout customization (March 7, 2011)">stdout customization</a> (1)</li>
	<li><a href="http://blog.samsonis.me/2011/03/stdout-on-github/" title="stdout on github (March 7, 2011)">stdout on github</a> (0)</li>
	<li><a href="http://blog.samsonis.me/2009/06/redmine-on-archlinux/" title="Redmine on Archlinux (June 30, 2009)">Redmine on Archlinux</a> (6)</li>
	<li><a href="http://blog.samsonis.me/2009/06/install-ruby-on-rails-on-archlinux/" title="Install Ruby on Rails on Archlinux (June 30, 2009)">Install Ruby on Rails on Archlinux</a> (0)</li>
	<li><a href="http://blog.samsonis.me/2011/12/downgrade-rubygems/" title="Downgrade Rubygems (December 5, 2011)">Downgrade Rubygems</a> (0)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.samsonis.me/2011/03/stdout-deployment/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>stdout on github</title>
		<link>http://blog.samsonis.me/2011/03/stdout-on-github/</link>
		<comments>http://blog.samsonis.me/2011/03/stdout-on-github/#comments</comments>
		<pubDate>Mon, 07 Mar 2011 05:23:57 +0000</pubDate>
		<dc:creator>Samson Wu</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Share]]></category>
		<category><![CDATA[Technique]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[Loser]]></category>
		<category><![CDATA[LoserLogs]]></category>
		<category><![CDATA[stdout]]></category>

		<guid isPermaLink="false">http://blog.samsonis.me/?p=2778</guid>
		<description><![CDATA[stdout, aka LoserLogs or LoserStream is finally on github, check out at https://github.com/samsonw/stdout . The code is based on rails 2.3.11 instead of rails 3, quite a surprise, isn&#8217;t it? Actually I was planning to, but after some research, it turns out my shared host provider HostMonster only support rails 2 at the time of ...]]></description>
			<content:encoded><![CDATA[<p>stdout, aka LoserLogs or <a href="http://blog.samsonis.me/2011/03/stdout-samsonw-info/#comment-1612">LoserStream</a> is finally on github, check out at <a href="https://github.com/samsonw/stdout">https://github.com/samsonw/stdout</a> .</p>
<p>The code is based on rails 2.3.11 instead of rails 3, quite a surprise, isn&#8217;t it?  Actually I was planning to, but after some research, it turns out my shared host provider <a href="http://www.hostmonster.com/">HostMonster</a> only support rails 2 at the time of this writing, shame on them.</p>
<p>It was always quite enjoyable to figure this and that out in the process of curating that site, except the deployment experiences on HostMonster.  To my surprise, they&#8217;re still using Fastcgi to support rails application, again, shame on them.</p>
<p>Last but not least, the project is called &#8220;LoserLogs&#8221; and copyrighted by &#8220;Losers&#8221; corporation, cause I and along with some of my friends are all having the &#8220;loser&#8221; faith in our heart, this is NOT a joke :)</p>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.samsonis.me/2011/03/stdout-samsonw-info/" title="stdout.samsonw.info (March 4, 2011)">stdout.samsonw.info</a> (3)</li>
	<li><a href="http://blog.samsonis.me/2011/03/stdout-deployment/" title="stdout deployment (March 7, 2011)">stdout deployment</a> (4)</li>
	<li><a href="http://blog.samsonis.me/2011/03/stdout-customization/" title="stdout customization (March 7, 2011)">stdout customization</a> (1)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.samsonis.me/2011/03/stdout-on-github/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redmine on Archlinux</title>
		<link>http://blog.samsonis.me/2009/06/redmine-on-archlinux/</link>
		<comments>http://blog.samsonis.me/2009/06/redmine-on-archlinux/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 05:07:57 +0000</pubDate>
		<dc:creator>Samson Wu</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[ArchLinux]]></category>
		<category><![CDATA[Redmine]]></category>

		<guid isPermaLink="false">http://blog.samsonis.me/?p=956</guid>
		<description><![CDATA[[Overview] This entry will describe a basic installation and configuration of redmine, a flexible and cross-platform project management web application, on an archlinux system. For the official installation guide, please refer this wiki page. [Preparation] 1. Download the latest stable release of redmine (0.8.4) from rubyforge: $ wget http://rubyforge.org/frs/download.php/56909/redmine-0.8.4.tar.gz 2. Install ruby and ruby on ...]]></description>
			<content:encoded><![CDATA[<p><span style="text-decoration: underline;">[Overview]</span><br />
This entry will describe a basic installation and configuration of <a href="http://www.redmine.org/">redmine</a>, a flexible and cross-platform project management web application, on an archlinux system.</p>
<p>For the official installation guide, please refer this <a href="http://www.redmine.org/wiki/redmine/RedmineInstall">wiki page</a>.</p>
<p><span style="text-decoration: underline;">[Preparation]</span><br />
1. Download the latest stable release of redmine (0.8.4) from <a href="http://rubyforge.org/frs/?group_id=1850">rubyforge</a>:</p>
<div class="codecolorer-container text railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ wget http://rubyforge.org/frs/download.php/56909/redmine-0.8.4.tar.gz</div></div>
<p>2. <a href="http://blog.samsonis.me/2009/06/install-ruby-on-rails-on-archlinux/">Install ruby and ruby on rails</a><br />
(Notes: rails is optional since the redmine official release we download above already include the appropriate rails version (2.1.2) in its vendor directory)</p>
<p>3. Make sure rubygems and rake meet the version requirement of redmine:</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">gem <span style="color: #660033;">-v</span> <span style="color: #000000; font-weight: bold;">&gt;</span>= 1.3.1</div></div>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">rake <span style="color: #660033;">--version</span> <span style="color: #000000; font-weight: bold;">&gt;</span>= 0.8.3</div></div>
<p><span id="more-956"></span><br />
<span style="text-decoration: underline;">[Database]</span><br />
mysql is the recommended database of redmine, so here we will use mysql:</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> pacman <span style="color: #660033;">-S</span> mysql</div></div>
<p>start mysql:</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>rc.d<span style="color: #000000; font-weight: bold;">/</span>mysqld start</div></div>
<p>refer this <a href="http://wiki.archlinux.org/index.php/MySQL">wiki page</a> for more information about mysql installation.</p>
<p><span style="text-decoration: underline;">[Basic installation]</span><br />
<span style="text-decoration: underline;">step 1</span>: create redmine db with user &#8220;redmine&#8221;</p>
<div class="codecolorer-container mysql railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ mysql <span style="color: #CC0099;">-</span>u root <span style="color: #CC0099;">-</span>p<br />
mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">create</span> <span style="color: #990099; font-weight: bold;">database</span> redmine character <span style="color: #990099; font-weight: bold;">set</span> utf8<span style="color: #000033;">;</span><br />
mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">create</span> <span style="color: #000099;">user</span> <span style="color: #008000;">'redmine'</span>@<span style="color: #008000;">'localhost'</span> identified by <span style="color: #008000;">'password'</span><span style="color: #000033;">;</span><br />
mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">grant</span> <span style="color: #990099; font-weight: bold;">all</span> <span style="color: #990099; font-weight: bold;">privileges</span> <span style="color: #990099; font-weight: bold;">on</span> redmine.<span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">to</span> <span style="color: #008000;">'redmine'</span>@<span style="color: #008000;">'localhost'</span><span style="color: #000033;">;</span></div></div>
<p><span style="text-decoration: underline;">step 2</span>: configure redmine database settings for &#8220;production&#8221; environment</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #7a0874; font-weight: bold;">cd</span> redmine-0.8.4<br />
$ <span style="color: #c20cb9; font-weight: bold;">cp</span> config<span style="color: #000000; font-weight: bold;">/</span>database.yml.example config<span style="color: #000000; font-weight: bold;">/</span>database.yml</div></div>
<p>edit config/database.yml, make the production section looks like:</p>
<blockquote><p>production:<br />
adapter: mysql<br />
database: redmine<br />
host: localhost<br />
username: redmine<br />
password: password<br />
encoding: utf8</p></blockquote>
<p><span style="text-decoration: underline;">step 3</span>: create database structure and an administrator account</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ rake db:migrate <span style="color: #007800;">RAILS_ENV</span>=<span style="color: #ff0000;">&quot;production&quot;</span></div></div>
<p>the default administrator account is:</p>
<blockquote><p>username: admin<br />
password: admin</p></blockquote>
<p><span style="text-decoration: underline;">step 4</span>: insert default configuration data in database</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ rake redmine:load_default_data <span style="color: #007800;">RAILS_ENV</span>=<span style="color: #ff0000;">&quot;production&quot;</span></div></div>
<p>according to the official wiki, this step is optional but <em>highly recommended</em>.  It will load default roles, trackers, statuses, workflows and enumerations for our convenience.</p>
<p><span style="text-decoration: underline;">step 5</span>: test installation<br />
start mongrel:</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ script<span style="color: #000000; font-weight: bold;">/</span>server <span style="color: #660033;">-e</span> production</div></div>
<p>point your browser to navigate http://server-domain-or-ip:3000/ to see the redmine welcome page, use the default admin account above to login.</p>
<p>redmine home:</p>
<p><a href="http://blog.samsonis.me/wp-content/uploads/2009/06/redmine-home.png"><img class="alignnone size-medium wp-image-1022" title="redmine home" src="http://blog.samsonis.me/wp-content/uploads/2009/06/redmine-home-300x217.png" alt="redmine home" width="300" height="217" /></a></p>
<p>redmine administration setting:</p>
<p><a href="http://blog.samsonis.me/wp-content/uploads/2009/06/redmine-admin-setting.png"><img class="alignnone size-medium wp-image-1023" title="redmine admin setting" src="http://blog.samsonis.me/wp-content/uploads/2009/06/redmine-admin-setting-300x217.png" alt="redmine admin setting" width="300" height="217" /></a></p>
<p><span style="text-decoration: underline;">[Deploy using phusion passenger (aka mod_rails)]</span><br />
<span style="text-decoration: underline;">step 1</span>: install passenger and its apache 2 module<br />
install passenger:</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> passenger</div></div>
<p>install apache 2 module, please make sure g++, ruby, openssl and apache are installed before issue the command below:</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> passenger-install-apache2-module</div></div>
<p>follow the screen instructions and pay attention to the console output, some of them will be used later.</p>
<p><span style="text-decoration: underline;">step 2</span>: deploy and set up permissions</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">/</span>srv<span style="color: #000000; font-weight: bold;">/</span>http<span style="color: #000000; font-weight: bold;">/</span>rails<br />
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-r</span> redmine-0.8.4 <span style="color: #000000; font-weight: bold;">/</span>srv<span style="color: #000000; font-weight: bold;">/</span>http<span style="color: #000000; font-weight: bold;">/</span>rails<span style="color: #000000; font-weight: bold;">/</span><br />
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> http:http <span style="color: #000000; font-weight: bold;">/</span>srv<span style="color: #000000; font-weight: bold;">/</span>http<span style="color: #000000; font-weight: bold;">/</span>rails<span style="color: #000000; font-weight: bold;">/</span>redmine-0.8.4</div></div>
<p><span style="text-decoration: underline;">step 3</span>: configure apache to use passenger<br />
add one include at the end of httpd.conf:</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Include conf/extra/httpd-rails.conf&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>httpd<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>httpd.conf</div></div>
<p>create the httpd-rails.conf:</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>httpd<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>extra<br />
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">touch</span> httpd-rails.conf</div></div>
<p>edit httpd-rails.conf, follow the former console output and add the passenger configuration there, below is my configuration, yours may be differ:</p>
<blockquote><p>LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/ext/apache2/mod_passenger.so<br />
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.4<br />
PassengerRuby /usr/bin/ruby</p>
<p>NameVirtualHost *:80</p>
<p>&lt;VirtualHost *:80&gt;<br />
&nbsp;&nbsp;ServerName SERVER-DOMAIN-OR-IP<br />
&nbsp;&nbsp;DocumentRoot /srv/http/rails/redmine-0.8.4/public<br />
&nbsp;&nbsp;RailsEnv production<br />
&nbsp;&nbsp;ErrorLog /var/log/httpd/rails_error_log<br />
&nbsp;&nbsp;CustomLog /var/log/httpd/rails_access_log common<br />
&lt;/VirtualHost&gt;</p></blockquote>
<p><span style="text-decoration: underline;">step 4</span>: restart apache and test installation</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>rc.d<span style="color: #000000; font-weight: bold;">/</span>httpd restart</div></div>
<p>navigate http://SERVER-DOMAIN-OR-IP/ to see if anything is broken.</p>
<p><span style="text-decoration: underline;">[Optional components]</span><br />
we use subversion for repository browsing:</p>
<div class="codecolorer-container text railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ sudo pacman -S subversion</div></div>
<p>and enable Gantt export to png image:</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> pacman <span style="color: #660033;">-S</span> imagemagick<br />
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> rmagick</div></div>
<p><span style="text-decoration: underline;">[Themes]</span><br />
I like the Basecamp theme:</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>srv<span style="color: #000000; font-weight: bold;">/</span>http<span style="color: #000000; font-weight: bold;">/</span>rails<span style="color: #000000; font-weight: bold;">/</span>redmine-0.8.4<span style="color: #000000; font-weight: bold;">/</span>public<span style="color: #000000; font-weight: bold;">/</span>themes<br />
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.redmine.org<span style="color: #000000; font-weight: bold;">/</span>attachments<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1274</span><span style="color: #000000; font-weight: bold;">/</span>basecamp.zip<br />
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">unzip</span> basecamp.zip<br />
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> http:http basecamp<br />
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> basecamp.zip</div></div>
<p>then the basecamp theme option is available in the drop-down list of &#8220;Theme&#8221; in the &#8220;General&#8221; tab under &#8220;Administration -&gt; Settings&#8221;.</p>
<p><a href="http://blog.samsonis.me/wp-content/uploads/2009/06/redmine-basecamp.png"><img class="alignnone size-medium wp-image-1033" title="redmine basecamp" src="http://blog.samsonis.me/wp-content/uploads/2009/06/redmine-basecamp-300x217.png" alt="redmine basecamp" width="300" height="217" /></a></p>
<p><span style="text-decoration: underline;">[SMTP]</span><br />
to be continued&#8230;</p>
<p><span style="text-decoration: underline;">[Plugins]</span><br />
to be continued&#8230;</p>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.samsonis.me/2009/06/install-ruby-on-rails-on-archlinux/" title="Install Ruby on Rails on Archlinux (June 30, 2009)">Install Ruby on Rails on Archlinux</a> (0)</li>
	<li><a href="http://blog.samsonis.me/2011/03/archlinux-rvm-ruby-rails-nginx-passenger-and-you/" title="ArchLinux, RVM, Ruby, Rails, Nginx, Passenger and You (March 30, 2011)">ArchLinux, RVM, Ruby, Rails, Nginx, Passenger and You</a> (3)</li>
	<li><a href="http://blog.samsonis.me/2009/05/safeboot%e5%8f%8c%e7%b3%bb%e7%bb%9f%e5%bc%95%e5%af%bc/" title="SafeBoot双系统引导 (May 12, 2009)">SafeBoot双系统引导</a> (29)</li>
	<li><a href="http://blog.samsonis.me/2009/02/archlinux%e4%b8%8b%e7%9a%84%e6%97%b6%e9%97%b4%e6%97%b6%e5%8c%ba%e8%ae%be%e7%bd%ae/" title="Archlinux下的时间时区设置 (February 13, 2009)">Archlinux下的时间时区设置</a> (15)</li>
	<li><a href="http://blog.samsonis.me/2009/02/archlinux-200902%e7%89%88%e6%9c%ac%e7%9a%84%e6%94%b9%e8%bf%9b/" title="ArchLinux 2009.02版本的改进 (February 16, 2009)">ArchLinux 2009.02版本的改进</a> (3)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.samsonis.me/2009/06/redmine-on-archlinux/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Install Ruby on Rails on Archlinux</title>
		<link>http://blog.samsonis.me/2009/06/install-ruby-on-rails-on-archlinux/</link>
		<comments>http://blog.samsonis.me/2009/06/install-ruby-on-rails-on-archlinux/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 17:57:41 +0000</pubDate>
		<dc:creator>Samson Wu</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[ArchLinux]]></category>

		<guid isPermaLink="false">http://blog.samsonis.me/?p=958</guid>
		<description><![CDATA[[Overview] Here we will install ruby on rails framework on our Archlinux box. For more detail information, please refer this wiki page. [Install ruby and rubygems] First we need to install ruby and its package system rubygems: $ sudo pacman -S ruby rubygems [Install rails] Next install rails via rubygems: $ sudo gem install rails ...]]></description>
			<content:encoded><![CDATA[<p><span style="text-decoration: underline;">[Overview]</span><br />
Here we will install <a href="http://rubyonrails.org/">ruby on rails</a> framework on our Archlinux box.  For more detail information, please refer this <a href="http://wiki.archlinux.org/index.php/RubyOnRails">wiki page</a>.</p>
<p><span style="text-decoration: underline;">[Install ruby and rubygems]</span><br />
First we need to install ruby and its package system <a href="http://docs.rubygems.org/">rubygems</a>:</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> pacman <span style="color: #660033;">-S</span> ruby rubygems</div></div>
<p><span style="text-decoration: underline;">[Install rails]</span><br />
Next install rails via rubygems:</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> rails</div></div>
<p>gem will help us manage all the dependencies and download them automatically.</p>
<p>(Notes: if you execute the above command without being root (e.g. without sudo), gem will install rails in the home directory of the current user. Usually the directory is named after &#8220;.gem&#8221;, you probably need to manually add rails and rake bin directory to your PATH before you could use them, that may not be what you exactly want.)<br />
<span id="more-958"></span><br />
next install sqlite database since it&#8217;s rails&#8217;s default database:</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> pacman <span style="color: #660033;">-S</span> ruby-sqlite3</div></div>
<p>rails supports a lot of modern databases, but here we will only use sqlite for simplicity.</p>
<p>Finally let&#8217;s replace rails build-in http server <a href="http://www.webrick.org/">webrick</a> with <a href="http://mongrel.rubyforge.org/">mongrel</a>, which is faster and more stable, and also rails community&#8217;s recommendation.</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> mongrel</div></div>
<p><span style="text-decoration: underline;">[Test rails installation]</span><br />
All right, that&#8217;s it, pretty simple, isn&#8217;t it?  Next, let&#8217;s make sure it exactly works as we expected.</p>
<p>test ruby, rubygems, rails and rake installation, make sure all these tools are successfully installed:</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ ruby <span style="color: #660033;">-v</span><br />
$ gem <span style="color: #660033;">-v</span><br />
$ rails <span style="color: #660033;">-v</span><br />
$ rake <span style="color: #660033;">--version</span></div></div>
<p>create a rails testapp with preconfiguration for sqlite 3 database:</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ rails <span style="color: #660033;">-d</span> sqlite3 testapp</div></div>
<p>next start the web server, mongrel will be booted since we have mongrel installed before, otherwise webrick will be used:</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #7a0874; font-weight: bold;">cd</span> testapp<br />
$ script<span style="color: #000000; font-weight: bold;">/</span>server</div></div>
<p>as can be seen from the console output below, the default listening port is 3000:</p>
<blockquote><p>=> Booting Mongrel<br />
=> Rails 2.3.2 application starting on http://0.0.0.0:3000<br />
=> Call with -d to detach<br />
=> Ctrl-C to shutdown server</p></blockquote>
<p>finally fire our favorite browser to http://server-domain-or-ip:3000/ to see the rails &#8220;welcome abroad&#8221; page, and we&#8217;re done:</p>
<p><a href="http://blog.samsonis.me/wp-content/uploads/2009/06/ruby-on-rails-installation.png"><img src="http://blog.samsonis.me/wp-content/uploads/2009/06/ruby-on-rails-installation-300x217.png" alt="ruby on rails installation" title="ruby on rails installation" width="300" height="217" class="alignnone size-medium wp-image-986" /></a></p>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.samsonis.me/2009/06/redmine-on-archlinux/" title="Redmine on Archlinux (June 30, 2009)">Redmine on Archlinux</a> (6)</li>
	<li><a href="http://blog.samsonis.me/2011/03/archlinux-rvm-ruby-rails-nginx-passenger-and-you/" title="ArchLinux, RVM, Ruby, Rails, Nginx, Passenger and You (March 30, 2011)">ArchLinux, RVM, Ruby, Rails, Nginx, Passenger and You</a> (3)</li>
	<li><a href="http://blog.samsonis.me/2009/05/safeboot%e5%8f%8c%e7%b3%bb%e7%bb%9f%e5%bc%95%e5%af%bc/" title="SafeBoot双系统引导 (May 12, 2009)">SafeBoot双系统引导</a> (29)</li>
	<li><a href="http://blog.samsonis.me/2009/02/archlinux%e4%b8%8b%e7%9a%84%e6%97%b6%e9%97%b4%e6%97%b6%e5%8c%ba%e8%ae%be%e7%bd%ae/" title="Archlinux下的时间时区设置 (February 13, 2009)">Archlinux下的时间时区设置</a> (15)</li>
	<li><a href="http://blog.samsonis.me/2009/02/archlinux-200902%e7%89%88%e6%9c%ac%e7%9a%84%e6%94%b9%e8%bf%9b/" title="ArchLinux 2009.02版本的改进 (February 16, 2009)">ArchLinux 2009.02版本的改进</a> (3)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.samsonis.me/2009/06/install-ruby-on-rails-on-archlinux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

