最速部署 Rails 3 在 IIS6

 

http://slid.es/shesee/rails-3-iis6/



shesee

shesee

Work in Taipei
CECI engineer




  • Advanced Traffic Management System (ATMS)
  • Advanced Traveler Information System (ATIS)
  • Train Timetable Information System (TWRail)

... and more traffic relative



Never Ruby



Never Ruby
Never Rails



Never Ruby
Never Rails
Never Linux




Never Ruby
Never Rails
Never Linux

Never out of Windows

So, Let's try



阿里山森林鐵路查詢系統(AliRail)


So, Let's try



阿里山森林鐵路查詢系統(AliRail)

迷你、單純、No one care的小專案


So, Let's try



阿里山森林鐵路查詢系統(AliRail)

迷你、單純、No one care的小專案

本來切了一個ubuntu 12.04 VM來架


So, Let's try



阿里山森林鐵路查詢系統(AliRail)

迷你、單純、No one care的小專案

本來切了一個ubuntu 12.04 VM來架

結果發現百萬防火牆的外點IP用完了

How To




將 Rails 3 專案

(很快的)架上IIS呢

Environment





  1. Windows server 2003
  2. IIS 6
  3. 9+ years machine (XD)

Helicon Zoo

a repository of web frameworks and applications 
for Microsoft IIS
http://www.helicontech.com/zoo/

and it's not for FREE...


Ruby on Windows


RubyInstaller (http://rubyinstaller.org)


Ruby on Windows


Development kit (http://rubyinstaller.org/download)




Or you may get some error while run "rake".

Ruby on Windows



Execute cmd

> gem install bundler
> gem install rake
> gem install eventmachine
> bundle install
> rake assets:precompile

gem 'thin'


why Thin


因為它比WEBrick快


> thin --prefix=/alirail -e production

Reverse proxy server


This is what I want: 
To make IIS been a reverse proxy server


"?" = IIRF 2.1

IIRF 2.1 (http://iirf.codeplex.com/releases/view/58734)



A ISAPI rewriter



Easy install




Next Next and Next

Successfully



Chectout ISAPI篩選器

Put on IIS6


把 public folder 設定在IIS底下成為一個網站
(例如我的uri是alirail)

*放入一個IIRF.ini*
IIRF是支援regex的

RewriteLog AppPath\log\iirf.log

ProxyPass ^/(.*)$          http://localhost:3000/$1 [I]

But you'll get a naked Site






人生最重要的就是這個BUT

...Cause Assets Pipeline


主要是因為我有一個URI(http://domain/alirail)的關係

解決方法:

把public/assets/也掛成一個URI

變成 http://domain/assets

再複習一次有多簡單



  1. 安裝 RubyInstaller (下一步下一步下一步)
  2. 安裝 Development Kit (下一步下一步下一步)
  3. 安裝 gem 們
  4. 安裝 IIRF 2.1 (下一步下一步下一步)
  5. 掛上IIS
  6. 加上 public/iirf.ini

Microsoft style


How about multiple sites?





不得已要裝在Windows上的,一個就夠了。

Contact shesee


*Always find something interesting.*


https://www.facebook.com/hsu.c.12
http://twitter.com/sheseee
http://carolhsu.github.io

最速部署 Rails 3 在 IIS6 

By shesee

最速部署 Rails 3 在 IIS6 

  • 5,165