passenger 4.0.30 → 4.0.31
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.tar.gz.asc +7 -7
- data/NEWS +31 -0
- data/bin/passenger +5 -5
- data/bin/passenger-config +6 -126
- data/bin/passenger-install-apache2-module +108 -26
- data/bin/passenger-install-nginx-module +81 -27
- data/bin/passenger-memory-stats +7 -6
- data/bin/passenger-status +13 -10
- data/build/agents.rb +8 -12
- data/build/apache2.rb +12 -7
- data/build/basics.rb +28 -20
- data/build/common_library.rb +4 -4
- data/build/cplusplus_support.rb +4 -4
- data/build/cxx_tests.rb +5 -3
- data/build/debian.rb +1 -2
- data/build/integration_tests.rb +25 -9
- data/build/misc.rb +2 -2
- data/build/oxt_tests.rb +5 -6
- data/build/packaging.rb +72 -40
- data/build/ruby_tests.rb +5 -1
- data/build/test_basics.rb +1 -2
- data/debian.template/locations.ini.template +1 -0
- data/debian.template/rules.template +2 -1
- data/dev/install_scripts_bootstrap_code.rb +42 -0
- data/dev/run_travis.sh +1 -0
- data/dev/runner +27 -0
- data/doc/Packaging.txt.md +5 -10
- data/doc/Users guide Apache.idmap.txt +3 -1
- data/doc/Users guide Apache.txt +5 -3
- data/doc/Users guide Nginx.idmap.txt +9 -5
- data/doc/Users guide Nginx.txt +47 -17
- data/doc/users_guide_snippets/environment_variables.txt +2 -2
- data/doc/users_guide_snippets/installation.txt +6 -2
- data/doc/users_guide_snippets/tips.txt +4 -0
- data/ext/apache2/Hooks.cpp +16 -3
- data/ext/common/Account.h +6 -5
- data/ext/common/AgentsStarter.h +1 -1
- data/ext/common/ApplicationPool2/Common.h +72 -0
- data/ext/common/ApplicationPool2/Group.h +263 -148
- data/ext/common/ApplicationPool2/Implementation.cpp +66 -44
- data/ext/common/ApplicationPool2/Options.h +1 -7
- data/ext/common/ApplicationPool2/Pool.h +96 -72
- data/ext/common/ApplicationPool2/Process.h +12 -17
- data/ext/common/ApplicationPool2/Socket.h +4 -4
- data/ext/common/ApplicationPool2/SuperGroup.h +20 -17
- data/ext/common/Constants.h +15 -1
- data/ext/common/MessageServer.h +22 -0
- data/ext/common/Utils.cpp +4 -1
- data/ext/common/Utils.h +3 -1
- data/ext/common/Utils/StrIntUtils.h +1 -0
- data/ext/common/Utils/Timer.h +15 -1
- data/ext/common/Utils/utf8/checked.h +0 -0
- data/ext/common/Utils/utf8/core.h +0 -0
- data/ext/common/Utils/utf8/unchecked.h +0 -0
- data/ext/common/agents/Base.cpp +59 -35
- data/ext/common/agents/HelperAgent/Main.cpp +23 -12
- data/ext/common/agents/HelperAgent/RequestHandler.h +10 -1
- data/ext/common/agents/LoggingAgent/FilterSupport.h +9 -5
- data/ext/common/agents/TempDirToucher.c +12 -3
- data/ext/common/agents/Watchdog/Main.cpp +8 -2
- data/ext/nginx/ConfigurationCommands.c +10 -0
- data/ext/nginx/ConfigurationFields.h +2 -0
- data/ext/nginx/ContentHandler.c +32 -19
- data/ext/nginx/CreateLocationConfig.c +5 -0
- data/ext/nginx/MergeLocationConfig.c +6 -0
- data/ext/nginx/config +13 -6
- data/ext/ruby/passenger_native_support.c +61 -2
- data/helper-scripts/classic-rails-loader.rb +9 -10
- data/helper-scripts/classic-rails-preloader.rb +10 -11
- data/helper-scripts/node-loader.js +3 -2
- data/helper-scripts/rack-loader.rb +8 -9
- data/helper-scripts/rack-preloader.rb +9 -10
- data/lib/phusion_passenger.rb +36 -7
- data/lib/phusion_passenger/abstract_installer.rb +16 -15
- data/lib/phusion_passenger/active_support3_extensions/init.rb +1 -1
- data/lib/phusion_passenger/admin_tools/memory_stats.rb +2 -2
- data/lib/phusion_passenger/admin_tools/server_instance.rb +5 -5
- data/lib/phusion_passenger/analytics_logger.rb +3 -3
- data/lib/phusion_passenger/classic_rails/thread_handler_extension.rb +1 -1
- data/lib/phusion_passenger/config.rb +125 -0
- data/lib/phusion_passenger/config/about_command.rb +183 -0
- data/lib/phusion_passenger/config/command.rb +57 -0
- data/lib/phusion_passenger/config/restart_app_command.rb +146 -0
- data/lib/phusion_passenger/config/utils.rb +108 -0
- data/lib/phusion_passenger/console_text_template.rb +2 -1
- data/lib/phusion_passenger/constants.rb +7 -2
- data/lib/phusion_passenger/loader_shared_helpers.rb +12 -21
- data/lib/phusion_passenger/message_client.rb +15 -4
- data/lib/phusion_passenger/native_support.rb +116 -98
- data/lib/phusion_passenger/nginx/config_options.rb +5 -0
- data/lib/phusion_passenger/platform_info.rb +1 -1
- data/lib/phusion_passenger/platform_info/apache.rb +9 -5
- data/lib/phusion_passenger/platform_info/apache_detector.rb +5 -6
- data/lib/phusion_passenger/platform_info/binary_compatibility.rb +3 -3
- data/lib/phusion_passenger/platform_info/compiler.rb +29 -11
- data/lib/phusion_passenger/platform_info/curl.rb +1 -1
- data/lib/phusion_passenger/platform_info/cxx_portability.rb +30 -16
- data/lib/phusion_passenger/platform_info/depcheck.rb +6 -6
- data/lib/phusion_passenger/platform_info/linux.rb +2 -2
- data/lib/phusion_passenger/platform_info/operating_system.rb +25 -5
- data/lib/phusion_passenger/platform_info/ruby.rb +7 -4
- data/lib/phusion_passenger/platform_info/zlib.rb +1 -1
- data/lib/phusion_passenger/plugin.rb +0 -1
- data/lib/phusion_passenger/preloader_shared_helpers.rb +1 -1
- data/lib/phusion_passenger/public_api.rb +1 -1
- data/lib/phusion_passenger/rack/thread_handler_extension.rb +1 -1
- data/lib/phusion_passenger/request_handler.rb +8 -9
- data/lib/phusion_passenger/request_handler/thread_handler.rb +21 -9
- data/lib/phusion_passenger/ruby_core_enhancements.rb +1 -1
- data/lib/phusion_passenger/standalone/app_finder.rb +2 -2
- data/lib/phusion_passenger/standalone/command.rb +10 -8
- data/lib/phusion_passenger/standalone/help_command.rb +1 -1
- data/lib/phusion_passenger/standalone/main.rb +3 -3
- data/lib/phusion_passenger/standalone/package_runtime_command.rb +2 -2
- data/lib/phusion_passenger/standalone/runtime_installer.rb +55 -13
- data/lib/phusion_passenger/standalone/runtime_locator.rb +3 -3
- data/lib/phusion_passenger/standalone/start_command.rb +6 -7
- data/lib/phusion_passenger/standalone/status_command.rb +1 -1
- data/lib/phusion_passenger/standalone/stop_command.rb +1 -1
- data/lib/phusion_passenger/standalone/utils.rb +1 -1
- data/lib/phusion_passenger/standalone/version_command.rb +2 -3
- data/lib/phusion_passenger/utils.rb +1 -1
- data/lib/phusion_passenger/utils/download.rb +1 -2
- data/lib/phusion_passenger/utils/file_system_watcher.rb +1 -1
- data/lib/phusion_passenger/utils/hosts_file_parser.rb +1 -1
- data/lib/phusion_passenger/utils/tee_input.rb +1 -1
- data/lib/phusion_passenger/utils/terminal_choice_menu.rb +217 -0
- data/lib/phusion_passenger/utils/unseekable_socket.rb +1 -1
- data/resources/templates/apache2/config_snippets.txt.erb +2 -3
- data/resources/templates/apache2/deployment_example.txt.erb +2 -2
- data/resources/templates/apache2/notify_apache_module_installed.txt.erb +3 -0
- data/resources/templates/nginx/config_snippets.txt.erb +1 -1
- data/resources/templates/nginx/deployment_example.txt.erb +2 -2
- data/resources/templates/nginx/nginx_module_sources_not_available.txt.erb +11 -5
- data/rpm/Vagrantfile +1 -0
- data/test/cxx/ApplicationPool2/PoolTest.cpp +224 -35
- data/test/cxx/ApplicationPool2/ProcessTest.cpp +6 -6
- data/test/cxx/MessagePassingTest.cpp +1 -1
- data/test/cxx/RequestHandlerTest.cpp +26 -26
- data/test/integration_tests/apache2_tests.rb +162 -243
- data/test/integration_tests/native_packaging_spec.rb +10 -10
- data/test/integration_tests/nginx_tests.rb +87 -107
- data/test/integration_tests/shared/example_webapp_tests.rb +246 -0
- data/test/integration_tests/source_packaging_test.rb +2 -1
- data/test/integration_tests/standalone_tests.rb +34 -19
- data/test/ruby/admin_tools_spec.rb +4 -4
- data/test/ruby/analytics_logger_spec.rb +1 -1
- data/test/ruby/debug_logging_spec.rb +2 -2
- data/test/ruby/message_channel_spec.rb +1 -1
- data/test/ruby/request_handler_spec.rb +171 -64
- data/test/ruby/shared/loader_sharedspec.rb +5 -5
- data/test/ruby/shared/rails/analytics_logging_extensions_sharedspec.rb +2 -2
- data/test/ruby/spec_helper.rb +4 -4
- data/test/ruby/standalone/runtime_installer_spec.rb +1 -1
- data/test/ruby/standalone/runtime_locator_spec.rb +1 -1
- data/test/ruby/utils/file_system_watcher_spec.rb +1 -1
- data/test/ruby/utils/hosts_file_parser.rb +1 -1
- data/test/ruby/utils/unseekable_socket_spec.rb +1 -1
- data/test/ruby/utils_spec.rb +4 -4
- data/test/stub/apache2/httpd.conf.erb +5 -0
- data/test/stub/index.html +1 -0
- data/test/stub/rack/config.ru +80 -33
- data/test/stub/{rails_apps/1.2/empty/app/models → rack/public}/.gitignore +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/Rakefile +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/controllers/application_controller.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/controllers/recipes_controller.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/controllers/uploads_controller.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/controllers/welcome_controller.rb +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/app/helpers/application_helper.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/helpers/recipes_helper.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/helpers/test_helper.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/helpers/uploads_helper.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/helpers/welcome_helper.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/layouts/default.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/recipes/create.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/recipes/index.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/recipes/new.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/uploads/index.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/uploads/new.html.erb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/welcome/cached.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/welcome/index.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/boot.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/database.yml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/environment.rb +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/config/environments/development.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/environments/production.rb +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/config/initializers/inflections.rb +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/config/initializers/mime_types.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/routes.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/log/useless.txt +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/.htaccess +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/public/404.html +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/public/422.html +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/public/500.html +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/dispatch.cgi +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/dispatch.fcgi +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/dispatch.rb +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/public/favicon.ico +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/images/angrywizard.gif +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/images/cookbook.gif +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/images/header.png +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/public/images/rails.png +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/public/robots.txt +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/uploads.html +0 -0
- data/test/stub/{rails_apps/1.2/empty/db → rails2.3-mycook/public/uploads}/.gitignore +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/welcome/cached.html +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/about +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/console +0 -0
- data/test/stub/{rails_apps/2.2/empty → rails2.3-mycook}/script/dbconsole +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/destroy +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/generate +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/performance/benchmarker +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/performance/profiler +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/performance/request +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/plugin +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/process/inspector +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/process/reaper +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/process/spawner +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/runner +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/server +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/sites/some.site/public/uploads.html +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/sites/some.site/public/welcome/cached.html +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/tmp/cache/useless.txt +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/tmp/pids/useless.txt +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/tmp/sessions/useless.txt +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/tmp/sockets/useless.txt +0 -0
- data/test/stub/rails2.3/app/controllers/foo_controller.rb +1 -1
- data/test/stub/rails2.3/config/routes.rb +1 -2
- data/test/stub/wsgi/passenger_wsgi.py +47 -8
- data/test/stub/{rails_apps/1.2/empty/public/stylesheets → wsgi/public}/.gitignore +0 -0
- data/test/support/apache2_controller.rb +2 -2
- data/test/support/nginx_controller.rb +11 -5
- data/test/support/placebo-preloader.rb +2 -2
- data/test/support/test_helper.rb +26 -7
- metadata +78 -240
- metadata.gz.asc +7 -7
- data/debian.template/repack.sh +0 -42
- data/debian.template/watch +0 -3
- data/test/integration_tests/cgi_environment_spec.rb +0 -36
- data/test/integration_tests/hello_world_rack_spec.rb +0 -43
- data/test/integration_tests/hello_world_wsgi_spec.rb +0 -41
- data/test/integration_tests/mycook_spec.rb +0 -166
- data/test/stub/rack/public/rack.jpg +0 -0
- data/test/stub/rails_apps/1.2/empty/.gitignore +0 -3
- data/test/stub/rails_apps/1.2/empty/app/controllers/application.rb +0 -7
- data/test/stub/rails_apps/1.2/empty/config/boot.rb +0 -108
- data/test/stub/rails_apps/1.2/empty/config/database.yml +0 -31
- data/test/stub/rails_apps/1.2/empty/config/environment.rb +0 -66
- data/test/stub/rails_apps/1.2/empty/config/environments/development.rb +0 -21
- data/test/stub/rails_apps/1.2/empty/config/environments/production.rb +0 -18
- data/test/stub/rails_apps/1.2/empty/config/environments/staging.rb +0 -18
- data/test/stub/rails_apps/1.2/empty/config/environments/test.rb +0 -19
- data/test/stub/rails_apps/1.2/empty/config/routes.rb +0 -23
- data/test/stub/rails_apps/1.2/empty/doc/README_FOR_APP +0 -2
- data/test/stub/rails_apps/1.2/empty/public/.htaccess +0 -40
- data/test/stub/rails_apps/1.2/empty/public/500.html +0 -30
- data/test/stub/rails_apps/1.2/empty/public/dispatch.cgi +0 -10
- data/test/stub/rails_apps/1.2/empty/public/dispatch.fcgi +0 -24
- data/test/stub/rails_apps/1.2/empty/public/dispatch.rb +0 -10
- data/test/stub/rails_apps/1.2/empty/public/robots.txt +0 -1
- data/test/stub/rails_apps/1.2/empty/script/about +0 -3
- data/test/stub/rails_apps/1.2/empty/script/breakpointer +0 -3
- data/test/stub/rails_apps/1.2/empty/script/console +0 -3
- data/test/stub/rails_apps/1.2/empty/script/destroy +0 -3
- data/test/stub/rails_apps/1.2/empty/script/generate +0 -3
- data/test/stub/rails_apps/1.2/empty/script/plugin +0 -3
- data/test/stub/rails_apps/1.2/empty/script/runner +0 -3
- data/test/stub/rails_apps/1.2/empty/script/server +0 -3
- data/test/stub/rails_apps/1.2/empty/test/test_helper.rb +0 -28
- data/test/stub/rails_apps/2.0/empty/.gitignore +0 -3
- data/test/stub/rails_apps/2.0/empty/Rakefile +0 -10
- data/test/stub/rails_apps/2.0/empty/app/controllers/application.rb +0 -10
- data/test/stub/rails_apps/2.0/empty/app/helpers/application_helper.rb +0 -3
- data/test/stub/rails_apps/2.0/empty/app/models/.gitignore +0 -0
- data/test/stub/rails_apps/2.0/empty/config/boot.rb +0 -108
- data/test/stub/rails_apps/2.0/empty/config/database.yml +0 -31
- data/test/stub/rails_apps/2.0/empty/config/environment.rb +0 -59
- data/test/stub/rails_apps/2.0/empty/config/environments/production.rb +0 -18
- data/test/stub/rails_apps/2.0/empty/config/environments/staging.rb +0 -18
- data/test/stub/rails_apps/2.0/empty/config/environments/test.rb +0 -22
- data/test/stub/rails_apps/2.0/empty/config/routes.rb +0 -35
- data/test/stub/rails_apps/2.0/empty/db/.gitignore +0 -0
- data/test/stub/rails_apps/2.0/empty/doc/README_FOR_APP +0 -2
- data/test/stub/rails_apps/2.0/empty/public/.htaccess +0 -40
- data/test/stub/rails_apps/2.0/empty/public/404.html +0 -30
- data/test/stub/rails_apps/2.0/empty/public/dispatch.cgi +0 -10
- data/test/stub/rails_apps/2.0/empty/public/dispatch.fcgi +0 -24
- data/test/stub/rails_apps/2.0/empty/public/dispatch.rb +0 -10
- data/test/stub/rails_apps/2.0/empty/public/favicon.ico +0 -0
- data/test/stub/rails_apps/2.0/empty/public/images/rails.png +0 -0
- data/test/stub/rails_apps/2.0/empty/public/stylesheets/.gitignore +0 -0
- data/test/stub/rails_apps/2.0/empty/script/performance/benchmarker +0 -3
- data/test/stub/rails_apps/2.0/empty/script/performance/profiler +0 -3
- data/test/stub/rails_apps/2.0/empty/script/process/inspector +0 -3
- data/test/stub/rails_apps/2.0/empty/script/process/reaper +0 -3
- data/test/stub/rails_apps/2.0/empty/script/process/spawner +0 -3
- data/test/stub/rails_apps/2.0/empty/test/test_helper.rb +0 -38
- data/test/stub/rails_apps/2.2/empty/.gitignore +0 -3
- data/test/stub/rails_apps/2.2/empty/Rakefile +0 -10
- data/test/stub/rails_apps/2.2/empty/app/controllers/application.rb +0 -15
- data/test/stub/rails_apps/2.2/empty/app/helpers/application_helper.rb +0 -3
- data/test/stub/rails_apps/2.2/empty/app/models/.gitignore +0 -0
- data/test/stub/rails_apps/2.2/empty/config/boot.rb +0 -109
- data/test/stub/rails_apps/2.2/empty/config/database.yml +0 -31
- data/test/stub/rails_apps/2.2/empty/config/environment.rb +0 -75
- data/test/stub/rails_apps/2.2/empty/config/environments/development.rb +0 -17
- data/test/stub/rails_apps/2.2/empty/config/environments/production.rb +0 -24
- data/test/stub/rails_apps/2.2/empty/config/environments/staging.rb +0 -24
- data/test/stub/rails_apps/2.2/empty/config/environments/test.rb +0 -22
- data/test/stub/rails_apps/2.2/empty/config/initializers/inflections.rb +0 -10
- data/test/stub/rails_apps/2.2/empty/config/initializers/mime_types.rb +0 -5
- data/test/stub/rails_apps/2.2/empty/config/initializers/new_rails_defaults.rb +0 -17
- data/test/stub/rails_apps/2.2/empty/config/locales/en.yml +0 -5
- data/test/stub/rails_apps/2.2/empty/config/routes.rb +0 -43
- data/test/stub/rails_apps/2.2/empty/db/.gitignore +0 -0
- data/test/stub/rails_apps/2.2/empty/doc/README_FOR_APP +0 -5
- data/test/stub/rails_apps/2.2/empty/public/404.html +0 -30
- data/test/stub/rails_apps/2.2/empty/public/422.html +0 -30
- data/test/stub/rails_apps/2.2/empty/public/500.html +0 -33
- data/test/stub/rails_apps/2.2/empty/public/dispatch.cgi +0 -10
- data/test/stub/rails_apps/2.2/empty/public/dispatch.fcgi +0 -24
- data/test/stub/rails_apps/2.2/empty/public/dispatch.rb +0 -10
- data/test/stub/rails_apps/2.2/empty/public/favicon.ico +0 -0
- data/test/stub/rails_apps/2.2/empty/public/images/rails.png +0 -0
- data/test/stub/rails_apps/2.2/empty/public/robots.txt +0 -5
- data/test/stub/rails_apps/2.2/empty/public/stylesheets/.gitignore +0 -0
- data/test/stub/rails_apps/2.2/empty/script/about +0 -4
- data/test/stub/rails_apps/2.2/empty/script/console +0 -3
- data/test/stub/rails_apps/2.2/empty/script/destroy +0 -3
- data/test/stub/rails_apps/2.2/empty/script/generate +0 -3
- data/test/stub/rails_apps/2.2/empty/script/performance/benchmarker +0 -3
- data/test/stub/rails_apps/2.2/empty/script/performance/profiler +0 -3
- data/test/stub/rails_apps/2.2/empty/script/performance/request +0 -3
- data/test/stub/rails_apps/2.2/empty/script/plugin +0 -3
- data/test/stub/rails_apps/2.2/empty/script/process/inspector +0 -3
- data/test/stub/rails_apps/2.2/empty/script/process/reaper +0 -3
- data/test/stub/rails_apps/2.2/empty/script/process/spawner +0 -3
- data/test/stub/rails_apps/2.2/empty/script/runner +0 -3
- data/test/stub/rails_apps/2.2/empty/script/server +0 -3
- data/test/stub/rails_apps/2.2/empty/test/performance/browsing_test.rb +0 -9
- data/test/stub/rails_apps/2.2/empty/test/test_helper.rb +0 -38
- data/test/stub/rails_apps/2.3/empty/.gitignore +0 -3
- data/test/stub/rails_apps/2.3/empty/Rakefile +0 -10
- data/test/stub/rails_apps/2.3/empty/app/controllers/application_controller.rb +0 -10
- data/test/stub/rails_apps/2.3/empty/app/helpers/application_helper.rb +0 -3
- data/test/stub/rails_apps/2.3/empty/app/models/.gitignore +0 -0
- data/test/stub/rails_apps/2.3/empty/config/boot.rb +0 -110
- data/test/stub/rails_apps/2.3/empty/config/database.yml +0 -31
- data/test/stub/rails_apps/2.3/empty/config/environment.rb +0 -41
- data/test/stub/rails_apps/2.3/empty/config/environments/development.rb +0 -17
- data/test/stub/rails_apps/2.3/empty/config/environments/production.rb +0 -28
- data/test/stub/rails_apps/2.3/empty/config/environments/staging.rb +0 -28
- data/test/stub/rails_apps/2.3/empty/config/environments/test.rb +0 -28
- data/test/stub/rails_apps/2.3/empty/config/initializers/backtrace_silencers.rb +0 -7
- data/test/stub/rails_apps/2.3/empty/config/initializers/inflections.rb +0 -10
- data/test/stub/rails_apps/2.3/empty/config/initializers/mime_types.rb +0 -5
- data/test/stub/rails_apps/2.3/empty/config/initializers/new_rails_defaults.rb +0 -21
- data/test/stub/rails_apps/2.3/empty/config/initializers/session_store.rb +0 -15
- data/test/stub/rails_apps/2.3/empty/config/locales/en.yml +0 -5
- data/test/stub/rails_apps/2.3/empty/config/routes.rb +0 -43
- data/test/stub/rails_apps/2.3/empty/db/.gitignore +0 -0
- data/test/stub/rails_apps/2.3/empty/db/seeds.rb +0 -7
- data/test/stub/rails_apps/2.3/empty/doc/README_FOR_APP +0 -2
- data/test/stub/rails_apps/2.3/empty/public/404.html +0 -30
- data/test/stub/rails_apps/2.3/empty/public/422.html +0 -30
- data/test/stub/rails_apps/2.3/empty/public/500.html +0 -30
- data/test/stub/rails_apps/2.3/empty/public/favicon.ico +0 -0
- data/test/stub/rails_apps/2.3/empty/public/images/rails.png +0 -0
- data/test/stub/rails_apps/2.3/empty/public/robots.txt +0 -5
- data/test/stub/rails_apps/2.3/empty/public/stylesheets/.gitignore +0 -0
- data/test/stub/rails_apps/2.3/empty/script/about +0 -4
- data/test/stub/rails_apps/2.3/empty/script/console +0 -3
- data/test/stub/rails_apps/2.3/empty/script/dbconsole +0 -3
- data/test/stub/rails_apps/2.3/empty/script/destroy +0 -3
- data/test/stub/rails_apps/2.3/empty/script/generate +0 -3
- data/test/stub/rails_apps/2.3/empty/script/performance/benchmarker +0 -3
- data/test/stub/rails_apps/2.3/empty/script/performance/profiler +0 -3
- data/test/stub/rails_apps/2.3/empty/script/plugin +0 -3
- data/test/stub/rails_apps/2.3/empty/script/runner +0 -3
- data/test/stub/rails_apps/2.3/empty/script/server +0 -3
- data/test/stub/rails_apps/2.3/empty/test/performance/browsing_test.rb +0 -9
- data/test/stub/rails_apps/2.3/empty/test/test_helper.rb +0 -38
- data/test/stub/rails_apps/2.3/mycook/Rakefile +0 -10
- data/test/stub/rails_apps/2.3/mycook/app/helpers/application_helper.rb +0 -3
- data/test/stub/rails_apps/2.3/mycook/config/environments/development.rb +0 -18
- data/test/stub/rails_apps/2.3/mycook/config/initializers/inflections.rb +0 -10
- data/test/stub/rails_apps/2.3/mycook/config/initializers/mime_types.rb +0 -5
- data/test/stub/rails_apps/2.3/mycook/public/404.html +0 -30
- data/test/stub/rails_apps/2.3/mycook/public/422.html +0 -30
- data/test/stub/rails_apps/2.3/mycook/public/500.html +0 -30
- data/test/stub/rails_apps/2.3/mycook/public/favicon.ico +0 -0
- data/test/stub/rails_apps/2.3/mycook/public/images/rails.png +0 -0
- data/test/stub/rails_apps/2.3/mycook/public/robots.txt +0 -5
- data/test/stub/rails_apps/2.3/mycook/public/uploads/.gitignore +0 -0
- data/test/stub/rails_apps/2.3/mycook/script/about +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/console +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/dbconsole +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/destroy +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/generate +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/performance/benchmarker +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/performance/profiler +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/performance/request +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/plugin +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/process/inspector +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/process/reaper +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/process/spawner +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/runner +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/server +0 -3
- data/test/stub/wsgi/public/wsgi-snake.jpg +0 -0
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
# Phusion Passenger - https://www.phusionpassenger.com/
|
2
3
|
# Copyright (c) 2010-2013 Phusion
|
3
4
|
#
|
@@ -22,7 +23,7 @@
|
|
22
23
|
# THE SOFTWARE.
|
23
24
|
|
24
25
|
require 'erb'
|
25
|
-
|
26
|
+
PhusionPassenger.require_passenger_lib 'utils/ansi_colors'
|
26
27
|
|
27
28
|
module PhusionPassenger
|
28
29
|
|
@@ -21,8 +21,6 @@
|
|
21
21
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
22
|
# THE SOFTWARE.
|
23
23
|
|
24
|
-
require 'phusion_passenger'
|
25
|
-
|
26
24
|
module PhusionPassenger
|
27
25
|
PASSENGER_ANALYTICS_WEB_LOG = "PASSENGER_ANALYTICS_WEB_LOG".freeze
|
28
26
|
PASSENGER_TXN_ID = "PASSENGER_TXN_ID".freeze
|
@@ -74,6 +72,13 @@ module PhusionPassenger
|
|
74
72
|
NGINX_DOC_URL = "http://www.modrails.com/documentation/Users%20guide%20Nginx.html"
|
75
73
|
STANDALONE_DOC_URL = "http://www.modrails.com/documentation/Users%20guide%20Standalone.html"
|
76
74
|
SUPPORT_URL = "http://www.phusionpassenger.com/support"
|
75
|
+
ENTERPRISE_URL = "http://www.phusionpassenger.com/enterprise"
|
76
|
+
DEB_DEV_PACKAGE = "passenger-dev"
|
77
|
+
DEB_APACHE_MODULE_PACKAGE = "libapache2-mod-passenger"
|
78
|
+
DEB_NGINX_PACKAGE = "nginx-extras"
|
79
|
+
RPM_DEV_PACKAGE = "passenger-devel"
|
80
|
+
RPM_APACHE_MODULE_PACKAGE = "mod_passenger"
|
81
|
+
RPM_NGINX_PACKAGE = "nginx"
|
77
82
|
STANDALONE_NGINX_CONFIGURE_OPTIONS =
|
78
83
|
"--with-cc-opt='-Wno-error' " <<
|
79
84
|
"--without-http_fastcgi_module " <<
|
@@ -22,8 +22,8 @@
|
|
22
22
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
23
|
# THE SOFTWARE.
|
24
24
|
|
25
|
-
|
26
|
-
|
25
|
+
PhusionPassenger.require_passenger_lib 'public_api'
|
26
|
+
PhusionPassenger.require_passenger_lib 'debug_logging'
|
27
27
|
|
28
28
|
module PhusionPassenger
|
29
29
|
|
@@ -42,6 +42,8 @@ module LoaderSharedHelpers
|
|
42
42
|
# To be called whenever the (pre)loader is about to abort with an error.
|
43
43
|
def about_to_abort(exception = nil)
|
44
44
|
dump_all_information
|
45
|
+
# https://code.google.com/p/phusion-passenger/issues/detail?id=1039
|
46
|
+
puts
|
45
47
|
end
|
46
48
|
|
47
49
|
def to_boolean(value)
|
@@ -152,7 +154,7 @@ module LoaderSharedHelpers
|
|
152
154
|
DebugLogging.log_level = options["log_level"] if options["log_level"]
|
153
155
|
|
154
156
|
# Instantiate the analytics logger if requested. Can be nil.
|
155
|
-
|
157
|
+
PhusionPassenger.require_passenger_lib 'analytics_logger'
|
156
158
|
options["analytics_logger"] = AnalyticsLogger.new_from_options(options)
|
157
159
|
end
|
158
160
|
|
@@ -220,15 +222,6 @@ module LoaderSharedHelpers
|
|
220
222
|
end
|
221
223
|
end
|
222
224
|
|
223
|
-
# Bundler might remove Phusion Passenger from the load path in its zealous
|
224
|
-
# attempt to un-require RubyGems, so here we put Phusion Passenger back
|
225
|
-
# into the load path. This must be done before loading the app's startup
|
226
|
-
# file because the app might require() Phusion Passenger files.
|
227
|
-
if !$LOAD_PATH.include?(PhusionPassenger.ruby_libdir)
|
228
|
-
$LOAD_PATH.unshift(PhusionPassenger.ruby_libdir)
|
229
|
-
$LOAD_PATH.uniq!
|
230
|
-
end
|
231
|
-
|
232
225
|
|
233
226
|
# !!! NOTE !!!
|
234
227
|
# If the app is using Bundler then any dependencies required past this
|
@@ -242,15 +235,6 @@ module LoaderSharedHelpers
|
|
242
235
|
# This method is to be called after loading the application code but
|
243
236
|
# before forking a worker process.
|
244
237
|
def after_loading_app_code(options)
|
245
|
-
# Even though run_load_path_setup_code() restores the Phusion Passenger
|
246
|
-
# load path after setting up Bundler, the app itself might also
|
247
|
-
# remove Phusion Passenger from the load path for whatever reason,
|
248
|
-
# so here we restore the load path again.
|
249
|
-
if !$LOAD_PATH.include?(PhusionPassenger.ruby_libdir)
|
250
|
-
$LOAD_PATH.unshift(PhusionPassenger.ruby_libdir)
|
251
|
-
$LOAD_PATH.uniq!
|
252
|
-
end
|
253
|
-
|
254
238
|
# Post-install framework extensions. Possibly preceded by a call to
|
255
239
|
# PhusionPassenger.install_framework_extensions!
|
256
240
|
if defined?(::Rails) && !defined?(::Rails::VERSION)
|
@@ -268,6 +252,13 @@ module LoaderSharedHelpers
|
|
268
252
|
end
|
269
253
|
end
|
270
254
|
|
255
|
+
def advertise_readiness
|
256
|
+
# https://code.google.com/p/phusion-passenger/issues/detail?id=1039
|
257
|
+
puts
|
258
|
+
|
259
|
+
puts "!> Ready"
|
260
|
+
end
|
261
|
+
|
271
262
|
def advertise_sockets(output, request_handler)
|
272
263
|
request_handler.server_sockets.each_pair do |name, options|
|
273
264
|
concurrency = PhusionPassenger.advertised_concurrency_level || options[:concurrency]
|
@@ -23,9 +23,9 @@
|
|
23
23
|
# THE SOFTWARE.
|
24
24
|
|
25
25
|
require 'socket'
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
PhusionPassenger.require_passenger_lib 'message_channel'
|
27
|
+
PhusionPassenger.require_passenger_lib 'utils'
|
28
|
+
PhusionPassenger.require_passenger_lib 'utils/tmpdir'
|
29
29
|
|
30
30
|
module PhusionPassenger
|
31
31
|
|
@@ -112,7 +112,18 @@ class MessageClient
|
|
112
112
|
check_security_response
|
113
113
|
return read_scalar
|
114
114
|
end
|
115
|
-
|
115
|
+
|
116
|
+
def restart_app_group(app_group_name, options = {})
|
117
|
+
write("restart_app_group", app_group_name, *options.to_a.flatten)
|
118
|
+
check_security_response
|
119
|
+
result = read
|
120
|
+
if result.nil?
|
121
|
+
raise EOFError
|
122
|
+
else
|
123
|
+
return result.first == "true"
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
116
127
|
def helper_agent_requests
|
117
128
|
write("requests")
|
118
129
|
check_security_response
|
@@ -32,29 +32,36 @@ class NativeSupportLoader
|
|
32
32
|
if defined?(NativeSupport)
|
33
33
|
return true
|
34
34
|
else
|
35
|
-
require 'phusion_passenger'
|
36
35
|
load_from_native_support_output_dir ||
|
37
|
-
|
36
|
+
load_from_buildout_dir ||
|
38
37
|
load_from_load_path ||
|
39
38
|
load_from_home_dir
|
40
39
|
end
|
41
40
|
end
|
42
41
|
|
43
42
|
def start
|
44
|
-
try_load
|
43
|
+
if try_load
|
44
|
+
return true
|
45
|
+
elsif download_binary_and_load || compile_and_load
|
46
|
+
STDERR.puts " --> #{library_name} successfully loaded."
|
47
|
+
return true
|
48
|
+
else
|
49
|
+
STDERR.puts " --> Continuing without #{library_name}."
|
50
|
+
return false
|
51
|
+
end
|
45
52
|
end
|
46
53
|
|
47
54
|
private
|
48
55
|
def archdir
|
49
56
|
@archdir ||= begin
|
50
|
-
|
57
|
+
PhusionPassenger.require_passenger_lib 'platform_info/binary_compatibility'
|
51
58
|
PlatformInfo.ruby_extension_binary_compatibility_id
|
52
59
|
end
|
53
60
|
end
|
54
61
|
|
55
62
|
def libext
|
56
63
|
@libext ||= begin
|
57
|
-
|
64
|
+
PhusionPassenger.require_passenger_lib 'platform_info/operating_system'
|
58
65
|
PlatformInfo.library_extension
|
59
66
|
end
|
60
67
|
end
|
@@ -74,23 +81,13 @@ private
|
|
74
81
|
File.join(PhusionPassenger.ruby_extension_source_dir, "extconf.rb")
|
75
82
|
end
|
76
83
|
|
77
|
-
def native_support_dir_in_source_root
|
78
|
-
if PhusionPassenger.originally_packaged?
|
79
|
-
@native_support_dir_in_source_root ||=
|
80
|
-
File.expand_path("#{PhusionPassenger.source_root}/buildout/ruby")
|
81
|
-
else
|
82
|
-
return nil
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
84
|
def load_from_native_support_output_dir
|
87
85
|
# Quick workaround for people suffering from
|
88
86
|
# https://code.google.com/p/phusion-passenger/issues/detail?id=865
|
89
87
|
output_dir = ENV['PASSENGER_NATIVE_SUPPORT_OUTPUT_DIR']
|
90
88
|
if output_dir && !output_dir.empty?
|
91
89
|
begin
|
92
|
-
|
93
|
-
return true
|
90
|
+
return load_native_extension("#{output_dir}/#{VERSION_STRING}/#{archdir}/#{library_name}")
|
94
91
|
rescue LoadError
|
95
92
|
return false
|
96
93
|
end
|
@@ -99,11 +96,10 @@ private
|
|
99
96
|
end
|
100
97
|
end
|
101
98
|
|
102
|
-
def
|
103
|
-
if PhusionPassenger.
|
99
|
+
def load_from_buildout_dir
|
100
|
+
if PhusionPassenger.buildout_dir
|
104
101
|
begin
|
105
|
-
|
106
|
-
return true
|
102
|
+
return load_native_extension("#{PhusionPassenger.buildout_dir}/ruby/#{archdir}/#{library_name}")
|
107
103
|
rescue LoadError
|
108
104
|
return false
|
109
105
|
end
|
@@ -113,16 +109,14 @@ private
|
|
113
109
|
end
|
114
110
|
|
115
111
|
def load_from_load_path
|
116
|
-
|
117
|
-
return true
|
112
|
+
return load_native_extension('passenger_native_support')
|
118
113
|
rescue LoadError
|
119
114
|
return false
|
120
115
|
end
|
121
116
|
|
122
117
|
def load_from_home_dir
|
123
118
|
begin
|
124
|
-
|
125
|
-
return true
|
119
|
+
return load_native_extension("#{home}/#{USER_NAMESPACE_DIRNAME}/native_support/#{VERSION_STRING}/#{archdir}/#{library_name}")
|
126
120
|
rescue LoadError
|
127
121
|
return false
|
128
122
|
end
|
@@ -133,16 +127,18 @@ private
|
|
133
127
|
return
|
134
128
|
end
|
135
129
|
if ENV['PASSENGER_DOWNLOAD_NATIVE_SUPPORT_BINARY'] == '0'
|
136
|
-
STDERR.puts "
|
137
|
-
"not downloading precompiled binary"
|
130
|
+
STDERR.puts " --> Skipping downloading of precompiled #{library_name}"
|
138
131
|
return
|
139
132
|
end
|
140
|
-
|
141
|
-
|
142
|
-
|
133
|
+
|
134
|
+
STDERR.puts " --> Downloading precompiled #{library_name} for the current Ruby interpreter..."
|
135
|
+
STDERR.puts " (set PASSENGER_DOWNLOAD_NATIVE_SUPPORT_BINARY=0 to disable)"
|
143
136
|
|
144
|
-
require '
|
145
|
-
require '
|
137
|
+
require 'shellwords'
|
138
|
+
require 'logger'
|
139
|
+
PhusionPassenger.require_passenger_lib 'platform_info/ruby'
|
140
|
+
PhusionPassenger.require_passenger_lib 'utils/tmpio'
|
141
|
+
PhusionPassenger.require_passenger_lib 'utils/download'
|
146
142
|
PhusionPassenger::Utils.mktmpdir("passenger-native-support-") do |dir|
|
147
143
|
Dir.chdir(dir) do
|
148
144
|
basename = "rubyext-#{archdir}.tar.gz"
|
@@ -150,9 +146,10 @@ private
|
|
150
146
|
return false
|
151
147
|
end
|
152
148
|
|
153
|
-
|
154
|
-
sh "
|
155
|
-
|
149
|
+
s_basename = Shellwords.escape(basename)
|
150
|
+
sh "tar xzf #{s_basename}"
|
151
|
+
sh "rm -f #{s_basename}"
|
152
|
+
STDERR.puts " Checking whether downloaded binary is usable..."
|
156
153
|
|
157
154
|
File.open("test.rb", "w") do |f|
|
158
155
|
f.puts(%Q{
|
@@ -165,19 +162,19 @@ private
|
|
165
162
|
if sh_nonfatal("#{PlatformInfo.ruby_command} -I. test.rb") &&
|
166
163
|
File.exist?("test.txt") &&
|
167
164
|
File.read("test.txt") == "hello\n"
|
168
|
-
STDERR.puts "Binary is usable."
|
165
|
+
STDERR.puts " Binary is usable."
|
169
166
|
File.unlink("test.rb")
|
170
167
|
File.unlink("test.txt")
|
171
168
|
result = try_directories(installation_target_dirs) do |target_dir|
|
172
169
|
files = Dir["#{dir}/*"]
|
173
|
-
STDERR.puts "
|
170
|
+
STDERR.puts " Installing " + files.map{ |n| File.basename(n) }.join(' ')
|
174
171
|
FileUtils.cp(files, target_dir)
|
175
|
-
|
176
|
-
[
|
172
|
+
load_result = load_native_extension("#{target_dir}/#{library_name}")
|
173
|
+
[load_result, false]
|
177
174
|
end
|
178
175
|
return result
|
179
176
|
else
|
180
|
-
STDERR.puts "Binary is not usable."
|
177
|
+
STDERR.puts " Binary is not usable."
|
181
178
|
return false
|
182
179
|
end
|
183
180
|
end
|
@@ -186,23 +183,41 @@ private
|
|
186
183
|
|
187
184
|
def compile_and_load
|
188
185
|
if ENV['PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY'] == '0'
|
189
|
-
STDERR.puts "
|
190
|
-
|
186
|
+
STDERR.puts " --> Skipping compiling of #{library_name}"
|
187
|
+
return false
|
188
|
+
end
|
189
|
+
|
190
|
+
if PhusionPassenger.natively_packaged? && !File.exist?(PhusionPassenger.ruby_extension_source_dir)
|
191
|
+
PhusionPassenger.require_passenger_lib 'constants'
|
192
|
+
STDERR.puts " --> No #{library_name} found for current Ruby interpreter."
|
193
|
+
case PhusionPassenger.native_packaging_method
|
194
|
+
when 'deb'
|
195
|
+
STDERR.puts " This library provides various optimized routines that make"
|
196
|
+
STDERR.puts " #{PhusionPassenger::PROGRAM_NAME} faster. Please run 'sudo apt-get install #{PhusionPassenger::DEB_DEV_PACKAGE}'"
|
197
|
+
STDERR.puts " so that #{PhusionPassenger::PROGRAM_NAME} can compile one on the next run."
|
198
|
+
when 'rpm'
|
199
|
+
STDERR.puts " This library provides various optimized routines that make"
|
200
|
+
STDERR.puts " #{PhusionPassenger::PROGRAM_NAME} faster. Please run 'sudo yum install #{PhusionPassenger::RPM_DEV_PACKAGE}'"
|
201
|
+
STDERR.puts " so that #{PhusionPassenger::PROGRAM_NAME} can compile one on the next run."
|
202
|
+
else
|
203
|
+
STDERR.puts " #{PhusionPassenger::PROGRAM_NAME} can compile one, but an extra package must be installed"
|
204
|
+
STDERR.puts " first. Please ask your operating system vendor for instructions."
|
205
|
+
end
|
191
206
|
return false
|
192
207
|
end
|
193
208
|
|
194
|
-
STDERR.puts "
|
195
|
-
|
196
|
-
|
209
|
+
STDERR.puts " --> Compiling #{library_name} for the current Ruby interpreter..."
|
210
|
+
STDERR.puts " (set PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY=0 to disable)"
|
211
|
+
STDERR.puts " -------------------------------"
|
197
212
|
|
198
213
|
require 'fileutils'
|
199
|
-
require '
|
214
|
+
require 'shellwords'
|
215
|
+
PhusionPassenger.require_passenger_lib 'platform_info/ruby'
|
200
216
|
|
201
217
|
target_dir = compile(installation_target_dirs)
|
202
218
|
if target_dir
|
203
|
-
|
219
|
+
return load_native_extension("#{target_dir}/#{library_name}")
|
204
220
|
else
|
205
|
-
STDERR.puts "Ruby native_support extension not loaded. Continuing without native_support."
|
206
221
|
return false
|
207
222
|
end
|
208
223
|
end
|
@@ -212,8 +227,8 @@ private
|
|
212
227
|
if (output_dir = ENV['PASSENGER_NATIVE_SUPPORT_OUTPUT_DIR']) && !output_dir.empty?
|
213
228
|
target_dirs << "#{output_dir}/#{VERSION_STRING}/#{archdir}"
|
214
229
|
end
|
215
|
-
if
|
216
|
-
target_dirs << "#{
|
230
|
+
if PhusionPassenger.buildout_dir
|
231
|
+
target_dirs << "#{PhusionPassenger.buildout_dir}/ruby/#{archdir}"
|
217
232
|
end
|
218
233
|
target_dirs << "#{home}/#{USER_NAMESPACE_DIRNAME}/native_support/#{VERSION_STRING}/#{archdir}"
|
219
234
|
return target_dirs
|
@@ -222,62 +237,49 @@ private
|
|
222
237
|
def download(name, output_dir)
|
223
238
|
url = "#{PhusionPassenger::BINARIES_URL_ROOT}/#{PhusionPassenger::VERSION_STRING}/#{name}"
|
224
239
|
filename = "#{output_dir}/#{name}"
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
STDERR.puts "Attempting to download #{url} into #{output_dir}"
|
233
|
-
cert = PhusionPassenger.binaries_ca_cert_path
|
234
|
-
File.unlink("#{filename}.tmp") rescue nil
|
235
|
-
if PhusionPassenger::PlatformInfo.find_command("wget")
|
236
|
-
result = system("wget", "--tries=3", "-O", "#{filename}.tmp", "--ca-certificate=#{cert}", url)
|
237
|
-
else
|
238
|
-
result = system("curl", url, "-f", "-L", "-o", "#{filename}.tmp", "--cacert", cert)
|
239
|
-
end
|
240
|
-
if result
|
241
|
-
File.rename("#{filename}.tmp", filename)
|
242
|
-
else
|
243
|
-
File.unlink("#{filename}.tmp") rescue nil
|
244
|
-
end
|
245
|
-
return result
|
240
|
+
logger = Logger.new(STDERR)
|
241
|
+
logger.level = Logger::WARN
|
242
|
+
logger.formatter = proc { |severity, datetime, progname, msg| " #{msg}\n" }
|
243
|
+
return PhusionPassenger::Utils::Download.download(url, filename,
|
244
|
+
:cacert => PhusionPassenger.binaries_ca_cert_path,
|
245
|
+
:use_cache => true,
|
246
|
+
:logger => logger)
|
246
247
|
end
|
247
248
|
|
248
249
|
def mkdir(dir)
|
249
250
|
begin
|
250
|
-
STDERR.puts "# mkdir -p #{dir}"
|
251
|
+
STDERR.puts " # mkdir -p #{dir}"
|
251
252
|
FileUtils.mkdir_p(dir)
|
252
253
|
rescue Errno::EEXIST
|
253
254
|
end
|
254
255
|
end
|
255
256
|
|
256
|
-
def sh(
|
257
|
-
if !sh_nonfatal(
|
258
|
-
command_string = args.join(' ')
|
257
|
+
def sh(command_string)
|
258
|
+
if !sh_nonfatal(command_string)
|
259
259
|
raise "Could not compile #{library_name} (\"#{command_string}\" failed)"
|
260
260
|
end
|
261
261
|
end
|
262
262
|
|
263
|
-
def sh_nonfatal(
|
264
|
-
|
265
|
-
|
266
|
-
|
263
|
+
def sh_nonfatal(command_string)
|
264
|
+
STDERR.puts " # #{command_string}"
|
265
|
+
PhusionPassenger::Utils.mktmpdir("passenger-native-support-") do |tmpdir|
|
266
|
+
s_tmpdir = Shellwords.escape(tmpdir)
|
267
|
+
result = system("#{command_string} >#{s_tmpdir}/log 2>&1")
|
268
|
+
system("cat #{s_tmpdir}/log | sed 's/^/ /'")
|
269
|
+
return result
|
270
|
+
end
|
267
271
|
end
|
268
272
|
|
269
273
|
def compile(target_dirs)
|
270
274
|
try_directories(target_dirs) do |target_dir|
|
271
275
|
result =
|
272
|
-
sh_nonfatal("#{PlatformInfo.ruby_command}
|
273
|
-
sh_nonfatal("make")
|
276
|
+
sh_nonfatal("#{PlatformInfo.ruby_command} #{Shellwords.escape extconf_rb}") &&
|
277
|
+
sh_nonfatal("make clean && make")
|
274
278
|
if result
|
275
|
-
STDERR.puts "Compilation succesful."
|
276
|
-
STDERR.puts "-------------------------------"
|
279
|
+
STDERR.puts " Compilation succesful."
|
277
280
|
[target_dir, false]
|
278
281
|
else
|
279
|
-
STDERR.puts "Compilation failed."
|
280
|
-
STDERR.puts "-------------------------------"
|
282
|
+
STDERR.puts " Compilation failed."
|
281
283
|
[nil, false]
|
282
284
|
end
|
283
285
|
end
|
@@ -290,7 +292,7 @@ private
|
|
290
292
|
mkdir(dir)
|
291
293
|
File.open("#{dir}/.permission_test", "w").close
|
292
294
|
File.unlink("#{dir}/.permission_test")
|
293
|
-
STDERR.puts "# cd #{dir}"
|
295
|
+
STDERR.puts " # cd #{dir}"
|
294
296
|
Dir.chdir(dir) do
|
295
297
|
result, should_retry = yield(dir)
|
296
298
|
return result if !should_retry
|
@@ -301,33 +303,49 @@ private
|
|
301
303
|
# error on the last one too then propagate the
|
302
304
|
# exception.
|
303
305
|
if i == dirs.size - 1
|
304
|
-
STDERR.puts "Encountered permission error, " +
|
306
|
+
STDERR.puts " Encountered permission error, " +
|
305
307
|
"but no more directories to try. Giving up."
|
306
|
-
STDERR.puts "-------------------------------"
|
308
|
+
STDERR.puts " -------------------------------"
|
307
309
|
return nil
|
308
310
|
else
|
309
|
-
STDERR.puts "Encountered permission error, " +
|
311
|
+
STDERR.puts " Encountered permission error, " +
|
310
312
|
"trying a different directory..."
|
311
|
-
STDERR.puts "-------------------------------"
|
313
|
+
STDERR.puts " -------------------------------"
|
312
314
|
end
|
313
315
|
rescue Errno::ENOTDIR
|
314
|
-
# This can occur when
|
315
|
-
#
|
316
|
-
# is set to false. For example, when we're running
|
317
|
-
# in Phusion Passenger Standalone. In this case
|
318
|
-
# just ignore this directory.
|
316
|
+
# This can occur when locations.ini set buildout_dir
|
317
|
+
# to an invalid path. Just ignore this error.
|
319
318
|
if i == dirs.size - 1
|
320
|
-
STDERR.puts "Not a valid directory, " +
|
319
|
+
STDERR.puts " Not a valid directory, " +
|
321
320
|
"but no more directories to try. Giving up."
|
322
|
-
STDERR.puts "-------------------------------"
|
321
|
+
STDERR.puts " -------------------------------"
|
323
322
|
return nil
|
324
323
|
else
|
325
|
-
STDERR.puts "Not a valid directory. Trying a different one..."
|
326
|
-
STDERR.puts "-------------------------------"
|
324
|
+
STDERR.puts " Not a valid directory. Trying a different one..."
|
325
|
+
STDERR.puts " -------------------------------"
|
327
326
|
end
|
328
327
|
end
|
329
328
|
end
|
330
329
|
end
|
330
|
+
|
331
|
+
def load_native_extension(name_or_filename)
|
332
|
+
# If passenger_native_support.so exited because it detected that it was compiled
|
333
|
+
# for a different Ruby version, then subsequent require("passenger_native_support")
|
334
|
+
# calls will do nothing. So we remove passenger_native_support from $LOADED_FEATURES
|
335
|
+
# to force it to be loaded.
|
336
|
+
$LOADED_FEATURES.reject! { |fn| File.basename(fn) == library_name }
|
337
|
+
begin
|
338
|
+
require(name_or_filename)
|
339
|
+
return defined?(PhusionPassenger::NativeSupport)
|
340
|
+
rescue LoadError => e
|
341
|
+
if e.to_s =~ /dlopen/
|
342
|
+
# Print dlopen failures. We're not interested in any other
|
343
|
+
# kinds of failures, such as file-not-found.
|
344
|
+
puts e.to_s.gsub(/^/, " ")
|
345
|
+
end
|
346
|
+
return false
|
347
|
+
end
|
348
|
+
end
|
331
349
|
end
|
332
350
|
|
333
351
|
end # module PhusionPassenger
|