passenger 5.1.10 → 5.1.11
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.
- checksums.yaml +4 -4
- data/CHANGELOG +18 -0
- data/Rakefile +20 -17
- data/bin/passenger-install-apache2-module +14 -11
- data/build/agent.rb +45 -18
- data/build/apache2.rb +32 -16
- data/build/basics.rb +29 -40
- data/build/common_library.rb +70 -54
- data/build/cxx_tests.rb +34 -43
- data/build/integration_tests.rb +10 -10
- data/build/misc.rb +6 -6
- data/build/node_tests.rb +1 -2
- data/build/oxt_tests.rb +7 -5
- data/build/packaging.rb +11 -441
- data/build/ruby_extension.rb +1 -1
- data/build/ruby_tests.rb +1 -2
- data/build/support/cplusplus.rb +6 -5
- data/build/support/cxx_dependency_map.rb +357 -833
- data/build/support/general.rb +23 -1
- data/build/test_basics.rb +3 -28
- data/dev/ci/tests/rpm/Jenkinsfile +68 -0
- data/dev/ci/tests/rpm/run +63 -0
- data/dev/ci/tests/source-packaging/run +1 -1
- data/dev/ci/tests/source-packaging/setup +1 -1
- data/doc/{Packaging.txt.md → Packaging.md} +0 -0
- data/resources/templates/apache2/deployment_example.txt.erb +2 -2
- data/resources/templates/apache2/multiple_apache_installations_detected.txt.erb +2 -2
- data/resources/templates/nginx/deployment_example.txt.erb +1 -1
- data/resources/templates/standalone/mass_deployment_default_server.erb +2 -2
- data/resources/templates/standalone/server.erb +2 -2
- data/src/agent/AgentMain.cpp +0 -4
- data/src/agent/Core/CoreMain.cpp +88 -5
- data/src/agent/Core/SpawningKit/Spawner.h +2 -1
- data/src/agent/Shared/Fundamentals/AbortHandler.cpp +1109 -0
- data/src/agent/Shared/Fundamentals/AbortHandler.h +63 -0
- data/src/agent/Shared/Fundamentals/Implementation.cpp +7 -0
- data/src/agent/Shared/Fundamentals/Initialization.cpp +614 -0
- data/src/agent/Shared/{Base.h → Fundamentals/Initialization.h} +23 -14
- data/src/agent/Shared/Fundamentals/Utils.cpp +127 -0
- data/src/agent/Shared/Fundamentals/Utils.h +46 -0
- data/src/agent/TempDirToucher/TempDirToucherMain.cpp +1 -1
- data/src/agent/Watchdog/CoreWatcher.cpp +3 -1
- data/src/agent/Watchdog/InstanceDirToucher.cpp +90 -53
- data/src/agent/Watchdog/WatchdogMain.cpp +13 -29
- data/src/apache2_module/Hooks.cpp +4 -1
- data/src/cxx_supportlib/ConfigKit/Store.h +32 -5
- data/src/cxx_supportlib/Constants.h +1 -2
- data/src/cxx_supportlib/Crypto.cpp +2 -1
- data/src/cxx_supportlib/Hooks.h +16 -37
- data/src/cxx_supportlib/LoggingKit/Context.h +22 -0
- data/src/cxx_supportlib/LoggingKit/Forward.h +1 -0
- data/src/cxx_supportlib/LoggingKit/Implementation.cpp +106 -22
- data/src/cxx_supportlib/ProcessManagement/Ruby.cpp +106 -0
- data/src/{agent/UstRouter/FileSink.h → cxx_supportlib/ProcessManagement/Ruby.h} +23 -47
- data/src/cxx_supportlib/ProcessManagement/Spawn.cpp +199 -0
- data/src/cxx_supportlib/ProcessManagement/Spawn.h +150 -0
- data/src/cxx_supportlib/ProcessManagement/Utils.cpp +459 -0
- data/src/cxx_supportlib/ProcessManagement/Utils.h +107 -0
- data/src/cxx_supportlib/Utils.cpp +41 -561
- data/src/cxx_supportlib/Utils.h +0 -68
- data/src/cxx_supportlib/Utils/AsyncSignalSafeUtils.h +187 -0
- data/src/cxx_supportlib/Utils/ProcessMetricsCollector.h +14 -2
- data/src/cxx_supportlib/WatchdogLauncher.h +2 -12
- data/src/cxx_supportlib/oxt/dynamic_thread_group.hpp +2 -2
- data/src/cxx_supportlib/vendor-modified/jsoncpp/json-forwards.h +4 -0
- data/src/cxx_supportlib/vendor-modified/jsoncpp/json.h +16 -1
- data/src/cxx_supportlib/vendor-modified/jsoncpp/jsoncpp.cpp +12 -9
- data/src/cxx_supportlib/vendor-modified/libev/ev++.h +4 -4
- data/src/cxx_supportlib/vendor-modified/libev/ev.h +3 -3
- data/src/nginx_module/CacheLocationConfig.c +0 -75
- data/src/nginx_module/CacheLocationConfig.c.cxxcodebuilder +1 -0
- data/src/nginx_module/Configuration.c +0 -1
- data/src/nginx_module/Configuration.h +0 -1
- data/src/nginx_module/ConfigurationCommands.c +1 -1
- data/src/nginx_module/ContentHandler.c +0 -1
- data/src/nginx_module/ContentHandler.h +0 -1
- data/src/nginx_module/CreateLocationConfig.c +0 -5
- data/src/nginx_module/CreateLocationConfig.c.cxxcodebuilder +1 -0
- data/src/nginx_module/LocationConfig.h +0 -4
- data/src/nginx_module/LocationConfig.h.cxxcodebuilder +2 -1
- data/src/nginx_module/MergeLocationConfig.c +0 -12
- data/src/nginx_module/MergeLocationConfig.c.cxxcodebuilder +1 -0
- data/src/nginx_module/ngx_http_passenger_module.h +0 -1
- data/src/ruby_supportlib/phusion_passenger.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/common_library.rb +20 -11
- data/src/ruby_supportlib/phusion_passenger/config/api_call_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/reopen_logs_command.rb +0 -1
- data/src/ruby_supportlib/phusion_passenger/config/validate_install_command.rb +10 -3
- data/src/ruby_supportlib/phusion_passenger/console_text_template.rb +3 -1
- data/src/ruby_supportlib/phusion_passenger/constants.rb +0 -1
- data/src/ruby_supportlib/phusion_passenger/debug_logging.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb +32 -6
- data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +0 -1
- data/src/ruby_supportlib/phusion_passenger/packaging.rb +2 -4
- data/src/ruby_supportlib/phusion_passenger/platform_info/apache.rb +101 -20
- data/src/ruby_supportlib/phusion_passenger/platform_info/apache_detector.rb +21 -9
- data/src/ruby_supportlib/phusion_passenger/platform_info/compiler.rb +34 -31
- data/src/ruby_supportlib/phusion_passenger/platform_info/cxx_portability.rb +3 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/depcheck_specs/apache2.rb +2 -14
- data/src/ruby_supportlib/phusion_passenger/platform_info/operating_system.rb +40 -3
- data/src/ruby_supportlib/phusion_passenger/standalone/app_finder.rb +15 -14
- data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/config_utils.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb +8 -3
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command/nginx_engine.rb +19 -18
- data/src/ruby_supportlib/phusion_passenger/standalone/stop_command.rb +6 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller.rb +17 -1
- metadata +19 -97
- data/build/documentation.rb +0 -70
- data/doc/CloudLicensingConfiguration.html +0 -172
- data/doc/CloudLicensingConfiguration.txt.md +0 -3
- data/doc/Packaging.html +0 -488
- data/doc/Security of user switching support.idmap.txt +0 -34
- data/doc/Security of user switching support.txt +0 -197
- data/doc/ServerOptimizationGuide.html +0 -172
- data/doc/ServerOptimizationGuide.txt.md +0 -3
- data/doc/images/by_sa.png +0 -0
- data/doc/images/cloud_licensing_batch_job.png +0 -0
- data/doc/images/code_walkthrough.jpg +0 -0
- data/doc/images/direct_spawning.png +0 -0
- data/doc/images/direct_spawning.svg +0 -251
- data/doc/images/glyphicons-halflings-white.png +0 -0
- data/doc/images/glyphicons-halflings.png +0 -0
- data/doc/images/icons/README +0 -5
- data/doc/images/icons/callouts/1.png +0 -0
- data/doc/images/icons/callouts/10.png +0 -0
- data/doc/images/icons/callouts/11.png +0 -0
- data/doc/images/icons/callouts/12.png +0 -0
- data/doc/images/icons/callouts/13.png +0 -0
- data/doc/images/icons/callouts/14.png +0 -0
- data/doc/images/icons/callouts/15.png +0 -0
- data/doc/images/icons/callouts/2.png +0 -0
- data/doc/images/icons/callouts/3.png +0 -0
- data/doc/images/icons/callouts/4.png +0 -0
- data/doc/images/icons/callouts/5.png +0 -0
- data/doc/images/icons/callouts/6.png +0 -0
- data/doc/images/icons/callouts/7.png +0 -0
- data/doc/images/icons/callouts/8.png +0 -0
- data/doc/images/icons/callouts/9.png +0 -0
- data/doc/images/icons/caution.png +0 -0
- data/doc/images/icons/example.png +0 -0
- data/doc/images/icons/home.png +0 -0
- data/doc/images/icons/important.png +0 -0
- data/doc/images/icons/next.png +0 -0
- data/doc/images/icons/note.png +0 -0
- data/doc/images/icons/prev.png +0 -0
- data/doc/images/icons/tip.png +0 -0
- data/doc/images/icons/up.png +0 -0
- data/doc/images/icons/warning.png +0 -0
- data/doc/images/many_web_framework_protocols.png +0 -0
- data/doc/images/passenger_architecture.png +0 -0
- data/doc/images/passenger_architecture.svg +0 -385
- data/doc/images/passenger_architecture_overview.png +0 -0
- data/doc/images/passenger_core_architecture.png +0 -0
- data/doc/images/passenger_nodejs_architecture.svg +0 -558
- data/doc/images/phusion_banner.png +0 -0
- data/doc/images/rack.png +0 -0
- data/doc/images/smart_spawning.png +0 -0
- data/doc/images/smart_spawning.svg +0 -323
- data/doc/images/spawn_server_architecture.png +0 -0
- data/doc/images/spawn_server_architecture.svg +0 -655
- data/doc/images/spawning_preparation_work.png +0 -0
- data/doc/images/startup_sequence.png +0 -0
- data/doc/images/typical_isolated_web_application.png +0 -0
- data/doc/images/typical_isolated_web_application.svg +0 -213
- data/doc/users_guide_snippets/alternative_for_flying_passenger.txt +0 -1
- data/doc/users_guide_snippets/analysis_and_system_maintenance.txt +0 -61
- data/doc/users_guide_snippets/appendix_a_about.txt +0 -13
- data/doc/users_guide_snippets/appendix_b_terminology.txt +0 -71
- data/doc/users_guide_snippets/appendix_c_spawning_methods.txt +0 -36
- data/doc/users_guide_snippets/deployment_basics.txt +0 -37
- data/doc/users_guide_snippets/enterprise_only.txt +0 -1
- data/doc/users_guide_snippets/environment_variables.txt +0 -44
- data/doc/users_guide_snippets/global_queueing_explained.txt +0 -74
- data/doc/users_guide_snippets/installation.txt +0 -228
- data/doc/users_guide_snippets/installation/run_installer.txt +0 -58
- data/doc/users_guide_snippets/installation/verify_running_epilogue.txt +0 -6
- data/doc/users_guide_snippets/passenger_spawn_method.txt +0 -37
- data/doc/users_guide_snippets/rackup_specifications.txt +0 -1
- data/doc/users_guide_snippets/rvm_helper_tool.txt +0 -44
- data/doc/users_guide_snippets/since_version.txt +0 -1
- data/doc/users_guide_snippets/support_information.txt +0 -8
- data/doc/users_guide_snippets/tips.txt +0 -302
- data/doc/users_guide_snippets/troubleshooting/default.txt +0 -48
- data/doc/users_guide_snippets/troubleshooting/rails.txt +0 -59
- data/doc/users_guide_snippets/under_the_hood/page_caching_support.txt +0 -24
- data/doc/users_guide_snippets/under_the_hood/relationship_with_ruby.txt +0 -10
- data/doc/users_guide_snippets/where_to_get_support.txt +0 -9
- data/src/agent/Shared/Base.cpp +0 -1678
- data/src/agent/UstRouter/ApiServer.h +0 -292
- data/src/agent/UstRouter/Client.h +0 -112
- data/src/agent/UstRouter/Controller.h +0 -1309
- data/src/agent/UstRouter/LogSink.h +0 -145
- data/src/agent/UstRouter/OptionParser.h +0 -180
- data/src/agent/UstRouter/RemoteSender.h +0 -853
- data/src/agent/UstRouter/RemoteSink.h +0 -145
- data/src/agent/UstRouter/Transaction.h +0 -278
- data/src/agent/UstRouter/UstRouterMain.cpp +0 -681
- data/src/agent/Watchdog/UstRouterWatcher.cpp +0 -80
- data/src/ruby_supportlib/phusion_passenger/platform_info/macos.rb +0 -45
@@ -94,7 +94,7 @@ module PhusionPassenger
|
|
94
94
|
opts.on("-a", "--agent NAME", String, "The name of the socket to send the command#{nl}" +
|
95
95
|
"to. This specifies which agent the request#{nl}" +
|
96
96
|
"is sent to. Choices: watchdog_api,#{nl}" +
|
97
|
-
"core_api
|
97
|
+
"core_api.#{nl}" +
|
98
98
|
"Default: core_api") do |val|
|
99
99
|
options[:agent_name] = val
|
100
100
|
end
|
@@ -71,7 +71,6 @@ module PhusionPassenger
|
|
71
71
|
def perform_reopen_logs
|
72
72
|
perform_reopen_logs_on("watchdog", "watchdog_api")
|
73
73
|
perform_reinherit_logs_on("core", "core_api")
|
74
|
-
perform_reinherit_logs_on("UstRouter", "ust_router_api")
|
75
74
|
if using_standalone_nginx_engine?
|
76
75
|
perform_reopen_logs_on_nginx
|
77
76
|
end
|
@@ -379,7 +379,12 @@ module PhusionPassenger
|
|
379
379
|
checking "whether Apache is installed"
|
380
380
|
|
381
381
|
if PlatformInfo.httpd
|
382
|
-
|
382
|
+
# macOS >= 10.13 High Sierra no longer includes apxs2, but that's
|
383
|
+
# okay because we know Apache is installed
|
384
|
+
if PlatformInfo.apxs2 ||
|
385
|
+
(PlatformInfo.os_name_simple == 'macosx' &&
|
386
|
+
PlatformInfo.os_version >= '10.13' &&
|
387
|
+
PlatformInfo.httpd == '/usr/sbin/httpd')
|
383
388
|
check_ok
|
384
389
|
true
|
385
390
|
else
|
@@ -436,7 +441,9 @@ module PhusionPassenger
|
|
436
441
|
You are about to validate #{PROGRAM_NAME} against the following
|
437
442
|
Apache installation:
|
438
443
|
|
439
|
-
apxs2: #{PlatformInfo.apxs2}
|
444
|
+
apxs2 : #{PlatformInfo.apxs2 || 'OS-provided installation'}
|
445
|
+
Executable: #{PlatformInfo.httpd || 'unknown'}
|
446
|
+
Version : #{PlatformInfo.httpd_version || 'unknown'}
|
440
447
|
|
441
448
|
However, this Apache installation appears to be broken, so this program
|
442
449
|
cannot continue. To find out why this program thinks the above Apache
|
@@ -567,7 +574,7 @@ module PhusionPassenger
|
|
567
574
|
for Apache is not installed or not active. Please run the
|
568
575
|
#{PROGRAM_NAME} Apache module installer:
|
569
576
|
|
570
|
-
#{ruby_command} #{installer_command} --apxs2=#{PlatformInfo.apxs2}
|
577
|
+
#{ruby_command} #{installer_command} --apxs2=#{PlatformInfo.apxs2 || 'none'}
|
571
578
|
}
|
572
579
|
end
|
573
580
|
else
|
@@ -33,7 +33,9 @@ module PhusionPassenger
|
|
33
33
|
@buffer = ''
|
34
34
|
if input[:file]
|
35
35
|
filename = "#{PhusionPassenger.resources_dir}/templates/#{input[:file]}.txt.erb"
|
36
|
-
data = File.
|
36
|
+
data = File.open(filename, 'r:utf-8') do |f|
|
37
|
+
f.read
|
38
|
+
end
|
37
39
|
else
|
38
40
|
data = input[:text]
|
39
41
|
end
|
@@ -72,7 +72,6 @@ module PhusionPassenger
|
|
72
72
|
DEFAULT_UNION_STATION_GATEWAY_ADDRESS = "gateway.unionstationapp.com"
|
73
73
|
DEFAULT_UNION_STATION_GATEWAY_PORT = 443
|
74
74
|
DEFAULT_HTTP_SERVER_LISTEN_ADDRESS = "tcp://127.0.0.1:3000"
|
75
|
-
DEFAULT_UST_ROUTER_LISTEN_ADDRESS = "tcp://127.0.0.1:9344"
|
76
75
|
DEFAULT_LVE_MIN_UID = 500
|
77
76
|
|
78
77
|
# Size limits
|
@@ -112,7 +112,7 @@ module PhusionPassenger
|
|
112
112
|
output = @@stderr_evaluator.call
|
113
113
|
end
|
114
114
|
location = caller[nesting_level].sub(/.*phusion_passenger\//, '')
|
115
|
-
location.sub!(/(
|
115
|
+
location.sub!(/(.*?):.*/, '\1')
|
116
116
|
now = Time.now
|
117
117
|
time_str = now.strftime("%Y-%m-%d %H:%M:%S.")
|
118
118
|
time_str << sprintf("%04d", now.usec / 100)
|
@@ -27,6 +27,8 @@ PhusionPassenger.require_passenger_lib 'constants'
|
|
27
27
|
PhusionPassenger.require_passenger_lib 'public_api'
|
28
28
|
PhusionPassenger.require_passenger_lib 'ruby_core_enhancements'
|
29
29
|
PhusionPassenger.require_passenger_lib 'debug_logging'
|
30
|
+
PhusionPassenger.require_passenger_lib 'platform_info/ruby'
|
31
|
+
PhusionPassenger.require_passenger_lib 'platform_info/operating_system'
|
30
32
|
PhusionPassenger.require_passenger_lib 'utils/shellwords'
|
31
33
|
|
32
34
|
module PhusionPassenger
|
@@ -42,7 +44,8 @@ module PhusionPassenger
|
|
42
44
|
# unlikely to be changed.
|
43
45
|
dump_ruby_environment
|
44
46
|
check_rvm_using_wrapper_script(options)
|
45
|
-
|
47
|
+
load_macos_foundation
|
48
|
+
sanitize_spawn_options(options)
|
46
49
|
end
|
47
50
|
|
48
51
|
def check_rvm_using_wrapper_script(options)
|
@@ -78,6 +81,29 @@ module PhusionPassenger
|
|
78
81
|
puts
|
79
82
|
end
|
80
83
|
|
84
|
+
def load_macos_foundation
|
85
|
+
# Apple added an assertion in 10.13 that prevents anything Obj-C related
|
86
|
+
# from occuring between fork and exec. This workaround prevents the assertion.
|
87
|
+
# http://www.sealiesoftware.com/blog/archive/2017/6/5/Objective-C_and_fork_in_macOS_1013.html
|
88
|
+
# https://github.com/puma/puma/issues/1421
|
89
|
+
if PlatformInfo::RUBY_ENGINE == 'ruby' && PlatformInfo.os_name_simple == "macosx"
|
90
|
+
# Eager-load Foundation.framework, to ensure the Objective-C runtime
|
91
|
+
# exists well before any forking happens
|
92
|
+
begin
|
93
|
+
require 'fiddle'
|
94
|
+
rescue LoadError
|
95
|
+
return
|
96
|
+
end
|
97
|
+
if Fiddle.respond_to?(:dlopen)
|
98
|
+
begin
|
99
|
+
Fiddle.dlopen '/System/Library/Frameworks/Foundation.framework/Foundation'
|
100
|
+
rescue Fiddle::DLError => e
|
101
|
+
STDERR.puts "WARNING: #{e}"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
81
107
|
def to_boolean(value)
|
82
108
|
return !(value.nil? || value == false || value == "false")
|
83
109
|
end
|
@@ -267,8 +293,8 @@ module PhusionPassenger
|
|
267
293
|
require File.expand_path('config/setup_load_paths')
|
268
294
|
|
269
295
|
# Older versions of Bundler use .bundle/environment.rb as the Bundler
|
270
|
-
# environment lock file. This has been replaced by Gemfile.lock
|
271
|
-
# versions, but we still support the older mechanism.
|
296
|
+
# environment lock file. This has been replaced by Gemfile.lock/gems.locked
|
297
|
+
# in later versions, but we still support the older mechanism.
|
272
298
|
# If the Bundler environment lock file exists then load that. If it
|
273
299
|
# exists then there's a 99.9% chance that loading it is the correct
|
274
300
|
# thing to do.
|
@@ -284,9 +310,9 @@ module PhusionPassenger
|
|
284
310
|
# or the gems are not locked. In either case, we're supposed to call
|
285
311
|
# Bundler.setup.
|
286
312
|
#
|
287
|
-
# The existence of Gemfile indicates whether (2) is true:
|
288
|
-
elsif File.exist?('Gemfile')
|
289
|
-
# In case of Rails 3
|
313
|
+
# The existence of Gemfile/gems.rb indicates whether (2) is true:
|
314
|
+
elsif File.exist?('Gemfile') || File.exist?('gems.rb')
|
315
|
+
# In case of Rails 3+, config/boot.rb already calls Bundler.setup.
|
290
316
|
# However older versions of Rails may not so loading boot.rb might
|
291
317
|
# not be the correct thing to do. To be on the safe side we
|
292
318
|
# call Bundler.setup ourselves; calling Bundler.setup twice is
|
@@ -27,10 +27,7 @@ module PhusionPassenger
|
|
27
27
|
module Packaging
|
28
28
|
# Files that must be generated before packaging.
|
29
29
|
PREGENERATED_FILES = [
|
30
|
-
'src/cxx_supportlib/Constants.h'
|
31
|
-
'doc/Packaging.html',
|
32
|
-
'doc/CloudLicensingConfiguration.html',
|
33
|
-
'doc/ServerOptimizationGuide.html'
|
30
|
+
'src/cxx_supportlib/Constants.h'
|
34
31
|
]
|
35
32
|
|
36
33
|
USER_EXECUTABLES = [
|
@@ -90,6 +87,7 @@ module PhusionPassenger
|
|
90
87
|
'.github/*',
|
91
88
|
'.settings/*',
|
92
89
|
'.externalToolBuilders/*',
|
90
|
+
'.vscode/*',
|
93
91
|
'.cproject',
|
94
92
|
'.project',
|
95
93
|
'Gemfile',
|
@@ -48,7 +48,17 @@ module PhusionPassenger
|
|
48
48
|
# The absolute path to the 'apxs' or 'apxs2' executable, or nil if not found.
|
49
49
|
def self.apxs2
|
50
50
|
if env_defined?("APXS2")
|
51
|
-
|
51
|
+
if ENV['APXS2'] == 'none'
|
52
|
+
# This is a special value indicating that we should pretend as if
|
53
|
+
# apxs2 is not found. It is applicable when the user is running
|
54
|
+
# macOS >= 10.13 High Sierra, where apxs2 is not included in the OS.
|
55
|
+
# When the user runs 'passenger-config about detect-apache2',
|
56
|
+
# that command will tell the way to install against this specific
|
57
|
+
# Apache is to run passenger-install-apache2-module --apxs2-path='none'
|
58
|
+
return nil
|
59
|
+
else
|
60
|
+
return ENV["APXS2"]
|
61
|
+
end
|
52
62
|
end
|
53
63
|
['apxs2', 'apxs'].each do |name|
|
54
64
|
command = find_command(name)
|
@@ -70,7 +80,7 @@ module PhusionPassenger
|
|
70
80
|
# The absolute path to the Apache binary (that is, 'httpd', 'httpd2', 'apache'
|
71
81
|
# or 'apache2'), or nil if not found.
|
72
82
|
def self.httpd(options = {})
|
73
|
-
apxs2 = options
|
83
|
+
apxs2 = options.fetch(:apxs2, self.apxs2)
|
74
84
|
if env_defined?('HTTPD')
|
75
85
|
return ENV['HTTPD']
|
76
86
|
elsif apxs2.nil?
|
@@ -401,36 +411,42 @@ module PhusionPassenger
|
|
401
411
|
|
402
412
|
# The absolute path to the 'a2enmod' executable.
|
403
413
|
def self.a2enmod(options = {})
|
404
|
-
apxs2 = options
|
405
|
-
dir = File.dirname(apxs2)
|
414
|
+
apxs2 = options.fetch(:apxs2, self.apxs2)
|
415
|
+
dir = File.dirname(apxs2) if apxs2
|
406
416
|
# a2enmod is supposed to be a Debian extension that only works
|
407
417
|
# on the APT-installed Apache, so only return non-nil if we're
|
408
418
|
# working against the APT-installed Apache.
|
409
419
|
if dir == "/usr/bin" || dir == "/usr/sbin"
|
410
420
|
if env_defined?('A2ENMOD')
|
421
|
+
log "Using $A2ENMOD (= #{ENV['A2ENMOD']})"
|
411
422
|
return ENV['A2ENMOD']
|
412
423
|
else
|
413
424
|
return find_apache2_executable("a2enmod", options)
|
414
425
|
end
|
415
426
|
else
|
416
|
-
|
427
|
+
log "Not applicable"
|
428
|
+
nil
|
417
429
|
end
|
418
430
|
end
|
419
431
|
memoize :a2enmod
|
420
432
|
|
421
433
|
# The absolute path to the 'a2enmod' executable.
|
422
434
|
def self.a2dismod(options = {})
|
423
|
-
apxs2 = options
|
424
|
-
dir = File.dirname(apxs2)
|
435
|
+
apxs2 = options.fetch(:apxs2, self.apxs2)
|
436
|
+
dir = File.dirname(apxs2) if apxs2
|
425
437
|
# a2dismod is supposed to be a Debian extension that only works
|
426
438
|
# on the APT-installed Apache, so only return non-nil if we're
|
427
439
|
# working against the APT-installed Apache.
|
428
440
|
if dir == "/usr/bin" || dir == "/usr/sbin"
|
429
441
|
if env_defined?('A2DISMOD')
|
442
|
+
log "Using $A2DISMOD (= #{ENV['A2DISMOD']})"
|
430
443
|
return ENV['A2DISMOD']
|
431
444
|
else
|
432
445
|
return find_apache2_executable("a2dismod", options)
|
433
446
|
end
|
447
|
+
else
|
448
|
+
log "Not applicable"
|
449
|
+
nil
|
434
450
|
end
|
435
451
|
end
|
436
452
|
memoize :a2dismod
|
@@ -527,9 +543,16 @@ module PhusionPassenger
|
|
527
543
|
|
528
544
|
# The absolute path to the Apache 2 'bin' directory, or nil if unknown.
|
529
545
|
def self.apache2_bindir(options = {})
|
530
|
-
apxs2 = options
|
546
|
+
apxs2 = options.fetch(:apxs2, self.apxs2)
|
531
547
|
if apxs2.nil?
|
532
|
-
|
548
|
+
# macOS >= 10.13 High Sierra no longer ships apxs2, so we'll use
|
549
|
+
# a hardcoded default.
|
550
|
+
if os_name_simple == 'macosx' && os_version >= '10.13' \
|
551
|
+
&& httpd(:apxs2 => apxs2) == '/usr/sbin/httpd'
|
552
|
+
'/usr/bin'
|
553
|
+
else
|
554
|
+
nil
|
555
|
+
end
|
533
556
|
else
|
534
557
|
return `#{apxs2} -q BINDIR 2>/dev/null`.strip
|
535
558
|
end
|
@@ -538,9 +561,16 @@ module PhusionPassenger
|
|
538
561
|
|
539
562
|
# The absolute path to the Apache 2 'sbin' directory, or nil if unknown.
|
540
563
|
def self.apache2_sbindir(options = {})
|
541
|
-
apxs2 = options
|
564
|
+
apxs2 = options.fetch(:apxs2, self.apxs2)
|
542
565
|
if apxs2.nil?
|
543
|
-
|
566
|
+
# macOS >= 10.13 High Sierra no longer ships apxs2, so we'll use
|
567
|
+
# a hardcoded default.
|
568
|
+
if os_name_simple == 'macosx' && os_version >= '10.13' \
|
569
|
+
&& httpd(:apxs2 => apxs2) == '/usr/sbin/httpd'
|
570
|
+
'/usr/sbin'
|
571
|
+
else
|
572
|
+
nil
|
573
|
+
end
|
544
574
|
else
|
545
575
|
return `#{apxs2} -q SBINDIR`.strip
|
546
576
|
end
|
@@ -578,7 +608,14 @@ module PhusionPassenger
|
|
578
608
|
flags << apu_cxxflags
|
579
609
|
end
|
580
610
|
end
|
581
|
-
if
|
611
|
+
if apxs2.nil?
|
612
|
+
# macOS >= 10.13 High Sierra no longer includes apxs2
|
613
|
+
# so we'll use hardcoded paths here.
|
614
|
+
if os_name_simple == 'macosx' && os_version >= '10.13' && httpd == '/usr/sbin/httpd'
|
615
|
+
xcode_prefix = `/usr/bin/xcode-select -p`.strip
|
616
|
+
flags << "-I#{xcode_prefix}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/apache2"
|
617
|
+
end
|
618
|
+
else
|
582
619
|
apxs2_flags = `#{apxs2} -q CFLAGS`.strip << " -I" << `#{apxs2} -q INCLUDEDIR`.strip
|
583
620
|
apxs2_flags.gsub!(/-O\d? /, '')
|
584
621
|
|
@@ -613,6 +650,12 @@ module PhusionPassenger
|
|
613
650
|
# https://github.com/phusion/passenger/issues/1756
|
614
651
|
apxs2_flags.gsub!('-pie', '')
|
615
652
|
|
653
|
+
# macOS >= 10.12 Sierra no longer includes apr-config
|
654
|
+
# so we'll use a hardcoded path here.
|
655
|
+
if os_name_simple == 'macosx' && os_version >= '10.12' && httpd == '/usr/sbin/httpd'
|
656
|
+
apxs2_flags << ' -I/usr/include/apr-1'
|
657
|
+
end
|
658
|
+
|
616
659
|
apxs2_flags.strip!
|
617
660
|
flags << apxs2_flags
|
618
661
|
end
|
@@ -728,24 +771,54 @@ module PhusionPassenger
|
|
728
771
|
|
729
772
|
################ Miscellaneous information ################
|
730
773
|
|
774
|
+
# Returns whether it is necessary to use information outputted by 'apxs2'
|
775
|
+
# in order to compile an Apache module.
|
776
|
+
#
|
777
|
+
# Since macOS 10.13 High Sierra apxs2 is no longer included in the
|
778
|
+
# operating system, so we return false in that case. We'll fallback
|
779
|
+
# to hardcoded paths.
|
780
|
+
def self.apxs2_needed_for_building_apache_modules?
|
781
|
+
!(os_name_simple == 'macosx' &&
|
782
|
+
os_version >= '10.13' &&
|
783
|
+
httpd == '/usr/sbin/httpd')
|
784
|
+
end
|
785
|
+
|
731
786
|
# Returns whether it is necessary to use information outputted by
|
732
787
|
# 'apr-config' and 'apu-config' in order to compile an Apache module.
|
788
|
+
#
|
733
789
|
# When Apache is installed with --with-included-apr, the APR/APU
|
734
790
|
# headers are placed into the same directory as the Apache headers,
|
735
791
|
# and so 'apr-config' and 'apu-config' won't be necessary in that case.
|
792
|
+
#
|
793
|
+
# Also, since macOS 10.12 Sierra apr-config is no longer included
|
794
|
+
# in the operating system, so we also return false in that case.
|
795
|
+
# We'll fallback to hardcoded paths.
|
736
796
|
def self.apr_config_needed_for_building_apache_modules?
|
737
|
-
|
738
|
-
|
797
|
+
!(
|
798
|
+
os_name_simple == 'macosx' &&
|
799
|
+
os_version >= '10.13' &&
|
800
|
+
httpd == '/usr/sbin/httpd'
|
801
|
+
) &&
|
802
|
+
!try_compile("whether APR is needed for building Apache modules",
|
803
|
+
:c, "#include <apr.h>\n", apache2_module_cflags(false))
|
739
804
|
end
|
740
805
|
memoize :apr_config_needed_for_building_apache_modules?, true
|
741
806
|
|
742
807
|
private
|
743
808
|
def self.determine_apr_info(language)
|
744
809
|
if apr_config.nil?
|
745
|
-
if os_name_simple == 'macosx' &&
|
746
|
-
# macOS 10.12 Sierra does not supply apr-config, so
|
810
|
+
if os_name_simple == 'macosx' && httpd == '/usr/sbin/httpd'
|
811
|
+
# macOS >= 10.12 Sierra does not supply apr-config, so
|
747
812
|
# we use hardcoded defaults.
|
748
|
-
|
813
|
+
if os_version >= '10.13'
|
814
|
+
# On macOS >= 10.13 High Sierra /usr/include no longer
|
815
|
+
# exists.
|
816
|
+
xcode_prefix = `/usr/bin/xcode-select -p`.strip
|
817
|
+
["-I#{xcode_prefix}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/apr-1",
|
818
|
+
'-lapr-1']
|
819
|
+
else
|
820
|
+
['-I/usr/include/apr-1', '-lapr-1']
|
821
|
+
end
|
749
822
|
else
|
750
823
|
[nil, nil]
|
751
824
|
end
|
@@ -783,10 +856,18 @@ module PhusionPassenger
|
|
783
856
|
|
784
857
|
def self.determine_apu_info(language)
|
785
858
|
if apu_config.nil?
|
786
|
-
if os_name_simple == 'macosx' &&
|
787
|
-
# macOS 10.12 Sierra does not supply apu-config, so
|
859
|
+
if os_name_simple == 'macosx' && httpd == '/usr/sbin/httpd'
|
860
|
+
# macOS >= 10.12 Sierra does not supply apu-config, so
|
788
861
|
# we use hardcoded defaults.
|
789
|
-
|
862
|
+
if os_version >= '10.13'
|
863
|
+
# On macOS >= 10.13 High Sierra /usr/include no longer
|
864
|
+
# exists.
|
865
|
+
xcode_prefix = `/usr/bin/xcode-select -p`.strip
|
866
|
+
["-I#{xcode_prefix}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/apr-1",
|
867
|
+
'-laprutil-1']
|
868
|
+
else
|
869
|
+
['-I/usr/include/apr-1', '-laprutil-1']
|
870
|
+
end
|
790
871
|
else
|
791
872
|
[nil, nil]
|
792
873
|
end
|
@@ -63,7 +63,7 @@ module PhusionPassenger
|
|
63
63
|
def report
|
64
64
|
log " <b>* Found Apache #{version}!</b>"
|
65
65
|
log " Information:"
|
66
|
-
log " apxs2 : #{apxs2}"
|
66
|
+
log " apxs2 : #{apxs2 || 'N/A'}"
|
67
67
|
log " Main executable: #{httpd}"
|
68
68
|
log " Control command: #{ctl}"
|
69
69
|
log " Config file : #{config_file || 'unknown'}"
|
@@ -76,7 +76,7 @@ module PhusionPassenger
|
|
76
76
|
end
|
77
77
|
log ""
|
78
78
|
log " To install #{PROGRAM_NAME} against this specific Apache version:"
|
79
|
-
log " #{PlatformInfo.ruby_command} #{PhusionPassenger.bin_dir}/passenger-install-apache2-module --apxs2-path='#{apxs2}'"
|
79
|
+
log " #{PlatformInfo.ruby_command} #{PhusionPassenger.bin_dir}/passenger-install-apache2-module --apxs2-path='#{apxs2 || 'none'}'"
|
80
80
|
log ""
|
81
81
|
log " To start, stop or restart this specific Apache version:"
|
82
82
|
log " #{ctl} start"
|
@@ -121,7 +121,7 @@ module PhusionPassenger
|
|
121
121
|
log "<banner>Looking for possible Apache installations...</banner>"
|
122
122
|
apxses = PlatformInfo.find_all_commands("apxs2") +
|
123
123
|
PlatformInfo.find_all_commands("apxs")
|
124
|
-
if !apxses.include?(PlatformInfo.apxs2)
|
124
|
+
if PlatformInfo.apxs2 && !apxses.include?(PlatformInfo.apxs2)
|
125
125
|
PlatformInfo.send(:log, "Looking for #{PlatformInfo.apxs2}: found")
|
126
126
|
apxses << PlatformInfo.apxs2
|
127
127
|
end
|
@@ -130,10 +130,17 @@ module PhusionPassenger
|
|
130
130
|
apxses.each do |apxs2|
|
131
131
|
detect_one(apxs2)
|
132
132
|
end
|
133
|
+
# macOS >= 10.13 High Sierra no longer ships apxs2, but we'll want to perform
|
134
|
+
# an autodetection run against the OS-provided Apache installation anyway.
|
135
|
+
if PlatformInfo.os_name_simple == 'macosx' && PlatformInfo.os_version >= '10.13'
|
136
|
+
detect_one(nil)
|
137
|
+
end
|
133
138
|
end
|
134
139
|
|
135
140
|
def detect_one(apxs2)
|
136
|
-
|
141
|
+
# Note: apxs2 is nil on macOS 10.13 High Sierra. See comment in #detect_all.
|
142
|
+
apxs2_description = apxs2 || 'OS-default Apache installation'
|
143
|
+
log "<banner>Analyzing #{apxs2_description}...</banner>"
|
137
144
|
add_result do |result|
|
138
145
|
result.apxs2 = apxs2
|
139
146
|
log "Detecting main Apache executable..."
|
@@ -154,7 +161,9 @@ module PhusionPassenger
|
|
154
161
|
end
|
155
162
|
if result.httpd
|
156
163
|
log "Detecting configuration file location..."
|
157
|
-
result.config_file = PlatformInfo.httpd_default_config_file(
|
164
|
+
result.config_file = PlatformInfo.httpd_default_config_file(
|
165
|
+
:httpd => result.httpd,
|
166
|
+
:apache2ctl => result.ctl)
|
158
167
|
if result.config_file
|
159
168
|
log " --> #{result.config_file}"
|
160
169
|
else
|
@@ -163,7 +172,9 @@ module PhusionPassenger
|
|
163
172
|
end
|
164
173
|
if result.httpd
|
165
174
|
log "Detecting error log file..."
|
166
|
-
result.error_log = PlatformInfo.httpd_actual_error_log(
|
175
|
+
result.error_log = PlatformInfo.httpd_actual_error_log(
|
176
|
+
:httpd => result.httpd,
|
177
|
+
:apache2ctl => result.ctl)
|
167
178
|
if result.error_log
|
168
179
|
log " --> #{result.error_log}"
|
169
180
|
else
|
@@ -176,13 +187,14 @@ module PhusionPassenger
|
|
176
187
|
result.a2dismod = PlatformInfo.a2dismod(:apxs2 => apxs2)
|
177
188
|
end
|
178
189
|
if result.httpd
|
179
|
-
result.config_file_broken = PlatformInfo.apache2ctl_V(:apxs2 => apxs2
|
190
|
+
result.config_file_broken = PlatformInfo.apache2ctl_V(:apxs2 => apxs2,
|
191
|
+
:apache2ctl => result.ctl).nil?
|
180
192
|
end
|
181
193
|
if result.httpd
|
182
|
-
log "<green>Found a usable Apache installation using #{
|
194
|
+
log "<green>Found a usable Apache installation using #{apxs2_description}.</green>"
|
183
195
|
true
|
184
196
|
else
|
185
|
-
log "<yellow>Cannot find a usable Apache installation using #{
|
197
|
+
log "<yellow>Cannot find a usable Apache installation using #{apxs2_description}.</yellow>"
|
186
198
|
false
|
187
199
|
end
|
188
200
|
end
|