<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Ruby Fun -- Aaron Qian's Blog</title>
    <link>http://aaron.aaron033.com</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Aaron Qian's Blog about Ruby on Rails and Merb</description>
    <item>
      <title>Merb, DataMapper, Upload Progress, Nginx, Rack, Mongrel, Subversion on SilverRack VPS</title>
      <description>&lt;blockquote&gt;
		&lt;p&gt;&lt;strong&gt;Note: This guide is from my own experience, if it didn&amp;#8217;t work for you, or you caught mistakes in this site, please feel free to leave your comments/suggestion/corrections, and I&amp;#8217;d be more than happy to update this article.&lt;/strong&gt;&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;h2&gt;So You Want A Production Site?&lt;/h2&gt;


	&lt;p&gt;After playing with merb 0.9.4 and datamapper 0.9.3 on my local development enviorment, I was delighted with this killer combo for their innovation, ease of use, clarity, and stability. I&amp;#8217;ve made a little project with merb and wanted to test out how hard it would be to setup as production server. This blog is a tutorial on what I did to get it working.&lt;/p&gt;


	&lt;h3&gt;Get your &lt;span class="caps"&gt;VPS&lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;A few of the projects I worked before are currently using &lt;a href="http://silverrack.com"&gt;SilverRack&lt;/a&gt; slice to host their &lt;a href="http://rubyonrails.org"&gt;Rails&lt;/a&gt; applications, and from the past experience it was a good pick.&lt;/p&gt;


	&lt;p&gt;So I went straight to their website and filled out their &lt;a href="https://silverrack.com/account/signup"&gt;purchase form&lt;/a&gt;. I used the following options:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;256MB slice&lt;/li&gt;
		&lt;li&gt;&lt;strong&gt;railsconf&lt;/strong&gt; coupon code. ($5 discount, don&amp;#8217;t know if it works with other packages)&lt;/li&gt;
		&lt;li&gt;ubuntu 8.10 hardy&lt;/li&gt;
	&lt;/ul&gt;


	&lt;h3&gt;Initial setup&lt;/h3&gt;


	&lt;p&gt;After the purchase, you will get an email with instruction to login to your slice with &lt;span class="caps"&gt;SSH&lt;/span&gt;. You can setup your &lt;span class="caps"&gt;DNS&lt;/span&gt; setting by logging in to &lt;a href="http://silverrack.com"&gt;SilverRack&lt;/a&gt; as well.&lt;/p&gt;


	&lt;p&gt;Now let&amp;#8217;s get your new shinny Ubuntu &lt;span class="caps"&gt;VPS&lt;/span&gt; some basic apps! Logging in to your &lt;span class="caps"&gt;VPS&lt;/span&gt; as root and get this puppy going.&lt;/p&gt;


	&lt;h4&gt;Fix some perl locale complaints
Note, if you encounter errors similar to below:&lt;/h4&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;perl: warning: Setting locale failed&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;The remedy is:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;apt-get install --reinstall language-pack-en&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h4&gt;Update your apt repository&lt;/h4&gt;


	&lt;p&gt;Update &lt;code&gt;sources.list&lt;/code&gt;:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;nano /etc/apt/sources.list&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Paste the following into &lt;code&gt;sources.list&lt;/code&gt;:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;deb http://us.archive.ubuntu.com/ubuntu/ hardy main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ hardy main restricted

deb http://us.archive.ubuntu.com/ubuntu/ hardy-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ hardy-updates main restricted

deb http://us.archive.ubuntu.com/ubuntu/ hardy universe
deb-src http://us.archive.ubuntu.com/ubuntu/ hardy universe
deb http://us.archive.ubuntu.com/ubuntu/ hardy-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ hardy-updates universe

deb http://us.archive.ubuntu.com/ubuntu/ hardy multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ hardy multiverse
deb http://us.archive.ubuntu.com/ubuntu/ hardy-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ hardy-updates multiverse

deb http://archive.canonical.com/ubuntu hardy partner
deb-src http://archive.canonical.com/ubuntu hardy partner&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Update the package database:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;apt-get update&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Upgrade to the latest version of all base packages:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;apt-get upgrade&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h4&gt;Install some basic tools&lt;/h4&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;apt-get install bash man-db cron wget lynx git-core subversion build-essential &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h4&gt;Add a default user&lt;/h4&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;adduser &amp;lt;username&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h4&gt;Give sudo access&lt;/h4&gt;


	&lt;p&gt;Open sudoer config file:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;nano /etc/sudoers&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Add the following line at the end:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;ALL=(ALL) ALL&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h4&gt;Disable root login via &lt;span class="caps"&gt;SSH&lt;/span&gt;&lt;/h4&gt;


Edit the sshd config file:
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;nano /etc/ssh/sshd_config&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Find this line:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;PermitRootLogin yes&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;and change to:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;PermitRootLogin no&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Restart &lt;span class="caps"&gt;SSH&lt;/span&gt;&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;/etc/init.d/ssh restart&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h3&gt;Install Merb and Datamapper&lt;/h3&gt;


	&lt;h4&gt;Setup Ruby, Gems, and Rake&lt;/h4&gt;


Get ruby:
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;apt-get install ruby irb ri rdoc rubygems ruby1.8-dev libzlib-ruby libyaml-ruby libreadline-ruby libncurses-ruby libcurses-ruby libruby libruby-extras libfcgi-ruby1.8 build-essential libopenssl-ruby libdbm-ruby libdbi-ruby libdbd-sqlite3-ruby sqlite3 libsqlite3-dev libsqlite3-ruby libxml-ruby libxml2-dev&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

Update your gem to latest
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;gem update --system&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;If you see something like this:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;uninitialized constant Gem::GemRunner (NameError)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Then open &lt;code&gt;/usr/bin/gem&lt;/code&gt; and Insert the following:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;require 'rubygems/gem_runner'&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;&lt;strong&gt;After&lt;/strong&gt; this line:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;require 'rubygems'&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h4&gt;Install Merb and Datamapper Dependencies&lt;/h4&gt;


Type the following into your console:
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;gem install erubis rake json_pure rspec rack hpricot mime-types addressable english rspec&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Now you can go have some coffee while the gems download and compile&amp;#8230;&lt;/p&gt;


	&lt;h4&gt;Download the latest gems from &lt;a href="http://github.com"&gt;GitHub&lt;/a&gt;&lt;/h4&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;mkdir ~/gems
cd ~/gems
git clone git://github.com/wycats/merb-core.git
git clone git://github.com/wycats/merb-more.git
git clone git://github.com/wycats/merb-plugins.git
git clone git://github.com/sam/extlib.git
git clone git://github.com/wycats/do.git
git clone git://github.com/sam/dm-core.git
git clone git://github.com/sam/dm-more.git&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h4&gt;Compile and install all gems&lt;/h4&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;cd merb-core; sudo rake install; cd..
cd merb-more; sudo rake install; cd..
cd merb-plugins; sudo rake install; cd..
cd extlib; sudo rake install; cd..
cd do; sudo rake install; cd..
cd dm-core; sudo rake install; cd..
cd dm-more; sudo rake install; cd..&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Now you should have Merb and DataMapper both installed, to check their existence, you can do the following:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;gem list&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;You should see gems with names start with &amp;#8220;merb-&amp;#8221; and &amp;#8220;dm-&amp;#8221;&lt;/p&gt;


	&lt;h3&gt;nginx for Your Front-End&lt;/h3&gt;


	&lt;h4&gt;grab a latest stable source from &lt;a href="http://nginx.net/"&gt;nginx&lt;/a&gt;&lt;/h4&gt;


At the time of writing, I downloaded the latest stable
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;cd ~
wget http://sysoev.ru/nginx/nginx-0.6.31.tar.gz&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

h4. Untar it
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;tar -xvzf nginx-0.6.31.tar.gz&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

h4. Make a modules directory for upload progress module
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;cd nginx-0.6.31
mkdir modules&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h4&gt;Download the &lt;a href="http://blog.new-bamboo.co.uk/2007/11/23/upload-progress-with-nginx"&gt;nginx upload progress module&lt;/a&gt;&lt;/h4&gt;


	&lt;p&gt;Download the latest source tar.gz file, and untar it. Finally, put it in your &amp;#8220;modules&amp;#8221; directory&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;cd modules
wget http://wiki.codemongers.com/NginxHttpUploadProgressModule?action=AttachFile&amp;amp;do=get&amp;amp;target=nginx_uploadprogress_module-0.2.tar.gz
tar -xvzf nginx_uploadprogress_module-0.2.tar.gz
rm nginx_uploadprogress_module-0.2.tar.gz
cd ..&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h4&gt;Install dependencies for Nginx&lt;/h4&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;apt-get install libpcre3-dev libgcrypt11-dev libssl-dev&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h4&gt;Configure Nginx&lt;/h4&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;./configure --with-openssl=/usr/lib/ssl/ --with-md5=/usr/lib --add-module=modules/nginx_uploadprogress_module&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h4&gt;Make and Install&lt;/h4&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;make
make install&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h4&gt;Setup Init Script&lt;/h4&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;cd /etc/init.d/
wget http://topfunky.net/svn/shovel/nginx/init.d/nginx
chmod +x nginx&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h4&gt;Make Nginx start on boot&lt;/h4&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;update-rc.d -f nginx defaults&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h4&gt;Start Nginx&lt;/h4&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;/etc/init.d/nginx start&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h4&gt;link Nginx Configuration Files to ect&lt;/h4&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;ln -s /usr/local/nginx/conf /etc/nginx&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h3&gt;Setup Your Subversion Repository&lt;/h3&gt;


	&lt;h4&gt;Install subversion and tools&lt;/h4&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;apt-get install subversion subversion-tools libsvn-dev libsvn1&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h4&gt;Setup a repository&lt;/h4&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;adduser deploy
sudo svnadmin create /var/svn/mycode
chown -R deploy:deploy /var/svn/mycode&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h4&gt;Edit svnserve config file&lt;/h4&gt;


	&lt;p&gt;Open the config file:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;nano /var/svn/mycode/conf/svnserve.conf&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Modify the following lines:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;anon-access = none
auth-access = write
authz-db = /usr/local/nginx/conf/svn_access.rules
realm = My Code Repository&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h4&gt;Permissions&lt;/h4&gt;


	&lt;p&gt;Create an svnserve access file:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;sudo nano /usr/local/nginx/conf/svn_access.rules&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Paste in the following and save the file:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;[groups]
developers = deploy
qc = deploy
pm = deploy
[/]

@developers = rw
@qc = r
@pm = r&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h4&gt;Init Script for snvserve&lt;/h4&gt;


	&lt;p&gt;Create a svnserve startup file:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;sudo nano /etc/init.d/svnserve&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Paste in the following:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;#!/bin/sh
# Use the following variables to customize user, group, and paths.
SVNSERVE=`which svnserve`
SVN_USER=aaron
SVN_GROUP=aaron
SVN_ROOT_PATH=/var/svn/mycode/

if [ -f /etc/rc.d/init.d/functions ]; then
# RedHat style
. /etc/rc.d/init.d/functions
START=&amp;quot;daemon $SVNSERVE -d --root $SVN_ROOT_PATH&amp;quot;
STOP=&amp;quot;killproc $SVNSERVE&amp;quot;
else
# Ubuntu LSB style
. /lib/lsb/init-functions
START=&amp;quot;start-stop-daemon --start --exec $SVNSERVE -- -d --root $SVN_ROOT_PATH&amp;quot;
STOP=&amp;quot;start-stop-daemon --stop --exec $SVNSERVE&amp;quot;
fi

if [ ! -x $SVNSERVE ]; then
echo &amp;quot;Could not find ${SVNSERVE}. PATH is ${PATH}&amp;quot;
exit 0
fi

case &amp;quot;$1&amp;quot; in
start)
echo &amp;quot;Starting svnserve...&amp;quot;
umask 002
$START
if [ $? ]; then
echo &amp;quot;Started svnserve&amp;quot;
exit 0
else
exit $?
fi
;;

