Check to see if Ruby and Gems are already installed on your machine.
If you nothing happens then you need to install Ruby on Rails and then the gems which should be posted or will be soon. If your getting a list of gems look for mongrel or mongrel_cluster. If your not seeing the gems then you need to install them
gem list --local
Once you get them installed now you will need add a user for the service.
sudo gem install mongrel sudo gem install mongrel_cluster
Now we need to create the folder for the mongrel config files
/usr/sbin/adduser -r mongrel
Now we need to copy the mongrel_cluster information to the init.d directory so it can execute. NOTE: this line is very long so it will be on 2 lines and also please note that version change to please check or use auto complete to get the most recent version.
Now we need this to be executable
cp /usr/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.2/ resources/mongrel_cluster /etc/init.d/
Now let's try and start it up
chmod +x /etc/init.d/mongrel_cluster
Now everything should be good to go. Here is a sample of the mongrel_cluster.yml file.
/etc/init.d/mongrel_cluster start && sudo /sbin/chkconfig mongrel_cluster on
You will need to create a link from the mongrel_cluster.yml file from the project/current/config directory to the /ect/mongrel_cluster folder you created above. It is going to be on two lines because it is so long.
user: mongrel cwd: /var/www/vhost/helpdesk.techitweb.com/current log_file: /var/www/vhost/helpdesk.techitweb.com/shared/log/mongrel.log port: "8000" environment: production group: mongrel address: 127.0.0.1 pid_file: /var/www/vhost/helpdesk.techitweb.com/shared/pids/mongrel.pid servers: 3
Now you will need to change the permissions on the folders so that the mongrel user can write logs and pids
ln -s /var/www/apps/testapp/current/config/mongrel_cluster.yml /etc/mongrel_cluster/helpdeskapp.yml
Now that you have everything setup now just setup apache vhost files
chown -R mongrel.mongrel /var/www/vhost/APPLICATION/shared/log chown -R mongrel.mongrel /var/www/vhost/APPLICATION/shared/pids
I think that the best way to test this is to do both the /etc/init.d/mongrel_cluster restart and then reboot the machine to make sure it will run after a restart.
<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>