Deploying Ruby On Rails in a Windows environment can be very painful. I couldn’t find any blog which really helped me, so I decided to summarize all the necessary steps I followed to successfully deploy a Rails application in a Windows 2008 server from scratch. I won’t give much explanation on each step, so if you like to know more about it, at the end of this post you’ll find a list of articles I found useful.
**The environment: **
Steps:
gem install rails -v '= 2.3.5' --include-dependencies
gem install activerecord-sqlserver-adapter --version 2.3.5
${RUBY_INSTALLATION_DIR}\lib\ruby\site_ruby\1.8\i386-msvcrt
C:\Windows>SysWOW64\odbcad32.exe
(make sure you use this command instead of using the regular access from the control panel)rake db:create RAILS_ENV=production
rake db:migrate RAILS_ENV=production
rake db:seed RAILS_ENV=production
C:\Windows\System32\drivers\etc\hosts
and add the following line 127.0.0.1 localhost localhost-1 localhost-2
(add as many localhost-x hostnames as mongrel services you’re planning to setup)Rule 2 * Pattern:^([^.]+)$ * Action: Route to Server Farm * Path: /{R:1} * Do not check stop processing subsequent rules 13. In the IIS Manager create a new Web Site and in the Path box, type or browse to the directory that contains your Rails public folder. 14. Download this win32 services gem and install it. 15. Download this mongrel-service gem and install it. 16. Setup as many mongrel services as you need
mongrel_rails service::install -N my-app-node-1 -e production -p 3000
mongrel_rails service::install -N my-app-node-2 -e production -p 3001
etc..
Launch the Window Services console from Control Panel. Change the startup type of your mongrel services to Automatic and start each of them.
Open a browser and test your application
Finally, some articles you might find useful:
Create a 32bit DSN on a 64bit operating system
Ruby on Rails in IIS70 with url rewriter
Define and configure an application request routing server farm
Creating rewrite rules for the url rewrite module
10 steps to get Ruby on Rails running on Windows with IIS FastCGI
19 Oct 2010