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
@@ -0,0 +1,183 @@
|
|
1
|
+
# Phusion Passenger - https://www.phusionpassenger.com/
|
2
|
+
# Copyright (c) 2010-2013 Phusion
|
3
|
+
#
|
4
|
+
# "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in
|
14
|
+
# all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
# THE SOFTWARE.
|
23
|
+
|
24
|
+
PhusionPassenger.require_passenger_lib 'constants'
|
25
|
+
PhusionPassenger.require_passenger_lib 'config/command'
|
26
|
+
|
27
|
+
module PhusionPassenger
|
28
|
+
module Config
|
29
|
+
|
30
|
+
class AboutCommand < Command
|
31
|
+
def self.description
|
32
|
+
return "Show information about #{PROGRAM_NAME}"
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.help
|
36
|
+
puts "Usage: passenger-config about <SUBCOMMAND>"
|
37
|
+
puts "Show information about #{PROGRAM_NAME}."
|
38
|
+
puts
|
39
|
+
puts "Available subcommands:"
|
40
|
+
puts " root Show #{PROGRAM_NAME}'s root directory."
|
41
|
+
puts " ruby-libdir Show #{PROGRAM_NAME}'s Ruby library directory."
|
42
|
+
puts " includedir Show the Nginx runtime library headers directory."
|
43
|
+
puts " nginx-addon-dir Show #{PROGRAM_NAME}'s Nginx addon directory."
|
44
|
+
puts " nginx-libs Show Nginx runtime library flags."
|
45
|
+
puts " compiled Check whether runtime libraries are compiled."
|
46
|
+
puts " natively-packaged Check whether Phusion Passenger is natively"
|
47
|
+
puts " packaged."
|
48
|
+
puts " installed-from-release-package Check whether this installation came from"
|
49
|
+
puts " an official release package."
|
50
|
+
puts " make-locations-ini Generate a locations.ini based on the current"
|
51
|
+
puts " install paths."
|
52
|
+
puts " detect-apache2 Autodetect Apache installations."
|
53
|
+
puts " ruby-command Show the correct command for invoking the Ruby"
|
54
|
+
puts " interpreter."
|
55
|
+
puts " rubyext-compat-id Show the Ruby extension binary compatibility ID."
|
56
|
+
puts " cxx-compat-id Show the C++ binary compatibility ID."
|
57
|
+
puts " version Show the version number."
|
58
|
+
end
|
59
|
+
|
60
|
+
def run
|
61
|
+
PhusionPassenger.require_passenger_lib 'platform_info'
|
62
|
+
PhusionPassenger.require_passenger_lib 'platform_info/compiler'
|
63
|
+
|
64
|
+
subcommand = @argv[0].to_s.dup
|
65
|
+
# Compatibility with version <= 4.0.29: accept both
|
66
|
+
# 'subcommand' and '--subcommand'.
|
67
|
+
subcommand = "--#{subcommand}" if subcommand !~ /^--/
|
68
|
+
|
69
|
+
case subcommand
|
70
|
+
when "--root"
|
71
|
+
puts PhusionPassenger.source_root
|
72
|
+
when "--ruby-libdir"
|
73
|
+
puts PhusionPassenger.ruby_libdir
|
74
|
+
when "--includedir"
|
75
|
+
puts PhusionPassenger.include_dir
|
76
|
+
when "--nginx-addon-dir"
|
77
|
+
puts PhusionPassenger.nginx_module_source_dir
|
78
|
+
when "--nginx-libs"
|
79
|
+
puts "#{common_library.link_objects_as_string} #{PhusionPassenger.lib_dir}/common/libboost_oxt.a"
|
80
|
+
when "--compiled"
|
81
|
+
common_library.link_objects.each do |filename|
|
82
|
+
if !File.exist?(filename)
|
83
|
+
exit 1
|
84
|
+
end
|
85
|
+
end
|
86
|
+
if File.exist?("#{PhusionPassenger.lib_dir}/common/libboost_oxt.a")
|
87
|
+
exit 0
|
88
|
+
else
|
89
|
+
exit 1
|
90
|
+
end
|
91
|
+
when "--natively-packaged"
|
92
|
+
if PhusionPassenger.natively_packaged?
|
93
|
+
exit 0
|
94
|
+
else
|
95
|
+
exit 1
|
96
|
+
end
|
97
|
+
when "--installed-from-release-package"
|
98
|
+
if PhusionPassenger.installed_from_release_package?
|
99
|
+
exit 0
|
100
|
+
else
|
101
|
+
exit 1
|
102
|
+
end
|
103
|
+
when "--make-locations-ini"
|
104
|
+
puts "[locations]"
|
105
|
+
puts "natively_packaged=#{PhusionPassenger.natively_packaged?}"
|
106
|
+
if PhusionPassenger.natively_packaged?
|
107
|
+
puts "native_packaging_method=#{PhusionPassenger.native_packaging_method}"
|
108
|
+
end
|
109
|
+
PhusionPassenger::REQUIRED_LOCATIONS_INI_FIELDS.each do |field|
|
110
|
+
puts "#{field}=#{PhusionPassenger.send(field)}"
|
111
|
+
end
|
112
|
+
PhusionPassenger::OPTIONAL_LOCATIONS_INI_FIELDS.each do |field|
|
113
|
+
if value = PhusionPassenger.send(field)
|
114
|
+
puts "#{field}=#{value}"
|
115
|
+
end
|
116
|
+
end
|
117
|
+
when "--detect-apache2"
|
118
|
+
PhusionPassenger.require_passenger_lib 'platform_info/apache_detector'
|
119
|
+
detector = PhusionPassenger::PlatformInfo::ApacheDetector.new(STDOUT)
|
120
|
+
begin
|
121
|
+
detector.detect_all
|
122
|
+
detector.report
|
123
|
+
ensure
|
124
|
+
detector.finish
|
125
|
+
end
|
126
|
+
when "--ruby-command"
|
127
|
+
PhusionPassenger.require_passenger_lib 'platform_info/ruby'
|
128
|
+
ruby = PhusionPassenger::PlatformInfo.ruby_command
|
129
|
+
puts "passenger-config was invoked through the following Ruby interpreter:"
|
130
|
+
puts " Command: #{ruby}"
|
131
|
+
STDOUT.write " Version: "
|
132
|
+
STDOUT.flush
|
133
|
+
system("/bin/sh -c '#{ruby} -v'")
|
134
|
+
puts " To use in Apache: PassengerRuby #{ruby}"
|
135
|
+
puts " To use in Nginx : passenger_ruby #{ruby}"
|
136
|
+
puts " To use with Standalone: #{ruby} #{PhusionPassenger.bin_dir}/passenger start"
|
137
|
+
puts
|
138
|
+
|
139
|
+
ruby = PhusionPassenger::PlatformInfo.find_command('ruby')
|
140
|
+
if ruby && !ruby.include?("rvm/rubies/")
|
141
|
+
# If this is an RVM Ruby executable then we don't show it. We want people to
|
142
|
+
# use the RVM wrapper scripts only.
|
143
|
+
puts "The following Ruby interpreter was found first in $PATH:"
|
144
|
+
puts " Command: #{ruby}"
|
145
|
+
STDOUT.write " Version: "
|
146
|
+
STDOUT.flush
|
147
|
+
system("/bin/sh -c '#{ruby} -v'")
|
148
|
+
puts " To use in Apache: PassengerRuby #{ruby}"
|
149
|
+
puts " To use in Nginx : passenger_ruby #{ruby}"
|
150
|
+
puts " To use with Standalone: #{ruby} #{PhusionPassenger.bin_dir}/passenger start"
|
151
|
+
elsif !ruby.include?("rvm/rubies/")
|
152
|
+
puts "No Ruby interpreter found in $PATH."
|
153
|
+
end
|
154
|
+
puts
|
155
|
+
puts "## Notes for RVM users"
|
156
|
+
puts "Do you want to know which command to use for a different Ruby interpreter? 'rvm use' that Ruby interpreter, then re-run 'passenger-config --ruby-command'."
|
157
|
+
when "--rubyext-compat-id"
|
158
|
+
PhusionPassenger.require_passenger_lib 'platform_info/binary_compatibility'
|
159
|
+
puts PhusionPassenger::PlatformInfo.ruby_extension_binary_compatibility_id
|
160
|
+
when "--cxx-compat-id"
|
161
|
+
PhusionPassenger.require_passenger_lib 'platform_info/binary_compatibility'
|
162
|
+
puts PhusionPassenger::PlatformInfo.cxx_binary_compatibility_id
|
163
|
+
when "--version"
|
164
|
+
puts PhusionPassenger::VERSION_STRING
|
165
|
+
when "--help"
|
166
|
+
self.class.help
|
167
|
+
else
|
168
|
+
self.class.help
|
169
|
+
exit 1
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
private
|
174
|
+
def common_library
|
175
|
+
PhusionPassenger.require_passenger_lib 'common_library'
|
176
|
+
return COMMON_LIBRARY.
|
177
|
+
only(*NGINX_LIBS_SELECTOR).
|
178
|
+
set_output_dir("#{PhusionPassenger.lib_dir}/common/libpassenger_common")
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
end # module Config
|
183
|
+
end # module PhusionPassenger
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Phusion Passenger - https://www.phusionpassenger.com/
|
2
|
+
# Copyright (c) 2010-2013 Phusion
|
3
|
+
#
|
4
|
+
# "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in
|
14
|
+
# all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
# THE SOFTWARE.
|
23
|
+
|
24
|
+
module PhusionPassenger
|
25
|
+
module Config
|
26
|
+
|
27
|
+
class Command
|
28
|
+
def self.description
|
29
|
+
return nil
|
30
|
+
end
|
31
|
+
|
32
|
+
def initialize(argv)
|
33
|
+
@argv = argv.dup
|
34
|
+
@options = self.class.create_default_options
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
def self.create_default_options
|
39
|
+
return {}
|
40
|
+
end
|
41
|
+
|
42
|
+
def parse_options
|
43
|
+
@parser = self.class.create_option_parser(@options)
|
44
|
+
begin
|
45
|
+
@parser.parse!(@argv)
|
46
|
+
rescue OptionParser::ParseError => e
|
47
|
+
abort @parser.to_s
|
48
|
+
end
|
49
|
+
if @options[:help]
|
50
|
+
puts @parser
|
51
|
+
exit
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end # module Config
|
57
|
+
end # module PhusionPassenger
|
@@ -0,0 +1,146 @@
|
|
1
|
+
# Phusion Passenger - https://www.phusionpassenger.com/
|
2
|
+
# Copyright (c) 2010-2013 Phusion
|
3
|
+
#
|
4
|
+
# "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in
|
14
|
+
# all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
# THE SOFTWARE.
|
23
|
+
|
24
|
+
require 'optparse'
|
25
|
+
PhusionPassenger.require_passenger_lib 'constants'
|
26
|
+
PhusionPassenger.require_passenger_lib 'admin_tools/server_instance'
|
27
|
+
PhusionPassenger.require_passenger_lib 'config/command'
|
28
|
+
PhusionPassenger.require_passenger_lib 'config/utils'
|
29
|
+
|
30
|
+
module PhusionPassenger
|
31
|
+
module Config
|
32
|
+
|
33
|
+
class RestartAppCommand < Command
|
34
|
+
include PhusionPassenger::Config::Utils
|
35
|
+
|
36
|
+
def self.description
|
37
|
+
return "Restart an application"
|
38
|
+
end
|
39
|
+
|
40
|
+
def run
|
41
|
+
parse_options
|
42
|
+
select_passenger_instance
|
43
|
+
@admin_client = connect_to_passenger_admin_socket(:role => :passenger_status)
|
44
|
+
select_app_group_name
|
45
|
+
perform_restart
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
def self.create_option_parser(options)
|
50
|
+
OptionParser.new do |opts|
|
51
|
+
nl = "\n" + ' ' * 37
|
52
|
+
opts.banner =
|
53
|
+
"Usage 1: passenger-config restart-app <APP PATH PREFIX> [OPTIONS]\n" +
|
54
|
+
"Usage 2: passenger-config restart-app --name <APP GROUP NAME> [OPTIONS]"
|
55
|
+
opts.separator ""
|
56
|
+
opts.separator " Restart an application. The syntax determines how the application that is to"
|
57
|
+
opts.separator " be restarted, will be selected."
|
58
|
+
opts.separator ""
|
59
|
+
opts.separator " 1. Selects all applications whose paths begin with the given prefix."
|
60
|
+
opts.separator ""
|
61
|
+
opts.separator " Example: passenger-config restart-app /webapps"
|
62
|
+
opts.separator " Restarts all apps whose path begin with /webapps, such as /webapps/foo,"
|
63
|
+
opts.separator " /webapps/bar and /webapps123."
|
64
|
+
opts.separator ""
|
65
|
+
opts.separator " 2. Selects a specific application based on an exact match of its app group"
|
66
|
+
opts.separator " name."
|
67
|
+
opts.separator ""
|
68
|
+
opts.separator " Example: passenger-config restart-app --name /webapps/foo"
|
69
|
+
opts.separator " Restarts only /webapps/foo, but not for example /webapps/foo/bar or"
|
70
|
+
opts.separator " /webapps/foo123."
|
71
|
+
opts.separator ""
|
72
|
+
|
73
|
+
opts.separator "Options:"
|
74
|
+
opts.on("--name APP_GROUP_NAME", String, "The app group name to select") do |value|
|
75
|
+
options[:app_group_name] = value
|
76
|
+
end
|
77
|
+
opts.on("--rolling-restart", "Perform a rolling restart instead of a#{nl}" +
|
78
|
+
"regular restart (Enterprise only). The#{nl}" +
|
79
|
+
"default is a blocking restart") do |value|
|
80
|
+
if Config::Utils.is_enterprise?
|
81
|
+
options[:rolling_restart] = true
|
82
|
+
else
|
83
|
+
abort "--rolling-restart is only available in #{PROGRAM_NAME} Enterprise: #{ENTERPRISE_URL}"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
opts.on("--instance PID", Integer, "The #{PROGRAM_NAME} instance to select") do |value|
|
87
|
+
options[:instance] = value
|
88
|
+
end
|
89
|
+
opts.on("-h", "--help", "Show this help") do
|
90
|
+
options[:help] = true
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def help
|
96
|
+
puts @parser
|
97
|
+
end
|
98
|
+
|
99
|
+
def parse_options
|
100
|
+
super
|
101
|
+
case @argv.size
|
102
|
+
when 0
|
103
|
+
if !@options[:app_group_name]
|
104
|
+
abort "Please pass either an app path prefix or an app group name. " +
|
105
|
+
"See --help for more information."
|
106
|
+
end
|
107
|
+
when 1
|
108
|
+
if @options[:app_group_name]
|
109
|
+
abort "You've passed an app path prefix, but you cannot also pass an " +
|
110
|
+
"app group name. Please use only either one of them. See --help " +
|
111
|
+
"for more information."
|
112
|
+
end
|
113
|
+
else
|
114
|
+
help
|
115
|
+
abort
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def select_app_group_name
|
120
|
+
groups = @server_instance.groups(@admin_client)
|
121
|
+
if app_group_name = @options[:app_group_name]
|
122
|
+
@groups = [groups.find { |g| g.name == app_group_name }]
|
123
|
+
if !@groups[0]
|
124
|
+
abort "There is no #{PROGRAM_NAME}-served application running with the app group name '#{app_group_name}'."
|
125
|
+
end
|
126
|
+
else
|
127
|
+
regex = /^#{Regexp.escape(@argv.first)}/
|
128
|
+
@groups = groups.find_all { |g| g.app_root =~ regex }
|
129
|
+
if @groups.empty?
|
130
|
+
abort "There are no #{PROGRAM_NAME}-served applications running whose paths begin with '#{@argv.first}'."
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
def perform_restart
|
136
|
+
restart_method = @options[:rolling_restart] ? "rolling" : "blocking"
|
137
|
+
@groups.each do |group|
|
138
|
+
puts "Restarting #{group.name}"
|
139
|
+
@admin_client.restart_app_group(group.name,
|
140
|
+
:method => restart_method)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
end # module Config
|
146
|
+
end # module PhusionPassenger
|
@@ -0,0 +1,108 @@
|
|
1
|
+
# Phusion Passenger - https://www.phusionpassenger.com/
|
2
|
+
# Copyright (c) 2010-2013 Phusion
|
3
|
+
#
|
4
|
+
# "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in
|
14
|
+
# all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
# THE SOFTWARE.
|
23
|
+
|
24
|
+
PhusionPassenger.require_passenger_lib 'constants'
|
25
|
+
|
26
|
+
module PhusionPassenger
|
27
|
+
module Config
|
28
|
+
|
29
|
+
module Utils
|
30
|
+
extend self # Make methods available as class methods.
|
31
|
+
|
32
|
+
def self.included(klass)
|
33
|
+
# When included into another class, make sure that Utils
|
34
|
+
# methods are made private.
|
35
|
+
public_instance_methods(false).each do |method_name|
|
36
|
+
klass.send(:private, method_name)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def select_passenger_instance
|
41
|
+
if pid = @options[:instance]
|
42
|
+
@server_instance = AdminTools::ServerInstance.for_pid(pid)
|
43
|
+
if !@server_instance
|
44
|
+
puts "*** ERROR: there doesn't seem to be a #{PROGRAM_NAME} instance running on PID #{pid}."
|
45
|
+
list_all_passenger_instances(AdminTools::ServerInstance.list)
|
46
|
+
puts
|
47
|
+
puts "Please pass `--instance <#{PROGRAM_NAME}> PID>` to select a specific #{PROGRAM_NAME} instance."
|
48
|
+
abort
|
49
|
+
end
|
50
|
+
else
|
51
|
+
server_instances = AdminTools::ServerInstance.list
|
52
|
+
if server_instances.empty?
|
53
|
+
abort "*** ERROR: Phusion Passenger doesn't seem to be running."
|
54
|
+
elsif server_instances.size == 1
|
55
|
+
@server_instance = server_instances.first
|
56
|
+
else
|
57
|
+
complain_that_multiple_passenger_instances_are_running(server_instances)
|
58
|
+
abort
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def complain_that_multiple_passenger_instances_are_running(server_instances)
|
64
|
+
puts "It appears that multiple #{PROGRAM_NAME} instances are running. Please select"
|
65
|
+
puts "a specific one by passing:"
|
66
|
+
puts
|
67
|
+
puts " --instance <#{PROGRAM_NAME} PID>"
|
68
|
+
puts
|
69
|
+
list_all_passenger_instances(server_instances)
|
70
|
+
abort
|
71
|
+
end
|
72
|
+
|
73
|
+
def list_all_passenger_instances(server_instances)
|
74
|
+
puts "The following #{PROGRAM_NAME} instances are running:"
|
75
|
+
server_instances.each do |instance|
|
76
|
+
begin
|
77
|
+
description = instance.web_server_description
|
78
|
+
rescue Errno::EACCES, Errno::ENOENT
|
79
|
+
description = nil
|
80
|
+
end
|
81
|
+
printf " PID: %-8s %s\n", instance.pid, description
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def connect_to_passenger_admin_socket(options)
|
86
|
+
return @server_instance.connect(options)
|
87
|
+
rescue AdminTools::ServerInstance::RoleDeniedError
|
88
|
+
PhusionPassenger.require_passenger_lib 'platform_info/ruby'
|
89
|
+
STDERR.puts "*** ERROR: You are not authorized to query the status for " +
|
90
|
+
"this #{PROGRAM_NAME} instance. Please try again with '#{PlatformInfo.ruby_sudo_command}'."
|
91
|
+
exit 2
|
92
|
+
rescue AdminTools::ServerInstance::CorruptedDirectoryError
|
93
|
+
STDERR.puts "*** ERROR: The server instance directory #{server_instance.path} is corrupted. " +
|
94
|
+
"This could have two causes:\n" +
|
95
|
+
"\n" +
|
96
|
+
" 1. The #{PROGRAM_NAME} instance is no longer running, but it failed to cleanup the directory. " +
|
97
|
+
"Please delete this directory and ignore the problem.\n" +
|
98
|
+
" 2. An external program corrupted the directory. Please restart this #{PROGRAM_NAME} instance.\n"
|
99
|
+
exit 2
|
100
|
+
end
|
101
|
+
|
102
|
+
def is_enterprise?
|
103
|
+
return defined?(PhusionPassenger::PASSENGER_IS_ENTERPRISE) && PhusionPassenger::PASSENGER_IS_ENTERPRISE
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
end # module Config
|
108
|
+
end # module PhusionPassenger
|