Presentation is loading. Please wait.

Presentation is loading. Please wait.

Deploying on Windows (it’s actually possible!) Brian Hogan New Auburn Personal Computer Services LLC Contents copyright © 2007 Brian P. Hogan. Do not reproduce.

Similar presentations


Presentation on theme: "Deploying on Windows (it’s actually possible!) Brian Hogan New Auburn Personal Computer Services LLC Contents copyright © 2007 Brian P. Hogan. Do not reproduce."— Presentation transcript:

1 Deploying on Windows (it’s actually possible!) Brian Hogan New Auburn Personal Computer Services LLC Contents copyright © 2007 Brian P. Hogan. Do not reproduce without permission.

2 Overview Deploying with Mongrel Deploying with Mongrel Deploying with Pen Deploying with Pen Deploying with Apache and Mongrel Deploying with Apache and Mongrel Deploying behind IIS Deploying behind IIS Other methods Other methods Performance Performance

3 Why?? You have no choice You have no choice It’s your “foot in the door” It’s your “foot in the door” You’re just stubborn You’re just stubborn

4 Deployment Strategies Mongrel Mongrel Mongrel and Pen Mongrel and Pen Mongrel and Apache Mongrel and Apache Hiding behind IIS Hiding behind IIS Other options Other options

5 Before we begin Get Ruby and Ruby on Rails installed on your server Get Ruby and Ruby on Rails installed on your server Get any other gems you need Get any other gems you need Make sure your app works in production mode! Make sure your app works in production mode! –Demo app at http://svn.napcsweb.com/public/guestbook/ Hope, pray, or perform some sort of dance. Hope, pray, or perform some sort of dance.

6 Deploying with Mongrel

7 Install Mongrel Install Mongrel Install the Mongrel Service gem Install the Mongrel Service gem Set it up as a service Set it up as a service –Mongrel_rails service:install –n “guestbook_4001” –p 4001 –e production Set the service to start automatically Set the service to start automatically

8 Deploying with Mongrel Pros Pros –Easy to set up –Easy to maintain –Great for a small application during development or demonstration

9 Deploying with Mongrel Cons Cons –No page caching –Does not scale –Mongrel serves CSS, images, and JavaScript

10 Deploying with Mongrel and Pen Add some load balancing!

11 Deploying with Mongrel and Pen Install Mongrel and mongrel_service Install Mongrel and mongrel_service Set it up as a service for each app Set it up as a service for each app –Mongrel_rails service:install –n “guestbook_4001” –p 4001 –e production –Mongrel_rails service:install –n “guestbook_4002” –p 4002 –e production Set the services to start automatically Set the services to start automatically

12 Deploying with Mongrel and Pen Install Pen and Cygwin1.dll to c:\pen Install Pen and Cygwin1.dll to c:\pen –Pen : http://siag.nu/pub/pen/pen-0.17.1a.exe http://siag.nu/pub/pen/pen-0.17.1a.exe –Cygwin1 http://www.dll-files.com/dllindex/dll-files.shtml?cygwin1 http://www.dll-files.com/dllindex/dll-files.shtml?cygwin1

13 Deploying with Mongrel and Pen Install Pen as a service Install Pen as a service –Download resource kit and install to c:\reskit –http://www.microsoft.com/downloads/details. aspx?familyid=9d467a69-57ff-4ae7-96ee- b18c4790cffd http://www.microsoft.com/downloads/details. aspx?familyid=9d467a69-57ff-4ae7-96ee- b18c4790cffdhttp://www.microsoft.com/downloads/details. aspx?familyid=9d467a69-57ff-4ae7-96ee- b18c4790cffd Install Pen as service Install Pen as service –C:\reskit\instsrv Pen c:\reskit\srvany.exe

14 Deploying with Mongrel and Pen Set Service properties Set Service properties –Open Regedit –Go to HKLM\System\CurrentControlSet\Services\Pen –Add a new key called Properties –Add three String values to Parameters key  Application = c:\pen  AppParameters = -f 4000 localhost:4001 localhost:4002  AppDirectory = c:\pen

15 Deploying with Mongrel and Pen Start Service Start Service –net start pen Remove Service Remove Service –sc delete pen

16 Deploying with Mongrel and Pen Pros Pros –Free and simple load balancing –Relatively quick setup –Performs moderately well –Can balance over multiple machines

17 Deploying with Mongrel and Pen Cons Cons –Still serving assets and cached pages with Mongrel –Cumbersome if you have lots of apps

18 Deploying with Mongrels and Apache

