passenger 2.1.3 → 2.2.0
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 +2 -0
- data/INSTALL +3 -1
- data/LICENSE +19 -355
- data/NEWS +3 -0
- data/README +11 -4
- data/Rakefile +435 -236
- data/bin/passenger-config +20 -14
- data/bin/passenger-install-apache2-module +67 -201
- data/bin/passenger-install-nginx-module +477 -0
- data/bin/passenger-make-enterprisey +17 -12
- data/bin/passenger-memory-stats +33 -23
- data/bin/passenger-spawn-server +17 -12
- data/bin/passenger-status +18 -13
- data/bin/passenger-stress-test +17 -12
- data/doc/{Users guide.html → Users guide Apache.html } +79 -61
- data/doc/{Users guide.txt → Users guide Apache.txt } +43 -939
- data/doc/Users guide Nginx.html +2276 -0
- data/doc/Users guide Nginx.txt +776 -0
- data/doc/cxxapi/ApplicationPoolServer_8h-source.html +9 -4
- data/doc/cxxapi/ApplicationPool_8h-source.html +9 -4
- data/doc/cxxapi/Application_8h-source.html +26 -21
- data/doc/cxxapi/Bucket_8h-source.html +54 -44
- data/doc/cxxapi/CachedFileStat_8h-source.html +9 -4
- data/doc/cxxapi/Configuration_8h-source.html +357 -339
- data/doc/cxxapi/DirectoryMapper_8h-source.html +294 -280
- data/doc/cxxapi/DummySpawnManager_8h-source.html +9 -4
- data/doc/cxxapi/Exceptions_8h-source.html +9 -4
- data/doc/cxxapi/FileChecker_8h-source.html +9 -4
- data/doc/cxxapi/Hooks_8h-source.html +50 -40
- data/doc/cxxapi/Logging_8h-source.html +9 -4
- data/doc/cxxapi/MessageChannel_8h-source.html +20 -15
- data/doc/cxxapi/PoolOptions_8h-source.html +10 -5
- data/doc/cxxapi/SpawnManager_8h-source.html +9 -4
- data/doc/cxxapi/StandardApplicationPool_8h-source.html +10 -5
- data/doc/cxxapi/SystemTime_8h-source.html +9 -4
- data/doc/cxxapi/Utils_8h-source.html +242 -214
- data/doc/cxxapi/annotated.html +4 -28
- data/doc/cxxapi/classClient-members.html +4 -4
- data/doc/cxxapi/classClient.html +14 -11
- data/doc/cxxapi/classHooks-members.html +4 -5
- data/doc/cxxapi/classHooks.html +26 -24
- data/doc/cxxapi/classPassenger_1_1Application-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1Application.html +40 -37
- data/doc/cxxapi/classPassenger_1_1ApplicationPool-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1ApplicationPool.html +95 -92
- data/doc/cxxapi/classPassenger_1_1ApplicationPoolServer-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1ApplicationPoolServer.html +26 -23
- data/doc/cxxapi/classPassenger_1_1ApplicationPool__inherit__graph.map +1 -1
- data/doc/cxxapi/classPassenger_1_1ApplicationPool__inherit__graph.md5 +1 -1
- data/doc/cxxapi/classPassenger_1_1ApplicationPool__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1Application_1_1Session-members.html +17 -17
- data/doc/cxxapi/classPassenger_1_1Application_1_1Session.html +139 -136
- data/doc/cxxapi/classPassenger_1_1BufferedUpload-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1BufferedUpload.html +13 -10
- data/doc/cxxapi/classPassenger_1_1BusyException-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1BusyException.html +11 -8
- data/doc/cxxapi/classPassenger_1_1ConfigurationException-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1ConfigurationException.html +11 -8
- data/doc/cxxapi/classPassenger_1_1DirectoryMapper-members.html +4 -5
- data/doc/cxxapi/classPassenger_1_1DirectoryMapper.html +45 -43
- data/doc/cxxapi/classPassenger_1_1DummySpawnManager-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1DummySpawnManager.html +13 -10
- data/doc/cxxapi/classPassenger_1_1FileChecker-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1FileChecker.html +22 -19
- data/doc/cxxapi/classPassenger_1_1FileNotFoundException-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1FileNotFoundException.html +12 -9
- data/doc/cxxapi/classPassenger_1_1FileNotFoundException__inherit__graph.map +1 -1
- data/doc/cxxapi/classPassenger_1_1FileNotFoundException__inherit__graph.md5 +1 -1
- data/doc/cxxapi/classPassenger_1_1FileNotFoundException__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1FileSystemException-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1FileSystemException.html +14 -11
- data/doc/cxxapi/classPassenger_1_1FileSystemException__inherit__graph.map +1 -1
- data/doc/cxxapi/classPassenger_1_1FileSystemException__inherit__graph.md5 +1 -1
- data/doc/cxxapi/classPassenger_1_1FileSystemException__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1IOException-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1IOException.html +12 -9
- data/doc/cxxapi/classPassenger_1_1IOException__inherit__graph.map +1 -1
- data/doc/cxxapi/classPassenger_1_1IOException__inherit__graph.md5 +1 -1
- data/doc/cxxapi/classPassenger_1_1IOException__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1MessageChannel-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1MessageChannel.html +228 -225
- data/doc/cxxapi/classPassenger_1_1RuntimeException-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1RuntimeException.html +11 -8
- data/doc/cxxapi/classPassenger_1_1SpawnException-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1SpawnException.html +14 -11
- data/doc/cxxapi/classPassenger_1_1SpawnManager-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1SpawnManager.html +50 -47
- data/doc/cxxapi/classPassenger_1_1StandardApplicationPool-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1StandardApplicationPool.html +73 -70
- data/doc/cxxapi/classPassenger_1_1StandardApplicationPool__inherit__graph.map +1 -1
- data/doc/cxxapi/classPassenger_1_1StandardApplicationPool__inherit__graph.md5 +1 -1
- data/doc/cxxapi/classPassenger_1_1StandardApplicationPool__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1SystemException-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1SystemException.html +17 -14
- data/doc/cxxapi/classPassenger_1_1SystemException__inherit__graph.map +1 -1
- data/doc/cxxapi/classPassenger_1_1SystemException__inherit__graph.md5 +1 -1
- data/doc/cxxapi/classPassenger_1_1SystemException__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1SystemTime-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1SystemTime.html +14 -11
- data/doc/cxxapi/classes.html +35 -0
- data/doc/cxxapi/definitions_8h-source.html +9 -4
- data/doc/cxxapi/doxygen.css +311 -303
- data/doc/cxxapi/files.html +9 -18
- data/doc/cxxapi/functions.html +5 -224
- data/doc/cxxapi/functions_func.html +5 -185
- data/doc/cxxapi/functions_type.html +4 -4
- data/doc/cxxapi/functions_vars.html +4 -4
- data/doc/cxxapi/graph_legend.dot +19 -19
- data/doc/cxxapi/graph_legend.html +5 -5
- data/doc/cxxapi/graph_legend.png +0 -0
- data/doc/cxxapi/group__Configuration.html +11 -13
- data/doc/cxxapi/group__Configuration.png +0 -0
- data/doc/cxxapi/group__Core.html +10 -12
- data/doc/cxxapi/group__Core.png +0 -0
- data/doc/cxxapi/group__Exceptions.html +5 -7
- data/doc/cxxapi/group__Hooks.html +5 -7
- data/doc/cxxapi/group__Hooks.png +0 -0
- data/doc/cxxapi/group__Support.html +5 -624
- data/doc/cxxapi/hierarchy.html +6 -6
- data/doc/cxxapi/inherit__graph__0.map +1 -1
- data/doc/cxxapi/inherit__graph__0.md5 +1 -1
- data/doc/cxxapi/inherit__graph__0.png +0 -0
- data/doc/cxxapi/inherit__graph__1.map +1 -1
- data/doc/cxxapi/inherit__graph__1.md5 +1 -1
- data/doc/cxxapi/inherit__graph__1.png +0 -0
- data/doc/cxxapi/inherit__graph__10.map +1 -1
- data/doc/cxxapi/inherit__graph__10.md5 +1 -1
- data/doc/cxxapi/inherit__graph__10.png +0 -0
- data/doc/cxxapi/inherit__graph__11.map +1 -1
- data/doc/cxxapi/inherit__graph__11.md5 +1 -1
- data/doc/cxxapi/inherit__graph__11.png +0 -0
- data/doc/cxxapi/inherit__graph__12.map +1 -1
- data/doc/cxxapi/inherit__graph__12.md5 +1 -1
- data/doc/cxxapi/inherit__graph__12.png +0 -0
- data/doc/cxxapi/inherit__graph__13.map +1 -2
- data/doc/cxxapi/inherit__graph__13.md5 +1 -1
- data/doc/cxxapi/inherit__graph__13.png +0 -0
- data/doc/cxxapi/inherit__graph__14.map +2 -1
- data/doc/cxxapi/inherit__graph__14.md5 +1 -1
- data/doc/cxxapi/inherit__graph__14.png +0 -0
- data/doc/cxxapi/inherit__graph__15.map +1 -1
- data/doc/cxxapi/inherit__graph__15.md5 +1 -1
- data/doc/cxxapi/inherit__graph__15.png +0 -0
- data/doc/cxxapi/inherit__graph__16.map +1 -1
- data/doc/cxxapi/inherit__graph__16.md5 +1 -1
- data/doc/cxxapi/inherit__graph__16.png +0 -0
- data/doc/cxxapi/inherit__graph__17.map +1 -1
- data/doc/cxxapi/inherit__graph__17.md5 +1 -1
- data/doc/cxxapi/inherit__graph__17.png +0 -0
- data/doc/cxxapi/inherit__graph__18.map +1 -1
- data/doc/cxxapi/inherit__graph__18.md5 +1 -1
- data/doc/cxxapi/inherit__graph__18.png +0 -0
- data/doc/cxxapi/inherit__graph__19.map +1 -1
- data/doc/cxxapi/inherit__graph__19.md5 +1 -1
- data/doc/cxxapi/inherit__graph__19.png +0 -0
- data/doc/cxxapi/inherit__graph__2.map +1 -1
- data/doc/cxxapi/inherit__graph__2.md5 +1 -1
- data/doc/cxxapi/inherit__graph__2.png +0 -0
- data/doc/cxxapi/inherit__graph__20.map +2 -2
- data/doc/cxxapi/inherit__graph__20.md5 +1 -1
- data/doc/cxxapi/inherit__graph__20.png +0 -0
- data/doc/cxxapi/inherit__graph__21.map +1 -1
- data/doc/cxxapi/inherit__graph__21.md5 +1 -1
- data/doc/cxxapi/inherit__graph__21.png +0 -0
- data/doc/cxxapi/inherit__graph__3.map +1 -1
- data/doc/cxxapi/inherit__graph__3.md5 +1 -1
- data/doc/cxxapi/inherit__graph__3.png +0 -0
- data/doc/cxxapi/inherit__graph__4.map +1 -1
- data/doc/cxxapi/inherit__graph__4.md5 +1 -1
- data/doc/cxxapi/inherit__graph__4.png +0 -0
- data/doc/cxxapi/inherit__graph__5.map +1 -2
- data/doc/cxxapi/inherit__graph__5.md5 +1 -1
- data/doc/cxxapi/inherit__graph__5.png +0 -0
- data/doc/cxxapi/inherit__graph__6.map +2 -1
- data/doc/cxxapi/inherit__graph__6.md5 +1 -1
- data/doc/cxxapi/inherit__graph__6.png +0 -0
- data/doc/cxxapi/inherit__graph__7.map +1 -1
- data/doc/cxxapi/inherit__graph__7.md5 +1 -1
- data/doc/cxxapi/inherit__graph__7.png +0 -0
- data/doc/cxxapi/inherit__graph__8.map +1 -1
- data/doc/cxxapi/inherit__graph__8.md5 +1 -1
- data/doc/cxxapi/inherit__graph__8.png +0 -0
- data/doc/cxxapi/inherit__graph__9.map +1 -1
- data/doc/cxxapi/inherit__graph__9.md5 +1 -1
- data/doc/cxxapi/inherit__graph__9.png +0 -0
- data/doc/cxxapi/inherits.html +41 -41
- data/doc/cxxapi/main.html +4 -4
- data/doc/cxxapi/modules.html +4 -5
- data/doc/cxxapi/structPassenger_1_1AnythingToString-members.html +4 -4
- data/doc/cxxapi/structPassenger_1_1AnythingToString.html +13 -10
- data/doc/cxxapi/structPassenger_1_1AnythingToString_3_01vector_3_01string_01_4_01_4-members.html +5 -5
- data/doc/cxxapi/structPassenger_1_1AnythingToString_3_01vector_3_01string_01_4_01_4.html +16 -13
- data/doc/cxxapi/structPassenger_1_1PoolOptions-members.html +4 -4
- data/doc/cxxapi/structPassenger_1_1PoolOptions.html +63 -60
- data/doc/cxxapi/tabs.css +5 -2
- data/doc/cxxapi/tree.html +7 -81
- data/doc/rdoc/classes/ConditionVariable.html +59 -59
- data/doc/rdoc/classes/Exception.html +11 -11
- data/doc/rdoc/classes/GC.html +4 -4
- data/doc/rdoc/classes/IO.html +14 -14
- data/doc/rdoc/classes/PhusionPassenger.html +75 -20
- data/doc/rdoc/classes/PhusionPassenger/AbstractInstaller.html +153 -0
- data/doc/rdoc/classes/PhusionPassenger/AbstractRequestHandler.html +125 -130
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer.html +236 -236
- data/doc/rdoc/classes/PhusionPassenger/AbstractServerCollection.html +213 -213
- data/doc/rdoc/classes/PhusionPassenger/AdminTools.html +28 -28
- data/doc/rdoc/classes/PhusionPassenger/AdminTools/ControlProcess.html +91 -75
- data/doc/rdoc/classes/PhusionPassenger/AppInitError.html +10 -10
- data/doc/rdoc/classes/PhusionPassenger/Application.html +64 -64
- data/doc/rdoc/classes/PhusionPassenger/ConsoleTextTemplate.html +34 -34
- data/doc/rdoc/classes/PhusionPassenger/FrameworkInitError.html +13 -13
- data/doc/rdoc/classes/PhusionPassenger/HTMLTemplate.html +30 -30
- data/doc/rdoc/classes/PhusionPassenger/InitializationError.html +10 -10
- data/doc/rdoc/classes/PhusionPassenger/MessageChannel.html +136 -136
- data/doc/rdoc/classes/PhusionPassenger/NativeSupport.html +24 -24
- data/doc/rdoc/classes/PhusionPassenger/Rack/ApplicationSpawner.html +42 -42
- data/doc/rdoc/classes/PhusionPassenger/Rack/RequestHandler.html +55 -53
- data/doc/rdoc/classes/PhusionPassenger/Railz.html +1 -1
- data/doc/rdoc/classes/PhusionPassenger/Railz/ApplicationSpawner.html +25 -30
- data/doc/rdoc/classes/PhusionPassenger/Railz/CGIFixed.html +23 -23
- data/doc/rdoc/classes/PhusionPassenger/Railz/FrameworkSpawner.html +116 -117
- data/doc/rdoc/classes/PhusionPassenger/Railz/RequestHandler.html +22 -22
- data/doc/rdoc/classes/PhusionPassenger/SpawnManager.html +118 -124
- data/doc/rdoc/classes/PhusionPassenger/UnknownError.html +10 -10
- data/doc/rdoc/classes/PhusionPassenger/Utils.html +354 -354
- data/doc/rdoc/classes/PhusionPassenger/VersionNotFound.html +9 -9
- data/doc/rdoc/classes/PhusionPassenger/WSGI/ApplicationSpawner.html +37 -37
- data/doc/rdoc/classes/PlatformInfo.html +282 -261
- data/doc/rdoc/classes/RakeExtensions.html +7 -7
- data/doc/rdoc/classes/Signal.html +26 -26
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/DEVELOPERS_TXT.html +6 -1
- data/doc/rdoc/files/README.html +15 -6
- data/doc/rdoc/files/ext/phusion_passenger/native_support_c.html +1 -1
- 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 +20 -13
- data/doc/rdoc/files/lib/phusion_passenger/abstract_server_collection_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/abstract_server_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/admin_tools/control_process_rb.html +31 -1
- data/doc/rdoc/files/lib/phusion_passenger/admin_tools_rb.html +31 -1
- data/doc/rdoc/files/lib/phusion_passenger/application_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/console_text_template_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/constants_rb.html +21 -12
- data/doc/rdoc/files/lib/phusion_passenger/dependencies_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/events_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/exceptions_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/html_template_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/message_channel_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/packaging_rb.html +122 -0
- data/doc/rdoc/files/lib/phusion_passenger/platform_info_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/rack/application_spawner_rb.html +22 -12
- data/doc/rdoc/files/lib/phusion_passenger/rack/request_handler_rb.html +21 -12
- data/doc/rdoc/files/lib/phusion_passenger/railz/application_spawner_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/railz/cgi_fixed_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/railz/framework_spawner_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/railz/request_handler_rb.html +21 -12
- data/doc/rdoc/files/lib/phusion_passenger/simple_benchmarking_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/spawn_manager_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/utils_rb.html +27 -21
- data/doc/rdoc/files/lib/phusion_passenger/wsgi/application_spawner_rb.html +21 -12
- data/doc/rdoc/files/misc/rake/extensions_rb.html +21 -12
- data/doc/rdoc/fr_class_index.html +1 -0
- data/doc/rdoc/fr_file_index.html +2 -0
- data/doc/rdoc/fr_method_index.html +116 -112
- data/doc/users_guide_snippets/analysis_and_system_maintenance_tools.txt +144 -0
- data/doc/users_guide_snippets/appendix_a_about.txt +13 -0
- data/doc/users_guide_snippets/appendix_b_terminology.txt +63 -0
- data/doc/users_guide_snippets/appendix_c_spawning_methods.txt +304 -0
- data/doc/users_guide_snippets/global_queueing_explained.txt +78 -0
- data/doc/users_guide_snippets/rackup_specifications.txt +75 -0
- data/doc/users_guide_snippets/rails_spawn_method.txt +48 -0
- data/doc/users_guide_snippets/tips.txt +173 -0
- data/ext/apache2/Bucket.cpp +17 -12
- data/ext/apache2/Bucket.h +17 -12
- data/ext/apache2/Configuration.cpp +17 -12
- data/ext/apache2/Configuration.h +27 -14
- data/ext/apache2/DirectoryMapper.h +21 -12
- data/ext/apache2/Hooks.cpp +67 -21
- data/ext/apache2/Hooks.h +17 -12
- data/ext/apache2/mod_passenger.c +17 -12
- data/ext/{apache2 → common}/Application.h +19 -14
- data/ext/{apache2 → common}/ApplicationPool.h +17 -12
- data/ext/{apache2 → common}/ApplicationPoolServer.h +18 -72
- data/ext/{apache2 → common}/ApplicationPoolServerExecutable.cpp +45 -104
- data/ext/common/ApplicationPoolStatusReporter.h +212 -0
- data/ext/{apache2 → common}/CachedFileStat.cpp +17 -12
- data/ext/{apache2 → common}/CachedFileStat.h +17 -12
- data/ext/{apache2 → common}/DummySpawnManager.h +17 -12
- data/ext/{apache2 → common}/Exceptions.h +17 -12
- data/ext/{apache2 → common}/FileChecker.h +17 -12
- data/ext/common/Logging.cpp +65 -0
- data/ext/{apache2 → common}/Logging.h +17 -12
- data/ext/{apache2 → common}/MessageChannel.h +17 -12
- data/ext/{apache2 → common}/PoolOptions.h +17 -12
- data/ext/{apache2 → common}/SpawnManager.h +17 -12
- data/ext/{apache2 → common}/StandardApplicationPool.h +17 -12
- data/ext/common/StaticString.h +147 -0
- data/ext/common/SystemTime.cpp +33 -0
- data/ext/{apache2 → common}/SystemTime.h +17 -12
- data/ext/{apache2 → common}/Utils.cpp +69 -12
- data/ext/{apache2 → common}/Utils.h +41 -12
- data/ext/nginx/Configuration.c +1091 -0
- data/ext/nginx/Configuration.h +71 -0
- data/ext/nginx/ContentHandler.c +1154 -0
- data/ext/nginx/ContentHandler.h +64 -0
- data/ext/nginx/HelperServer.cpp +857 -0
- data/ext/nginx/HttpStatusExtractor.h +161 -0
- data/ext/nginx/ScgiRequestParser.h +317 -0
- data/ext/nginx/StaticContentHandler.c +222 -0
- data/ext/nginx/StaticContentHandler.h +37 -0
- data/ext/nginx/config +41 -0
- data/ext/nginx/ngx_http_passenger_module.c +572 -0
- data/ext/nginx/ngx_http_passenger_module.h +72 -0
- data/ext/oxt/backtrace.cpp +8 -1
- data/ext/oxt/system_calls.cpp +40 -0
- data/ext/oxt/system_calls.hpp +14 -7
- data/ext/phusion_passenger/extconf.rb +17 -12
- data/ext/phusion_passenger/native_support.c +19 -12
- data/lib/phusion_passenger/abstract_installer.rb +196 -0
- data/lib/phusion_passenger/abstract_request_handler.rb +19 -24
- data/lib/phusion_passenger/abstract_server.rb +17 -12
- data/lib/phusion_passenger/abstract_server_collection.rb +17 -12
- data/lib/phusion_passenger/admin_tools.rb +23 -0
- data/lib/phusion_passenger/admin_tools/control_process.rb +39 -13
- data/lib/phusion_passenger/application.rb +17 -12
- data/lib/phusion_passenger/console_text_template.rb +17 -12
- data/lib/phusion_passenger/constants.rb +22 -11
- data/lib/phusion_passenger/dependencies.rb +47 -12
- data/lib/phusion_passenger/events.rb +17 -12
- data/lib/phusion_passenger/exceptions.rb +17 -12
- data/lib/phusion_passenger/html_template.rb +17 -12
- data/lib/phusion_passenger/message_channel.rb +17 -12
- data/lib/phusion_passenger/packaging.rb +39 -0
- data/lib/phusion_passenger/platform_info.rb +48 -22
- data/lib/phusion_passenger/rack/application_spawner.rb +22 -11
- data/lib/phusion_passenger/rack/request_handler.rb +21 -12
- data/lib/phusion_passenger/railz/application_spawner.rb +23 -23
- data/lib/phusion_passenger/railz/framework_spawner.rb +18 -14
- data/lib/phusion_passenger/railz/request_handler.rb +18 -11
- data/lib/phusion_passenger/simple_benchmarking.rb +17 -12
- data/lib/phusion_passenger/spawn_manager.rb +17 -20
- data/lib/phusion_passenger/templates/{apache_must_be_compiled_with_compatible_mpm.txt.erb → apache2/apache_must_be_compiled_with_compatible_mpm.txt.erb} +0 -0
- data/lib/phusion_passenger/templates/{apache2_config_snippets.txt.erb → apache2/config_snippets.txt.erb} +0 -0
- data/lib/phusion_passenger/templates/{deployment_example.txt.erb → apache2/deployment_example.txt.erb} +0 -0
- data/lib/phusion_passenger/templates/{no_write_permission_to_passenger_root.txt.erb → apache2/no_write_permission_to_passenger_root.txt.erb} +0 -0
- data/lib/phusion_passenger/templates/{possible_solutions_for_compilation_and_installation_problems.txt.erb → apache2/possible_solutions_for_compilation_and_installation_problems.txt.erb} +0 -0
- data/lib/phusion_passenger/templates/{run_installer_as_root.txt.erb → apache2/run_installer_as_root.txt.erb} +0 -0
- data/lib/phusion_passenger/templates/{welcome.txt.erb → apache2/welcome.txt.erb} +0 -0
- data/lib/phusion_passenger/templates/nginx/ask_for_extra_configure_flags.txt.erb +8 -0
- data/lib/phusion_passenger/templates/nginx/cannot_write_to_dir.txt.erb +11 -0
- data/lib/phusion_passenger/templates/nginx/config_snippets.txt.erb +17 -0
- data/lib/phusion_passenger/templates/nginx/config_snippets_inserted.txt.erb +20 -0
- data/lib/phusion_passenger/templates/nginx/confirm_extra_configure_flags.txt.erb +5 -0
- data/lib/phusion_passenger/templates/nginx/deployment_example.txt.erb +22 -0
- data/lib/phusion_passenger/templates/nginx/pcre_could_not_be_downloaded.txt.erb +11 -0
- data/lib/phusion_passenger/templates/nginx/pcre_could_not_be_extracted.txt.erb +11 -0
- data/lib/phusion_passenger/templates/nginx/possible_solutions_for_compilation_and_installation_problems.txt.erb +11 -0
- data/lib/phusion_passenger/templates/nginx/possible_solutions_for_download_and_extraction_problems.txt.erb +20 -0
- data/lib/phusion_passenger/templates/nginx/query_download_and_install.txt.erb +21 -0
- data/lib/phusion_passenger/templates/nginx/run_installer_as_root.txt.erb +8 -0
- data/lib/phusion_passenger/templates/nginx/welcome.txt.erb +15 -0
- data/lib/phusion_passenger/utils.rb +20 -15
- data/lib/phusion_passenger/wsgi/application_spawner.rb +18 -11
- data/lib/phusion_passenger/wsgi/request_handler.py +23 -0
- data/misc/copy_boost_headers.rb +23 -0
- data/misc/find_owner_pipe_leaks.rb +18 -11
- data/misc/rake/cplusplus.rb +18 -11
- data/misc/rake/extensions.rb +21 -14
- data/misc/render_error_pages.rb +18 -11
- data/test/ApplicationPoolServerTest.cpp +1 -3
- data/test/ApplicationPoolServer_ApplicationPoolTest.cpp +1 -1
- data/test/CxxTestMain.cpp +19 -3
- data/test/HttpStatusExtractorTest.cpp +181 -0
- data/test/ScgiRequestParserTest.cpp +337 -0
- data/test/StaticStringTest.cpp +51 -0
- data/test/UtilsTest.cpp +32 -0
- data/test/config.yml.example +5 -0
- data/test/{integration_tests.rb → integration_tests/apache2_tests.rb} +7 -299
- data/test/integration_tests/hello_world_rack_spec.rb +36 -0
- data/test/integration_tests/hello_world_wsgi_spec.rb +41 -0
- data/test/integration_tests/mycook_spec.rb +192 -0
- data/test/integration_tests/nginx_tests.rb +98 -0
- data/test/ruby/rack/application_spawner_spec.rb +40 -0
- data/test/stub/nginx/koi-utf +109 -0
- data/test/stub/nginx/koi-win +103 -0
- data/test/stub/nginx/mime.types +70 -0
- data/test/stub/nginx/nginx.conf.erb +57 -0
- data/test/stub/nginx/win-utf +126 -0
- data/test/stub/rails_apps/mycook/app/controllers/uploads_controller.rb +4 -0
- data/test/stub/rails_apps/mycook/config/routes.rb +1 -1
- data/test/stub/wsgi/passenger_wsgi.pyc +0 -0
- data/test/support/Support.h +40 -0
- data/test/support/nginx_controller.rb +98 -0
- data/test/support/test_helper.rb +79 -0
- metadata +1091 -1028
- data/benchmark/DummyRequestHandler.cpp +0 -101
- data/ext/apache2/Logging.cpp +0 -60
- data/ext/apache2/SystemTime.cpp +0 -28
data/bin/passenger-config
CHANGED
@@ -1,23 +1,30 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# Phusion Passenger - http://www.modrails.com/
|
3
|
-
# Copyright (
|
3
|
+
# Copyright (c) 2008, 2009 Phusion
|
4
4
|
#
|
5
|
-
# Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.
|
5
|
+
# "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
6
6
|
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
# the
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
10
13
|
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
# GNU General Public License for more details.
|
14
|
+
# The above copyright notice and this permission notice shall be included in
|
15
|
+
# all copies or substantial portions of the Software.
|
15
16
|
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
+
# THE SOFTWARE.
|
19
24
|
|
20
25
|
PASSENGER_ROOT = File.expand_path(File.dirname(__FILE__) << "/..")
|
26
|
+
$LOAD_PATH.unshift("#{PASSENGER_ROOT}/lib")
|
27
|
+
require 'phusion_passenger/constants'
|
21
28
|
|
22
29
|
def help
|
23
30
|
puts "Tool for showing Passenger configuration information."
|
@@ -32,8 +39,7 @@ case ARGV[0]
|
|
32
39
|
when "--root"
|
33
40
|
puts PASSENGER_ROOT
|
34
41
|
when "--version"
|
35
|
-
|
36
|
-
puts $1
|
42
|
+
puts PhusionPassenger::VERSION_STRING
|
37
43
|
else
|
38
44
|
help
|
39
45
|
exit 1
|
@@ -1,21 +1,26 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# Phusion Passenger - http://www.modrails.com/
|
3
|
-
# Copyright (
|
3
|
+
# Copyright (c) 2008, 2009 Phusion
|
4
4
|
#
|
5
|
-
# Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.
|
5
|
+
# "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
6
6
|
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
# the
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
10
13
|
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
# GNU General Public License for more details.
|
14
|
+
# The above copyright notice and this permission notice shall be included in
|
15
|
+
# all copies or substantial portions of the Software.
|
15
16
|
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
+
# THE SOFTWARE.
|
19
24
|
|
20
25
|
PASSENGER_ROOT = File.expand_path(File.dirname(__FILE__) << "/..")
|
21
26
|
$LOAD_PATH.unshift("#{PASSENGER_ROOT}/lib")
|
@@ -30,42 +35,46 @@ ENV["PATH"] += ":/usr/sbin:/sbin:/usr/local/sbin"
|
|
30
35
|
require 'optparse'
|
31
36
|
require 'phusion_passenger/platform_info'
|
32
37
|
require 'phusion_passenger/dependencies'
|
33
|
-
require 'phusion_passenger/
|
38
|
+
require 'phusion_passenger/abstract_installer'
|
34
39
|
include PlatformInfo
|
35
40
|
|
36
|
-
class Installer
|
41
|
+
class Installer < PhusionPassenger::AbstractInstaller
|
37
42
|
include PhusionPassenger
|
38
43
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
44
|
+
def dependencies
|
45
|
+
result = [
|
46
|
+
Dependencies::GCC,
|
47
|
+
Dependencies::Ruby_DevHeaders,
|
48
|
+
Dependencies::Ruby_OpenSSL,
|
49
|
+
Dependencies::RubyGems,
|
50
|
+
Dependencies::Rake,
|
51
|
+
Dependencies::Apache2,
|
52
|
+
Dependencies::Apache2_DevHeaders,
|
53
|
+
Dependencies::FastThread
|
54
|
+
]
|
55
|
+
if Dependencies.fastthread_required?
|
56
|
+
result << Dependencies::FastThread
|
57
|
+
end
|
58
|
+
# Some broken servers don't have apr-config or apu-config installed.
|
59
|
+
# Nevertheless, it is possible to compile Apache modules if Apache
|
60
|
+
# was configured with --included-apr. So here we check whether
|
61
|
+
# apr-config and apu-config are available. If they're not available,
|
62
|
+
# then we only register them as required dependency if no Apache
|
63
|
+
# module can be compiled without their presence.
|
64
|
+
if (PlatformInfo.apr_config && PlatformInfo.apu_config) ||
|
65
|
+
PlatformInfo.apr_config_needed_for_building_apache_modules?
|
66
|
+
result << Dependencies::APR_DevHeaders
|
67
|
+
result << Dependencies::APU_DevHeaders
|
68
|
+
end
|
69
|
+
return result
|
53
70
|
end
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
# apr-config and apu-config are available. If they're not available,
|
58
|
-
# then we only register them as required dependency if no Apache
|
59
|
-
# module can be compiled without their presence.
|
60
|
-
if (PlatformInfo.apr_config && PlatformInfo.apu_config) ||
|
61
|
-
PlatformInfo.apr_config_needed_for_building_apache_modules?
|
62
|
-
REQUIRED_DEPENDENCIES << Dependencies::APR_DevHeaders
|
63
|
-
REQUIRED_DEPENDENCIES << Dependencies::APU_DevHeaders
|
71
|
+
|
72
|
+
def users_guide
|
73
|
+
return "#{DOCDIR}/Users guide Apache.html"
|
64
74
|
end
|
65
75
|
|
66
|
-
def
|
67
|
-
|
68
|
-
if natively_packaged?
|
76
|
+
def install!
|
77
|
+
if PhusionPassenger.natively_packaged?
|
69
78
|
check_dependencies || exit(1)
|
70
79
|
show_apache2_config_snippets
|
71
80
|
show_deployment_example
|
@@ -84,75 +93,15 @@ class Installer
|
|
84
93
|
show_possible_solutions_for_compilation_and_installation_problems
|
85
94
|
exit(1)
|
86
95
|
end
|
87
|
-
ensure
|
88
|
-
reset_terminal_colors
|
89
96
|
end
|
90
97
|
|
91
98
|
private
|
92
|
-
def init_terminal_colors
|
93
|
-
STDOUT.write("\e[0m\e[37m\e[40m")
|
94
|
-
STDOUT.flush
|
95
|
-
end
|
96
|
-
|
97
|
-
def reset_terminal_colors
|
98
|
-
STDOUT.write("\e[0m")
|
99
|
-
STDOUT.flush
|
100
|
-
end
|
101
|
-
|
102
99
|
def show_welcome_screen
|
103
|
-
render_template 'welcome', :version =>
|
100
|
+
render_template 'apache2/welcome', :version => VERSION_STRING
|
104
101
|
wait
|
105
102
|
end
|
106
|
-
|
107
|
-
def check_dependencies
|
108
|
-
missing_dependencies = []
|
109
|
-
color_puts "<banner>Checking for required software...</banner>"
|
110
|
-
puts
|
111
|
-
REQUIRED_DEPENDENCIES.each do |dep|
|
112
|
-
color_print " * #{dep.name}... "
|
113
|
-
result = dep.check
|
114
|
-
if result.found?
|
115
|
-
if result.found_at
|
116
|
-
color_puts "<green>found at #{result.found_at}</green>"
|
117
|
-
else
|
118
|
-
color_puts "<green>found</green>"
|
119
|
-
end
|
120
|
-
else
|
121
|
-
color_puts "<red>not found</red>"
|
122
|
-
missing_dependencies << dep
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
if missing_dependencies.empty?
|
127
|
-
return true
|
128
|
-
else
|
129
|
-
puts
|
130
|
-
color_puts "<red>Some required software is not installed.</red>"
|
131
|
-
color_puts "But don't worry, this installer will tell you how to install them.\n"
|
132
|
-
color_puts "<b>Press Enter to continue, or Ctrl-C to abort.</b>"
|
133
|
-
if natively_packaged?
|
134
|
-
wait(10)
|
135
|
-
else
|
136
|
-
wait
|
137
|
-
end
|
138
|
-
|
139
|
-
line
|
140
|
-
color_puts "<banner>Installation instructions for required software</banner>"
|
141
|
-
puts
|
142
|
-
missing_dependencies.each do |dep|
|
143
|
-
print_dependency_installation_instructions(dep)
|
144
|
-
puts
|
145
|
-
end
|
146
|
-
color_puts "If the aforementioned instructions didn't solve your problem, then please take"
|
147
|
-
color_puts "a look at the Users Guide:"
|
148
|
-
puts
|
149
|
-
color_puts " <yellow>#{USERS_GUIDE}</yellow>"
|
150
|
-
return false
|
151
|
-
end
|
152
|
-
end
|
153
103
|
|
154
104
|
def check_whether_apache_uses_compatible_mpm
|
155
|
-
line
|
156
105
|
# 'httpd -V' output is in the form of:
|
157
106
|
#
|
158
107
|
# Server MPM: Prefork # <--- this line is not always available!
|
@@ -172,7 +121,8 @@ private
|
|
172
121
|
end
|
173
122
|
end
|
174
123
|
if mpm != "prefork" && mpm != "worker"
|
175
|
-
|
124
|
+
new_screen
|
125
|
+
render_template 'apache2/apache_must_be_compiled_with_compatible_mpm',
|
176
126
|
:current_mpm => mpm
|
177
127
|
wait
|
178
128
|
end
|
@@ -181,13 +131,13 @@ private
|
|
181
131
|
def check_write_permission_to_passenger_root
|
182
132
|
File.new("__test__.txt", "w").close
|
183
133
|
return true
|
184
|
-
rescue
|
134
|
+
rescue SystemCallError
|
185
135
|
puts
|
186
136
|
line
|
187
137
|
if Process.uid == 0
|
188
|
-
render_template 'no_write_permission_to_passenger_root'
|
138
|
+
render_template 'apache2/no_write_permission_to_passenger_root'
|
189
139
|
else
|
190
|
-
render_template 'run_installer_as_root'
|
140
|
+
render_template 'apache2/run_installer_as_root'
|
191
141
|
end
|
192
142
|
return false
|
193
143
|
ensure
|
@@ -201,26 +151,26 @@ private
|
|
201
151
|
puts "cd #{PASSENGER_ROOT}"
|
202
152
|
if ENV['TRACE']
|
203
153
|
puts "#{RUBY} -S #{PlatformInfo.rake} --trace clean apache2"
|
204
|
-
return
|
154
|
+
return sh(RUBY, "-S", PlatformInfo.rake, "--trace", "clean", "apache2")
|
205
155
|
else
|
206
156
|
puts "#{RUBY} -S #{PlatformInfo.rake} clean apache2"
|
207
|
-
return
|
157
|
+
return sh(RUBY, "-S", PlatformInfo.rake, "clean", "apache2")
|
208
158
|
end
|
209
159
|
end
|
210
160
|
|
211
161
|
def show_apache2_config_snippets
|
212
162
|
puts
|
213
163
|
line
|
214
|
-
if natively_packaged?
|
164
|
+
if PhusionPassenger.natively_packaged?
|
215
165
|
module_location = "#{PASSENGER_ROOT}/lib/phusion_passenger/mod_passenger.so"
|
216
166
|
else
|
217
167
|
module_location = "#{PASSENGER_ROOT}/ext/apache2/mod_passenger.so"
|
218
168
|
end
|
219
|
-
render_template '
|
169
|
+
render_template 'apache2/config_snippets',
|
220
170
|
:module_location => module_location,
|
221
171
|
:passenger_root => PASSENGER_ROOT,
|
222
172
|
:ruby => RUBY
|
223
|
-
if natively_packaged?
|
173
|
+
if PhusionPassenger.natively_packaged?
|
224
174
|
wait(10)
|
225
175
|
else
|
226
176
|
wait
|
@@ -230,102 +180,18 @@ private
|
|
230
180
|
def show_deployment_example
|
231
181
|
puts
|
232
182
|
line
|
233
|
-
render_template 'deployment_example',
|
234
|
-
:users_guide =>
|
183
|
+
render_template 'apache2/deployment_example',
|
184
|
+
:users_guide => users_guide,
|
235
185
|
:phusion_website => PHUSION_WEBSITE,
|
236
186
|
:passenger_website => PASSENGER_WEBSITE
|
237
187
|
end
|
238
188
|
|
239
189
|
def show_possible_solutions_for_compilation_and_installation_problems
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
:users_guide => USERS_GUIDE,
|
190
|
+
new_screen
|
191
|
+
render_template 'apache2/possible_solutions_for_compilation_and_installation_problems',
|
192
|
+
:users_guide => users_guide,
|
244
193
|
:passenger_website => PASSENGER_WEBSITE
|
245
194
|
end
|
246
|
-
|
247
|
-
private
|
248
|
-
def color_print(text)
|
249
|
-
STDOUT.write(ConsoleTextTemplate.new(:text => text).result)
|
250
|
-
STDOUT.flush
|
251
|
-
end
|
252
|
-
|
253
|
-
def color_puts(text)
|
254
|
-
color_print("#{text}\n")
|
255
|
-
end
|
256
|
-
|
257
|
-
def render_template(name, options = {})
|
258
|
-
puts ConsoleTextTemplate.new({ :file => name }, options).result
|
259
|
-
end
|
260
|
-
|
261
|
-
def line
|
262
|
-
puts "--------------------------------------------"
|
263
|
-
end
|
264
|
-
|
265
|
-
def wait(timeout = nil)
|
266
|
-
return if @auto
|
267
|
-
begin
|
268
|
-
if timeout
|
269
|
-
require 'timeout' unless defined?(Timeout)
|
270
|
-
begin
|
271
|
-
Timeout.timeout(timeout) do
|
272
|
-
STDIN.readline
|
273
|
-
end
|
274
|
-
rescue Timeout::Error
|
275
|
-
# Do nothing.
|
276
|
-
end
|
277
|
-
else
|
278
|
-
STDIN.readline
|
279
|
-
end
|
280
|
-
rescue Interrupt
|
281
|
-
exit 2
|
282
|
-
end
|
283
|
-
end
|
284
|
-
|
285
|
-
def print_dependency_installation_instructions(dep)
|
286
|
-
color_puts " * To install <yellow>#{dep.name}</yellow>:"
|
287
|
-
if !dep.install_command.nil?
|
288
|
-
color_puts " Please run <b>#{dep.install_command}</b> as root."
|
289
|
-
elsif !dep.install_instructions.nil?
|
290
|
-
color_puts " " << dep.install_instructions
|
291
|
-
elsif !dep.website.nil?
|
292
|
-
color_puts " Please download it from <b>#{dep.website}</b>"
|
293
|
-
if !dep.website_comments.nil?
|
294
|
-
color_puts " (#{dep.website_comments})"
|
295
|
-
end
|
296
|
-
else
|
297
|
-
color_puts " Search Google."
|
298
|
-
end
|
299
|
-
end
|
300
|
-
|
301
|
-
def natively_packaged?
|
302
|
-
return self.class.natively_packaged?
|
303
|
-
end
|
304
|
-
|
305
|
-
def self.natively_packaged?
|
306
|
-
return File.expand_path(File.dirname(__FILE__)) == "/usr/bin"
|
307
|
-
end
|
308
|
-
|
309
|
-
def self.determine_version
|
310
|
-
if natively_packaged?
|
311
|
-
require 'rbconfig'
|
312
|
-
return File.read("/etc/passenger_version.txt")
|
313
|
-
else
|
314
|
-
File.read("#{PASSENGER_ROOT}/Rakefile") =~ /^PACKAGE_VERSION = "(.*)"$/
|
315
|
-
return $1
|
316
|
-
end
|
317
|
-
end
|
318
|
-
|
319
|
-
def self.determine_users_guide
|
320
|
-
if natively_packaged?
|
321
|
-
return "/usr/share/doc/phusion_passenger/Users guide.html"
|
322
|
-
else
|
323
|
-
return "#{PASSENGER_ROOT}/doc/Users guide.html"
|
324
|
-
end
|
325
|
-
end
|
326
|
-
|
327
|
-
PASSENGER_VERSION = determine_version
|
328
|
-
USERS_GUIDE = determine_users_guide
|
329
195
|
end
|
330
196
|
|
331
197
|
options = {}
|
@@ -349,4 +215,4 @@ rescue OptionParser::ParseError => e
|
|
349
215
|
exit 1
|
350
216
|
end
|
351
217
|
|
352
|
-
Installer.new
|
218
|
+
Installer.new(options).start
|
@@ -0,0 +1,477 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Phusion Passenger - http://www.modrails.com/
|
3
|
+
# Copyright (c) 2009 Phusion
|
4
|
+
#
|
5
|
+
# "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in
|
15
|
+
# all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
+
# THE SOFTWARE.
|
24
|
+
|
25
|
+
PASSENGER_ROOT = File.expand_path(File.dirname(__FILE__) << "/..")
|
26
|
+
$LOAD_PATH.unshift("#{PASSENGER_ROOT}/lib")
|
27
|
+
$LOAD_PATH.unshift("#{PASSENGER_ROOT}/ext")
|
28
|
+
|
29
|
+
require 'optparse'
|
30
|
+
require 'fileutils'
|
31
|
+
require 'phusion_passenger/platform_info'
|
32
|
+
require 'phusion_passenger/dependencies'
|
33
|
+
require 'phusion_passenger/abstract_installer'
|
34
|
+
include PlatformInfo
|
35
|
+
|
36
|
+
class Installer < PhusionPassenger::AbstractInstaller
|
37
|
+
include PhusionPassenger
|
38
|
+
|
39
|
+
NGINX_VERSION = "0.6.36"
|
40
|
+
|
41
|
+
def dependencies
|
42
|
+
return [
|
43
|
+
Dependencies::GCC,
|
44
|
+
Dependencies::Ruby_DevHeaders,
|
45
|
+
Dependencies::Ruby_OpenSSL,
|
46
|
+
Dependencies::RubyGems,
|
47
|
+
Dependencies::Rake,
|
48
|
+
Dependencies::FastThread,
|
49
|
+
Dependencies::Zlib_Dev
|
50
|
+
]
|
51
|
+
end
|
52
|
+
|
53
|
+
def users_guide
|
54
|
+
return "#{DOCDIR}/Users guide Nginx.html"
|
55
|
+
end
|
56
|
+
|
57
|
+
def install!
|
58
|
+
Dir.chdir(PASSENGER_ROOT)
|
59
|
+
show_welcome_screen
|
60
|
+
check_dependencies || exit(1)
|
61
|
+
|
62
|
+
check_write_permission_to_passenger_root || exit(1)
|
63
|
+
|
64
|
+
download_and_install = should_we_download_and_install_nginx_automatically?
|
65
|
+
if pcre_is_installed?
|
66
|
+
@pcre_source_dir = nil
|
67
|
+
else
|
68
|
+
@pcre_source_dir = download_and_extract_pcre
|
69
|
+
end
|
70
|
+
if download_and_install
|
71
|
+
nginx_source_dir = download_and_extract_nginx
|
72
|
+
if nginx_source_dir.nil?
|
73
|
+
show_possible_solutions_for_download_and_extraction_problems
|
74
|
+
exit(1)
|
75
|
+
end
|
76
|
+
nginx_prefix = ask_for_nginx_install_prefix
|
77
|
+
extra_nginx_configure_flags = nil
|
78
|
+
else
|
79
|
+
nginx_source_dir = ask_for_nginx_source_dir
|
80
|
+
nginx_prefix = ask_for_nginx_install_prefix
|
81
|
+
extra_nginx_configure_flags = ask_for_extra_nginx_configure_flags(nginx_prefix)
|
82
|
+
end
|
83
|
+
check_whether_we_can_write_to(nginx_prefix) || exit(1)
|
84
|
+
nginx_config_already_exists_before_installing = nginx_config_exists?(nginx_prefix)
|
85
|
+
compile_passenger_support_files || exit(1)
|
86
|
+
if install_nginx(nginx_source_dir, nginx_prefix, extra_nginx_configure_flags)
|
87
|
+
if nginx_config_already_exists_before_installing
|
88
|
+
show_passenger_config_snippets(nginx_prefix)
|
89
|
+
else
|
90
|
+
insert_passenger_config_snippets(nginx_prefix)
|
91
|
+
end
|
92
|
+
show_deployment_example
|
93
|
+
else
|
94
|
+
show_possible_solutions_for_compilation_and_installation_problems
|
95
|
+
exit(1)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
private
|
100
|
+
def show_welcome_screen
|
101
|
+
render_template 'nginx/welcome', :version => VERSION_STRING
|
102
|
+
wait
|
103
|
+
end
|
104
|
+
|
105
|
+
def check_write_permission_to_passenger_root
|
106
|
+
File.new("__test__.txt", "w").close
|
107
|
+
return true
|
108
|
+
rescue
|
109
|
+
new_screen
|
110
|
+
if Process.uid == 0
|
111
|
+
render_template 'no_write_permission_to_passenger_root'
|
112
|
+
else
|
113
|
+
render_template 'run_installer_as_root'
|
114
|
+
end
|
115
|
+
return false
|
116
|
+
ensure
|
117
|
+
File.unlink("__test__.txt") rescue nil
|
118
|
+
end
|
119
|
+
|
120
|
+
def compile_passenger_support_files
|
121
|
+
new_screen
|
122
|
+
color_puts "<banner>Compiling Passenger support files...</banner>"
|
123
|
+
return sh(RUBY, "-S", PlatformInfo.rake, "clean", "nginx")
|
124
|
+
end
|
125
|
+
|
126
|
+
def should_we_download_and_install_nginx_automatically?
|
127
|
+
new_screen
|
128
|
+
render_template 'nginx/query_download_and_install',
|
129
|
+
:nginx_version => NGINX_VERSION
|
130
|
+
puts
|
131
|
+
|
132
|
+
if @auto_download
|
133
|
+
color_puts "<b>=> Proceeding with choice 1.</b>"
|
134
|
+
return true
|
135
|
+
elsif @nginx_source_dir
|
136
|
+
color_puts "<b>=> Proceeding with choice 2.</b>"
|
137
|
+
return false
|
138
|
+
else
|
139
|
+
choice = prompt("Enter your choice (1 or 2) or press Ctrl-C to abort") do |input|
|
140
|
+
if input == "1" || input == "2"
|
141
|
+
true
|
142
|
+
elsif input.empty?
|
143
|
+
color_puts "<red>No choice has been given.</red>"
|
144
|
+
false
|
145
|
+
else
|
146
|
+
color_puts "<red>'#{input}' is not a valid choice.</red>"
|
147
|
+
false
|
148
|
+
end
|
149
|
+
end
|
150
|
+
return choice == "1"
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
def download_and_extract_pcre
|
155
|
+
new_screen
|
156
|
+
color_puts "<banner>PCRE (required by Nginx) not installed, downloading it...</banner>"
|
157
|
+
|
158
|
+
basename = "pcre-7.8.tar.gz"
|
159
|
+
dirname = "pcre-7.8"
|
160
|
+
url = "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/#{basename}"
|
161
|
+
File.unlink("/tmp/#{basename}") rescue nil
|
162
|
+
FileUtils.rm_rf("/tmp/#{dirname}")
|
163
|
+
|
164
|
+
if download(url, "/tmp/#{basename}")
|
165
|
+
Dir.chdir("/tmp") do
|
166
|
+
color_puts "<banner>Extracting PCRE source tarball...</banner>"
|
167
|
+
if sh("tar", "xzvf", basename)
|
168
|
+
return "/tmp/#{dirname}"
|
169
|
+
else
|
170
|
+
new_screen
|
171
|
+
render_template "nginx/pcre_could_not_be_extracted"
|
172
|
+
wait
|
173
|
+
return nil
|
174
|
+
end
|
175
|
+
end
|
176
|
+
else
|
177
|
+
new_screen
|
178
|
+
render_template "nginx/pcre_could_not_be_downloaded"
|
179
|
+
wait
|
180
|
+
return nil
|
181
|
+
end
|
182
|
+
rescue Interrupt
|
183
|
+
exit 2
|
184
|
+
end
|
185
|
+
|
186
|
+
def download_and_extract_nginx
|
187
|
+
new_screen
|
188
|
+
color_puts "<banner>Downloading Nginx...</banner>"
|
189
|
+
|
190
|
+
basename = "nginx-#{NGINX_VERSION}.tar.gz"
|
191
|
+
url = "http://sysoev.ru/nginx/#{basename}"
|
192
|
+
File.unlink("/tmp/#{basename}") rescue nil
|
193
|
+
FileUtils.rm_rf("/tmp/nginx-#{NGINX_VERSION}")
|
194
|
+
|
195
|
+
if download(url, "/tmp/#{basename}")
|
196
|
+
Dir.chdir("/tmp") do
|
197
|
+
color_puts "<banner>Extracting Nginx source tarball...</banner>"
|
198
|
+
if sh("tar", "xzvf", basename)
|
199
|
+
return "/tmp/nginx-#{NGINX_VERSION}"
|
200
|
+
else
|
201
|
+
return nil
|
202
|
+
end
|
203
|
+
end
|
204
|
+
else
|
205
|
+
return nil
|
206
|
+
end
|
207
|
+
rescue Interrupt
|
208
|
+
exit 2
|
209
|
+
end
|
210
|
+
|
211
|
+
def show_possible_solutions_for_download_and_extraction_problems
|
212
|
+
new_screen
|
213
|
+
render_template "nginx/possible_solutions_for_download_and_extraction_problems"
|
214
|
+
puts
|
215
|
+
end
|
216
|
+
|
217
|
+
def ask_for_nginx_install_prefix
|
218
|
+
new_screen
|
219
|
+
color_puts "<banner>Where do you want to install Nginx to?</banner>"
|
220
|
+
puts
|
221
|
+
if @prefix
|
222
|
+
color_puts "<b>=> #{@prefix}</b>"
|
223
|
+
return @prefix
|
224
|
+
else
|
225
|
+
prefix = prompt("Please specify a prefix directory [/opt/nginx]") do |input|
|
226
|
+
if input.empty? || input =~ %r(/)
|
227
|
+
true
|
228
|
+
else
|
229
|
+
color_puts "<red>Please specify an absolute path.</red>"
|
230
|
+
false
|
231
|
+
end
|
232
|
+
end
|
233
|
+
if prefix.empty?
|
234
|
+
prefix = "/opt/nginx"
|
235
|
+
end
|
236
|
+
return prefix
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
def ask_for_nginx_source_dir
|
241
|
+
new_screen
|
242
|
+
color_puts "<banner>Where is your Nginx source code located?</banner>"
|
243
|
+
puts
|
244
|
+
if @nginx_source_dir
|
245
|
+
color_puts "<b>=> #{@nginx_source_dir}</b>"
|
246
|
+
return @nginx_source_dir
|
247
|
+
else
|
248
|
+
return prompt("Please specify the directory") do |input|
|
249
|
+
if input =~ %r(/)
|
250
|
+
if File.exist?("#{input}/src/core/nginx.c")
|
251
|
+
true
|
252
|
+
else
|
253
|
+
color_puts "<red>'#{input}' does not look like an Nginx source directory.</red>"
|
254
|
+
false
|
255
|
+
end
|
256
|
+
else
|
257
|
+
color_puts "<red>Please specify an absolute path.</red>"
|
258
|
+
false
|
259
|
+
end
|
260
|
+
end
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
def ask_for_extra_nginx_configure_flags(prefix)
|
265
|
+
done = false
|
266
|
+
while !done
|
267
|
+
new_screen
|
268
|
+
render_template 'nginx/ask_for_extra_configure_flags',
|
269
|
+
:command => build_nginx_configure_command(prefix)
|
270
|
+
puts
|
271
|
+
if @extra_configure_flags
|
272
|
+
if @extra_configure_flags == "none"
|
273
|
+
extra_args = ""
|
274
|
+
color_puts "<b>=> No extra configure flags.</b>"
|
275
|
+
else
|
276
|
+
extra_args = @extra_configure_flags
|
277
|
+
color_puts "<b>=> #{extra_args}</b>"
|
278
|
+
end
|
279
|
+
return extra_args
|
280
|
+
else
|
281
|
+
extra_args = prompt "Extra arguments to pass to configure script"
|
282
|
+
|
283
|
+
new_screen
|
284
|
+
render_template 'nginx/confirm_extra_configure_flags',
|
285
|
+
:command => build_nginx_configure_command(prefix, extra_args)
|
286
|
+
puts
|
287
|
+
answer = prompt("Is this what you want? (yes/no) [default=yes]") do |input|
|
288
|
+
if input.empty? || input == "yes" || input == "no"
|
289
|
+
true
|
290
|
+
else
|
291
|
+
color_puts "<red>Please enter 'yes' or 'no'.</red>"
|
292
|
+
false
|
293
|
+
end
|
294
|
+
end
|
295
|
+
done = answer.empty? || answer == "yes"
|
296
|
+
end
|
297
|
+
end
|
298
|
+
return extra_args
|
299
|
+
end
|
300
|
+
|
301
|
+
def check_whether_we_can_write_to(dir)
|
302
|
+
FileUtils.mkdir_p(dir)
|
303
|
+
File.new("#{dir}/__test__.txt", "w").close
|
304
|
+
return true
|
305
|
+
rescue
|
306
|
+
new_screen
|
307
|
+
if Process.uid == 0
|
308
|
+
render_template 'nginx/cannot_write_to_dir', :dir => dir
|
309
|
+
else
|
310
|
+
render_template 'nginx/run_installer_as_root', :dir => dir
|
311
|
+
end
|
312
|
+
return false
|
313
|
+
ensure
|
314
|
+
File.unlink("#{dir}/__test__.txt") rescue nil
|
315
|
+
end
|
316
|
+
|
317
|
+
def nginx_config_exists?(prefix)
|
318
|
+
return !!locate_nginx_config_file(prefix)
|
319
|
+
end
|
320
|
+
|
321
|
+
def install_nginx(source_dir, prefix, extra_configure_flags)
|
322
|
+
Dir.chdir(source_dir) do
|
323
|
+
new_screen
|
324
|
+
color_puts "<banner>Compiling and installing Nginx...</banner>"
|
325
|
+
if !sh(build_nginx_configure_command(prefix, extra_configure_flags)) ||
|
326
|
+
!sh("make") ||
|
327
|
+
!sh("make install")
|
328
|
+
return false
|
329
|
+
end
|
330
|
+
end
|
331
|
+
return true
|
332
|
+
end
|
333
|
+
|
334
|
+
def show_passenger_config_snippets(prefix)
|
335
|
+
new_screen
|
336
|
+
render_template 'nginx/config_snippets',
|
337
|
+
:config_file => locate_nginx_config_file(prefix),
|
338
|
+
:passenger_root => PASSENGER_ROOT,
|
339
|
+
:ruby => RUBY
|
340
|
+
wait
|
341
|
+
end
|
342
|
+
|
343
|
+
def show_deployment_example
|
344
|
+
line
|
345
|
+
puts
|
346
|
+
render_template 'nginx/deployment_example',
|
347
|
+
:users_guide => users_guide,
|
348
|
+
:phusion_website => PHUSION_WEBSITE,
|
349
|
+
:passenger_website => PASSENGER_WEBSITE
|
350
|
+
end
|
351
|
+
|
352
|
+
def show_possible_solutions_for_compilation_and_installation_problems
|
353
|
+
line
|
354
|
+
puts
|
355
|
+
render_template 'nginx/possible_solutions_for_compilation_and_installation_problems',
|
356
|
+
:users_guide => users_guide,
|
357
|
+
:passenger_website => PASSENGER_WEBSITE
|
358
|
+
end
|
359
|
+
|
360
|
+
def locate_nginx_config_file(prefix)
|
361
|
+
["#{prefix}/conf/nginx.conf", "#{prefix}/etc/nginx.conf"].each do |filename|
|
362
|
+
if File.exist?(filename)
|
363
|
+
return filename
|
364
|
+
end
|
365
|
+
end
|
366
|
+
return nil
|
367
|
+
end
|
368
|
+
|
369
|
+
def insert_passenger_config_snippets(prefix)
|
370
|
+
config_file = locate_nginx_config_file(prefix)
|
371
|
+
contents = File.read(config_file)
|
372
|
+
contents.sub!(/^http \{/,
|
373
|
+
"http {\n" <<
|
374
|
+
" passenger_root #{PASSENGER_ROOT};\n" <<
|
375
|
+
" passenger_ruby #{RUBY};\n")
|
376
|
+
File.open(config_file, 'w') do |f|
|
377
|
+
f.write(contents)
|
378
|
+
end
|
379
|
+
|
380
|
+
new_screen
|
381
|
+
render_template 'nginx/config_snippets_inserted',
|
382
|
+
:config_file => config_file,
|
383
|
+
:passenger_root => PASSENGER_ROOT,
|
384
|
+
:ruby => RUBY
|
385
|
+
wait
|
386
|
+
end
|
387
|
+
|
388
|
+
def build_nginx_configure_command(prefix, extra_configure_flags = nil)
|
389
|
+
command = "./configure --prefix='#{prefix}' "
|
390
|
+
if @pcre_source_dir
|
391
|
+
command << "--with-pcre='#{@pcre_source_dir}' "
|
392
|
+
else
|
393
|
+
command << "--without-http_rewrite_module "
|
394
|
+
end
|
395
|
+
command << "--add-module='#{PASSENGER_ROOT}/ext/nginx' #{extra_configure_flags}"
|
396
|
+
command.strip!
|
397
|
+
return command
|
398
|
+
end
|
399
|
+
|
400
|
+
def pcre_is_installed?
|
401
|
+
if @pcre_is_installed.nil?
|
402
|
+
@pcre_is_installed = begin
|
403
|
+
File.open('/tmp/passenger-check.c', 'w') do |f|
|
404
|
+
f.puts("#include <pcre.h>")
|
405
|
+
end
|
406
|
+
Dir.chdir('/tmp') do
|
407
|
+
system("(gcc -c passenger-check.c) >/dev/null 2>/dev/null")
|
408
|
+
end
|
409
|
+
ensure
|
410
|
+
File.unlink('/tmp/passenger-check.c') rescue nil
|
411
|
+
File.unlink('/tmp/passenger-check.o') rescue nil
|
412
|
+
end
|
413
|
+
end
|
414
|
+
return @pcre_is_installed
|
415
|
+
end
|
416
|
+
|
417
|
+
def download(url, output)
|
418
|
+
if PlatformInfo.find_command("wget")
|
419
|
+
return sh("wget", "-O", output, url)
|
420
|
+
else
|
421
|
+
return sh("curl", url, "-o", output)
|
422
|
+
end
|
423
|
+
end
|
424
|
+
end
|
425
|
+
|
426
|
+
options = {}
|
427
|
+
parser = OptionParser.new do |opts|
|
428
|
+
opts.banner = "Usage: passenger-install-nginx-module [options]"
|
429
|
+
opts.separator ""
|
430
|
+
|
431
|
+
opts.separator "Options:"
|
432
|
+
opts.on("--auto", "Automatically confirm 'Press ENTER to\n" <<
|
433
|
+
"#{' ' * 37}continue' prompts.") do
|
434
|
+
options[:auto] = true
|
435
|
+
end
|
436
|
+
opts.on("--prefix=DIR", String, "Use the given Nginx install prefix instead\n" <<
|
437
|
+
"#{' ' * 37}of asking for it interactively.") do |dir|
|
438
|
+
options[:prefix] = dir
|
439
|
+
end
|
440
|
+
opts.on("--auto-download", "Download and install Nginx automatically,\n" <<
|
441
|
+
"#{' ' * 37}instead of asking interactively whether to\n" <<
|
442
|
+
"#{' ' * 37}download+install or to use an existing\n" <<
|
443
|
+
"#{' ' * 37}Nginx source directory.") do
|
444
|
+
options[:auto_download] = true
|
445
|
+
end
|
446
|
+
opts.on("--nginx-source-dir=DIR", String, "Compile and install Nginx using the given\n" <<
|
447
|
+
"#{' ' * 37}Nginx source directory, instead of\n" <<
|
448
|
+
"#{' ' * 37}interactively asking to download+install\n" <<
|
449
|
+
"#{' ' * 37}or to use an existing Nginx source\n" <<
|
450
|
+
"#{' ' * 37}directory. Conflicts with --auto-download.") do |dir|
|
451
|
+
options[:nginx_source_dir] = dir
|
452
|
+
end
|
453
|
+
opts.on("--extra-configure-flags=STRING", String, "Pass these extra flags to Nginx's\n" <<
|
454
|
+
"#{' ' * 37}'configure' script, instead of asking for\n" <<
|
455
|
+
"#{' ' * 37}it interactively. Only applicable if\n" <<
|
456
|
+
"#{' ' * 37}--nginx-source-dir is given. Specify\n" <<
|
457
|
+
"#{' ' * 37}'none' if you do not want to pass\n" <<
|
458
|
+
"#{' ' * 37}additional flags but do not want this\n" <<
|
459
|
+
"#{' ' * 37}installer to ask interactively either.") do |flags|
|
460
|
+
options[:extra_configure_flags] = flags
|
461
|
+
end
|
462
|
+
end
|
463
|
+
begin
|
464
|
+
parser.parse!
|
465
|
+
rescue OptionParser::ParseError => e
|
466
|
+
puts e
|
467
|
+
puts
|
468
|
+
puts "Please see '--help' for valid options."
|
469
|
+
exit 1
|
470
|
+
end
|
471
|
+
|
472
|
+
if options[:auto_download] && options[:nginx_source_dir]
|
473
|
+
STDERR.puts "You cannot specify both --auto-download and --nginx-source-dir."
|
474
|
+
exit 1
|
475
|
+
end
|
476
|
+
|
477
|
+
Installer.new(options).start
|