Specifications

Managing the Deployment of Ruby on Rails Applications
You can use Server Admin to manage the deployment of Ruby on Rails applications
with the Apache 2.2 mod_proxy_balancer module.
You can dedicate your website (virtual host) to Ruby on Rails or you can share your
website with Ruby on Rails. The following scenarios describe how to do this:
In the rst scenario, the website is dedicated to the Ruby on Rails web application. Â
In the second scenario, the website is shared with the Ruby on Rails application. Â
In these scenarios, the default wild-card website, which has the asterisk in the
address column of the websites list, is used as an example. There are other variations
depending on how you organize your websites and how you organize your Ruby on
Rails applications, but these scenarios illustrate the general mechanism. You can check
the knowledge base for additional techniques.
Scenario 1 — Dedicating a Website (Virtual Host) to the Proxied Web Application
1 Open Terminal and enter the following commands to create your Ruby on Rails
application outside the document root of an existing web virtual host (for example in
/Library/WebServer/MyWebApp, where MyWebApp is the name of your rails application).
$ cd /Library/WebServer
$ rails MyWebApp
$ ...
2 Start the Mongrel web server using the mongrel_rails_persist command:
$ sudo mongrel_rails_persist start -p 3001 -c /Library/WebServer/MyWebApp
This wrapper for the mongrel_rails command registers the instance of Mongrel
with Bonjour and provides a launchd plist le so the instance of Mongrel restarts on
server startup.
3 Use Safari to browse the local Rails URL to conrm that the web application is
responding:
http://127.0.0.1:3001
If you specied a model or scaold in your Rails application, the URL might be
something like http://127.0.0.1:3001/<ModelName>.
You should see the Welcome Aboard / You’re riding the rails” page.
4 Open Server Admin and connect to the server.
5 Click the triangle at the left of the server.
The list of services appears.
6 From the expanded Servers list, select Web.
7 Click Sites, then select the website in the list.
8 Click Proxy below the websites list.
72 Chapter 5 Working with Open Source Applications