We will need to install a compiler on the system before you continue.
apt-get install build-essential
You can then install ubuntu software for the mongrel_cluster
apt-get install mongrel-cluster
Now that it is installed we will need to configure each site to have a file located in the /etc/mongrel_cluster folder. here is an example of a configuration
user: www-data cwd: /var/www/vhost/subdomain.website.com/current log_file: /var/www/vhost/subdomain.website.com/shared/log/mongrel.log port: "8000" environment: production group: mongrel address: 127.0.0.1 pid_file: /var/www/vhost/subdomain.website.com/shared/pids/mongrel.pid servers: 3
This will start up 3 mongrels linking to port 8000 in the proxy setup. This should be located in each of the RoR projects in the config folder you will then link each of the files to the folder using a command like this.
ln -s /var/www/vhost/testapp/current/config/mongrel_cluster.yml /etc/mongrel-cluster/sites-enabled/helpdeskapp.yml
You will also need to make sure that the mongrel user has the ability to write to the tmp/, logs/, system/ folders in each project
chown -Rh www-data:www-data /var/www/vhost/APPLICATION/shared/log chown -Rh www-data:www-data /var/www/vhost/APPLICATION/shared/pids chown -Rh www-data:www-data /var/www/vhost/APPLICATION/shared/system
Now you will need to change the mod_proxy part in each of the vhost files.
<IfModule mod_proxy_balancer.c> <Proxy "balancer://mongrel-cluster"> BalancerMember http://127.0.0.1:8000 BalancerMember http://127.0.0.1:8001 BalancerMember http://127.0.0.1:8002 </Proxy> ProxyPass / balancer://mongrel-cluster/ ProxyPassReverse / balancer://mongrel-cluster/ # ProxyPreserveHost on </IfModule>
Now you can proceed with the web setup and project setup.
To restart the mongrel just run the following: