Thursday, 5 July 2007

Deploy Rails on Windows: Part 1

An application I'm developing is due to go public around Christmas. I thought the best way to get to grips with deployment would be to set up a little test application, before trying to move all my code onto the server. This guide will consist of 3 parts:
  1. Installing Rails
  2. My-first-app with Oracle
  3. Pen of pesky Mongrels
I'll be using Windows Server, Oracle 10g, Mongrel & Pen. Many thanks to Brian Hogan for his informative talk at RailsConf which made the whole process very easy. See Deployment Strategies for Rails on Windows Servers for more detailed information.

Part 1: Installing Rails

Install Ruby

Download the one click windows installer. When installing, uncheck 'SciTE' – there are better editors available. Also, make sure ‘Enable RubyGems’ is checked. This is the package manager for Ruby, used to install Rails itself and myriad of other stuff.

Install to 'c:\program files\ruby' (or your installation path), then add ‘c:\program files\ruby\bin’ to your PATH for command line stuff.

Goto ‘Control Panel\System’, select the ‘Advanced’ tab and click ‘Environment Variables’. Look under user variables. If PATH isn’t already defined, click ‘New’.
  • Variable name = ‘PATH’
  • Variable value = ‘%PATH%;c:\program files\ruby\bin’
Note the ‘;’ separator in the value string. If PATH is already defined just add ‘;c:\program files\ruby\bin’ to the end of it.

Install Rails

Now that we have ruby installed, we can use RubyGems to install rails.

gem install rails --include-dependencies

Yes, it is that easy.


Create your application skeleton and start the server:

rails path/to/your/new/application
cd path/to/your/new/application
ruby script/server

Congratulations! You’re now on Rails. Onto Part 2: My-first-app with Oracle...

1 comment:

Hire Ruby on Rails Programmer said...

i am currently working with a ruby on rails development company as a freelancer and just want to thanks your post really saves me :D thanks buddy keep up the good work.
waiting for the further posts.