<?xml version="1.0" encoding="UTF-8"?>
<wiki-page>
  <author>Don Parish</author>
  <content>Apache 2.1+ is required for this configuration due to mod_proxy_balancer dependencies.  Fedora Core 4 and below boxes need to be upgraded to either Fedora Core 5 or above!

h2. Install Relevant Gems

You will need to install @mongrel@ and @mongrel_cluster@ in addition to the other Ruby Gems mentioned in the [[Quick install|Quick install]] wiki page:
{{{
sudo gem install mongrel mongrel_cluster --include-dependencies
}}}

h2. Configure Mongrel Retrospectiva

I assume you have configured the database according to [[Quick install|Quick install]] already.

Change directory into the Retrospectiva RAILS_ROOT and execute the following in your shell on the webserver you plan to deploy on:
{{{
mongrel_rails cluster::configure -e RAILS_ENV -p START_PORT -a IP_ADDR -N MONGREL_PROCS
}}}
where RAILS_ENV is the Rails environment you want to make the configuration for (probably 'production' in this case), START_PORT is port number to start Mongrel processes at, IP_ADDR is the ip address to listen on (in most simple cases it would be 127.0.0.1) and NOMGREL_PROCS is the number of mongrel processes to run (so if MONGREL_PROCS=3 and START_PORT=8000 Mongrel process would be running on ports 8000, 8001, 8002).

Once this has been run it will create a file names mongrel_cluster.yml in Retrospectiva's config directory.

h2. Start Mongrel Cluster

Still under the RAILS_ROOT of Retrospectiva execute the following in the shell:
{{{
sudo mongrel_rails cluster::start
}}}

You should see a message that sayings something like "Mongrel starting X...".  If no error messages are written to stderr, pat yourself on the back!

h2. Apache2 Configuration

On a Fedora Core system create a file named /etc/httpd/conf.d/retrospectiva.include, which includes the following configuration:
{{{
&lt;Proxy balancer://retrospectiva_cluster&gt;
  BalancerMember http://127.0.0.1:8000
  BalancerMember http://127.0.0.1:8001
  BalancerMember http://127.0.0.1:8002
&lt;/Proxy&gt;
ProxyPass / balancer://retrospectiva_cluster/
ProxyPassReverse / balancer://retrospectiva_cluster/
ProxyPreserveHost on
ProxyPass /images !
ProxyPass /stylesheets !
ProxyPass /javascripts ! 
ProxyPass /favicon.ico !
}}}

Now add the following configuration snippet into the virtual host(s) you want to host Retrospectiva under:
{{{ Include conf.d/retrospectiva.include }}}

h2. Reload Apache2

On Fedora Core systems, to reload Apache2 you need to execute the following in your shell:
{{{
sudo /etc/init.d/httpd reload
}}}

On Debian based systems:
{{{
sudo /etc/init.d/apache2 reload
}}}

h2. Congratuations - All done!


h2. Example on Fedora Core 5 system

h3. Include file

Had to use *./*conf.d instead of plain conf.d like:
 Include ./conf.d/retrospectiva.include 

h3. Example Virtual Host on Apache 2.2 on Fedora Core 5

* the port 3000 was used to avoid conflicts with other web apps. 80 fine for dedicated server.

Add the following to this file /etc/httpd/conf/*httpd.conf*
{{{
Listen 3000
&lt;VirtualHost *:3000&gt;
    DocumentRoot /var/www/retrospectiva/public
    ServerName myapp.com
    Include ./conf.d/retrospectiva.include
&lt;/VirtualHost&gt;

Listen 8080
&lt;VirtualHost *:8080&gt;
  &lt;Location /&gt;
    SetHandler balancer-manager
    Deny from all
    Allow from localhost
  &lt;/Location&gt;
&lt;/VirtualHost&gt;
}}}

h3. Restart Apache:

{{{	/sbin/service httpd restart }}}</content>
  <created-at type="datetime">2007-01-26T18:17:05+00:00</created-at>
  <title>Apache Mongrel configuration</title>
  <updated-at type="datetime">2007-03-07T09:13:15+00:00</updated-at>
  <version type="integer">4</version>
</wiki-page>
