Madison Rails
Deploying Rails on Windows (Version #1)

The Problem

You have written a kick-ass Rails application using your favorite suite of tools. You find out from your boss that he thinks Linux is evil and open source is the spawn of Satan. However, he loves your app and tells you to deploy it on the Windows server.

The Downloads

Apache Installer
MySQL Installer
Ruby Installer

The Instructions

Install the Software

Install Apache as a Windows service. Install MySQL as a Windows service.

Install Ruby, being sure to install Ruby Gems. (It is checked by default in the installation wizard.)

Open a Command Prompt and type the following commands:

c:\> gem install rails --include-dependencies
c:\> gem install mongrel --include-dependencies
c:\> gem install mongrel_service --include-dependencies

Configure MySQL

Login to MySQL using your favorite method. When PHP is installed on the system, I like to use PhpMyAdmin.

Create a user for your Rails application in MySQL, then create a database. Give your new user all privileges to the database.

Configure Mongrel

At your Command Prompt, type the following commands:
c:\> mongrel_rails service::install -N my_sweet_app -c c:\path\to\my_sweet_app -p 4000 -e production
c:\> net start my_sweet_app

The -N switch is what you would like to call your service as it would appear in the Services Control Panel. -c is the path on your hard drive to your application. -p is the port you would like to run the app on. -e production means that you want to run the application in production mode.

Test that the application is running by opening your browser and typing “http://localhost:4000”. If your application comes up, you have succeeded in installing mongrel as a service. Now it is time to configure Apache.

Configure Apache

When configuring Apache, there are a couple decisions to make. Do you just need a single instance of Mongrel and clean URL? Or do you need a pack of Mongrels? The first approach is easy to configure. The second approach is much harder.

Just One Mongrel

A Whole Pack of Mongrels

References

Mongrel Web Site