stop)
echo &amp;quot;Stopping svnserve...&amp;quot;
$STOP
exit $?
;;

restart|force-reload)
&amp;quot;$0&amp;quot; stop &amp;amp;&amp;amp; &amp;quot;$0&amp;quot; start
;;

*)
echo &amp;quot;Usage: /etc/init.d/svnserve {start|stop|restart|force-reload}&amp;quot;
exit 1
;;
esac

echo &amp;quot;Unhandled case while trying to start svnserve.&amp;quot;
echo &amp;quot;see $0&amp;quot;
exit 3&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Make it executable:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;sudo chmod +x /etc/init.d/svnserve&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h4&gt;Make svnserve start on boot&lt;/h4&gt;


	&lt;p&gt;Add it to the startup scripts:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;sudo update-rc.d /etc/init.d/svnserve defaults&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h4&gt;Start the server&lt;/h4&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;sudo /etc/init.d/svnserve start&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h4&gt;Import your merb app&lt;/h4&gt;


	&lt;p&gt;Create a directories for your app:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;svn mkdir -m &amp;quot;make my_app&amp;quot; svn+ssh://domain.tld/var/svn/mycode/my_app
svn mkdir -m &amp;quot;make trunk&amp;quot; svn+ssh://domain.tld/var/svn/mycode/my_app/trunk&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Import your app:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;cd my_app
svn import -m &amp;quot;initial import of my_app&amp;quot; . svn+ssh://domain.tld/var/svn/mycode/my_app/trunk&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Checkout your app:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;makedir ~/projects/my_app
cd ~/projects/my_app
svn co svn+ssh://domain.tld/var/svn/mycode/my_app/trunk&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h3&gt;Capistrano&lt;/h3&gt;


	&lt;p&gt;To be continued&amp;#8230;&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;&lt;strong&gt;Note: This guide is from my own experience, if it didn&amp;#8217;t work for you, or you caught mistakes in this site, please feel free to leave your comments/suggestion/corrections, and I&amp;#8217;d be more than happy to update this article.&lt;/strong&gt;&lt;/p&gt;
	&lt;/blockquote&gt;




	&lt;h3&gt;References:&lt;/h3&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://merbivore.com"&gt;Merb&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://datamapper.org"&gt;DataMapper&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://github.com"&gt;GitHub&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://jblevins.org/computing/internet/ubuntu-vps"&gt;Setting up your &lt;span class="caps"&gt;VPS&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://the-time.blogspot.com/2008/01/sourceslist-hardy.html"&gt;Default Ubuntu Hardy sources.list&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://blog.new-bamboo.co.uk/2007/11/23/upload-progress-with-nginx"&gt;Nginx Upload Progress&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://blog.jeff-owens.com/index.php/2008/03/04/full-rails-stack-part-three-project-and-subversion/"&gt;How to setup svn+ssh&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://errtheblog.com/posts/52-nginx-config-like-whoa" title="Gem"&gt;Nginx Config file generator&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://blog.new-bamboo.co.uk/2008/2/29/using-the-nginx-upload-progress-module-with-safari"&gt;Nginx Upload Progress with Safari&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://silverrack.com"&gt;Silver Rack &lt;span class="caps"&gt;VPS&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;</description>
      <pubDate>Fri, 27 Jun 2008 15:23:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:4b7e97f8-21eb-40a3-a2f9-59f11dbd8d94</guid>
      <author>Aaron Qian</author>
      <link>http://aaron.aaron033.com/articles/2008/06/27/merb-datamapper-nginx-upload-progress-rack-mongrel-subversion-on-silverrack-vps</link>
      <category>merb</category>
      <category>DataMapper</category>
      <category>Upload</category>
      <category>Progress</category>
      <category>Nginx</category>
      <category>Rack</category>
      <category>Mongrel</category>
      <category>Subversion</category>
      <trackback:ping>http://aaron.aaron033.com/articles/trackback/4</trackback:ping>
    </item>
    <item>
      <title>Website Design Methodology   -- The Golden Pyramid</title>
      <description>&lt;h2&gt;Optimizing Design Efficiency and Cost&lt;/h2&gt;


	&lt;p&gt;Building a website is similar to building a pyramid, except it is built from the top of the pyramid to the bottom. The pyramid below represents different phases of creating a website from an idea to completion. The sizes of each phase gives you an idea of how much time/money it will take for each changes made during that phase.&lt;/p&gt;


	&lt;p&gt;&lt;img src="/files/pyramid.jpg" alt="" /&gt;&lt;/p&gt;


	&lt;h2&gt;Idea Phase&lt;/h2&gt;


	&lt;p&gt;This is the initial phase of making a website. Primary goal is to gather initial requirements of the site. However, the initial requirements is often incomplete, vague, and often contradictory.  Often times driven by the vision of the boss.&lt;/p&gt;


	&lt;h2&gt;Spec Phase&lt;/h2&gt;


	&lt;p&gt;This is the phase where you make your initial spec complete, correct, concise, and clear. Several tools will be used to facilitate this goal:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Wire Diagrams (Schematics)&lt;/li&gt;
		&lt;li&gt;Flow Diagrams (Use Cases)&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;At this stage, no design is done. However, functionalities, features, and general layouts are decided at this stage. This stage should also involve the Operation, Design and Development team and hear their input for several reasons:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Is this spec operationally suitable for the operations team? (Operations) &lt;/li&gt;
		&lt;li&gt;How to maximize Usability? (Usability)&lt;/li&gt;
		&lt;li&gt;How to lead different types of users through our website to increase the conversion rate? (Design and Usability)&lt;/li&gt;
		&lt;li&gt;Is this spec possible to implement? (Dev)&lt;/li&gt;
		&lt;li&gt;How long will it take? (Design, Dev)
