How to deploy your Rails application on Windows

27
RubyConf 2014 Lightning Talk How to deploy your Rails application on Windows shesee

Transcript of How to deploy your Rails application on Windows

Page 1: How to deploy your Rails application on Windows

RubyConf 2014 Lightning Talk

How to deploy your Rails application on Windowsshesee

Page 2: How to deploy your Rails application on Windows

shesee

Rails developer @ Taipei

» Ruby Taiwan Community

» Ruby Conf 2014 staff

» Rails Girls Coach

» Traffic-related engineering

» 5xRuby Inc.

» Optimis Corp.

Page 3: How to deploy your Rails application on Windows

They saidRails hates Windows

Page 4: How to deploy your Rails application on Windows

They saidRails hates Windows

True story.

Page 5: How to deploy your Rails application on Windows

True stroy

A rails application

needs to be deployed on Windows server 2003

Page 6: How to deploy your Rails application on Windows

True stroy

A rails application

needs to be deployed on Windows server 2003

>> 2013.years - 2003.years

=> 10 years

Page 7: How to deploy your Rails application on Windows

Enviroment10+ years old machine

» Windows server 2003

» IIS 6

Page 8: How to deploy your Rails application on Windows

There's Plan AHelicon Zoo

A repository of web frameworks and applicationsfor Microsoft IIS

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

Page 9: How to deploy your Rails application on Windows

There's Plan AHelicon Zoo

A repository of web frameworks and applicationsfor Microsoft IIS

But not for the 10 years old Windows system

Page 10: How to deploy your Rails application on Windows

Plan B

Setting Rails enviroment

RailsInstaller(http://railsinstaller.org)

It's simple and friendly for Microsoft users :)

Page 11: How to deploy your Rails application on Windows

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...

Page 12: How to deploy your Rails application on Windows

Plan B

gem 'thin'

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

$ thin --prefix=/yourapp -e production

Page 13: How to deploy your Rails application on Windows

Plan B

Reverse proxy server

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

Page 14: How to deploy your Rails application on Windows

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)

Page 15: How to deploy your Rails application on Windows

Plan B

East install

Next, next and more next

Page 16: How to deploy your Rails application on Windows

Plan B

Successful <3

Checkout ISAPI

Page 17: How to deploy your Rails application on Windows

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

Page 18: How to deploy your Rails application on Windows

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]

Page 19: How to deploy your Rails application on Windows

Plan B

However you get a nacked website

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

Page 20: How to deploy your Rails application on Windows

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

Page 21: How to deploy your Rails application on Windows

Plan B

Review our action

1.Install RubyInstaller

Page 22: How to deploy your Rails application on Windows

Plan B

Review our action

1.Install RubyInstaller

2.Install gem & bundler

Page 23: How to deploy your Rails application on Windows

Plan B

Review our action

1.Install RubyInstaller

2.Install gem & bundler

3.Install IIRF 2.1

Page 24: How to deploy your Rails application on Windows

Plan B

Review our action

1.Install RubyInstaller

2.Install gem & bundler

3.Install IIRF 2.1

4.Put on IIS

Page 25: How to deploy your Rails application on Windows

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

Page 26: How to deploy your Rails application on Windows

You just need toclick "next"

Page 27: How to deploy your Rails application on Windows

Thanks.Download this slide

http://carolHsu/rubyconf2014LT