<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/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>Raymond Law: Tag phusion</title>
    <link>http://blog.rayvinly.com/articles/tag/phusion</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Deploying your Rails applications with Phusion Passenger</title>
      <description>&lt;p&gt;There have been several methods to deploy an Ruby on Rails application.  Until recently, the most popular is to run Apache and proxy balance to multiple Mongrel instances that are running simultaneously.&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://www.modrails.com/"&gt;Passenger&lt;/a&gt;, developed by &lt;a href="http://www.phusion.nl/about.html"&gt;Phusion&lt;/a&gt;, is the new kid entering the Rails deployment market.  We have been using the Apache &lt;span class="caps"&gt;PHP&lt;/span&gt; module for years and deploying a &lt;span class="caps"&gt;PHP&lt;/span&gt; applications is a snap.  This has not been possible with Rails until Passenger.  It is so easy too!  You can still use &lt;a href="http://capify.org/"&gt;Capistrano&lt;/a&gt; to automate deployment.  I will show you how I get it to work on Ubuntu.&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;sudo gem install passenger
passenger-install-apache2-module&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;&lt;b&gt;Update:&lt;/b&gt; Phusion just released &lt;a href="http://phusion-passenger.googlecode.com/files/passenger-1.9.0.gem"&gt;Passenger 2.0 &lt;span class="caps"&gt;RC 1&lt;/span&gt;&lt;/a&gt;.  You can download this version and do &lt;code&gt;gem install passenger-1.9.0.gem&lt;/code&gt; instead.  But I had an error compiling it on Mac &lt;span class="caps"&gt;OS X&lt;/span&gt; Leopard.  hongli pointed me to use the version from &lt;a href="http://github.com/FooBarWidget/passenger/tree/master"&gt;GitHub&lt;/a&gt; that has the fix and it works like a charm.  Thanks Phusion guys.&lt;/p&gt;


	&lt;p&gt;To get it from GitHub:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;git clone git://github.com/FooBarWidget/passenger.git&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;I create a separate &lt;code&gt;/etc/apache2/mods-available/passenger.load&lt;/code&gt; and it contains the following:&lt;/p&gt;


	&lt;p&gt;For 1.0.5:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-1.0.5/ext/apache2/mod_passenger.so
RailsSpawnServer /usr/local/lib/ruby/gems/1.8/gems/passenger-1.0.5/bin/passenger-spawn-server
RailsRuby /usr/local/bin/ruby&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;For the GitHub version (Of course the path will look different depending on where your git clone is):&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;LoadModule passenger_module /home/rlaw/downloads/passenger/ext/apache2/mod_passenger.so
PassengerRoot /home/rlaw/downloads/passenger
PassengerRuby /usr/local/bin/ruby&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;I then tell Apache to load the Passenger module:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;a2enmod passenger&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Now, I create a virtual host configuration for one of my Rails app in &lt;code&gt;/etc/apache2/sites-available/dealistic&lt;/code&gt;:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;&amp;lt;VirtualHost *:80&amp;gt;
  ServerAdmin webmaster@dealistic.com
  ServerName dealistic.com

  DocumentRoot /home/deploy/apps/dealistic/current/public

  &amp;lt;Directory /home/deploy/apps/dealistic/current/public&amp;gt;
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
  &amp;lt;/Directory&amp;gt;

  LogLevel warn
  ErrorLog /var/log/apache2/dealistic/error.log
  CustomLog /var/log/apache2/dealistic/access.log combined
&amp;lt;/VirtualHost&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;I then restart Apache:&lt;/p&gt;


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

	&lt;p&gt;When you need to restart your application because you have changed some code that Rails does not reload in production, just do:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;touch /home/deploy/apps/dealistic/current/tmp/restart.txt&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;I have not tried their &lt;a href="http://www.rubyenterpriseedition.com/"&gt;Ruby Enterprise Edition&lt;/a&gt; yet.  They claim substantial memory and speed improvement at &lt;a href="http://en.oreilly.com/rails2008/public/schedule/detail/4354"&gt;RailsConf 2008&lt;/a&gt;, so it will be interesting to see.&lt;/p&gt;</description>
      <pubDate>Tue, 24 Jun 2008 10:00:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:43311149-3ecb-4bad-b3bc-c7dceca4269b</guid>
      <author>Raymond Law</author>
      <link>http://blog.rayvinly.com/articles/2008/06/24/deploying-your-rails-applications-with-phusion-passenger</link>
      <category>Ruby on Rails</category>
      <category>Web 2.0</category>
      <category>ruby</category>
      <category>rails</category>
      <category>rubyonrails</category>
      <category>deploy</category>
      <category>deployment</category>
      <category>apache</category>
      <category>passenger</category>
      <category>phusion</category>
      <trackback:ping>http://blog.rayvinly.com/articles/trackback/65</trackback:ping>
    </item>
  </channel>
</rss>
