<?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>Ivan Kuznetsov &#187; Ruby on Rails</title>
	<atom:link href="http://www.ivankuznetsov.com/category/ruby-on-rails/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ivankuznetsov.com</link>
	<description>Entrepreneur, Ruby on Rails and Ubuntu fanatic, consultant</description>
	<lastBuildDate>Tue, 18 May 2010 18:39:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Running Rails applications using Nginx with Passenger on Ubuntu Server</title>
		<link>http://www.ivankuznetsov.com/2010/05/running-rails-applications-using-nginx-with-passenger-on-ubuntu-server.html</link>
		<comments>http://www.ivankuznetsov.com/2010/05/running-rails-applications-using-nginx-with-passenger-on-ubuntu-server.html#comments</comments>
		<pubDate>Fri, 14 May 2010 10:40:50 +0000</pubDate>
		<dc:creator>Ivan Kuznetsov</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Web/Tech]]></category>
		<category><![CDATA[mod_rails]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[passenger]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.ivankuznetsov.com/?p=279</guid>
		<description><![CDATA[If you&#8217;re planning to run Rails applications on Nginx using Phusion Passenger, and do it on Ubuntu Linux, here&#8217;s what needs to be done. Even though there&#8217;s Ubuntu nginx package available (which works perfectly when you&#8217;re running PHP apps using FCGI), if you want to take into use Phusion Passenger, you&#8217;ll need to recompile Nginx [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ivankuznetsov.com/wp-content/uploads/enterprise_logo.png"><img class="alignleft size-full wp-image-281" title="enterprise_logo" src="http://www.ivankuznetsov.com/wp-content/uploads/enterprise_logo.png" alt="" width="261" height="68" /></a>If you&#8217;re planning to run <a href="http://rubyonrails.org/" target="_blank">Rails</a> applications on <a href="http://www.nginx.org" target="_blank">Nginx</a> using <a href="http://www.modrails.com/" target="_blank">Phusion Passenger</a>, and do it on <a href="http://www.ubuntu.com" target="_blank">Ubuntu</a> Linux, here&#8217;s what needs to be done.</p>
<p>Even though there&#8217;s Ubuntu nginx package available (which works perfectly when you&#8217;re running <a href="http://www.ivankuznetsov.com/2010/05/moving-joomla-wordpress-and-other-phpfastcgi-apps-to-nginx.html">PHP apps using FCGI</a>), if you want to take into use Phusion Passenger, you&#8217;ll need to recompile Nginx from sources.</p>
<p>Instructions below were verified on Ubuntu 10.04 (Lucid Lynx) Server Edition.</p>
<p><span id="more-279"></span></p>
<p>If you already have Nginx ubuntu package installed, uninstall it (NOTE! purge will delete all configuration files &#8211; so if you changed them &#8211; make a backup for future reference):</p>
<pre>sudo aptitude purge nginx</pre>
<p>Assuming you already have Rails stack installed, install Passenger gem:</p>
<pre>sudo gem install passenger</pre>
<p>At the time of this writing the latest version of Passenger is 2.2.11</p>
<p>Let&#8217;s check dependencies that Ubuntu nginx package has and install them before compilation:</p>
<pre>aptitude show nginx | grep Depends</pre>
<div>You&#8217;ll see something like:</div>
<pre>Depends: libc6 (&gt;= 2.4), libpcre3 (&gt;= 7.7), libssl0.9.8 (&gt;= 0.9.8k-1), zlib1g</pre>
<div>Install build dependencies and start nginx module installation (it will offer you to recompile nginx)</div>
<pre>sudo apt-get install libc6 libpcre3 libssl0.9.8 zlib1g
sudo /usr/local/bin/passenger-install-nginx-module</pre>
<div>Choose option 1 (Yes: download, compile and install Nginx for me) unless you need special configuration parameters or need features not enabled by default (like SSL).</div>
<div>Further instructions assume that you also chose default installation directory /opt/nginx.</div>
<div>If you&#8217;ve purchased Passenger Enterprise Edition, don&#8217;t forget to register it:</div>
<pre>sudo /usr/local/bin/passenger-make-enterprisey</pre>
<div>Now add nginx init script (I just copied this from Ubuntu default nginx package):</div>
<pre>sudo vim /etc/init.d/nginx</pre>
<div>with the following content:</div>
<pre>#! /bin/sh

### BEGIN INIT INFO
# Provides:          nginx
# Required-Start:    $local_fs $remote_fs $network $syslog
# Required-Stop:     $local_fs $remote_fs $network $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts the nginx web server
# Description:       starts nginx using start-stop-daemon
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/nginx/sbin
DAEMON=/opt/nginx/sbin/nginx
NAME=nginx
DESC=nginx

test -x $DAEMON || exit 0

# Include nginx defaults if available
if [ -f /etc/default/nginx ] ; then
        . /etc/default/nginx
fi

set -e

. /lib/lsb/init-functions

test_nginx_config() {
  if nginx -t $DAEMON_OPTS
  then
    return 0
  else
    return $?
  fi
}

case "$1" in
  start)
        echo -n "Starting $DESC: "
        test_nginx_config
        start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
                --exec $DAEMON -- $DAEMON_OPTS || true
        echo "$NAME."
        ;;
  stop)
        echo -n "Stopping $DESC: "
        start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
                --exec $DAEMON || true
        echo "$NAME."
        ;;
  restart|force-reload)
        echo -n "Restarting $DESC: "
        start-stop-daemon --stop --quiet --pidfile \
                /var/run/$NAME.pid --exec $DAEMON || true
        sleep 1
        test_nginx_config
        start-stop-daemon --start --quiet --pidfile \
                /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS || true
        echo "$NAME."
        ;;
  reload)
        echo -n "Reloading $DESC configuration: "
        test_nginx_config
        start-stop-daemon --stop --signal HUP --quiet --pidfile /var/run/$NAME.pid \
            --exec $DAEMON || true
        echo "$NAME."
        ;;
  configtest)
        echo -n "Testing $DESC configuration: "
        if test_nginx_config
        then
          echo "$NAME."
        else
          exit $?
        fi
        ;;
  status)
        status_of_proc -p /var/run/$NAME.pid "$DAEMON" nginx &amp;&amp; exit 0 || exit $?
        ;;
  *)
        echo "Usage: $NAME {start|stop|restart|reload|force-reload|status|configtest}" &gt;&amp;2
        exit 1
        ;;