19 Deploying with Mongrel and Apache Install Apache Install Apache –http://www.eng.lsu.edu/mirrors/apache/httpd/ binaries/win32/apache_2.2.4-win32-x86- no_ssl.msi http://www.eng.lsu.edu/mirrors/apache/httpd/ binaries/win32/apache_2.2.4-win32-x86- no_ssl.msihttp://www.eng.lsu.edu/mirrors/apache/httpd/ binaries/win32/apache_2.2.4-win32-x86- no_ssl.msi –Install to c:\apache –Do NOT install as a service – install on 8080

20 Deploying with Mongrel and Apache Edit configuration Edit configuration –C:\apache\conf\httpd.conf  Uncomment these lines LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_balancer_module modules/mod_proxy_balancer.so LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule rewrite_module modules/mod_rewrite.so –Add this to the bottom  Include conf/guestbook_proxy.conf –Copy the apache configuration from http://svn.napcsweb.com/public/guestbook/config/a pache/guestbook_proxy.conf to c:\apache\conf\ http://svn.napcsweb.com/public/guestbook/config/a pache/guestbook_proxy.conf http://svn.napcsweb.com/public/guestbook/config/a pache/guestbook_proxy.conf

21 Deploying with Mongrel and Apache Pros Pros –Best option for Windows  Super stable  Assets and cached pages served by Apache – fast  High-quality balancer  Almost identical configuration to Linux

22 Deploying with Mongrel and Apache Cons Cons –More difficult to configure and understand  If security is important, you’d better learn more about Apache before you deploy! –Uses more resources –Apache may be a “no-no” for some reason.

23 Deploying behind IIS Hiding your Rails apps

24 Deploying behind IIS Install ISAPI_Rewrite Install ISAPI_Rewrite –Configure the rewriter (httpd.ini)  RewriteProxy /guestbook(.*) http\://localhost:8080$1 [I,U] Install the reverse_proxy_fix plugin Install the reverse_proxy_fix plugin –ruby script/plugin install http://svn.napcsweb.com/public/reverse_proxy_fix/ Configure the plugin Configure the plugin –Give it your forward-facing URL prefix  http://www.mydomain.com/myapp http://www.mydomain.com/myapp Start your Rails app Start your Rails app –Start Apache and your Mongrel instances

25 Deploying behind IIS Pros Pros –Seamlessly graft many apps onto your main web server –Use existing SSL certificates from IIS –Use your existing authentication scheme

26 Deploying behind IIS Cons Cons –Not free –Requires that all URLs are generated with url_for –It’s an extra piece that can break

27 Other Strategies

28 Apache and FastCGI Don’t even bother. Don’t even bother. –It’s slow –Not good for multiple apps –It’s buggy too.

29 IIS and FastCGI Microsoft is working on a new FastCGI adapter! Microsoft is working on a new FastCGI adapter! –May be built into the next IIS –No official plans to support Rails  But it does work! Other IIS and FastCGI methods are not worth your time. Other IIS and FastCGI methods are not worth your time. –Not made for multiple apps –Not flexible –The non-MS FastCGI is not actively maintained

30 Considerations

31 Is Ruby Slower on Windows? Much slower Much slower –3-30 Requests / Second on Windows –50-100 Requests / Second on Linux Dual core Intel and AMD 64 chips speed things up Dual core Intel and AMD 64 chips speed things up –Nowhere near Mac or Linux speeds

32 Recommendations Small application Small application –Internal use, mostly read-only –Small group of users –50,000 requests per day –Use a single Mongrel and cache your pages

33 Recommendations Large internal application Large internal application –Many concurrent users –Lots of transactions –Use Pen and Mongrel

34 Recommendations Public-facing application Public-facing application –Many concurrent users –Mostly read-only –Use Apache and Mongrel with page caching

35 Recommendations Prepare to move to Linux Prepare to move to Linux –You’ll want the performance –Move your app servers to Linux  Use Pen or Apache to balance on Windows  Use ISAPI_Rewrite, and Reverse_proxy_fix to hide your apps behind IIS

36 Reasons to move to Linux You get to use automated deployment You get to use automated deployment –Capistrano is *nix only You get a speed boost You get a speed boost –It’s just going to perform better You can use Nginx and mongrel_cluster You can use Nginx and mongrel_cluster –Nginx is a simple web server and load balancer You will eventually run out of resources on Windows. You will eventually run out of resources on Windows. –You need more Mongrel instances on Windows to handle the load since Ruby runs slower.

37 Questions? Email brianhogan@napcs.com Email brianhogan@napcs.combrianhogan@napcs.com Google chat: bphogan@gmail.com Google chat: bphogan@gmail.combphogan@gmail.com


Download ppt "Deploying on Windows (it’s actually possible!) Brian Hogan New Auburn Personal Computer Services LLC Contents copyright © 2007 Brian P. Hogan. Do not reproduce."

Similar presentations


Ads by Google