Setup a Production Ready Ruby on Rails Application Over Apache and Mongrel
March 5th, 2007 by Stanislav BozhkovSetting up a Ruby on Rails Application in a production environment could be a bit tricky. This is because the standard servers for running ruby could serve only one request at a time. As a result if there’s a slow database connection or any other process away from the application server no other requests could be served. On contrast Apache httpd spawns a new child if there’s a necessity to process a new request. In this article I’ll guide you how to solve this problem. Generally there will be an apache httpd server which will be used as a gateway to a cluster of mongrel_rails processes. So, all users will be accessing the apache as a frontend, however the whole processing burden will be let down to the mongrel servers. Here it is an example:
First to mention, I’m making this setup on Fedora Core 6. However it should be almost the same on older versions or other distributions. Note: Your apache should support mod_proxy_balancer (it is distributed with apache 2.2.x). So, the basic software requirements are:
- Ruby - You won’t go without a ruby interpreter (preferably version 1.8.5). On a Fedora 2 I did a source “compile and install” without any complications
- ruby-devel package - In case that you’ve installed ruby as a package you should install ruby-devel in order to compile a few mongrel related gems
- gem - The tool to install most of the extensions which are related to ruby. If you want to install from sources (it’s pretty easy: ruby setup.rb) you can download it from here: gem sources
You like it? Digg it!
