We will assume you have Ruby, Rails, and Mongrel installed. Mongrel is a clustering software for Rails.


Copy provided init.d script to proper place. Modify path as necessary.

sudo cp /usr/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.2/resources/mongrel_cluster /etc/init.d/mongrel_cluster

Next, add a path statement to mongrel_cluster file just above the CONF_DIR variable:

vi /etc init.d/mongrel_cluster

ou may also want to change the USER=mongrel to USER=www-data.

Finally, let's modify permissions and make sure we boot mongrel on startup:

sudo chmod +x /etc/init.d/mongrel_cluster
sudo update-rc.d mongrel_cluster defaults

Modify your permissions of your app:

sudo chown -R www-data:www-data myrailsapp

Setup the Mongrel Cluster. This will get us a group of 3 mongrel clusters running on port 8000. From within your myrailsapp/config folder, type:

sudo mongrel_rails cluster::configure -e production \ -p 8000 -N 3 -c /var/www/apps/myrailsapp -a \ --user www-data --group mongrel

Now let's create a symlink to that file from within /etc where all our configs live:

sudo mkdir /etc/mongrel_cluster
cd /etc/mongrel_cluster/
sudo ln -s /var/www/myrailsapp/config/mongrel_cluster.yml

Information taken from here.

Linux - Fixme