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
This section will walk you through the process of installing all of the components necessary for hosting a Rails application.
Ruby is now installed. To confirm successful completion of this step, please perform the following steps:
In the Command Prompt window, type the following and press ENTER:
ruby -vVerify that the output appears as follows:
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-msWin32]Ruby installation is complete.
At the Command Prompt opened in the previous step, type the following and press ENTER:
gem update --systemThis 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 updatedType the following and press ENTER:
gem -vVerify that the output appears as follows:
1.0.1RubyGems updating is complete.
To verify successful completion of this step, bring up the Command Prompt opened in Step 1, type the following and press ENTER:
sqlite3 -versionVerify that the output appears as follows:
3.5.6sqlite3 installation is complete.
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.
At the Command Prompt opened in Step 1, type the following and press ENTER:
gem install railsType the following and press ENTER:
gem install RedCloth BlueClothType the following and press ENTER:
gem install ruport ruport-utilType the following and press ENTER:
gem install sqlite3-rubyNavigate 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\gemsType the following and press ENTER:
gem install ferret --localType the following and press ENTER:
gem install acts_as_ferretType the following and press ENTER:
gem install mongrel mongrel_service
If you are asked to select a version, choose the latest version for Win32.
Close the Command Prompt.
Rails and other gems installation is complete.