What plans do we have for &lt;span class="caps"&gt;SEO&lt;/span&gt;? (Dev, Design, Operations)&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;The detailed spec should be finalized &lt;span class="caps"&gt;BEFORE&lt;/span&gt; moving into design and development.  Often times this process is lengthy and chaotic.  It&#8217;s important that an open exchange of ideas are tabled and discussed as a team.  It&#8217;s also critical that there&#8217;s a clear decision maker reach closure.&lt;/p&gt;


	&lt;h2&gt;Design Phase&lt;/h2&gt;


	&lt;p&gt;This is the phase when the spec is finalized, and we start to create the prototype of the website. This time, design should only focus on the look and feel, not usability and functional issues. When this phase is done, ideally an &lt;span class="caps"&gt;HTML&lt;/span&gt; mock up should be done with links to demonstrate how the site should look like when it is operational. Also, when changes to usability and functional changes must be made, (meaning Spec is done wrong) there should be a meeting where all member should get involved.&lt;/p&gt;


	&lt;h2&gt;Development Phase&lt;/h2&gt;


	&lt;p&gt;At this phase, development of the backend starts. The design should have finalized the draft, and the development team should follow the design draft. (if &lt;span class="caps"&gt;HTML&lt;/span&gt; mock up is done, the develop team should use &lt;span class="caps"&gt;HTML&lt;/span&gt; mock ups)&lt;/p&gt;</description>
      <pubDate>Fri, 27 Jun 2008 06:27:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:7430e490-3536-4647-a078-257ebb4fdda2</guid>
      <author>Aaron Qian</author>
      <link>http://aaron.aaron033.com/articles/2008/06/27/website-design-methodology-the-golden-pyramid</link>
      <category>design</category>
      <category>methodology</category>
      <category>pyramid</category>
      <category>software</category>
      <category>development</category>
      <trackback:ping>http://aaron.aaron033.com/articles/trackback/2</trackback:ping>
    </item>
    <item>
      <title>Boohoo, My Site is Down!! -- Got Capistrano?</title>
      <description>&lt;h2&gt;Servers DO Fail&amp;#8212;Get Real&lt;/h2&gt;


	&lt;p&gt;About three days after my failed attempt in persuading my contractor  FooBy Company (for privacy reasons, the name is not real) to setup automatic deployment solutions for their rails online shopping service, I got a call from them and was informed that the website is down, and they can&amp;#8217;t seems to get the site back up. I have just started working with them. Without the knowledge of the internals of the server structure, I ssh into their server(a little nervous), read their poorly written bash scripts, hack around. After about one and half hours of frustration, 2 server reboots, a dozen &lt;code&gt;mongrel_rails cluster::start&lt;/code&gt;, a few undeleted pids, and countless French. I finally brought the site back from oblivion.&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;Total downtime: 3 hours 23 minutes&amp;#8230;&lt;/strong&gt;&lt;/p&gt;


	&lt;h2&gt;A Better Solution Than French&lt;/h2&gt;


	&lt;p&gt;Someone as smart as you might wonder, there must be a better solution to this. Yes, if you ask any creditable rails developer, usually you will get &lt;a href="http://www.capify.org/"&gt;Capistrano&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;As you probably already know, &lt;a href="http://www.capify.org/"&gt;Capistrano&lt;/a&gt; is a automatic server deployment solution that ease the complexity of rails/merb deployment. You can find out more on their website.&lt;/p&gt;


	&lt;h2&gt;How long does it take to setup Capistrano?&lt;/h2&gt;


	&lt;ol&gt;
	&lt;li&gt;&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;sudo gem install capistrano&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
		&lt;li&gt;&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;cd /YOUR_APP_ROOT; capify .&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
		&lt;li&gt;&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;mate config/deploy.rb&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt; and modify to your liking&lt;/li&gt;
		&lt;li&gt;&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;cap deploy:setup&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
		&lt;li&gt;ssh into your server, create directories, create config files&lt;/li&gt;
		&lt;li&gt;&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;cap deploy:cold&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
	&lt;/ol&gt;


	&lt;p&gt;&lt;strong&gt;Setup time: 20 minutes.&lt;/strong&gt;
