Topic: Start Mongrel Cluster at Boot
Topic type:
The steps necessary to set up your Mongrel Cluster to start at boot.
Originally written by Walter McGinnis, Kete Project Lead for Katipo Communications, Ltd.
An appendix of the Installation Guide
Important Note: This step assumes that you are logged in as the user who will be running your Kete. For demos and development this is likely your normal account, for production this is the "kete" account if you have followed the conventions laid forth in the last step.
Set Up Directory for Mongrel Config Files and to Launch at Boot
Not available for Mac OS X right now, if you have an idea of how to do this, please add it in discussion.
For Linux distributions, such as Debian Etch, that use /etc/init.d/:
$ sudo -s
root@host: # mkdir /etc/mongrel_cluster
root@host: # cp /usr/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.2/resources/mongrel_cluster /etc/init.d/ # mongrel_cluster version number may vary, adjust to suit
root@host: # chmod +x /etc/init.d/mongrel_cluster
root@host: # /usr/sbin/update-rc.d -f mongrel_cluster defaults
root@host: # exit
Very Important: now, you must open with root privileges in a text editor the /etc/init.d/mongrel_cluster file and replace "USER=mongrel" with "USER=kete". Save the file.
Required for demos and development:
Open your_app/config/mongrel_cluster.yml and edit to add a cwd line. It should look something this:
... cwd: /home/kete/apps/your_app ...
That sets your RAILS_ROOT for mongrel which will then put all other settings relative it it.
Then do this step to add your mongrel config file to the list that will be started at boot:
$ sudo ln -s /home/kete/apps/your_app/config/mongrel_cluster.yml /etc/mongrel_cluster/your_app.yml
Test your set up by doing the following:
$ sudo /etc/init.d/mongrel_cluster stop # visit browser, your site should be unavailable
$ sudo /etc/init.d/mongrel_cluster start # visit browser, your site should now be available
If you are using Capistrano, when we deploy we'll populate the /etc/mongrel_cluster directory with a config file. DON'T do the "sudo ln -s" step!