How to deploy your Rails application on Windows

Preview:

Citation preview

RubyConf 2014 Lightning Talk

How to deploy your Rails application on Windowsshesee

shesee

Rails developer @ Taipei

» Ruby Taiwan Community

» Ruby Conf 2014 staff

» Rails Girls Coach

» Traffic-related engineering

» 5xRuby Inc.

» Optimis Corp.

They saidRails hates Windows

They saidRails hates Windows

True story.

True stroy

A rails application

needs to be deployed on Windows server 2003

True stroy

A rails application

needs to be deployed on Windows server 2003

>> 2013.years - 2003.years

=> 10 years

Enviroment10+ years old machine

» Windows server 2003

» IIS 6

There's Plan AHelicon Zoo

A repository of web frameworks and applicationsfor Microsoft IIS

http://www.helicontech.com/zoo/

There's Plan AHelicon Zoo

A repository of web frameworks and applicationsfor Microsoft IIS

But not for the 10 years old Windows system

Plan B

Setting Rails enviroment

RailsInstaller(http://railsinstaller.org)

It's simple and friendly for Microsoft users :)

Plan B

Setting Rails enviroment

There's a bisic rails application,you might need to be

$ gem install bundler$ gem install rake$ bundle install$ rake assets:precompile

etc...

Plan B

gem 'thin'

This is our rails application server,which actually response the request.

$ thin --prefix=/yourapp -e production

Plan B

Reverse proxy server

This is our plan:Make IIS 6 been a reverse proxy server !

Plan B

Reverse proxy server - IIS6 with IIRF2.1

We need somethingto turn IIS6 to be a reverse proxy server

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

Plan B

East install

Next, next and more next

Plan B

Successful <3

Checkout ISAPI

Plan B

Put it under IIS 6

Put the "public" folder under IIS 6[Setting its URI]

And adding an IIRF.ini (config), it suppports regex

Plan B

Put it under IIS 6

Put the "public" folder under IIS 6[Setting its URI]

And adding an IIRF.ini (config), it suppports regex

Example

RewriteLog AppPath\log\iirf.log

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

Plan B

However you get a nacked website

Cause the URI path, asset pipeline can't be the default path now.

Plan B

However you get a nacked website

Cause the URI path, asset pipeline can't be the default path now.

Solution

Also put the "assets" folder under IIS 6

Original: http://domain

New: http://domain/URI

Plan B

Review our action

1.Install RubyInstaller

Plan B

Review our action

1.Install RubyInstaller

2.Install gem & bundler

Plan B

Review our action

1.Install RubyInstaller

2.Install gem & bundler

3.Install IIRF 2.1

Plan B

Review our action

1.Install RubyInstaller

2.Install gem & bundler

3.Install IIRF 2.1

4.Put on IIS

Plan B

Review our action

1.Install RubyInstaller

2.Install gem & bundler

3.Install IIRF 2.1

4.Put on IIS

5.Add public/iirf.ini

You just need toclick "next"

Thanks.Download this slide

http://carolHsu/rubyconf2014LT

Recommended