This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Deploying on WindowsDeploying on Windows(it’s actually possible!)(it’s actually possible!)
Brian HoganBrian HoganNew Auburn Personal Computer Services LLCNew Auburn Personal Computer Services LLC
OverviewOverview Deploying with MongrelDeploying with Mongrel Deploying with PenDeploying with Pen Deploying with Apache and MongrelDeploying with Apache and Mongrel Deploying behind IISDeploying behind IIS Other methodsOther methods PerformancePerformance
Why??Why??
You have no choiceYou have no choice It’s your “foot in the door”It’s your “foot in the door” You’re just stubbornYou’re just stubborn
Deployment StrategiesDeployment Strategies
MongrelMongrel Mongrel and PenMongrel and Pen Mongrel and ApacheMongrel and Apache Hiding behind IISHiding behind IIS Other optionsOther options
Before we beginBefore we begin
Get Ruby and Ruby on Rails installed Get Ruby and Ruby on Rails installed on your serveron your server
Get any other gems you needGet any other gems you need Make sure your app works in Make sure your app works in
production mode!production mode!– Demo app at Demo app at
Hope, pray, or perform some sort of Hope, pray, or perform some sort of dance.dance.
Deploying with MongrelDeploying with Mongrel
Deploying with MongrelDeploying with Mongrel Install MongrelInstall Mongrel Install the Mongrel Service gemInstall the Mongrel Service gem Set it up as a serviceSet it up as a service
Install Pen as serviceInstall Pen as service– C:\reskit\instsrv Pen c:\reskit\srvany.exeC:\reskit\instsrv Pen c:\reskit\srvany.exe
Deploying with Mongrel and Deploying with Mongrel and PenPen
Set Service propertiesSet Service properties– Open RegeditOpen Regedit– Go to HKLM\System\CurrentControlSet\Go to HKLM\System\CurrentControlSet\
Services\PenServices\Pen– Add a new key called PropertiesAdd a new key called Properties– Add three String values to Add three String values to ParametersParameters
– Add this to the bottomAdd this to the bottom Include conf/guestbook_proxy.confInclude conf/guestbook_proxy.conf
– Copy the apache configuration from Copy the apache configuration from http://svn.napcsweb.com/public/guestbook/cohttp://svn.napcsweb.com/public/guestbook/config/apache/guestbook_proxy.confnfig/apache/guestbook_proxy.conf to c:\apache\conf\ to c:\apache\conf\
Deploying with Mongrel and Deploying with Mongrel and ApacheApache
ProsPros– Best option for WindowsBest option for Windows
Super stableSuper stable Assets and cached pages served by Apache – Assets and cached pages served by Apache –
fastfast High-quality balancerHigh-quality balancer Almost identical configuration to LinuxAlmost identical configuration to Linux
Deploying with Mongrel and Deploying with Mongrel and ApacheApache
ConsCons– More difficult to configure and More difficult to configure and
understandunderstand If security is important, you’d better learn If security is important, you’d better learn
more about Apache before you deploy!more about Apache before you deploy!
– Uses more resourcesUses more resources– Apache may be a “no-no” for some Apache may be a “no-no” for some
Start your Rails appStart your Rails app– Start Apache and your Mongrel instancesStart Apache and your Mongrel instances
Deploying behind IISDeploying behind IIS ProsPros
– Seamlessly graft many apps onto your Seamlessly graft many apps onto your main web servermain web server
– Use existing SSL certificates from IISUse existing SSL certificates from IIS– Use your existing authentication schemeUse your existing authentication scheme
Deploying behind IISDeploying behind IIS ConsCons
– Not freeNot free– Requires that all URLs are generated Requires that all URLs are generated
with url_forwith url_for– It’s an extra piece that can breakIt’s an extra piece that can break
Other StrategiesOther Strategies
Apache and FastCGIApache and FastCGI Don’t even bother.Don’t even bother.
– It’s slowIt’s slow– Not good for multiple appsNot good for multiple apps– It’s buggy too.It’s buggy too.
IIS and FastCGIIIS and FastCGI Microsoft is working on a new FastCGI Microsoft is working on a new FastCGI
adapter!adapter!– MayMay be built into the next IIS be built into the next IIS– No official plans to support RailsNo official plans to support Rails
But it does work!But it does work!
Other IIS and FastCGI methods are not Other IIS and FastCGI methods are not worth your time.worth your time.– Not made for multiple appsNot made for multiple apps– Not flexibleNot flexible– The non-MS FastCGI is not actively The non-MS FastCGI is not actively
maintainedmaintained
ConsiderationsConsiderations
Is Ruby Slower on Is Ruby Slower on Windows?Windows?
Much slowerMuch slower– 3-30 Requests / Second on Windows3-30 Requests / Second on Windows– 50-100 Requests / Second on Linux50-100 Requests / Second on Linux
Dual core Intel and AMD 64 chips Dual core Intel and AMD 64 chips speed things upspeed things up– Nowhere near Mac or Linux speedsNowhere near Mac or Linux speeds
RecommendationsRecommendations Small applicationSmall application
– Internal use, mostly read-onlyInternal use, mostly read-only– Small group of usersSmall group of users– 50,000 requests per day50,000 requests per day– Use a single Mongrel and cache your Use a single Mongrel and cache your
pagespages
RecommendationsRecommendations Large internal applicationLarge internal application
– Many concurrent usersMany concurrent users– Lots of transactionsLots of transactions– Use Pen and MongrelUse Pen and Mongrel
– Many concurrent usersMany concurrent users– Mostly read-onlyMostly read-only– Use Apache and Mongrel with page Use Apache and Mongrel with page
cachingcaching
RecommendationsRecommendations Prepare to move to LinuxPrepare to move to Linux
– You’ll want the performanceYou’ll want the performance– Move your app servers to LinuxMove your app servers to Linux
Use Pen or Apache to balance on WindowsUse Pen or Apache to balance on Windows Use ISAPI_Rewrite, and Reverse_proxy_fix to Use ISAPI_Rewrite, and Reverse_proxy_fix to
hide your apps behind IIShide your apps behind IIS
Reasons to move to LinuxReasons to move to Linux You get to use automated deploymentYou get to use automated deployment
– Capistrano is *nix onlyCapistrano is *nix only You get a speed boostYou get a speed boost
– It’s just going to perform betterIt’s just going to perform better You can use Nginx and mongrel_clusterYou can use Nginx and mongrel_cluster
– Nginx is a simple web server and load Nginx is a simple web server and load balancerbalancer
You will eventually run out of resources You will eventually run out of resources on Windows.on Windows.– You need more Mongrel instances on Windows You need more Mongrel instances on Windows
to handle the load since Ruby runs slower.to handle the load since Ruby runs slower.