&lt;strong&gt;Deployment time: 1minute.&lt;/strong&gt; (Just run &lt;code&gt;cap deploy&lt;/code&gt;)&lt;/p&gt;


	&lt;h2&gt;Do it right =&amp;gt; Do it fast&lt;/h2&gt;


	&lt;p&gt;From my own experience in working with managers and CEOs, I have concluded some commonalities.&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;Speed is everything.&lt;/li&gt;
		&lt;li&gt;Short term benefit is always greater than long term benefits.&lt;/li&gt;
		&lt;li&gt;We should do it right, but we should do it later, because it cost too much&lt;/li&gt;
		&lt;li&gt;Don&amp;#8217;t fix/change/optimize it if it works now.&lt;/li&gt;
		&lt;li&gt;We know there are potential problems, let&amp;#8217;s fix it when the problem arises&lt;/li&gt;
	&lt;/ol&gt;


	&lt;h2&gt;No No No!&lt;/h2&gt;


	&lt;p&gt;&lt;b style="color:red;"&gt;Do it right, and do it once!!&lt;/b&gt;&lt;/p&gt;</description>
      <pubDate>Thu, 26 Jun 2008 16:26:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:217abdb6-8a1b-490b-b540-1483da5459c7</guid>
      <author>Aaron Qian</author>
      <link>http://aaron.aaron033.com/articles/2008/06/26/boohoo-my-site-is-down-got-capistrano</link>
      <category>capistrano</category>
      <category>story</category>
      <category>ruby</category>
      <category>rails</category>
      <category>merb</category>
      <category>boss</category>
      <trackback:ping>http://aaron.aaron033.com/articles/trackback/1</trackback:ping>
    </item>
  </channel>
</rss>
