passenger 2.2.2 → 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of passenger might be problematic. Click here for more details.
- data/DEVELOPERS.TXT +13 -3
- data/Rakefile +42 -33
- data/bin/passenger-install-apache2-module +1 -2
- data/bin/passenger-install-nginx-module +7 -19
- data/bin/passenger-status +64 -15
- data/bin/passenger-stress-test +2 -2
- data/doc/ApplicationPool algorithm.txt +26 -22
- data/doc/Users guide Apache.html +374 -149
- data/doc/Users guide Apache.txt +318 -51
- data/doc/Users guide Nginx.html +13 -13
- data/doc/Users guide Nginx.txt +7 -2
- data/doc/cxxapi/Bucket_8h-source.html +62 -25
- data/doc/cxxapi/Configuration_8h-source.html +343 -326
- data/doc/cxxapi/DirectoryMapper_8h-source.html +12 -12
- data/doc/cxxapi/Hooks_8h-source.html +1 -1
- data/doc/cxxapi/annotated.html +1 -1
- data/doc/cxxapi/classHooks-members.html +1 -1
- data/doc/cxxapi/classHooks.html +1 -1
- data/doc/cxxapi/classPassenger_1_1DirectoryMapper-members.html +2 -2
- data/doc/cxxapi/classPassenger_1_1DirectoryMapper.html +9 -9
- data/doc/cxxapi/classes.html +1 -1
- data/doc/cxxapi/definitions_8h-source.html +1 -1
- data/doc/cxxapi/files.html +1 -1
- data/doc/cxxapi/functions.html +2 -2
- data/doc/cxxapi/functions_func.html +2 -2
- data/doc/cxxapi/graph_legend.html +1 -1
- data/doc/cxxapi/group__Configuration.html +1 -1
- data/doc/cxxapi/group__Core.html +1 -1
- data/doc/cxxapi/group__Hooks.html +1 -1
- data/doc/cxxapi/group__Support.html +1 -1
- data/doc/cxxapi/main.html +1 -1
- data/doc/cxxapi/modules.html +1 -1
- data/doc/rdoc/classes/ConditionVariable.html +194 -0
- data/doc/rdoc/classes/Exception.html +120 -0
- data/doc/rdoc/classes/GC.html +113 -0
- data/doc/rdoc/classes/IO.html +169 -0
- data/doc/rdoc/classes/PhusionPassenger.html +238 -0
- data/doc/rdoc/classes/PhusionPassenger/AbstractInstaller.html +153 -0
- data/doc/rdoc/classes/PhusionPassenger/AbstractRequestHandler.html +517 -0
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer.html +719 -0
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerAlreadyStarted.html +97 -0
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerError.html +96 -0
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerNotStarted.html +97 -0
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer/UnknownMessage.html +96 -0
- data/doc/rdoc/classes/PhusionPassenger/AbstractServerCollection.html +598 -0
- data/doc/rdoc/classes/PhusionPassenger/AdminTools.html +140 -0
- data/doc/rdoc/classes/PhusionPassenger/AdminTools/ControlProcess.html +317 -0
- data/doc/rdoc/classes/PhusionPassenger/AdminTools/ControlProcess/Instance.html +138 -0
- data/doc/rdoc/classes/PhusionPassenger/AppInitError.html +154 -0
- data/doc/rdoc/classes/PhusionPassenger/Application.html +283 -0
- data/doc/rdoc/classes/PhusionPassenger/ConsoleTextTemplate.html +172 -0
- data/doc/rdoc/classes/PhusionPassenger/FrameworkInitError.html +145 -0
- data/doc/rdoc/classes/PhusionPassenger/HTMLTemplate.html +175 -0
- data/doc/rdoc/classes/PhusionPassenger/InitializationError.html +141 -0
- data/doc/rdoc/classes/PhusionPassenger/InvalidPath.html +92 -0
- data/doc/rdoc/classes/PhusionPassenger/MessageChannel.html +489 -0
- data/doc/rdoc/classes/PhusionPassenger/NativeSupport.html +350 -0
- data/doc/rdoc/classes/PhusionPassenger/Rack.html +91 -0
- data/doc/rdoc/classes/PhusionPassenger/Rack/ApplicationSpawner.html +188 -0
- data/doc/rdoc/classes/PhusionPassenger/Rack/RequestHandler.html +194 -0
- data/doc/rdoc/classes/PhusionPassenger/Railz.html +95 -0
- data/doc/rdoc/classes/PhusionPassenger/Railz/ApplicationSpawner.html +442 -0
- data/doc/rdoc/classes/PhusionPassenger/Railz/ApplicationSpawner/Error.html +98 -0
- data/doc/rdoc/classes/PhusionPassenger/Railz/CGIFixed.html +200 -0
- data/doc/rdoc/classes/PhusionPassenger/Railz/FrameworkSpawner.html +436 -0
- data/doc/rdoc/classes/PhusionPassenger/Railz/FrameworkSpawner/Error.html +98 -0
- data/doc/rdoc/classes/PhusionPassenger/Railz/RequestHandler.html +155 -0
- data/doc/rdoc/classes/PhusionPassenger/SpawnManager.html +402 -0
- data/doc/rdoc/classes/PhusionPassenger/UnknownError.html +125 -0
- data/doc/rdoc/classes/PhusionPassenger/Utils.html +805 -0
- data/doc/rdoc/classes/PhusionPassenger/VersionNotFound.html +140 -0
- data/doc/rdoc/classes/PhusionPassenger/WSGI.html +89 -0
- data/doc/rdoc/classes/PhusionPassenger/WSGI/ApplicationSpawner.html +188 -0
- data/doc/rdoc/classes/PlatformInfo.html +831 -0
- data/doc/rdoc/classes/RakeExtensions.html +197 -0
- data/doc/rdoc/classes/Signal.html +131 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/DEVELOPERS_TXT.html +255 -0
- data/doc/rdoc/files/README.html +157 -0
- data/doc/rdoc/files/ext/phusion_passenger/native_support_c.html +92 -0
- data/doc/rdoc/files/lib/phusion_passenger/abstract_installer_rb.html +129 -0
- data/doc/rdoc/files/lib/phusion_passenger/abstract_request_handler_rb.html +131 -0
- data/doc/rdoc/files/lib/phusion_passenger/abstract_server_collection_rb.html +126 -0
- data/doc/rdoc/files/lib/phusion_passenger/abstract_server_rb.html +130 -0
- data/doc/rdoc/files/lib/phusion_passenger/admin_tools/control_process_rb.html +130 -0
- data/doc/rdoc/files/lib/phusion_passenger/admin_tools_rb.html +122 -0
- data/doc/rdoc/files/lib/phusion_passenger/application_rb.html +127 -0
- data/doc/rdoc/files/lib/phusion_passenger/console_text_template_rb.html +126 -0
- data/doc/rdoc/files/lib/phusion_passenger/constants_rb.html +122 -0
- data/doc/rdoc/files/lib/phusion_passenger/dependencies_rb.html +134 -0
- data/doc/rdoc/files/lib/phusion_passenger/events_rb.html +122 -0
- data/doc/rdoc/files/lib/phusion_passenger/exceptions_rb.html +122 -0
- data/doc/rdoc/files/lib/phusion_passenger/html_template_rb.html +126 -0
- data/doc/rdoc/files/lib/phusion_passenger/message_channel_rb.html +122 -0
- data/doc/rdoc/files/lib/phusion_passenger/packaging_rb.html +122 -0
- data/doc/rdoc/files/lib/phusion_passenger/platform_info_rb.html +127 -0
- data/doc/rdoc/files/lib/phusion_passenger/rack/application_spawner_rb.html +133 -0
- data/doc/rdoc/files/lib/phusion_passenger/rack/request_handler_rb.html +127 -0
- data/doc/rdoc/files/lib/phusion_passenger/railz/application_spawner_rb.html +143 -0
- data/doc/rdoc/files/lib/phusion_passenger/railz/cgi_fixed_rb.html +126 -0
- data/doc/rdoc/files/lib/phusion_passenger/railz/framework_spawner_rb.html +145 -0
- data/doc/rdoc/files/lib/phusion_passenger/railz/request_handler_rb.html +127 -0
- data/doc/rdoc/files/lib/phusion_passenger/simple_benchmarking_rb.html +122 -0
- data/doc/rdoc/files/lib/phusion_passenger/spawn_manager_rb.html +161 -0
- data/doc/rdoc/files/lib/phusion_passenger/utils_rb.html +175 -0
- data/doc/rdoc/files/lib/phusion_passenger/wsgi/application_spawner_rb.html +129 -0
- data/doc/rdoc/files/misc/rake/extensions_rb.html +130 -0
- data/doc/rdoc/fr_class_index.html +90 -0
- data/doc/rdoc/fr_file_index.html +76 -0
- data/doc/rdoc/fr_method_index.html +200 -0
- data/doc/rdoc/index.html +26 -0
- data/doc/rdoc/rdoc-style.css +187 -0
- data/doc/users_guide_snippets/rackup_specifications.txt +2 -8
- data/ext/apache2/Bucket.cpp +71 -38
- data/ext/apache2/Bucket.h +53 -16
- data/ext/apache2/Configuration.cpp +15 -0
- data/ext/apache2/Configuration.h +19 -2
- data/ext/apache2/DirectoryMapper.h +10 -10
- data/ext/apache2/Hooks.cpp +334 -74
- data/ext/boost/mpl/apply.hpp +5 -1
- data/ext/boost/mpl/apply_wrap.hpp +5 -2
- data/ext/boost/mpl/aux_/full_lambda.hpp +5 -1
- data/ext/boost/mpl/bind.hpp +5 -1
- data/ext/common/Application.h +11 -31
- data/ext/common/ApplicationPool.h +2 -1
- data/ext/common/ApplicationPoolServer.h +61 -20
- data/ext/common/ApplicationPoolServerExecutable.cpp +132 -4
- data/ext/common/ApplicationPoolStatusReporter.h +189 -65
- data/ext/common/Base64.cpp +143 -0
- data/ext/common/Base64.h +57 -0
- data/ext/common/CachedFileStat.cpp +25 -82
- data/ext/common/CachedFileStat.h +11 -125
- data/ext/common/CachedFileStat.hpp +243 -0
- data/ext/common/Exceptions.h +13 -0
- data/ext/common/FileChangeChecker.h +209 -0
- data/ext/common/Logging.h +3 -2
- data/ext/common/MessageChannel.h +10 -10
- data/ext/common/PoolOptions.h +72 -5
- data/ext/common/SpawnManager.h +11 -8
- data/ext/common/StandardApplicationPool.h +38 -39
- data/ext/common/StaticString.h +1 -0
- data/ext/common/StringListCreator.h +83 -0
- data/ext/common/SystemTime.h +3 -2
- data/ext/common/Timer.h +88 -0
- data/ext/common/Utils.cpp +161 -42
- data/ext/common/Utils.h +62 -31
- data/ext/common/Version.h +1 -1
- data/ext/nginx/Configuration.c +0 -4
- data/ext/nginx/ContentHandler.c +8 -6
- data/ext/nginx/HelperServer.cpp +45 -55
- data/ext/nginx/HttpStatusExtractor.h +4 -0
- data/ext/nginx/StaticContentHandler.c +25 -5
- data/ext/nginx/config +3 -0
- data/ext/nginx/ngx_http_passenger_module.c +72 -17
- data/ext/nginx/ngx_http_passenger_module.h +2 -2
- data/lib/phusion_passenger/abstract_request_handler.rb +15 -7
- data/lib/phusion_passenger/abstract_server.rb +16 -2
- data/lib/phusion_passenger/admin_tools/control_process.rb +36 -25
- data/lib/phusion_passenger/constants.rb +1 -1
- data/lib/phusion_passenger/dependencies.rb +10 -0
- data/lib/phusion_passenger/platform_info.rb +1 -1
- data/lib/phusion_passenger/rack/application_spawner.rb +21 -2
- data/lib/phusion_passenger/rack/request_handler.rb +10 -0
- data/lib/phusion_passenger/railz/application_spawner.rb +38 -2
- data/lib/phusion_passenger/railz/framework_spawner.rb +26 -28
- data/lib/phusion_passenger/railz/request_handler.rb +5 -1
- data/lib/phusion_passenger/spawn_manager.rb +6 -2
- data/lib/phusion_passenger/utils.rb +79 -27
- data/misc/rake/cplusplus.rb +5 -5
- data/test/ApplicationPoolServerTest.cpp +42 -0
- data/test/ApplicationPoolTest.cpp +255 -267
- data/test/Base64Test.cpp +48 -0
- data/test/CachedFileStatTest.cpp +243 -103
- data/test/FileChangeCheckerTest.cpp +331 -0
- data/test/PoolOptionsTest.cpp +80 -0
- data/test/UtilsTest.cpp +5 -17
- data/test/integration_tests/apache2_tests.rb +15 -4
- data/test/integration_tests/mycook_spec.rb +3 -4
- data/test/oxt/syscall_interruption_test.cpp +2 -14
- data/test/ruby/abstract_server_collection_spec.rb +1 -1
- data/test/ruby/abstract_server_spec.rb +35 -1
- data/test/ruby/rack/application_spawner_spec.rb +23 -6
- data/test/ruby/rails/application_spawner_spec.rb +6 -6
- data/test/ruby/rails/framework_spawner_spec.rb +6 -5
- data/test/ruby/rails/minimal_spawner_spec.rb +19 -0
- data/test/ruby/rails/spawner_error_handling_spec.rb +62 -7
- data/test/ruby/spawn_manager_spec.rb +10 -7
- data/test/ruby/spawn_server_spec.rb +1 -1
- data/test/ruby/utils_spec.rb +193 -20
- data/test/ruby/wsgi/application_spawner_spec.rb +3 -1
- data/test/stub/apache2/httpd.conf.erb +3 -0
- data/test/stub/rack/config.ru +1 -1
- data/test/stub/rails_apps/mycook/app/controllers/welcome_controller.rb +8 -0
- data/test/support/Support.cpp +84 -0
- data/test/support/Support.h +66 -8
- data/test/support/config.rb +14 -2
- data/test/support/test_helper.rb +5 -0
- data/vendor/rack-1.0.0-git/lib/rack/auth/openid.rb +123 -116
- data/vendor/rack-1.0.0-git/lib/rack/cascade.rb +17 -12
- data/vendor/rack-1.0.0-git/lib/rack/commonlogger.rb +34 -43
- data/vendor/rack-1.0.0-git/lib/rack/handler/cgi.rb +1 -1
- data/vendor/rack-1.0.0-git/lib/rack/handler/fastcgi.rb +1 -1
- data/vendor/rack-1.0.0-git/lib/rack/handler/lsws.rb +1 -1
- data/vendor/rack-1.0.0-git/lib/rack/handler/mongrel.rb +1 -1
- data/vendor/rack-1.0.0-git/lib/rack/handler/scgi.rb +1 -1
- data/vendor/rack-1.0.0-git/lib/rack/handler/webrick.rb +1 -1
- data/vendor/rack-1.0.0-git/lib/rack/mock.rb +4 -17
- data/vendor/rack-1.0.0-git/lib/rack/request.rb +3 -9
- data/vendor/rack-1.0.0-git/lib/rack/rewindable_input.rb +2 -0
- data/vendor/rack-1.0.0-git/lib/rack/utils.rb +38 -12
- metadata +231 -186
- data/ext/common/FileChecker.h +0 -112
- data/test/FileCheckerTest.cpp +0 -79
- data/test/stub/minimal-railsapp/README +0 -3
- data/test/stub/minimal-railsapp/config/application.rb +0 -0
- data/test/stub/minimal-railsapp/config/environment.rb +0 -3
- data/test/stub/minimal-railsapp/vendor/rails/actionmailer/lib/action_mailer.rb +0 -0
- data/test/stub/minimal-railsapp/vendor/rails/actionpack/lib/action_controller.rb +0 -10
- data/test/stub/minimal-railsapp/vendor/rails/actionpack/lib/action_pack.rb +0 -0
- data/test/stub/minimal-railsapp/vendor/rails/actionpack/lib/action_view.rb +0 -0
- data/test/stub/minimal-railsapp/vendor/rails/activerecord/lib/active_record.rb +0 -7
- data/test/stub/minimal-railsapp/vendor/rails/activeresource/lib/active_resource.rb +0 -0
- data/test/stub/minimal-railsapp/vendor/rails/activesupport/lib/active_support.rb +0 -17
- data/test/stub/minimal-railsapp/vendor/rails/activesupport/lib/active_support/whiny_nil.rb +0 -0
- data/test/stub/minimal-railsapp/vendor/rails/railties/lib/dispatcher.rb +0 -0
- data/test/stub/minimal-railsapp/vendor/rails/railties/lib/initializer.rb +0 -8
- data/test/stub/minimal-railsapp/vendor/rails/railties/lib/ruby_version_check.rb +0 -1
- data/test/stub/railsapp/app/controllers/application.rb +0 -12
- data/test/stub/railsapp/app/controllers/bar_controller.rb +0 -5
- data/test/stub/railsapp/app/controllers/bar_controller_1.txt +0 -5
- data/test/stub/railsapp/app/controllers/bar_controller_2.txt +0 -5
- data/test/stub/railsapp/app/controllers/foo_controller.rb +0 -9
- data/test/stub/railsapp/app/helpers/application_helper.rb +0 -3
- data/test/stub/railsapp/config/boot.rb +0 -108
- data/test/stub/railsapp/config/database.yml +0 -19
- data/test/stub/railsapp/config/environment.rb +0 -59
- data/test/stub/railsapp/config/environments/development.rb +0 -18
- data/test/stub/railsapp/config/environments/production.rb +0 -19
- data/test/stub/railsapp/config/initializers/inflections.rb +0 -10
- data/test/stub/railsapp/config/initializers/mime_types.rb +0 -5
- data/test/stub/railsapp/config/routes.rb +0 -35
- data/test/stub/railsapp/public/useless.txt +0 -1
- data/test/stub/railsapp2/app/controllers/application.rb +0 -12
- data/test/stub/railsapp2/app/controllers/foo_controller.rb +0 -5
- data/test/stub/railsapp2/app/helpers/application_helper.rb +0 -3
- data/test/stub/railsapp2/config/boot.rb +0 -108
- data/test/stub/railsapp2/config/database.yml +0 -19
- data/test/stub/railsapp2/config/environment.rb +0 -59
- data/test/stub/railsapp2/config/environments/development.rb +0 -18
- data/test/stub/railsapp2/config/environments/production.rb +0 -19
- data/test/stub/railsapp2/config/initializers/inflections.rb +0 -10
- data/test/stub/railsapp2/config/initializers/mime_types.rb +0 -5
- data/test/stub/railsapp2/config/routes.rb +0 -35
- data/test/stub/railsapp2/public/useless.txt +0 -1
data/doc/Users guide Apache.html
CHANGED
@@ -470,80 +470,21 @@ using the commandline.</p></div>
|
|
470
470
|
<div class="sectionbody">
|
471
471
|
<div class="paragraph"><p>Phusion Passenger works on any POSIX-compliant operating system. In other
|
472
472
|
words: practically any operating system on earth, except Microsoft Windows.</p></div>
|
473
|
-
<div class="paragraph"><p>Phusion Passenger
|
474
|
-
|
475
|
-
|
476
|
-
<p>
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
<li>
|
481
|
-
<p>
|
482
|
-
Ubuntu Linux 7.10 (x86)
|
483
|
-
</p>
|
484
|
-
</li>
|
485
|
-
<li>
|
486
|
-
<p>
|
487
|
-
Ubuntu Linux 8.04 (x86)
|
488
|
-
</p>
|
489
|
-
</li>
|
490
|
-
<li>
|
491
|
-
<p>
|
492
|
-
Debian Sarge (x86)
|
493
|
-
</p>
|
494
|
-
</li>
|
495
|
-
<li>
|
496
|
-
<p>
|
497
|
-
Debian Etch (x86)
|
498
|
-
</p>
|
499
|
-
</li>
|
500
|
-
<li>
|
501
|
-
<p>
|
502
|
-
Debian Lenny/Sid (x86)
|
503
|
-
</p>
|
504
|
-
</li>
|
505
|
-
<li>
|
506
|
-
<p>
|
507
|
-
CentOS 5 (x86)
|
508
|
-
</p>
|
509
|
-
</li>
|
510
|
-
<li>
|
511
|
-
<p>
|
512
|
-
Red Hat Enterprise Linux 5 (x86)
|
513
|
-
</p>
|
514
|
-
</li>
|
515
|
-
<li>
|
516
|
-
<p>
|
517
|
-
Gentoo, March 14 2008 (AMD64)
|
518
|
-
</p>
|
519
|
-
</li>
|
520
|
-
<li>
|
521
|
-
<p>
|
522
|
-
FreeBSD 6.1-RELEASE (x86)
|
523
|
-
</p>
|
524
|
-
</li>
|
525
|
-
<li>
|
526
|
-
<p>
|
527
|
-
MacOS X Tiger (x86)
|
528
|
-
</p>
|
529
|
-
</li>
|
530
|
-
<li>
|
531
|
-
<p>
|
532
|
-
MacOS X Leopard (x86)
|
533
|
-
</p>
|
534
|
-
</li>
|
535
|
-
</ul></div>
|
536
|
-
<div class="paragraph"><p>Other operating systems have not been tested, but Phusion Passenger will probably
|
537
|
-
work fine on them. Please
|
473
|
+
<div class="paragraph"><p>Phusion Passenger is confirmed on a large number of operating systems and Linux
|
474
|
+
distributions, including, but not limited to, Ubuntu, Debian, CentOS/Fedora/RHEL,
|
475
|
+
Gentoo, Mac OS X, FreeBSD and Solaris. Both 32-bit and 64-bit platforms are supported.</p></div>
|
476
|
+
<div class="paragraph"><p>The only POSIX-compliant operating system on which Phusion Passenger for Apache is
|
477
|
+
known not to work at this time, is OpenBSD. Please use Phusion Passenger for Nginx
|
478
|
+
instead.</p></div>
|
479
|
+
<div class="paragraph"><p>If Phusion Passenger does not work on your platform then please
|
538
480
|
<a href="http://code.google.com/p/phusion-passenger/issues/list">report a bug</a>
|
539
481
|
or
|
540
|
-
<a href="http://groups.google.com/group/phusion-passenger">join our discussion list</a>
|
541
|
-
if it doesn’t.</p></div>
|
482
|
+
<a href="http://groups.google.com/group/phusion-passenger">join our discussion list</a>.</p></div>
|
542
483
|
</div>
|
543
|
-
<h2 id="
|
484
|
+
<h2 id="_installing_upgrading_and_uninstalling_phusion_passenger">2. Installing, upgrading and uninstalling Phusion Passenger</h2>
|
544
485
|
<div class="sectionbody">
|
545
486
|
<h3 id="_generic_installation_instructions">2.1. Generic installation instructions</h3>
|
546
|
-
<h4 id="install_passenger">2.1.1. Overview of
|
487
|
+
<h4 id="install_passenger">2.1.1. Overview of installation methods</h4>
|
547
488
|
<div class="paragraph"><p>There are three ways to install Phusion Passenger:</p></div>
|
548
489
|
<div class="olist arabic"><ol class="arabic">
|
549
490
|
<li>
|
@@ -561,41 +502,62 @@ By downloading the source tarball from the Phusion Passenger website
|
|
561
502
|
</li>
|
562
503
|
<li>
|
563
504
|
<p>
|
564
|
-
By
|
565
|
-
Phusion Passenger website.
|
505
|
+
By installing a native Linux package (e.g. Debian package).
|
566
506
|
</p>
|
567
507
|
</li>
|
568
508
|
</ol></div>
|
569
|
-
<div class="paragraph"><p>
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
<
|
574
|
-
<table><tr>
|
575
|
-
<td class="icon">
|
576
|
-
<img src="./images/icons/tip.png" alt="Tip" />
|
577
|
-
</td>
|
578
|
-
<td class="content">You might have to run the installation commands in the following sections
|
579
|
-
as <em>root</em>. If the installer fails because of permission errors, it will tell
|
580
|
-
you.</td>
|
581
|
-
</tr></table>
|
582
|
-
</div>
|
583
|
-
<h4 id="_preparation">2.1.2. Preparation</h4>
|
509
|
+
<div class="paragraph"><p>The following sections will explain each installation method. Please read the
|
510
|
+
section for the installation method that you prefer. In our opinion, installing
|
511
|
+
the gem or the native package is easiest. For these two installation methods,
|
512
|
+
Phusion Passenger provides an easy-to-use installer.</p></div>
|
513
|
+
<h4 id="_preparation_gem_and_source_tarball_only">2.1.2. Preparation (gem and source tarball only)</h4>
|
584
514
|
<div class="paragraph"><p>If you want to install Phusion Passenger via the gem or the source tarball,
|
585
|
-
then some
|
515
|
+
then some preparations might be required. You can skip this subsection if
|
586
516
|
you’re installing Phusion Passenger via a native Linux package, because no
|
587
517
|
compilation is necessary.</p></div>
|
518
|
+
<h5 id="_switching_to_a_root_command_prompt">Switching to a root command prompt</h5>
|
519
|
+
<div class="paragraph"><p>Before installing, you will probably need to switch to the <tt>root</tt> user first.
|
520
|
+
When you install Phusion Passenger via a gem or a source tarball, some Phusion
|
521
|
+
Passenger files have to be compiled, which requires write access to the
|
522
|
+
directory in which the Phusion Passenger files are located. On Unix systems,
|
523
|
+
the root user is the user who has write access to the entire system. So unless
|
524
|
+
you know that your normal user account has write access to the Phusion Passenger
|
525
|
+
directory, you should switch to root before installing Phusion Passenger.</p></div>
|
526
|
+
<div class="paragraph"><p>You can switch to root by typing the following command:</p></div>
|
527
|
+
<div class="listingblock">
|
528
|
+
<div class="content">
|
529
|
+
<pre><tt>sudo -s</tt></pre>
|
530
|
+
</div></div>
|
531
|
+
<div class="paragraph"><p>This will open a command prompt as the root user, from which you can proceed
|
532
|
+
with installing Phusion Passenger.</p></div>
|
533
|
+
<div class="paragraph"><p>If your system does not have <em>sudo</em> installed, please type the following command instead, which should do the same thing:</p></div>
|
534
|
+
<div class="listingblock">
|
535
|
+
<div class="content">
|
536
|
+
<pre><tt>su</tt></pre>
|
537
|
+
</div></div>
|
588
538
|
<h5 id="specifying_correct_apache_install">Specifying the correct Apache installation</h5>
|
589
|
-
<div class="paragraph"><p>
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
539
|
+
<div class="paragraph"><p>The Phusion Passenger installer will attempt to automatically detect Apache,
|
540
|
+
and compile Phusion Passenger against that Apache version. It does this by
|
541
|
+
looking for the <tt>apxs</tt> or <tt>apxs2</tt> command in the PATH environment variable.
|
542
|
+
Apxs is an integral part of any Apache installation.</p></div>
|
543
|
+
<div class="paragraph"><p>However, some systems have multiple Apache installations. This is likely
|
544
|
+
the case on MacOS X: the OS ships with Apache, but users tend to install
|
545
|
+
another Apache version seperately, e.g. via MacPorts. If your system has
|
546
|
+
multiple Apache installations, then you will need to tell the Phusion Passenger
|
547
|
+
installer which one to use. It is very important that you specify the
|
548
|
+
correct Apache installation, because if you load Phusion Passenger in an
|
549
|
+
Apache installation that it wasn’t compiled against, then it will likely
|
550
|
+
crash.</p></div>
|
551
|
+
<div class="paragraph"><p>On yet other systems, Apache is installed in a non-standard location,
|
552
|
+
preventing the Phusion Passenger installer from detecting Apache. This
|
553
|
+
is most likely the case on systems on which Apache was installed by hand
|
554
|
+
from source, i.e. as opposed to installed through the system’s native
|
555
|
+
package manager. If this is the case, then you will also have to tell
|
556
|
+
the installer where it can find Apache.</p></div>
|
557
|
+
<div class="paragraph"><p>To do so, set the <tt>APXS2</tt> environment variable to the full path of the
|
558
|
+
correct <tt>apxs</tt> or <tt>apxs2</tt> command. Suppose that you want to use the Apache
|
559
|
+
installation in <em>/opt/apache2</em>. Then, assuming that the corresponding
|
560
|
+
<tt>apxs</tt> program’s path is <em>/opt/apache2/bin/apxs</em>, type:</p></div>
|
599
561
|
<div class="listingblock">
|
600
562
|
<div class="content">
|
601
563
|
<pre><tt>export APXS2=/opt/apache2/bin/apxs</tt></pre>
|
@@ -609,6 +571,20 @@ environment variable. Suppose that you want to use the Apache installation in
|
|
609
571
|
be located in the <tt>sbin</tt> folder instead of the <tt>bin</tt> folder.</td>
|
610
572
|
</tr></table>
|
611
573
|
</div>
|
574
|
+
<div class="admonitionblock">
|
575
|
+
<table><tr>
|
576
|
+
<td class="icon">
|
577
|
+
<img src="./images/icons/note.png" alt="Note" />
|
578
|
+
</td>
|
579
|
+
<td class="content">
|
580
|
+
<div class="title">Environment variables and <em>sudo</em></div>By default, the <em>sudo</em> command will erase any environment variables that it
|
581
|
+
doesn’t recognize, prior to executing the given command. So if you set APXS2 as a
|
582
|
+
normal user, then run <tt>sudo passenger-install-apache2-module</tt> (which is the command
|
583
|
+
for the Phusion Passenger installer), then the installer will not receive the
|
584
|
+
environment variable value that you set. To solve this problem, please become root
|
585
|
+
prior to setting any environment variables, as described in the previous subsection.</td>
|
586
|
+
</tr></table>
|
587
|
+
</div>
|
612
588
|
<h5 id="specifying_ruby_installation">Specifying the correct Ruby installation</h5>
|
613
589
|
<div class="paragraph"><p>If your system has multiple Ruby installations — which is likely the case on
|
614
590
|
MacOS X, or if you’ve also installed
|
@@ -680,6 +656,14 @@ sudo sh -c 'wget -q -O - http://apt.brightbox.net/release.asc | apt-key add -'
|
|
680
656
|
sudo apt-get update
|
681
657
|
sudo apt-get install libapache2-mod-passenger</tt></pre>
|
682
658
|
</div></div>
|
659
|
+
<h4 id="_what_does_the_installer_do">2.1.6. What does the installer do?</h4>
|
660
|
+
<div class="paragraph"><p>Although we call it an “installer”, it doesn’t actually install anything.
|
661
|
+
The installer checks whether all required dependencies are installed,
|
662
|
+
compiles Phusion Passenger for you, and tells you how to modify the Apache
|
663
|
+
configuration file, but it doesn’t copy any files around.</p></div>
|
664
|
+
<div class="paragraph"><p><tt>passenger-install-apache2-module</tt> is actually just a user-friendly frontend
|
665
|
+
around the command <tt>rake apache2</tt>, which performs the actual compilation of
|
666
|
+
Phusion Passenger.</p></div>
|
683
667
|
<h3 id="_operating_system_specific_instructions_and_information">2.2. Operating system-specific instructions and information</h3>
|
684
668
|
<h4 id="_macos_x">2.2.1. MacOS X</h4>
|
685
669
|
<div class="paragraph"><p>Ben Ruebenstein has written an excellent
|
@@ -690,6 +674,111 @@ on installing Phusion Passenger on OS X</a>.</p></div>
|
|
690
674
|
<h4 id="_opensolaris">2.2.3. OpenSolaris</h4>
|
691
675
|
<div class="paragraph"><p>J Aaron Farr has written a <a href="http://cubiclemuses.com/cm/articles/2009/04/09/rails-passenger-open-solaris-ec2/">guide</a>
|
692
676
|
about setting up Ruby on Rails and Phusion Passenger on OpenSolaris and EC2.</p></div>
|
677
|
+
<h3 id="_upgrading_or_downgrading_phusion_passenger">2.3. Upgrading or downgrading Phusion Passenger</h3>
|
678
|
+
<h4 id="_via_a_gem_or_a_source_tarball">2.3.1. Via a gem or a source tarball</h4>
|
679
|
+
<div class="paragraph"><p>To ugrade or downgrade Phusion Passenger via the gem or the source tarball, install the newer
|
680
|
+
or older version as you normally would; that is, install the gem or unpack the tarball, and
|
681
|
+
run <tt>passenger-install-apache2-module</tt>. Eventually <tt>passenger-install-apache2-module</tt> will tell
|
682
|
+
you to copy & paste some settings into the Apache configuration file; something that looks along
|
683
|
+
the lines of:</p></div>
|
684
|
+
<div class="listingblock">
|
685
|
+
<div class="content">
|
686
|
+
<pre><tt>LoadModule passenger_module ...
|
687
|
+
PassengerRoot ...
|
688
|
+
PassengerRuby ...</tt></pre>
|
689
|
+
</div></div>
|
690
|
+
<div class="paragraph"><p>Because you already have Phusion Passenger installed, you already have the same settings
|
691
|
+
in your Apache configuration file, just with different values. Replace the old settings with
|
692
|
+
the new ones that the installer outputs.</p></div>
|
693
|
+
<div class="paragraph"><p>When you’re done, restart Apache.</p></div>
|
694
|
+
<h4 id="_via_a_native_linux_package">2.3.2. Via a native Linux package</h4>
|
695
|
+
<div class="paragraph"><p>There are no special instructions required to upgrade or downgrade Phusion Passenger
|
696
|
+
via a native Linux package.</p></div>
|
697
|
+
<h3 id="_unloading_disabling_phusion_passenger_from_apache_without_uninstalling_it">2.4. Unloading (disabling) Phusion Passenger from Apache without uninstalling it</h3>
|
698
|
+
<div class="paragraph"><p>You can temporarily unload (disable) Phusion Passenger from Apache, without
|
699
|
+
uninstalling the Phusion Passenger files, so that Apache behaves as if Phusion
|
700
|
+
Passenger was never installed in the first place. This might be useful to you if,
|
701
|
+
for example, you seem to be experiencing a problem caused by Phusion Passenger,
|
702
|
+
but you want to make sure whether that’s actually the case, without having
|
703
|
+
to through the hassle of uninstalling Phusion Passenger completely.</p></div>
|
704
|
+
<div class="paragraph"><p>To unload Phusion Passenger from Apache, edit your Apache configuration file(s)
|
705
|
+
and comment out:</p></div>
|
706
|
+
<div class="ulist"><ul>
|
707
|
+
<li>
|
708
|
+
<p>
|
709
|
+
all Phusion Passenger configuration directives.
|
710
|
+
</p>
|
711
|
+
</li>
|
712
|
+
<li>
|
713
|
+
<p>
|
714
|
+
the <em>LoadModule passenger_module</em> directive.
|
715
|
+
</p>
|
716
|
+
</li>
|
717
|
+
</ul></div>
|
718
|
+
<div class="paragraph"><p>For example, if your configuration file looks like this…</p></div>
|
719
|
+
<div class="listingblock">
|
720
|
+
<div class="content">
|
721
|
+
<pre><tt>Listen *:80
|
722
|
+
NameVirtualHosts *:80
|
723
|
+
....
|
724
|
+
|
725
|
+
LoadModule passenger_module /somewhere/passenger-x.x.x/ext/apache2/mod_passenger.so
|
726
|
+
|
727
|
+
PassengerRuby /usr/bin/ruby
|
728
|
+
PassengerRoot /somewhere/passenger/x.x.x
|
729
|
+
PassengerMaxPoolSize 10
|
730
|
+
|
731
|
+
<VirtualHost *:80>
|
732
|
+
ServerName www.foo.com
|
733
|
+
DocumentRoot /webapps/foo/public
|
734
|
+
RailsBaseURI /rails
|
735
|
+
</VirtualHost></tt></pre>
|
736
|
+
</div></div>
|
737
|
+
<div class="paragraph"><p>…then comment out the relevant directives, so that it looks like this:</p></div>
|
738
|
+
<div class="listingblock">
|
739
|
+
<div class="content">
|
740
|
+
<pre><tt>Listen *:80
|
741
|
+
NameVirtualHosts *:80
|
742
|
+
....
|
743
|
+
|
744
|
+
# LoadModule passenger_module /somewhere/passenger-x.x.x/ext/apache2/mod_passenger.so
|
745
|
+
|
746
|
+
# PassengerRuby /usr/bin/ruby
|
747
|
+
# PassengerRoot /somewhere/passenger/x.x.x
|
748
|
+
# PassengerMaxPoolSize 10
|
749
|
+
|
750
|
+
<VirtualHost *:80>
|
751
|
+
ServerName www.foo.com
|
752
|
+
DocumentRoot /webapps/foo/public
|
753
|
+
# RailsBaseURI /rails
|
754
|
+
</VirtualHost></tt></pre>
|
755
|
+
</div></div>
|
756
|
+
<div class="paragraph"><p>After you’ve done this, save the file and restart Apache.</p></div>
|
757
|
+
<h3 id="_uninstalling_phusion_passenger">2.5. Uninstalling Phusion Passenger</h3>
|
758
|
+
<div class="paragraph"><p>To uninstall Phusion Passenger, please first remove all Phusion Passenger
|
759
|
+
configuration directives from your Apache configuration file(s). After you’ve
|
760
|
+
done this, you need to remove the Phusion Passenger files.</p></div>
|
761
|
+
<div class="ulist"><ul>
|
762
|
+
<li>
|
763
|
+
<p>
|
764
|
+
If you installed Phusion Passenger via a gem, then type <tt>gem uninstall passenger</tt>.
|
765
|
+
You might have to run this as root.
|
766
|
+
</p>
|
767
|
+
</li>
|
768
|
+
<li>
|
769
|
+
<p>
|
770
|
+
If you installed Phusion Passenger via a source tarball, then remove the directory
|
771
|
+
in which you placed the extracted Phusion Passenger files. This directory is the
|
772
|
+
same as the one pointed to the by <em>PassengerRoot</em> configuration directive.
|
773
|
+
</p>
|
774
|
+
</li>
|
775
|
+
<li>
|
776
|
+
<p>
|
777
|
+
If you installed Phusion Passenger via a Debian package, then remove type
|
778
|
+
<tt>sudo apt-get remove libapache2-mod-passenger</tt>.
|
779
|
+
</p>
|
780
|
+
</li>
|
781
|
+
</ul></div>
|
693
782
|
</div>
|
694
783
|
<h2 id="_deploying_a_ruby_on_rails_application">3. Deploying a Ruby on Rails application</h2>
|
695
784
|
<div class="sectionbody">
|
@@ -793,7 +882,7 @@ By restarting Apache.
|
|
793
882
|
<p>
|
794
883
|
By creating or modifying the file <em>tmp/restart.txt</em> in the Rails
|
795
884
|
application’s <a href="#application_root">root folder</a>. Phusion Passenger will
|
796
|
-
automatically restart the application.
|
885
|
+
automatically restart the application during the next request.
|
797
886
|
</p>
|
798
887
|
</li>
|
799
888
|
</ol></div>
|
@@ -803,6 +892,10 @@ command line:</p></div>
|
|
803
892
|
<div class="content">
|
804
893
|
<pre><tt>touch /webapps/mycook/tmp/restart.txt</tt></pre>
|
805
894
|
</div></div>
|
895
|
+
<div class="paragraph"><p>Please note that, unlike earlier versions of Phusion Passenger, <em>restart.txt</em>
|
896
|
+
is not automatically deleted. Phusion Passenger checks whether the timestamp
|
897
|
+
of this file has changed in order to determine whether the application should
|
898
|
+
be restarted.</p></div>
|
806
899
|
<h3 id="_migrations">3.4. Migrations</h3>
|
807
900
|
<div class="paragraph"><p>Phusion Passenger is not related to Ruby on Rails migrations in any way. To
|
808
901
|
run migrations on your deployment server, please login to your deployment
|
@@ -878,7 +971,7 @@ $ some_awesome_editor config.ru
|
|
878
971
|
...type in some source code...
|
879
972
|
$ cat config.ru
|
880
973
|
app = proc do |env|
|
881
|
-
|
974
|
+
[200, { "Content-Type" => "text/html" }, ["hello <b>world</b>"]]
|
882
975
|
end
|
883
976
|
run app</tt></pre>
|
884
977
|
</div></div>
|
@@ -1019,7 +1112,7 @@ run Mack::Utils::Server.build_app</tt></pre>
|
|
1019
1112
|
require 'merb-core'
|
1020
1113
|
|
1021
1114
|
Merb::Config.setup(
|
1022
|
-
:merb_root => File.expand_path(File.dirname(__FILE__)),
|
1115
|
+
:merb_root => ::File.expand_path(::File.dirname(__FILE__)),
|
1023
1116
|
:environment => ENV['RACK_ENV']
|
1024
1117
|
)
|
1025
1118
|
Merb.environment = Merb::Config[:environment]
|
@@ -1043,13 +1136,7 @@ run Ramaze::Adapter::Base</tt></pre>
|
|
1043
1136
|
<div class="content">
|
1044
1137
|
<pre><tt>require 'rubygems'
|
1045
1138
|
require 'sinatra'
|
1046
|
-
|
1047
|
-
root_dir = File.dirname(__FILE__)
|
1048
|
-
|
1049
|
-
set :environment, ENV['RACK_ENV'].to_sym
|
1050
|
-
set :root, root_dir
|
1051
|
-
set :app_file, File.join(root_dir, 'app.rb')
|
1052
|
-
disable :run
|
1139
|
+
require 'app.rb'
|
1053
1140
|
|
1054
1141
|
run Sinatra::Application</tt></pre>
|
1055
1142
|
</div></div>
|
@@ -1330,10 +1417,10 @@ follows:</p></div>
|
|
1330
1417
|
<pre><tt><VirtualHost *:80>
|
1331
1418
|
ServerName www.foo.com
|
1332
1419
|
DocumentRoot /apps/foo/public
|
1333
|
-
<
|
1420
|
+
<Directory /apps/foo/public/wordpress>
|
1334
1421
|
PassengerEnabled off
|
1335
1422
|
AllowOverride all # <-- Makes Wordpress's .htaccess file work.
|
1336
|
-
</
|
1423
|
+
</Directory>
|
1337
1424
|
</VirtualHost></tt></pre>
|
1338
1425
|
</div></div>
|
1339
1426
|
<div class="paragraph"><p>This way, Phusion Passenger will not interfere with Wordpress.</p></div>
|
@@ -1361,10 +1448,10 @@ In <em>.htaccess</em>.
|
|
1361
1448
|
</li>
|
1362
1449
|
</ul></div>
|
1363
1450
|
<div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>on</em>.</p></div>
|
1364
|
-
<h3 id="
|
1451
|
+
<h3 id="PassengerTempDir">5.10. PassengerTempDir <directory></h3>
|
1365
1452
|
<div class="paragraph"><p>Specifies the directory that Phusion Passenger should use for storing temporary
|
1366
|
-
files. This includes things such as Unix socket files, buffered file uploads
|
1367
|
-
etc.</p></div>
|
1453
|
+
files. This includes things such as Unix socket files, buffered file uploads
|
1454
|
+
(see also <a href="#PassengerUploadBufferDir">PassengerUploadBufferDir</a>), etc.</p></div>
|
1368
1455
|
<div class="paragraph"><p>This option may be specified once, in the global server configuration. The
|
1369
1456
|
default temp directory that Phusion Passenger uses is <em>/tmp</em>.</p></div>
|
1370
1457
|
<div class="paragraph"><p>This option is especially useful if Apache is not allowed to write to /tmp
|
@@ -1384,7 +1471,48 @@ environment variable, like this:</p></div>
|
|
1384
1471
|
sudo -E passenger-status
|
1385
1472
|
# The -E option tells 'sudo' to preserve environment variables.</tt></pre>
|
1386
1473
|
</div></div>
|
1387
|
-
<h3 id="
|
1474
|
+
<h3 id="PassengerUploadBufferDir">5.11. PassengerUploadBufferDir <directory></h3>
|
1475
|
+
<div class="paragraph"><p>Phusion Passenger buffers large file uploads to disk in order prevent slow file
|
1476
|
+
uploads from blocking web applications. By default, a subdirectory in the
|
1477
|
+
system’s temporary files directory (or a subdirectory in the directory specified
|
1478
|
+
in <a href="#PassengerTempDir">PassengerTempDir</a>, if set) is automatically created for
|
1479
|
+
storing these buffered file uploads.</p></div>
|
1480
|
+
<div class="paragraph"><p>This configuration directive allows you to specify a different directory for storing
|
1481
|
+
buffered file uploads. If you’ve specified such a directory (as opposed to using
|
1482
|
+
Phusion Passenger’s default) then you <strong>must</strong> ensure that this directory exists.</p></div>
|
1483
|
+
<div class="paragraph"><p>This configuration directive is also useful if you’re using apache2-mpm-itk.
|
1484
|
+
The buffered file upload directory that Phusion Passenger creates by default has
|
1485
|
+
very strict permissions: it can only be accessed by the Apache worker processes.
|
1486
|
+
However, Phusion Passenger assumes that all Apache worker processes are running
|
1487
|
+
as the same user. apache2-mpm-itk breaks this assumption by running multiple
|
1488
|
+
Apache worker processes as different users. So if you’re using apace2-mpm-itk,
|
1489
|
+
you should set this option to a directory that is writable by all Apache worker
|
1490
|
+
processes, such as <em>/tmp</em>.</p></div>
|
1491
|
+
<div class="paragraph"><p>You may specify <em>PassengerUploadBufferDir</em> in the following places:</p></div>
|
1492
|
+
<div class="ulist"><ul>
|
1493
|
+
<li>
|
1494
|
+
<p>
|
1495
|
+
In the global server configuration.
|
1496
|
+
</p>
|
1497
|
+
</li>
|
1498
|
+
<li>
|
1499
|
+
<p>
|
1500
|
+
In a virtual host configuration block.
|
1501
|
+
</p>
|
1502
|
+
</li>
|
1503
|
+
<li>
|
1504
|
+
<p>
|
1505
|
+
In a <tt><Directory></tt> or <tt><Location></tt> block.
|
1506
|
+
</p>
|
1507
|
+
</li>
|
1508
|
+
<li>
|
1509
|
+
<p>
|
1510
|
+
In <em>.htaccess</em>, if <tt>AllowOverrides Options</tt> is enabled.
|
1511
|
+
</p>
|
1512
|
+
</li>
|
1513
|
+
</ul></div>
|
1514
|
+
<div class="paragraph"><p>In each place, it may be specified at most once.</p></div>
|
1515
|
+
<h3 id="_passengerrestartdir_lt_directory_gt">5.12. PassengerRestartDir <directory></h3>
|
1388
1516
|
<div class="paragraph"><p>As described in the deployment chapters of this document, Phusion Passenger
|
1389
1517
|
checks the file <em>tmp/restart.txt</em> in the applications'
|
1390
1518
|
<a href="#application_root">root directory</a> for restarting applications. Sometimes it
|
@@ -1452,8 +1580,8 @@ security flaw which allows an attacker to touch restart.txt, then that will
|
|
1452
1580
|
allow the attacker to cause a Denial-of-Service.</p></div>
|
1453
1581
|
<div class="paragraph"><p>You can prevent this from happening by pointing PassengerRestartDir to a
|
1454
1582
|
directory that’s readable by Apache, but only writable by administrators.</p></div>
|
1455
|
-
<h3 id="_resource_control_and_optimization_options">5.
|
1456
|
-
<h4 id="_passengermaxpoolsize_lt_integer_gt">5.
|
1583
|
+
<h3 id="_resource_control_and_optimization_options">5.13. Resource control and optimization options</h3>
|
1584
|
+
<h4 id="_passengermaxpoolsize_lt_integer_gt">5.13.1. PassengerMaxPoolSize <integer></h4>
|
1457
1585
|
<div class="paragraph"><p>The maximum number of Ruby on Rails or Rack application instances that may
|
1458
1586
|
be simultaneously active. A larger number results in higher memory usage,
|
1459
1587
|
but improved ability to handle concurrent HTTP clients.</p></div>
|
@@ -1478,7 +1606,7 @@ The default value is <em>6</em>.</p></div>
|
|
1478
1606
|
by about 33%. And it’s not hard to install.</td>
|
1479
1607
|
</tr></table>
|
1480
1608
|
</div>
|
1481
|
-
<h4 id="_passengermaxinstancesperapp_lt_integer_gt">5.
|
1609
|
+
<h4 id="_passengermaxinstancesperapp_lt_integer_gt">5.13.2. PassengerMaxInstancesPerApp <integer></h4>
|
1482
1610
|
<div class="paragraph"><p>The maximum number of application instances that may be simultaneously active
|
1483
1611
|
for a single application. This helps to make sure that a single application
|
1484
1612
|
will not occupy all available slots in the application pool.</p></div>
|
@@ -1488,7 +1616,7 @@ may use, i.e. only the global limit of <a href="#PassengerMaxPoolSize">Passenger
|
|
1488
1616
|
will be enforced.</p></div>
|
1489
1617
|
<div class="paragraph"><p>This option may only occur once, in the global server configuration.
|
1490
1618
|
The default value is <em>0</em>.</p></div>
|
1491
|
-
<h4 id="PassengerPoolIdleTime">5.
|
1619
|
+
<h4 id="PassengerPoolIdleTime">5.13.3. PassengerPoolIdleTime <integer></h4>
|
1492
1620
|
<div class="paragraph"><p>The maximum number of seconds that an application instance may be idle. That is,
|
1493
1621
|
if an application instance hasn’t received any traffic after the given number of
|
1494
1622
|
seconds, then it will be shutdown in order to conserve memory.</p></div>
|
@@ -1508,7 +1636,7 @@ recommended if you’re on a non-shared host that’s only running a few
|
|
1508
1636
|
applications, each which must be available at all times.</p></div>
|
1509
1637
|
<div class="paragraph"><p>This option may only occur once, in the global server configuration.
|
1510
1638
|
The default value is <em>300</em>.</p></div>
|
1511
|
-
<h4 id="PassengerMaxRequests">5.
|
1639
|
+
<h4 id="PassengerMaxRequests">5.13.4. PassengerMaxRequests <integer></h4>
|
1512
1640
|
<div class="paragraph"><p>The maximum number of requests an application instance will process. After
|
1513
1641
|
serving that many requests, the application instance will be shut down and
|
1514
1642
|
Phusion Passenger will restart it. A value of 0 means that there is no maximum:
|
@@ -1554,7 +1682,7 @@ measure to avoid memory leaks.</p></div>
|
|
1554
1682
|
</td>
|
1555
1683
|
</tr></table>
|
1556
1684
|
</div>
|
1557
|
-
<h4 id="_passengerstatthrottlerate_lt_integer_gt">5.
|
1685
|
+
<h4 id="_passengerstatthrottlerate_lt_integer_gt">5.13.5. PassengerStatThrottleRate <integer></h4>
|
1558
1686
|
<div class="paragraph"><p>By default, Phusion Passenger performs several filesystem checks (or, in
|
1559
1687
|
programmers jargon, <em>stat() calls</em>) each time a request is processed:</p></div>
|
1560
1688
|
<div class="ulist"><ul>
|
@@ -1604,8 +1732,8 @@ In <em>.htaccess</em>, if <tt>AllowOverride Limits</tt> is on.
|
|
1604
1732
|
</li>
|
1605
1733
|
</ul></div>
|
1606
1734
|
<div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>0</em>.</p></div>
|
1607
|
-
<h3 id="_ruby_on_rails_specific_options">5.
|
1608
|
-
<h4 id="_railsautodetect_lt_on_off_gt">5.
|
1735
|
+
<h3 id="_ruby_on_rails_specific_options">5.14. Ruby on Rails-specific options</h3>
|
1736
|
+
<h4 id="_railsautodetect_lt_on_off_gt">5.14.1. RailsAutoDetect <on|off></h4>
|
1609
1737
|
<div class="paragraph"><p>Whether Phusion Passenger should automatically detect whether a virtual host’s
|
1610
1738
|
document root is a Ruby on Rails application. The default is <em>on</em>.</p></div>
|
1611
1739
|
<div class="paragraph"><p>This option may occur in the global server configuration or in a virtual host
|
@@ -1633,7 +1761,7 @@ application by using the <a href="#RailsBaseURI">RailsBaseURI</a> configuration
|
|
1633
1761
|
RailsBaseURI / # This line has been added.
|
1634
1762
|
</VirtualHost></tt></pre>
|
1635
1763
|
</div></div>
|
1636
|
-
<h4 id="RailsBaseURI">5.
|
1764
|
+
<h4 id="RailsBaseURI">5.14.2. RailsBaseURI <uri></h4>
|
1637
1765
|
<div class="paragraph"><p>Used to specify that the given URI is a Rails application. See
|
1638
1766
|
<a href="#deploying_rails_to_sub_uri">Deploying Rails to a sub URI</a> for an example.</p></div>
|
1639
1767
|
<div class="paragraph"><p>It is allowed to specify this option multiple times. Do this to deploy multiple
|
@@ -1661,7 +1789,7 @@ In <em>.htaccess</em>, if <tt>AllowOverride Options</tt> is on.
|
|
1661
1789
|
</p>
|
1662
1790
|
</li>
|
1663
1791
|
</ul></div>
|
1664
|
-
<h4 id="rails_env">5.
|
1792
|
+
<h4 id="rails_env">5.14.3. RailsEnv <string></h4>
|
1665
1793
|
<div class="paragraph"><p>This option allows one to specify the default <tt>RAILS_ENV</tt> value.</p></div>
|
1666
1794
|
<div class="paragraph"><p>This option may occur in the following places:</p></div>
|
1667
1795
|
<div class="ulist"><ul>
|
@@ -1687,7 +1815,7 @@ In <em>.htaccess</em>, if <tt>AllowOverride Options</tt> is on.
|
|
1687
1815
|
</li>
|
1688
1816
|
</ul></div>
|
1689
1817
|
<div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>production</em>.</p></div>
|
1690
|
-
<h4 id="RailsSpawnMethod">5.
|
1818
|
+
<h4 id="RailsSpawnMethod">5.14.4. RailsSpawnMethod <string></h4>
|
1691
1819
|
<div class="admonitionblock">
|
1692
1820
|
<table><tr>
|
1693
1821
|
<td class="icon">
|
@@ -1780,7 +1908,7 @@ In a virtual host configuration block.
|
|
1780
1908
|
</li>
|
1781
1909
|
</ul></div>
|
1782
1910
|
<div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>smart-lv2</em>.</p></div>
|
1783
|
-
<h4 id="_railsframeworkspawneridletime_lt_integer_gt">5.
|
1911
|
+
<h4 id="_railsframeworkspawneridletime_lt_integer_gt">5.14.5. RailsFrameworkSpawnerIdleTime <integer></h4>
|
1784
1912
|
<div class="paragraph"><p>The FrameworkSpawner server (explained in <a href="#spawning_methods_explained">Spawning methods explained</a>) has an idle timeout, just like the backend processes spawned by
|
1785
1913
|
Phusion Passenger do. That is, it will automatically shutdown if it hasn’t done
|
1786
1914
|
anything for a given period.</p></div>
|
@@ -1807,7 +1935,7 @@ In a virtual host configuration block.
|
|
1807
1935
|
</li>
|
1808
1936
|
</ul></div>
|
1809
1937
|
<div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>1800</em> (30 minutes).</p></div>
|
1810
|
-
<h4 id="_railsappspawneridletime_lt_integer_gt">5.
|
1938
|
+
<h4 id="_railsappspawneridletime_lt_integer_gt">5.14.6. RailsAppSpawnerIdleTime <integer></h4>
|
1811
1939
|
<div class="paragraph"><p>The ApplicationSpawner server (explained in <a href="#spawning_methods_explained">Spawning methods explained</a>) has an idle timeout, just like the backend processes spawned by
|
1812
1940
|
Phusion Passenger do. That is, it will automatically shutdown if it hasn’t done
|
1813
1941
|
anything for a given period.</p></div>
|
@@ -1834,8 +1962,8 @@ In a virtual host configuration block.
|
|
1834
1962
|
</li>
|
1835
1963
|
</ul></div>
|
1836
1964
|
<div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>600</em> (10 minutes).</p></div>
|
1837
|
-
<h3 id="_rack_specific_options">5.
|
1838
|
-
<h4 id="_rackautodetect_lt_on_off_gt">5.
|
1965
|
+
<h3 id="_rack_specific_options">5.15. Rack-specific options</h3>
|
1966
|
+
<h4 id="_rackautodetect_lt_on_off_gt">5.15.1. RackAutoDetect <on|off></h4>
|
1839
1967
|
<div class="paragraph"><p>Whether Phusion Passenger should automatically detect whether a virtual host’s
|
1840
1968
|
document root is a Rack application. The default is <em>on</em>.</p></div>
|
1841
1969
|
<div class="paragraph"><p>This option may occur in the global server configuration or in a virtual host
|
@@ -1863,7 +1991,7 @@ application by using the <a href="#RackBaseURI">RackBaseURI</a> configuration op
|
|
1863
1991
|
RackBaseURI / # This line was added
|
1864
1992
|
</VirtualHost></tt></pre>
|
1865
1993
|
</div></div>
|
1866
|
-
<h4 id="RackBaseURI">5.
|
1994
|
+
<h4 id="RackBaseURI">5.15.2. RackBaseURI <uri></h4>
|
1867
1995
|
<div class="paragraph"><p>Used to specify that the given URI is a Rack application. See
|
1868
1996
|
<a href="#deploying_rack_to_sub_uri">Deploying Rack to a sub URI</a> for an example.</p></div>
|
1869
1997
|
<div class="paragraph"><p>It is allowed to specify this option multiple times. Do this to deploy multiple
|
@@ -1891,7 +2019,7 @@ In <em>.htaccess</em>, if <tt>AllowOverride Options</tt> is on.
|
|
1891
2019
|
</p>
|
1892
2020
|
</li>
|
1893
2021
|
</ul></div>
|
1894
|
-
<h4 id="rack_env">5.
|
2022
|
+
<h4 id="rack_env">5.15.3. RackEnv <string></h4>
|
1895
2023
|
<div class="paragraph"><p>The given value will be accessible in Rack applications in the <tt>RACK_ENV</tt>
|
1896
2024
|
environment variable. This allows one to define the environment in which
|
1897
2025
|
Rack applications are run, very similar to <tt>RAILS_ENV</tt>.</p></div>
|
@@ -1919,16 +2047,16 @@ In <em>.htaccess</em>, if <tt>AllowOverride Options</tt> is on.
|
|
1919
2047
|
</li>
|
1920
2048
|
</ul></div>
|
1921
2049
|
<div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>production</em>.</p></div>
|
1922
|
-
<h3 id="_deprecated_options">5.
|
2050
|
+
<h3 id="_deprecated_options">5.16. Deprecated options</h3>
|
1923
2051
|
<div class="paragraph"><p>The following options have been deprecated, but are still supported for backwards
|
1924
2052
|
compatibility reasons.</p></div>
|
1925
|
-
<h4 id="_railsruby">5.
|
2053
|
+
<h4 id="_railsruby">5.16.1. RailsRuby</h4>
|
1926
2054
|
<div class="paragraph"><p>Deprecated in favor of <a href="#PassengerRuby">PassengerRuby</a>.</p></div>
|
1927
|
-
<h4 id="_railsuserswitching">5.
|
2055
|
+
<h4 id="_railsuserswitching">5.16.2. RailsUserSwitching</h4>
|
1928
2056
|
<div class="paragraph"><p>Deprecated in favor of <a href="#PassengerUserSwitching">PassengerUserSwitching</a>.</p></div>
|
1929
|
-
<h4 id="_railsdefaultuser">5.
|
2057
|
+
<h4 id="_railsdefaultuser">5.16.3. RailsDefaultUser</h4>
|
1930
2058
|
<div class="paragraph"><p>Deprecated in favor of <a href="#PassengerDefaultUser">PassengerDefaultUser</a>.</p></div>
|
1931
|
-
<h4 id="_railsallowmodrewrite">5.
|
2059
|
+
<h4 id="_railsallowmodrewrite">5.16.4. RailsAllowModRewrite</h4>
|
1932
2060
|
<div class="paragraph"><p>This option doesn’t do anything anymore in recent versions of Phusion Passenger.</p></div>
|
1933
2061
|
</div>
|
1934
2062
|
<h2 id="_troubleshooting">6. Troubleshooting</h2>
|
@@ -2742,7 +2870,104 @@ please refer to
|
|
2742
2870
|
try drogus’s <a href="http://github.com/drogus/apache-upload-progress-module/tree/master">
|
2743
2871
|
Apache upload progress module</a> instead.</p></div>
|
2744
2872
|
</div>
|
2745
|
-
<h2 id="
|
2873
|
+
<h2 id="_under_the_hood">9. Under the hood</h2>
|
2874
|
+
<div class="sectionbody">
|
2875
|
+
<div class="paragraph"><p>Phusion Passenger hides a lot of complexity for the end user (i.e. the web server
|
2876
|
+
system administrator), but sometimes it is desirable to know what is going on.
|
2877
|
+
This section describes a few things that Phusion Passenger does under the hood.</p></div>
|
2878
|
+
<h3 id="_static_assets_serving">9.1. Static assets serving</h3>
|
2879
|
+
<div class="paragraph"><p>Phusion Passenger accelerates serving of static files. This means that, if an URI
|
2880
|
+
maps to a file that exists, then Phusion Passenger will let Apache serve that file
|
2881
|
+
directly, without hitting the web application.</p></div>
|
2882
|
+
<div class="paragraph"><p>Phusion Passenger does all this without the need for any mod_rewrite rules. People
|
2883
|
+
who are switching from an old Mongrel-based setup might have mod_rewrite rules such
|
2884
|
+
as these:</p></div>
|
2885
|
+
<div class="listingblock">
|
2886
|
+
<div class="content">
|
2887
|
+
<pre><tt># Check whether this request has a corresponding file; if that
|
2888
|
+
# exists, let Apache serve it, otherwise forward the request to
|
2889
|
+
# Mongrel.
|
2890
|
+
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
|
2891
|
+
RewriteRule ^(.*)$ balancer://mongrel%{REQUEST_URI} [P,QSA,L]</tt></pre>
|
2892
|
+
</div></div>
|
2893
|
+
<div class="paragraph"><p>These kind of mod_rewrite rules are no longer required, and you can safely remove
|
2894
|
+
them.</p></div>
|
2895
|
+
<h3 id="_page_caching_support">9.2. Page caching support</h3>
|
2896
|
+
<div class="paragraph"><p>For each HTTP request, Phusion Passenger will automatically look for a corresponding
|
2897
|
+
page cache file, and serve that if it exists. It does this by appending ".html" to
|
2898
|
+
the filename that the URI normally maps to, and checking whether that file exists.
|
2899
|
+
This check occurs after checking whether the original mapped filename exists (as part
|
2900
|
+
of static asset serving). All this is done without the need for special mod_rewrite
|
2901
|
+
rules.</p></div>
|
2902
|
+
<div class="paragraph"><p>For example, suppose that the browser requests <em>/foo/bar</em>.</p></div>
|
2903
|
+
<div class="olist arabic"><ol class="arabic">
|
2904
|
+
<li>
|
2905
|
+
<p>
|
2906
|
+
Phusion Passenger will first check whether this URI maps to a static file, i.e.
|
2907
|
+
whether the file <em>foo/bar</em> exists in the web application’s <em>public</em> directory.
|
2908
|
+
If it does then Phusion Passenger will serve this file through Apache immediately.
|
2909
|
+
</p>
|
2910
|
+
</li>
|
2911
|
+
<li>
|
2912
|
+
<p>
|
2913
|
+
If that doesn’t exist, then Phusion Passenger will check whether the file
|
2914
|
+
<em>foo/bar.html</em> exists. If it does then Phusion Passenger will serve this file
|
2915
|
+
through Apache immediately.
|
2916
|
+
</p>
|
2917
|
+
</li>
|
2918
|
+
<li>
|
2919
|
+
<p>
|
2920
|
+
If <em>foo/bar.html</em> doesn’t exist either, then Phusion Passenger will forward the
|
2921
|
+
request to the underlying web application.
|
2922
|
+
</p>
|
2923
|
+
</li>
|
2924
|
+
</ol></div>
|
2925
|
+
<div class="paragraph"><p>Note that Phusion Passenger’s page caching support doesn’t work if your web
|
2926
|
+
application uses a non-standard page cache directory, i.e. if it doesn’t cache to
|
2927
|
+
the <em>public</em> directory. In that case you’ll need to use mod_rewrite to serve such
|
2928
|
+
page cache files.</p></div>
|
2929
|
+
<h3 id="_how_phusion_passenger_detects_whether_a_virtual_host_is_a_web_application">9.3. How Phusion Passenger detects whether a virtual host is a web application</h3>
|
2930
|
+
<div class="paragraph"><p>After you’ve read the deployment instructions you might wonder how Phusion Passenger
|
2931
|
+
knows that the DocumentRoot points to a web application that Phusion Passenger is
|
2932
|
+
able to serve, and how it knows what kind of web application it is (e.g. Rails or Rack).</p></div>
|
2933
|
+
<div class="paragraph"><p>Phusion Passenger checks whether the virtual host is a Rails application by checking
|
2934
|
+
whether the following file exists:</p></div>
|
2935
|
+
<div class="listingblock">
|
2936
|
+
<div class="content">
|
2937
|
+
<pre><tt>dirname(DocumentRoot) + "/config/environment.rb"</tt></pre>
|
2938
|
+
</div></div>
|
2939
|
+
<div class="paragraph"><p>If you’re not a programmer and don’t understand the above pseudo-code snippet, it means
|
2940
|
+
that Phusion Passenger will:</p></div>
|
2941
|
+
<div class="olist arabic"><ol class="arabic">
|
2942
|
+
<li>
|
2943
|
+
<p>
|
2944
|
+
Extract the parent directory filename from the value of the DocumentRoot directory.
|
2945
|
+
</p>
|
2946
|
+
</li>
|
2947
|
+
<li>
|
2948
|
+
<p>
|
2949
|
+
Append the text "/config/environment.rb" to the result, and check whether the resulting
|
2950
|
+
filename exists.
|
2951
|
+
</p>
|
2952
|
+
</li>
|
2953
|
+
</ol></div>
|
2954
|
+
<div class="paragraph"><p>So suppose that your document root is <em>/webapps/foo/public</em>. Phusion Passenger will check
|
2955
|
+
whether the file <em>/webapps/foo/config/environment.rb</em> exists.</p></div>
|
2956
|
+
<div class="paragraph"><p>Note that Phusion Passenger does <strong>not</strong> resolve any symlinks in the document root path since
|
2957
|
+
version 2.2.0 — in contrast to versions earlier than 2.2.0, which does resolve symlinks.
|
2958
|
+
So for example, suppose that your DocumentRoot points to <em>/home/www/example.com</em>, which in
|
2959
|
+
turn is a symlink to <em>/webapps/example.com/public</em>. In versions earlier than 2.2.0, Phusion
|
2960
|
+
Passenger will check whether <em>/webapps/example.com/config/environment.rb</em> exists because it
|
2961
|
+
resolves all symlinks. Phusion Passenger 2.2.0 and later however will check for
|
2962
|
+
<em>/home/www/config/environment.rb</em>. This file of course doesn’t exist, and as a result Phusion
|
2963
|
+
Passenger will not activate itself for this virtual host, and you’ll most likely see an Apache
|
2964
|
+
mod_dirindex directory listing.</p></div>
|
2965
|
+
<div class="paragraph"><p>If you’re running into this problem, you can explicitly tell Phusion Passenger what the
|
2966
|
+
correct application root is through the <a href="#PassengerAppRoot">PassengerAppRoot</a> configuration directive.</p></div>
|
2967
|
+
<div class="paragraph"><p>Autodetection of Rack applications happens through the same mechanism, exception that
|
2968
|
+
Phusion Passenger will look for <em>config.ru</em> instead of <em>config/environment.rb</em>.</p></div>
|
2969
|
+
</div>
|
2970
|
+
<h2 id="_appendix_a_about_this_document">10. Appendix A: About this document</h2>
|
2746
2971
|
<div class="sectionbody">
|
2747
2972
|
<div class="paragraph"><p>The text of this document is licensed under the
|
2748
2973
|
<a href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons
|
@@ -2760,9 +2985,9 @@ Attribution-Share Alike 3.0 Unported License</a>.</p></div>
|
|
2760
2985
|
</span></p></div>
|
2761
2986
|
<div class="paragraph"><p>Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.</p></div>
|
2762
2987
|
</div>
|
2763
|
-
<h2 id="_appendix_b_terminology">
|
2988
|
+
<h2 id="_appendix_b_terminology">11. Appendix B: Terminology</h2>
|
2764
2989
|
<div class="sectionbody">
|
2765
|
-
<h3 id="application_root">
|
2990
|
+
<h3 id="application_root">11.1. Application root</h3>
|
2766
2991
|
<div class="paragraph"><p>The root directory of an application that’s served by Phusion Passenger.</p></div>
|
2767
2992
|
<div class="paragraph"><p>In case of Ruby on Rails applications, this is the directory that contains
|
2768
2993
|
<em>Rakefile</em>, <em>app/</em>, <em>config/</em>, <em>public/</em>, etc. In other words, the directory
|
@@ -2820,7 +3045,7 @@ For example, take the following directory structure:</p></div>
|
|
2820
3045
|
+- ...</tt></pre>
|
2821
3046
|
</div></div>
|
2822
3047
|
</div>
|
2823
|
-
<h2 id="spawning_methods_explained">
|
3048
|
+
<h2 id="spawning_methods_explained">12. Appendix C: Spawning methods explained</h2>
|
2824
3049
|
<div class="sectionbody">
|
2825
3050
|
<div class="paragraph"><p>At its core, Phusion Passenger is an HTTP proxy and process manager. It spawns
|
2826
3051
|
Ruby on Rails/Rack/WSGI worker processes (which may also be referred to as
|
@@ -2829,7 +3054,7 @@ processes.</p></div>
|
|
2829
3054
|
<div class="paragraph"><p>While this may sound simple, there’s not just one way to spawn worker processes.
|
2830
3055
|
Let’s go over the different spawning methods. For simplicity’s sake, let’s
|
2831
3056
|
assume that we’re only talking about Ruby on Rails applications.</p></div>
|
2832
|
-
<h3 id="_the_most_straightforward_and_traditional_way_conservative_spawning">
|
3057
|
+
<h3 id="_the_most_straightforward_and_traditional_way_conservative_spawning">12.1. The most straightforward and traditional way: conservative spawning</h3>
|
2833
3058
|
<div class="paragraph"><p>Phusion Passenger could create a new Ruby process, which will then load the
|
2834
3059
|
Rails application along with the entire Rails framework. This process will then
|
2835
3060
|
enter an request handling main loop.</p></div>
|
@@ -2844,7 +3069,7 @@ programmers jargon, mongrel_cluster creates new Ruby processes by forking the
|
|
2844
3069
|
current process and exec()-ing a new Ruby interpreter. Phusion Passenger on the
|
2845
3070
|
other hand creates processes that reuse the already loaded Ruby interpreter. In
|
2846
3071
|
programmers jargon, Phusion Passenger calls fork(), but not exec().</p></div>
|
2847
|
-
<h3 id="_the_smart_spawning_method">
|
3072
|
+
<h3 id="_the_smart_spawning_method">12.2. The smart spawning method</h3>
|
2848
3073
|
<div class="admonitionblock">
|
2849
3074
|
<table><tr>
|
2850
3075
|
<td class="icon">
|
@@ -2867,7 +3092,7 @@ by application and Rails framework code, by utilizing so-called
|
|
2867
3092
|
copy-on-write semantics of the virtual memory system on modern operating
|
2868
3093
|
systems. As a side effect, the startup time is also reduced. This is technique
|
2869
3094
|
is exploited by Phusion Passenger’s <em>smart</em> and <em>smart-lv2</em> spawn methods.</p></div>
|
2870
|
-
<h4 id="_how_it_works">
|
3095
|
+
<h4 id="_how_it_works">12.2.1. How it works</h4>
|
2871
3096
|
<div class="paragraph"><p>When the <em>smart-lv2</em> spawn method is being used, Phusion Passenger will first
|
2872
3097
|
create a so-called <em>ApplicationSpawner server</em> process. This process loads the
|
2873
3098
|
entire Rails application along with the Rails framework, by loading
|
@@ -2917,7 +3142,7 @@ ApplicationSpawner and FrameworkSpawner servers have an idle timeout just
|
|
2917
3142
|
</p>
|
2918
3143
|
</li>
|
2919
3144
|
</ul></div>
|
2920
|
-
<h4 id="_summary_of_benefits">
|
3145
|
+
<h4 id="_summary_of_benefits">12.2.2. Summary of benefits</h4>
|
2921
3146
|
<div class="paragraph"><p>Suppose that Phusion Passenger needs a new worker process for an application
|
2922
3147
|
that uses Rails 2.2.1.</p></div>
|
2923
3148
|
<div class="ulist"><ul>
|
@@ -2951,7 +3176,7 @@ process).</p></div>
|
|
2951
3176
|
assuming that your Ruby interpreter is <a href="#reducing_memory_usage">copy-on-write friendly</a>.</p></div>
|
2952
3177
|
<div class="paragraph"><p>Of course, smart spawning is not without gotchas. But if you understand the
|
2953
3178
|
gotchas you can easily reap the benefits of smart spawning.</p></div>
|
2954
|
-
<h3 id="_smart_spawning_gotcha_1_unintential_file_descriptor_sharing">
|
3179
|
+
<h3 id="_smart_spawning_gotcha_1_unintential_file_descriptor_sharing">12.3. Smart spawning gotcha #1: unintential file descriptor sharing</h3>
|
2955
3180
|
<div class="paragraph"><p>Because worker processes are created by forking from an ApplicationSpawner
|
2956
3181
|
server, it will share all file descriptors that are opened by the
|
2957
3182
|
ApplicationSpawner server. (This is part of the semantics of the Unix
|
@@ -2983,7 +3208,7 @@ http://www.gnu.org/software/src-highlite -->
|
|
2983
3208
|
<div class="paragraph"><p>Note that Phusion Passenger automatically reestablishes the connection to the
|
2984
3209
|
database upon creating a new worker process, which is why you normally do not
|
2985
3210
|
encounter any database issues when using smart spawning mode.</p></div>
|
2986
|
-
<h4 id="_example_1_memcached_connection_sharing_harmful">
|
3211
|
+
<h4 id="_example_1_memcached_connection_sharing_harmful">12.3.1. Example 1: Memcached connection sharing (harmful)</h4>
|
2987
3212
|
<div class="paragraph"><p>Suppose we have a Rails application that connects to a Memcached server in
|
2988
3213
|
<em>environment.rb</em>. This causes the ApplicationSpawner to have a socket connection
|
2989
3214
|
(file descriptor) to the Memcached server, as shown in the following figure:</p></div>
|
@@ -3073,7 +3298,7 @@ http://www.gnu.org/software/src-highlite -->
|
|
3073
3298
|
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
|
3074
3299
|
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
|
3075
3300
|
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
|
3076
|
-
<h4 id="_example_2_log_file_sharing_not_harmful">
|
3301
|
+
<h4 id="_example_2_log_file_sharing_not_harmful">12.3.2. Example 2: Log file sharing (not harmful)</h4>
|
3077
3302
|
<div class="paragraph"><p>There are also cases in which unintential file descriptor sharing is not harmful.
|
3078
3303
|
One such case is log file file descriptor sharing. Even if two processes write
|
3079
3304
|
to the log file at the same time, the worst thing that can happen is that the
|
@@ -3082,7 +3307,7 @@ data in the log file is interleaved.</p></div>
|
|
3082
3307
|
must synchronize write access via an inter-process synchronization mechanism,
|
3083
3308
|
such as file locks. Reopening the log file, like you would have done in the
|
3084
3309
|
Memcached example, doesn’t help.</p></div>
|
3085
|
-
<h3 id="_smart_spawning_gotcha_2_the_need_to_revive_threads">
|
3310
|
+
<h3 id="_smart_spawning_gotcha_2_the_need_to_revive_threads">12.4. Smart spawning gotcha #2: the need to revive threads</h3>
|
3086
3311
|
<div class="paragraph"><p>Another part of the <em>fork()</em> system call’s semantics is the fact that threads
|
3087
3312
|
disappear after a fork call. So if you’ve created any threads in environment.rb,
|
3088
3313
|
then those threads will no longer be running in newly created worker process.
|
@@ -3103,7 +3328,7 @@ http://www.gnu.org/software/src-highlite -->
|
|
3103
3328
|
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
|
3104
3329
|
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
|
3105
3330
|
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
|
3106
|
-
<h3 id="_smart_spawning_gotcha_3_code_load_order">
|
3331
|
+
<h3 id="_smart_spawning_gotcha_3_code_load_order">12.5. Smart spawning gotcha #3: code load order</h3>
|
3107
3332
|
<div class="paragraph"><p>This gotcha is only applicable to the <em>smart</em> spawn method, not the <em>smart-lv2</em>
|
3108
3333
|
spawn method.</p></div>
|
3109
3334
|
<div class="paragraph"><p>If your application expects the Rails framework to be not loaded during the
|
@@ -3122,7 +3347,7 @@ has no effect.</p></div>
|
|
3122
3347
|
</div>
|
3123
3348
|
<div id="footer">
|
3124
3349
|
<div id="footer-text">
|
3125
|
-
Last updated 2009-
|
3350
|
+
Last updated 2009-06-16 23:49:41 CEST
|
3126
3351
|
</div>
|
3127
3352
|
</div>
|
3128
3353
|
</body>
|