Mighty Interactive Homepage

Rails on Windows

Deploying to IIS with lighttpd and Mongrel

by Joseph Jaramillo

Typical Rails deployment occurs on open-source platforms, with Linux being the platform of choice. But what if you want (or need) to deploy on Windows? It's easier than you might think. We've managed to refine the process of deploying a Rails app on Windows down to a mostly point-and-click procedure.

The steps below outline setting up and running a Ruby on Rails application in a Microsoft Windows environment, using IIS, the ISAPIRewrite IIS plugin, lighttpd, and Mongrel. When we're finished IIS will proxy all requests for our web app to a lighttpd instance, which will in turn use its fair balancer to distribute these requests to Mongrel instances. For added convenience we'll set up lighttpd and Mongrel to start automatically on boot. In addition, we'll be installing some useful gems.

For the purposes of this document, any buttons that need to be clicked will be surrounded with quotes, like so: "Next" or "Next." Any keys which must be pressed will be capitalized, like so: ENTER or RETURN. Hotkeys requiring one or more keys to be pressed simultaneously will be capitalized and hyphenated: CTRL-C or CTRL-SHIFT-A. Keys should be pressed and held in the order they appear, and released after the last key is pressed.

The following instructions assume an up-to-date Windows Server 2003 installation with IIS installed. The server must have a functioning internet connection to continue.

For each of the instructions below, when you are directed to type commands into a Command Prompt, it is imperative that capitalization be matched exactly.

To perform this installation you must be signed into Windows Server 2003 with an Administrator account.

These instructions are current as of Friday, April 4th, 2008. If you find any errors or have any suggestions please feel free to pass them along to: joseph (at) mightyinteractive [dot] com

Section 1 - Installation

This section will walk you through the process of installing all of the components necessary for hosting a Rails application.

Step 1 - Installing Ruby

  1. Close all running applications.
  2. Open a web browser, and download the Ruby installer for Windows. Open it.
  3. Click the "Next" button.
  4. Click the "I Agree" button to accept the License Agreement.
  5. At the "Choose Components" screen the default selections will be adequate. You may choose not to install "SciTE" if you wish. SciTE is an open-source text editor with Ruby syntax formatting. Installing it will make it easier to edit Ruby files. Click "Next."
  6. At the "Choose Install Location" screen you can change the installation directory for Ruby and its associated files. These instructions assume installation to the default directory (c:\ruby). Click "Next."
  7. The Ruby installer will create a Start Menu folder. You can customize the name of this folder if desired. Click "Install" to begin the installation.
  8. The installer will show a running log of operations as the installation takes place. Once ths installation procedure has completed, click "Next."
  9. On the "Completing the Ruby-186-26 Setup Wizard" screen, uncheck the "Show Readme" checkbox and click "Finish."

Ruby is now installed. To confirm successful completion of this step, please perform the following steps:

  1. Open a Command Prompt.
  2. In the Command Prompt window, type the following and press ENTER:

    ruby -v
  3. Verify that the output appears as follows:

    ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-msWin32]

Ruby installation is complete.

Step 2 - Updating RubyGems

  1. At the Command Prompt opened in the previous step, type the following and press ENTER:

    gem update --system
  2. This will update RubyGems - the Ruby Packaging System - to the latest version available (currently 1.0.1). You will see text scroll as files are updated. At the end of this procedure you should see the following as the last line of the command’s output:

    RubyGems system software updated
  3. Type the following and press ENTER:

    gem -v
  4. Verify that the output appears as follows:

    1.0.1

RubyGems updating is complete.

Step 3 - Install sqlite3

  1. Download the sqlite3 executable and DLL file for Windows.
  2. Extract the archives and copy the contents (sqlite3.exe, sqlite3.dll, sqlite3.def) to the C:\WINDOWS\system32 directory.
  3. To verify successful completion of this step, bring up the Command Prompt opened in Step 1, type the following and press ENTER:

    sqlite3 -version
  4. Verify that the output appears as follows:

    3.5.6

sqlite3 installation is complete.

Step 4 - Installing Rails and other gems

Ruby packages (gems) are installed using the gem command. We will be installing several gems, including Rails. The output from the following commands will vary, and each may take some time (up to several minutes) to complete. After each command is finished you will be returned to the Command Prompt.

  1. At the Command Prompt opened in Step 1, type the following and press ENTER:

    gem install rails
  2. Type the following and press ENTER:

    gem install RedCloth BlueCloth
  3. Type the following and press ENTER:

    gem install ruport ruport-util
  4. Type the following and press ENTER:

    gem install sqlite3-ruby
  5. Navigate to the gems directory in the installation files directory. The location will vary according to your user name, but the command will look similar to the following:

    cd\"Documents And Settings"\YOUR_USER_NAME\Desktop\install\gems
  6. Type the following and press ENTER:

    gem install ferret --local
  7. Type the following and press ENTER:

    gem install acts_as_ferret
  8. Type the following and press ENTER:

    gem install mongrel mongrel_service

    If you are asked to select a version, choose the latest version for Win32.

  9. Close the Command Prompt.

Rails and other gems installation is complete.

Next Page | 1 | 2 | 3

E-mail Newsletter

Sign up to receive the bi-weekly New York Minute marketing newsletter. You will also receive periodic agency announcements and invitations. View latest issue.


Ruby on Rails – A Mighty Tool

Check out our new section on Ruby on Rails, the Web development platform everyone's talking about. Developers – download our plugins.


You Make Money, We Make Money

Ask us about our results-based pricing model, where we're true business partners with our clients. View a case study about how this approach increased ROI 500% in one year for Esscentual Brands.


Getting results

  • Arizona Highways

    Arizona Highways magazine, an award-winning publication for the past 78 years, needed to increase online sales and subscriptions while reducing cost-per-sale through their online store.

    View this case study »


PPC Calculator

Options

change to dark background change to light background