esac

exit 0</pre>
<div>Now make this script executable add it to default run levels:</div>
<pre>sudo chmod +x /etc/init.d/nginx
sudo /usr/sbin/update-rc.d -f nginx defaults</pre>
<div>Edit  nginx.conf to look like this:</div>
<pre>user www-data;
worker_processes  4;

error_log  /opt/nginx/logs/error.log;
pid        /var/run/nginx.pid;

events {
    worker_connections  8192;
    use epoll;
}

http {
    passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.11;
    passenger_ruby /usr/local/bin/ruby;

    include       /opt/nginx/conf/mime.types;

    # set a default type for the rare situation that
    # nothing matches from the mimie-type include
    default_type application/octet-stream;

    # This log format is compatible with any tool like awstats
    # that can parse standard apache logs.
    log_format main '$remote_addr - $remote_user [$time_local] '
                    '"$request" $status $body_bytes_sent "$http_referer" '
                    '"$http_user_agent" "$http_x_forwarded_for"' ;

    access_log  /opt/nginx/logs/access.log;

    sendfile        on;
    tcp_nopush     on;

    keepalive_timeout  0;
    tcp_nodelay        on;

    gzip  on;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";
    gzip_http_version 1.0;
    gzip_comp_level 2;
    gzip_proxied any;
    gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;

    include /opt/nginx/conf/sites-enabled/*;
}</pre>
<div>Now create virtual hosts structure (so that it looks like the structure created by Ubuntu original nginx package):</div>
<div>
<pre>sudo mkdir /opt/nginx/conf/sites-available
sudo mkdir /opt/nginx/conf/sites-enabled</pre>
</div>
<div>Now it is time to configure your first rails site. Create virtual host configuration in sites-available.</div>
<pre>sudo vim /opt/nginx/conf/sites-available/mysite.com</pre>
<div>Content can be something like:</div>
<pre>server {
        listen   80;
        server_name  www.mysite.com;

        access_log  /home/user/logs/www.mysite.com/access.log;
        root   /home/user/www.mysite.com/public;

        # serve static content directly
        location ~* \.(ico|jpg|gif|png|css|js|swf|html)$ {
          if (-f $request_filename) {
            expires max;
            break;
          }
        }

        passenger_enabled on;

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /\.ht {
          deny  all;
        }
}</pre>
<div>Make a symlink in sites-enabled directory and restart nginx.</div>
<pre>sudo ln -s /opt/nginx/conf/sites-available/mysite.com /opt/nginx/conf/sites-enabled/mysite.com
sudo /etc/init.d/nginx restart</pre>
<div>Now open the browser and check that your site is working.</div>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.ivankuznetsov.com%2F2010%2F05%2Frunning-rails-applications-using-nginx-with-passenger-on-ubuntu-server.html&amp;linkname=Running%20Rails%20applications%20using%20Nginx%20with%20Passenger%20on%20Ubuntu%20Server"><img src="http://www.ivankuznetsov.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.ivankuznetsov.com/2010/05/running-rails-applications-using-nginx-with-passenger-on-ubuntu-server.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Informal notes from #frozenrails 2010</title>
		<link>http://www.ivankuznetsov.com/2010/05/informal-notes-from-frozenrails-2010.html</link>
		<comments>http://www.ivankuznetsov.com/2010/05/informal-notes-from-frozenrails-2010.html#comments</comments>
		<pubDate>Tue, 11 May 2010 07:17:53 +0000</pubDate>
		<dc:creator>Ivan Kuznetsov</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Web/Tech]]></category>
		<category><![CDATA[frozenrails]]></category>
		<category><![CDATA[ror]]></category>

		<guid isPermaLink="false">http://www.ivankuznetsov.com/?p=248</guid>
		<description><![CDATA[Thanks to organisers from Kisko Labs and the HHLinuxClub on Friday, May 7th, 2010 Finland got its first  Rails conference. Conference has drawn very interesting speakers and  international crowd &#8211; from Finland (naturally), Sweden, Poland, Germany, Russia and other countries. I made a few notes from selected talks on the conference. Chris Wanstrath / GitHub (@defunkt) Slides: [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ivankuznetsov.com/wp-content/uploads/frozen_rails_logo.png"><img class="alignleft " title="frozen_rails_logo" src="http://www.ivankuznetsov.com/wp-content/uploads/frozen_rails_logo.png" alt="" width="99" height="95" /></a>Thanks to organisers from <a href="http://www.kiskolabs.com/">Kisko Labs</a> and the <a href="http://www.hhlinuxclub.org/">HHLinuxClub</a> on Friday, May 7th, 2010 Finland got its first  Rails conference.</p>
<p>Conference has drawn very interesting speakers and  international crowd &#8211; from Finland (naturally), Sweden, Poland, Germany, Russia and other countries. I made a few notes from selected talks on the conference.</p>
<h3>Chris Wanstrath / GitHub (<a href="http://twitter.com/defunkt" target="_blank">@defunkt</a>)</h3>
<ul>
<li>Slides: <a href="http://www.slideshare.net/err/inside-github" target="_blank">http://www.slideshare.net/err/inside-github</a></li>
<li><a href="http://www.youtube.com/watch?v=4XpnKHJAok8" target="_blank">Linus Trovalds Google tech talk about git</a> &#8211; where Linus tell you that you&#8217;re stpid if you&#8217;re not using git</li>
<li><a href="http://github.com/talison/rack-mobile-detect" target="_blank">rack-mobile-detect</a> – is used by GitHub, super useful if you&#8217;re planning to create mobile optimized version</li>
<li>GitHub uses Unicorn as an application server – personally I&#8217;m not sure if that&#8217;s better than Apache + Passenger. Chris tells that Unicorn is cool, because does fair load balancing on Linux kernel level, also Rails are loaded only once &#8211; and then required number of processes are forked &#8211; and this is very fast, a lot faster than loading rails separately for each Mongrel. And when one of the processes dies &#8211; there&#8217;s no need to re-load Rails, but just fork another process.</li>
<li>GitHub users <a href="http://github.com/blog/531-introducing-bert-and-bert-rpc" target="_blank">BERT</a> to forward requests to one of their six servers – BERT to Erlang is the same as JSON to JavaScript</li>
<li>GitHub doesn&#8217;t use <a href="http://github.com/collectiveidea/delayed_job" target="_blank">delayed_job</a> anymore since they needed several queues with different priorities &#8211; so far they use <a href="http://github.com/blog/542-introducing-resque" target="_blank">resque</a>, but are considering developing a real queue management system</li>
</ul>
<p><span id="more-248"></span></p>
<h3>Jose Valim / Plataforma (<a href="http://twitter.com/josevalim" target="_blank">@josevalim</a>)</h3>
<ul>
<li>Brazilian Rails consultants and developers: <a href="http://plataformatec.com.br/" target="_blank">http://plataformatec.com.br/</a></li>
<li>Developed several interesting components to make their life easier &#8211; extracted common components from several customer projects and open-sourced them</li>
<li>User authorisation and roles: Devise – <a href="http://blog.plataformatec.com.br/2010/04/authentication-is-with-devise/" target="_blank">http://blog.plataformatec.com.br/2010/04/authentication-is-with-devise/</a></li>
<li><a href="http://blog.plataformatec.com.br/2010/04/authentication-is-with-devise/" target="_blank"></a>Nice forms with labels, error handling, etc. : Simple Form – <a href="http://github.com/plataformatec/simple_form" target="_blank">http://github.com/plataformatec/simple_form</a></li>
</ul>
<h3>Mike Dirolf / MongoDB (<a href="http://twitter.com/mdirolf" target="_blank">@mdirolf</a>) &amp; Jonathan Weiss / CouchDB (<a href="http://twitter.com/jweiss" target="_blank">@jweiss</a>)</h3>
<ul>
<li>Two very interesting NoSQL presentations: <a href="http://www.slideshare.net/mdirolf/mongodb-at-frozenrails" target="_blank">http://www.slideshare.net/mdirolf/mongodb-at-frozenrails</a>, <a href="http://www.slideshare.net/jweiss/couchdb-on-rails-frozenrails-2010" target="_blank">http://www.slideshare.net/jweiss/couchdb-on-rails-frozenrails-2010</a></li>
<li>Answering a question from the audience Mike said that fault tolerance is something that is not quite there yet in MongoDB &#8211; there is a possibility to do recovery, but there&#8217;s a chance data might be lost</li>
<li>There is no such issue in CouchDB, it also is written in Erland and provides REST API</li>
<li>Links to project homepages: <a href="http://couchdb.apache.org/" target="_blank">http://couchdb.apache.org/</a> &amp;<a href=" http://www.mongodb.org/" target="_blank"> http://www.mongodb.org/</a> &#8211; worth taking a look at both</li>
</ul>
<h3>Yehuda Katz / EngineYard (<a href="http://twitter.com/wycats" target="_blank">@wycats</a>)</h3>
<ul>
<li>Very interesting presentation about developing web application for mobile devices (in Rails 3)</li>
<li>One of the central messages &#8211; HTML5 is coming &#8211; learn how to use it now, if you want to stay in business</li>
<li>I really hope Yehuda will publish his slides &#8211; it was a presentation worth spreading around</li>
<li>interesting thoughts:
<ul>
<li>same optimization methods as we traditionally use for Rails apps on desktop are not suitable for mobile browsers due to constraints &#8211; connection availability, memory, cpu, battery, etc.</li>
<li>don&#8217;t count on browser cach on mobile devices – separate data and presentation, cache presentation using localStorage feature of HTML5, load only data from the web after that</li>
<li>mobile browsers are updated a lot faster than desktop borwser &#8211; there are new browsers in the new phones, and nobody uses 2 year old phone</li>
<li>HTML5 will become mainstream on mobile devices a lot faster than on desktop (IE6 will not happen on mobile)</li>
<li>when developing apps for mobile take into account that in some places people still pay per kilobyte of traffic</li>
<li>incremental rendering on the mobile is evil &#8211; it consumes battery and can be very slow, unpleasant and unusable for the user</li>
</ul>
</li>
<li>battery &#8211; unoptimized sites can easily drain the battery, and even though users are most likely to blame the phone manufacturer it is good to think about it</li>
<li>http://Railsdispatch.com – recommended reading about Rails 3</li>
</ul>
<h3>Carl Lerche / Engine Yard (<a href="http://twitter.com/carllerche" target="_blank">@carllerche</a>)</h3>
<ul>
<li>Carl told about Rails 3 and migration to version 3 from earlier ones <a href="http://www.slideshare.net/carllerche/frozen-rails-slides" target="_blank">http://www.slideshare.net/carllerche/frozen-rails-slides</a></li>
<li>Migration itself is not that difficult (provided that you know what you&#8217;re doing) – it can even be done in 15 minutes, but thus far stability and performance of Rails 3 / Ruby 1.9.1 are not quite there yet</li>
<li>Rails 3 is not finished &#8211; the plan is to make RC for RailsConf, and the it will be released “when it’s ready”</li>
<li>When asked if they have done performance tests on Rails 3, Carl answered that, yes, they did, and its sad.  Performance optimization is the next big step after stabilization.</li>
<li>When asked which Ruby release is better to use with Rails 3, Carl answered &#8211; 1.8.7, since Ruby 1.9.1 still segfaults and is not ready for production sites.</li>
</ul>
<h3>JetBrains (<a href="http://twitter.com/rubymine" target="_blank">@rubymine</a>):</h3>
<ul>
<li>new release of RubyMine is available with Rails3 support</li>
<li>guys from JetBrains tell that  TextMate development/maintenance is lagging behind, and they observe migration of TextMate and even vim users to RubyMine (there&#8217;s now vim interface emultion)</li>
</ul>
<h3>overall impression:</h3>
<ul>
<li>Apple is the king – virtually everybody was walking around with either MacBook, iPhone, iPad or all of the above</li>
<li>first Rails conference in Finland was a huge success &#8211; I really hope there will be FrozenRails 2011</li>
</ul>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.ivankuznetsov.com%2F2010%2F05%2Finformal-notes-from-frozenrails-2010.html&amp;linkname=Informal%20notes%20from%20%23frozenrails%202010"><img src="http://www.ivankuznetsov.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.ivankuznetsov.com/2010/05/informal-notes-from-frozenrails-2010.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Setting up Ruby, Rails, Git and Redmine on Dreamhost</title>
		<link>http://www.ivankuznetsov.com/2009/07/setting-up-ruby-rails-git-and-redmine-on-dreamhost.html</link>
		<comments>http://www.ivankuznetsov.com/2009/07/setting-up-ruby-rails-git-and-redmine-on-dreamhost.html#comments</comments>
		<pubDate>Thu, 30 Jul 2009 14:58:27 +0000</pubDate>
		<dc:creator>Ivan Kuznetsov</dc:creator>
				<category><![CDATA[Dreamhost]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Web/Tech]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[redmine]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.ivankuznetsov.com/?p=195</guid>
		<description><![CDATA[The task is to have: - Redmine installation on redmine.mydomain.com - Several Git repositories on git.mydomain.com with different access rights to each one This proved to be a non-trivial task. There is a number of tutorials on the net, but none of them described the full solution. So after getting it all to work, I [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-196" title="Git, RedMine, Ruby, Rails on Dreamhost" src="http://www.ivankuznetsov.com/wp-content/uploads/git.png" alt="Git, RedMine, Ruby, Rails on Dreamhost" width="200" height="150" />The task is to have:<br />
- Redmine installation on redmine.mydomain.com<br />
- Several Git repositories on git.mydomain.com with different access rights to each one</p>
<p>This proved to be a non-trivial task. There is a number of tutorials on the net, but none of them described the full solution. So after getting it all to work, I decided to share all the tips and tricks. Feel free to comment, if you will find problems with the following set of instructions.<br />
<span id="more-195"></span>SSH to redmine.mydomain.com as a user that will be running Redmine (in the following examples it will be &#8216;redmine_user&#8217;).<br />
First, you need to compile openssl &#8211; it will be required for curl, git and redmine.</p>
<pre>mkdir ~/tmp
cd ~/tmp
wget http://www.openssl.org/source/openssl-0.9.8k.tar.gz
tar xzvf openssl-0.9.8k.tar.gz
cd openssl-0.9.8k
./config shared zlib --prefix=$HOME/.packages
make
make install</pre>
<p>Let&#8217;s tell the world that we keep binaries and libraries also in the local directory. Edit ~/.bashrc (it is used by all non-login shells):</p>
<pre>export TZ='Europe/Helsinki'
export PATH="$HOME/.packages/bin:$PATH"
export LD_LIBRARY_PATH="$HOME/.packages/lib"
export GEM_HOME="$HOME/.gems"
export GEM_PATH="$GEM_HOME:/usr/lib/ruby/gems/1.8"
export PATH="$HOME/.packages/bin:$HOME/.gems/bin:$PATH"
export RUBYLIB="$HOME/.packages/lib:$RUBYLIB"
export LD_LIBRARY_PATH="$HOME/.packages/lib"

# this ensures our gem install processes don't get killed by the DreamHost police
alias gem="nice -n19 ~/.packages/bin/gem"</pre>
<p>(You can skip TZ &#8211; it is just usefule to have correct time set for your environment. Use tzselect to find out correct TZ string for your region)</p>
<p>And edit ~/.bash_profile (it is used by login shells):</p>
<pre>umask 002
PS1='[\h:$PWD]$ '
alias ll="ls -l"
EDITOR="/usr/bin/vim"
. .bashrc</pre>
<p>Now let&#8217;s apply the changes in active shell:</p>
<pre>cd ~ : . .bash_profile</pre>
<p>Then you need to compile curl, to be able to compile git with curl and execute clone commands on your server.</p>
<pre>cd ~/tmp
wget http://curl.haxx.se/download/curl-7.19.5.tar.gz
tar xzvf curl-7.19.5.tar.gz
cd curl-7.19.5
./configure --prefix=$HOME/.packages --with-ssl=$HOME/.packages
make
make install</pre>
<p>Now get and compile Git. If you are not using Dreamhost PS, you might want to compile it with NO_MMPAP=1, to reduce<br />
probability of git process getting killed by Dreamhost police robots due to extensive memory</p>
<pre>cd ~/tmp
wget http://www.kernel.org/pub/software/scm/git/git-1.6.4.tar.gz
tar xzvf git-1.6.4.tar.gz
cd git-1.6.4
./configure --prefix=$HOME/.packages --with-curl=$HOME/.packages
make
make install</pre>
<p>Let&#8217;s start with ruby and rails related stuff. First readline library is needed, for script/console to work.</p>
<pre>cd ~/tmp
wget http://ftp.gnu.org/gnu/readline/readline-5.2.tar.gz
tar xzvf readline-5.2.tar.gz
cd readline-5.2
./configure --prefix=$HOME/.packages
make
make install</pre>
<p>Install ruby:</p>
<pre>cd ~/tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p72.tar.gz
tar zxvf ruby-1.8.7-p72.tar.gz
cd ruby-1.8.7-p72
./configure --prefix=$HOME/.packages --with-openssl-dir=$HOME/.packages --with-readline-dir=$HOME/.packages
make
make install</pre>
<p>Install rubygems:</p>
<pre>cd ~/tmp
wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
tar zxvf rubygems-1.3.5.tgz
cd rubygems-1.3.5
ruby setup.rb config --prefix=$HOME/.packages
ruby setup.rb setup
ruby setup.rb install</pre>
<p>Now you can install all required gems and freeze them if necessary.</p>
<p><strong>Installing RedMine</strong></p>
<p>Refer to <a href="http://wiki.dreamhost.com/Redmine" target="_blank">http://wiki.dreamhost.com/Redmine</a> for details.</p>
<p>But there&#8217;s one trick &#8211; if you want RedMine to use just compiled version of Git &#8211; edit in lib/redmine/scm/adapters/git_adapter.rb:</p>
<pre># Git executable name
GIT_BIN = "/home/username/.packages/bin/git"</pre>
<p>If this is not done, default Dreamhost git will be used (which is too old at the moment 1.4.4.4) and Git repository browsing will not work in RedMine<br />
(see <a href="http://groups.google.com/group/phusion-passenger/browse_thread/thread/5080d7c7cfbcf20e" target="_blank">http://groups.google.com/group/phusion-passenger/browse_thread/thread/5080d7c7cfbcf20e</a>).</p>
<p><strong>Setting up Git repository</strong></p>
<p>Refer to <a href="http://wiki.dreamhost.com/Git" target="_blank">http://wiki.dreamhost.com/Git</a> for details.</p>
<p>Couple of tricks here. There are bugs in WebDAV functionality in Ubuntu &#8211; so if you&#8217;re using it &#8211; launch Nautilus, use &#8220;File-&gt;Connect to server&#8230;&#8221; menu from there (not from the system menu), don&#8217;t enter user name in the dialog &#8211; leave it empty and enter it when you&#8217;re requested username and password in the next dialog.</p>
<p>When setting up WebDAV access rights, give access to user &#8220;redmine&#8221;.</p>
<p><strong>Setting Git repository copy for Redmine</strong></p>
<p>Create ~/.netrc for your redmine user on Dreamhost</p>
<p>Insert the following line in that file</p>
<pre>machine git.mydomain.com login redmine password [redmine_password]</pre>
<p>where redmine_password is the password you gave to user redmine in the previous step.<br />
.netrc will ensure that password is not asked when git is accessing the repository.<br />
You don&#8217;t need to bother about creating .netrc if you have a public repository (or at least available for cloning without password).</p>
<p><strong>Create a local copy of the repository</strong></p>
<p>For RedMine to be able to display Git repository, it needs to have a local clone of the repository.</p>
<pre>mkdir ~/git_project_clones
cd git_project_clones
git clone http://git.mydomain.com/repository_name</pre>
<p>Now you should have a local copy that can be used from RedMine.<br />
All you have left to do is to set up regular pulls from the master repository to this local copy. Use command</p>
<pre>crontab -e</pre>
<p>Add the following line to pull latest change into local copy every 5 minutes:</p>
<pre>*/5 * * * * cd /home/redmine_user/git_project_clones/repository_name &amp;&amp; /home/redmine_user/.packages/bin/git pull</pre>
<p>Make sure that you specify full path to git &#8211; otherwise it will execute Dreamhost default git 1.4.4.4 and command will fail with &#8220;refusing to create funny ref &#8216;remotes/origin/*&#8217; locally&#8221; error.</p>
<p>Save and exit cron editor.</p>
<p>(You might also want to check Redmine own wiki: <a href="http://www.redmine.org/wiki/redmine/HowTo_keep_in_sync_your_git_repository_for_redmine" target="_blank">http://www.redmine.org/wiki/redmine/HowTo_keep_in_sync_your_git_repository_for_redmine</a>)</p>
<p>Set repository in the settings of your project in RedMine: /home/redmine_user/git_project_clones/repository_name/.git</p>
<p>Now you need to manually update Git repository changesets in RedMine:</p>
<pre>cd ~/mydomain.com
script/runner "Repository.fetch_changesets" -e production</pre>
<p>And set a hook to your repository to do this every time repository is updated &#8211; edit ~/git_project_clones/repository_name/.git/hooks/post-update file and add the following command ther:</p>
<pre>cd /home/redmine_user/mydomain.com &amp;&amp; script/runner "Repository.fetch_changesets" -e production</pre>
<p>When writing this blogpost I found a lot of useful information on Dreamhost own wiki as well on these blog posts:<br />
<a href="http://www.wavethenavel.com/2008/09/08/bootstrapping-a-dreamhost-account-for-rails-and-git/" target="_blank"> http://www.wavethenavel.com/2008/09/08/bootstrapping-a-dreamhost-account-for-rails-and-git/</a><br />
<a href="http://juliobiason.net/2008/05/19/git-repositories-on-dreamhost-via-ssh/" target="_blank"> http://juliobiason.net/2008/05/19/git-repositories-on-dreamhost-via-ssh/</a><br />
<a href="http://www.simonecarletti.com/blog/2009/07/configuring-git-repository-with-redmine/" target="_blank"> http://www.simonecarletti.com/blog/2009/07/configuring-git-repository-with-redmine/</a></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.ivankuznetsov.com%2F2009%2F07%2Fsetting-up-ruby-rails-git-and-redmine-on-dreamhost.html&amp;linkname=Setting%20up%20Ruby%2C%20Rails%2C%20Git%20and%20Redmine%20on%20Dreamhost"><img src="http://www.ivankuznetsov.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.ivankuznetsov.com/2009/07/setting-up-ruby-rails-git-and-redmine-on-dreamhost.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Radiant CMS</title>
		<link>http://www.ivankuznetsov.com/2008/03/radiant-cms.html</link>
		<comments>http://www.ivankuznetsov.com/2008/03/radiant-cms.html#comments</comments>
		<pubDate>Sun, 23 Mar 2008 16:58:13 +0000</pubDate>
		<dc:creator>Ivan Kuznetsov</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Web/Tech]]></category>
		<category><![CDATA[Weblogs]]></category>

		<guid isPermaLink="false">http://www.ivankuznetsov.com/2008/03/radiant-cms.html</guid>
		<description><![CDATA[Easter weekend didn&#8217;t start well &#8211; I decided to upgrade Joomla on one of my sites to version 1.5.1 from 1.0 and upgrade just totally ruined the entire site &#8211; content was lost, template wasn&#8217;t compatible with version 1.5.1. At first I thought that the reason is Dreamhost&#8216;s automatic one-click upgrade that I used, but [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.ivankuznetsov.com/wp-content/uploads/2008/03/screenshot.png" class="alignleft" alt="Radiant CMS" />Easter weekend didn&#8217;t start well &#8211; I decided to upgrade <a href="http://www.joomla.org/">Joomla</a> on <a href="http://www.kvartira.fi">one of my sites</a> to version 1.5.1 from 1.0 and upgrade just totally ruined the entire site &#8211; content was lost, template wasn&#8217;t compatible with version 1.5.1. At first I thought that the reason is <a href="http://www.dreamhost.com">Dreamhost</a>&#8216;s automatic one-click upgrade that I used, but even after manual reinstall Joomla kept giving weird &#8220;Fatal error: Call to a member function name() on a non-object in helper.php on line 219&#8243; error in Control Panel, and legacy mode for old template didn&#8217;t work.</p>
<p><em>(To be fare I should say that <a href="http://www.dreamhost.com">Dreamhost</a> provides excellent value for money. If you are looking for a good hosting &#8211; use IVANKUZNETSOV promocode and get a $50 discount when setting up an account on Dreamhost) </em></p>
<p>A thought of reinstalling all modules and reconfiguring Joomla from scratch was simply too depressive, so I decided to try another CMS. As a <a href="http://www.rubyonrails.org/">Ruby on Rails</a> convert and a strong believer in open-source ideology I decided to go for <a href="http://www.radiantcms.org">Radiant</a> &#8211; open-source CMS written in RoR. It is still in beta (latest release is 0.6.4), but it is surprisingly stable and powerful. Take a look at the footer of <a href="http://www.ruby-lang.org">www.ruby-lang.org</a> &#8211; official Ruby programming language web site &#8211; it is powered by Radiant <img src='http://www.ivankuznetsov.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Installation of Radiant was rather easy &#8211; thanks to <a href="http://wiki.radiantcms.org/How_To_Deploy_on_Dreamhost">this</a> guide and my prior experience with RoR applications deployment on Dreamhost. It took me a couple of hours to figure out how to actually create sites with Radiant &#8211; there are not that many tutorials available yet, so it is pretty much  &#8220;make by example&#8221;. Split into pages, snippets and layouts makes a lot of sense onse you get your head around it.</p>
<p>From my experience Joomla is an overkill for most of the small sites, and despite being WYSIWYG, it still requires a professional or at least a tech savvy to configure it. After Radiant is set up and configured it is no more difficult to add content there than to edit a wiki page because of its <a href="http://www.textism.com/tools/textile/">Textile</a> support. But it is so much simpler and easier to use than Joomla.</p>
<p>I managed to restore the ruined site in a day&#8217;s time &#8211; fetched most of the lost content from Google cache, converted Joomla template into Radiant&#8217;s layouts and recreated the pages (well, it was a small site after all). First time I dealt with Joomla &#8211; I spent several days trying to figure out where are the settings that I actually need in the endless menus.</p>
<p>Radiant is clearly following &#8220;less is better&#8221; principle. If you want to try Radiant &#8211; there&#8217;s a <a href="http://radiantcms.org/demo/">live demo</a> where you can do whatever you want with the content.</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.ivankuznetsov.com%2F2008%2F03%2Fradiant-cms.html&amp;linkname=Radiant%20CMS"><img src="http://www.ivankuznetsov.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.ivankuznetsov.com/2008/03/radiant-cms.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
