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
@@ -344,6 +344,13 @@ module PhusionPassenger
|
|
344
344
|
end
|
345
345
|
memoize :cc_supports_visibility_flag?, true
|
346
346
|
|
347
|
+
def self.cc_supports_fno_limit_debug_info_flag?
|
348
|
+
try_compile_with_warning_flag(
|
349
|
+
"Checking for C compiler '-fno-limit-debug-info' support",
|
350
|
+
:c, '', '-fno-limit-debug-info')
|
351
|
+
end
|
352
|
+
memoize :cc_supports_fno_limit_debug_info_flag?
|
353
|
+
|
347
354
|
def self.cxx_supports_visibility_flag?
|
348
355
|
return false if os_name_simple == "aix"
|
349
356
|
return try_compile("Checking for C++ compiler '-fvisibility' support",
|
@@ -386,6 +393,13 @@ module PhusionPassenger
|
|
386
393
|
end
|
387
394
|
memoize :cxx_supports_wno_unused_local_typedefs_flag?, true
|
388
395
|
|
396
|
+
def self.cxx_supports_fno_limit_debug_info_flag?
|
397
|
+
try_compile_with_warning_flag(
|
398
|
+
"Checking for C++ compiler '-fno-limit-debug-info' support",
|
399
|
+
:cxx, '', '-fno-limit-debug-info')
|
400
|
+
end
|
401
|
+
memoize :cxx_supports_fno_limit_debug_info_flag?
|
402
|
+
|
389
403
|
def self.cc_supports_no_tls_direct_seg_refs_option?
|
390
404
|
return try_compile("Checking for C compiler '-mno-tls-direct-seg-refs' support",
|
391
405
|
:c, '', '-mno-tls-direct-seg-refs')
|
@@ -489,7 +503,7 @@ module PhusionPassenger
|
|
489
503
|
:c, "int main() { return 0; }\n", '-ldl')
|
490
504
|
end
|
491
505
|
memoize :has_dl_library?, true
|
492
|
-
|
506
|
+
|
493
507
|
def self.has_alloca_h?
|
494
508
|
return try_compile("Checking for alloca.h",
|
495
509
|
:c, '#include <alloca.h>')
|
@@ -513,44 +527,33 @@ module PhusionPassenger
|
|
513
527
|
#
|
514
528
|
# In any case we'll always want to use -ggdb for better GDB debugging.
|
515
529
|
if cc_is_gcc?
|
516
|
-
|
530
|
+
result = '-ggdb'
|
517
531
|
else
|
518
|
-
|
519
|
-
end
|
520
|
-
end
|
521
|
-
|
522
|
-
def self.dmalloc_ldflags
|
523
|
-
if !ENV['DMALLOC_LIBS'].to_s.empty?
|
524
|
-
return ENV['DMALLOC_LIBS']
|
532
|
+
result = '-g'
|
525
533
|
end
|
526
|
-
if
|
527
|
-
|
528
|
-
filename = "#{prefix}/lib/libdmallocthcxx.a"
|
529
|
-
if File.exist?(filename)
|
530
|
-
return filename
|
531
|
-
end
|
532
|
-
end
|
533
|
-
return nil
|
534
|
-
else
|
535
|
-
return "-ldmallocthcxx"
|
534
|
+
if cc_supports_fno_limit_debug_info_flag?
|
535
|
+
result << ' -fno-limit-debug-info'
|
536
536
|
end
|
537
|
+
result
|
537
538
|
end
|
538
|
-
memoize :dmalloc_ldflags
|
539
539
|
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
540
|
+
# C++ compiler flags that should be passed in order to enable debugging information.
|
541
|
+
def self.debugging_cxxflags
|
542
|
+
# According to OpenBSD's pthreads man page, pthreads do not work
|
543
|
+
# correctly when an app is compiled with -g. It recommends using
|
544
|
+
# -ggdb instead.
|
545
|
+
#
|
546
|
+
# In any case we'll always want to use -ggdb for better GDB debugging.
|
547
|
+
if cc_is_gcc?
|
548
|
+
result = '-ggdb'
|
549
549
|
else
|
550
|
-
|
550
|
+
result = '-g'
|
551
|
+
end
|
552
|
+
if cxx_supports_fno_limit_debug_info_flag?
|
553
|
+
result << ' -fno-limit-debug-info'
|
551
554
|
end
|
555
|
+
result
|
552
556
|
end
|
553
|
-
memoize :electric_fence_ldflags
|
554
557
|
|
555
558
|
def self.export_dynamic_flags
|
556
559
|
if os_name_simple == "linux"
|
@@ -144,7 +144,6 @@ module PhusionPassenger
|
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
|
-
flags << debugging_cflags
|
148
147
|
flags << '-DHAS_ALLOCA_H' if has_alloca_h?
|
149
148
|
flags << '-DHAVE_ACCEPT4' if has_accept4?
|
150
149
|
flags << '-DHAS_SFENCE' if supports_sfence_instruction?
|
@@ -152,6 +151,7 @@ module PhusionPassenger
|
|
152
151
|
flags << "-DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS"
|
153
152
|
|
154
153
|
if cc_or_cxx == :cxx
|
154
|
+
flags << debugging_cxxflags
|
155
155
|
flags << cxx_11_flag if cxx_11_flag
|
156
156
|
|
157
157
|
if cxx_supports_wno_unused_local_typedefs_flag?
|
@@ -164,6 +164,8 @@ module PhusionPassenger
|
|
164
164
|
check_unordered_map(flags, "std::unordered_map", "unordered_map", "HAS_UNORDERED_MAP") ||
|
165
165
|
check_unordered_map(flags, "std::tr1::unordered_map", "unordered_map", "HAS_TR1_UNORDERED_MAP") ||
|
166
166
|
check_hash_map(flags)
|
167
|
+
else
|
168
|
+
flags << debugging_cflags
|
167
169
|
end
|
168
170
|
|
169
171
|
if os_name_simple == "solaris"
|
@@ -103,13 +103,7 @@ define 'apr-dev' do
|
|
103
103
|
emerge "apr"
|
104
104
|
end
|
105
105
|
on :macosx do
|
106
|
-
|
107
|
-
if PlatformInfo.macos_version >= 12
|
108
|
-
brew_install "apr"
|
109
|
-
brew_link "apr"
|
110
|
-
else
|
111
|
-
install_osx_command_line_tools
|
112
|
-
end
|
106
|
+
install_osx_command_line_tools
|
113
107
|
end
|
114
108
|
end
|
115
109
|
|
@@ -139,12 +133,6 @@ define 'apu-dev' do
|
|
139
133
|
yum_install "apr-util-devel"
|
140
134
|
end
|
141
135
|
on :macosx do
|
142
|
-
|
143
|
-
if PlatformInfo.macos_version >= 12
|
144
|
-
brew_install "apr-util"
|
145
|
-
brew_link "apr-util"
|
146
|
-
else
|
147
|
-
install_osx_command_line_tools
|
148
|
-
end
|
136
|
+
install_osx_command_line_tools
|
149
137
|
end
|
150
138
|
end
|
@@ -49,15 +49,52 @@ module PhusionPassenger
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
memoize :os_name_simple
|
52
|
-
|
53
|
-
# Returns the operating system's name exactly as advertised by the system. While it is
|
54
|
-
# in lowercase and contains no spaces, it can contain things like version number or
|
52
|
+
|
53
|
+
# Returns the operating system's name exactly as advertised by the system. While it is
|
54
|
+
# in lowercase and contains no spaces, it can contain things like version number or
|
55
55
|
# may be less intuitive (e.g. "darwin" for OS X).
|
56
56
|
def self.os_name_full
|
57
57
|
rb_config['target_os']
|
58
58
|
end
|
59
59
|
memoize :os_name_full
|
60
60
|
|
61
|
+
# Returns the operating system's version number, or nil if unknown.
|
62
|
+
# This includes the patch version, so for example on macOS Sierra
|
63
|
+
# it could return "10.12.5".
|
64
|
+
#
|
65
|
+
# On Debian/Ubuntu, this returns the version number (e.g. "16.04")
|
66
|
+
# as opposed to the codename ("Trusty").
|
67
|
+
def self.os_version
|
68
|
+
case os_name_simple
|
69
|
+
when 'macosx'
|
70
|
+
`/usr/bin/sw_vers -productVersion`.strip.split.last
|
71
|
+
|
72
|
+
when 'linux'
|
73
|
+
# Parse LSB (applicable to e.g. Ubuntu)
|
74
|
+
if read_file('/etc/lsb-release') =~ /DISTRIB_RELEASE=(.+)/
|
75
|
+
version = $1.gsub(/["']/, '')
|
76
|
+
return version if !version.empty?
|
77
|
+
end
|
78
|
+
|
79
|
+
# Parse CentOS/RedHat
|
80
|
+
data = read_file('/etc/centos-release')
|
81
|
+
data = read_file('/etc/redhat-release') if data.empty?
|
82
|
+
if !data.empty?
|
83
|
+
data =~ /^(.+?) (Linux )?(release |version )?(.+?)( |$)/i
|
84
|
+
return $4 if $4
|
85
|
+
end
|
86
|
+
|
87
|
+
if File.exist?('/etc/debian_version')
|
88
|
+
return read_file('/etc/debian_version').strip
|
89
|
+
end
|
90
|
+
|
91
|
+
nil
|
92
|
+
|
93
|
+
else
|
94
|
+
nil
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
61
98
|
# The current platform's shared library extension ('so' on most Unices).
|
62
99
|
def self.library_extension
|
63
100
|
if os_name_simple == "macosx"
|
@@ -44,23 +44,14 @@ module PhusionPassenger
|
|
44
44
|
attr_reader :apps
|
45
45
|
attr_reader :execution_root
|
46
46
|
|
47
|
-
def self.looks_like_app_directory?(dir, options = {})
|
48
|
-
options = options.dup
|
49
|
-
ConfigUtils.load_local_config_file!(dir, options)
|
50
|
-
return options[:app_type] ||
|
51
|
-
STARTUP_FILES.any? do |file|
|
52
|
-
File.exist?("#{dir}/#{file}")
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
47
|
def self.supports_multi?
|
57
48
|
false
|
58
49
|
end
|
59
50
|
|
60
|
-
def initialize(dirs, options = {})
|
51
|
+
def initialize(dirs, options = {}, local_options = {})
|
61
52
|
@dirs = dirs
|
62
53
|
@options = options.dup
|
63
|
-
determine_mode_and_execution_root(options)
|
54
|
+
determine_mode_and_execution_root(options, local_options)
|
64
55
|
end
|
65
56
|
|
66
57
|
def scan
|
@@ -150,8 +141,18 @@ module PhusionPassenger
|
|
150
141
|
end
|
151
142
|
end
|
152
143
|
|
153
|
-
|
154
|
-
|
144
|
+
# Only pass `local_options` if the directory that you're checking is
|
145
|
+
# the directory that should be used in single mode.
|
146
|
+
#
|
147
|
+
# `local_options` must be the the value obtained from
|
148
|
+
# `ConfigUtils.load_local_config_file_from_app_dir_param!`.
|
149
|
+
def looks_like_app_directory?(dir, options = {}, local_options = {})
|
150
|
+
options = options.dup
|
151
|
+
ConfigUtils.load_local_config_file!(dir, options)
|
152
|
+
options[:app_type] ||
|
153
|
+
STARTUP_FILES.any? do |file|
|
154
|
+
File.exist?("#{dir}/#{file}")
|
155
|
+
end
|
155
156
|
end
|
156
157
|
|
157
158
|
def filename_to_server_names(filename)
|
@@ -170,7 +171,7 @@ module PhusionPassenger
|
|
170
171
|
return !!select([io], nil, nil, timeout)
|
171
172
|
end
|
172
173
|
|
173
|
-
def determine_mode_and_execution_root(options)
|
174
|
+
def determine_mode_and_execution_root(options, local_options)
|
174
175
|
@mode = :single
|
175
176
|
if @dirs.empty?
|
176
177
|
@execution_root = Dir.logical_pwd
|
@@ -246,7 +246,7 @@ module PhusionPassenger
|
|
246
246
|
:name => :spawn_method,
|
247
247
|
:type_desc => 'NAME',
|
248
248
|
:default => PlatformInfo.ruby_supports_fork? ? DEFAULT_SPAWN_METHOD : 'direct',
|
249
|
-
:desc => 'The spawn method to use. Default:
|
249
|
+
:desc => 'The spawn method to use. Default: see docs'
|
250
250
|
},
|
251
251
|
{
|
252
252
|
:name => :static_files_dir,
|
@@ -98,7 +98,7 @@ module PhusionPassenger
|
|
98
98
|
# If you add or change an option, make sure to update the following places too:
|
99
99
|
# - src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb,
|
100
100
|
# function #build_daemon_controller_options
|
101
|
-
# - resources/templates/config
|
101
|
+
# - resources/templates/standalone/config.erb
|
102
102
|
OptionParser.new do |opts|
|
103
103
|
defaults = CONFIG_DEFAULTS
|
104
104
|
nl = "\n" + ' ' * 37
|
@@ -286,7 +286,7 @@ module PhusionPassenger
|
|
286
286
|
|
287
287
|
def find_apps
|
288
288
|
PhusionPassenger.require_passenger_lib 'standalone/app_finder'
|
289
|
-
@app_finder = AppFinder.new(@argv, @options)
|
289
|
+
@app_finder = AppFinder.new(@argv, @options, @local_options)
|
290
290
|
@apps = @app_finder.scan
|
291
291
|
if @app_finder.multi_mode? && @options[:engine] != 'nginx'
|
292
292
|
puts "Mass deployment enabled, so forcing engine to 'nginx'."
|
@@ -535,7 +535,12 @@ module PhusionPassenger
|
|
535
535
|
@engine.stop
|
536
536
|
STDOUT.puts " done"
|
537
537
|
STDOUT.flush
|
538
|
-
|
538
|
+
if @options[:engine] == "nginx" && @options[:socket_file]
|
539
|
+
begin
|
540
|
+
File.delete(@options[:socket_file])
|
541
|
+
rescue Errno::ENOENT
|
542
|
+
end
|
543
|
+
end
|
539
544
|
end
|
540
545
|
@engine = nil
|
541
546
|
end
|
@@ -40,8 +40,8 @@ module PhusionPassenger
|
|
40
40
|
private
|
41
41
|
def start_engine_real
|
42
42
|
write_nginx_config_file(nginx_config_path)
|
43
|
-
maybe_debug_nginx_config
|
44
|
-
test_nginx_config
|
43
|
+
maybe_debug_nginx_config(nginx_config_path)
|
44
|
+
test_nginx_config(nginx_config_path, 'nginx.conf')
|
45
45
|
|
46
46
|
Standalone::ControlUtils.require_daemon_controller
|
47
47
|
@engine = DaemonController.new(build_daemon_controller_options)
|
@@ -97,45 +97,45 @@ module PhusionPassenger
|
|
97
97
|
end
|
98
98
|
|
99
99
|
|
100
|
-
def maybe_debug_nginx_config
|
100
|
+
def maybe_debug_nginx_config(path)
|
101
101
|
if @options[:debug_nginx_config]
|
102
|
-
File.open(
|
102
|
+
File.open(path, 'rb') do |f|
|
103
103
|
puts(f.read)
|
104
104
|
end
|
105
105
|
exit
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
|
-
def test_nginx_config
|
109
|
+
def test_nginx_config(path, file)
|
110
110
|
command = "#{Shellwords.escape @nginx_binary}" \
|
111
|
-
" -c #{Shellwords.escape
|
111
|
+
" -c #{Shellwords.escape path}" \
|
112
112
|
" -p #{Shellwords.escape @working_dir}" \
|
113
113
|
" -t"
|
114
114
|
output = `#{command} 2>&1`
|
115
115
|
if $? && $?.exitstatus != 0
|
116
|
-
output.gsub!(
|
116
|
+
output.gsub!(path, file)
|
117
117
|
output = PlatformInfo.send(:reindent, output, 4)
|
118
118
|
|
119
119
|
message = "*** ERROR: the Nginx configuration that #{PROGRAM_NAME}" \
|
120
120
|
" Standalone generated internally contains problems. The error " \
|
121
121
|
"message returned by the Nginx engine is:\n\n" \
|
122
122
|
"#{output}\n\n"
|
123
|
-
|
123
|
+
debug_log_file = Utils::TmpIO.new('passenger-standalone',
|
124
|
+
:suffix => '.log', :binary => true, :unlink_immediately => false)
|
125
|
+
begin
|
126
|
+
File.open(path, 'rb') do |f|
|
127
|
+
debug_log_file.write(f.read)
|
128
|
+
end
|
129
|
+
ensure
|
130
|
+
debug_log_file.close
|
131
|
+
end
|
132
|
+
if @options[:nginx_config_template] && file == 'nginx.conf'
|
124
133
|
message << "This probably means that you have a problem in your " \
|
125
134
|
"Nginx configuration template. Please fix your template.\n\n" \
|
126
135
|
"Tip: to debug your template, re-run #{SHORT_PROGRAM_NAME} " \
|
127
136
|
"Standalone with the `--debug-nginx-config` option. This " \
|
128
137
|
"allows you to see how the final Nginx config file looks like."
|
129
138
|
else
|
130
|
-
debug_log_file = Utils::TmpIO.new('passenger-standalone',
|
131
|
-
:suffix => '.log', :binary => true, :unlink_immediately => false)
|
132
|
-
begin
|
133
|
-
File.open(nginx_config_path, 'rb') do |f|
|
134
|
-
debug_log_file.write(f.read)
|
135
|
-
end
|
136
|
-
ensure
|
137
|
-
debug_log_file.close
|
138
|
-
end
|
139
139
|
message << "This probably means that you have found a bug in " \
|
140
140
|
"#{PROGRAM_NAME} Standalone. Please report this bug to our " \
|
141
141
|
"Github issue tracker: https://github.com/phusion/passenger/issues\n\n" \
|
@@ -167,7 +167,8 @@ module PhusionPassenger
|
|
167
167
|
:log_file => @options[:log_file],
|
168
168
|
:start_timeout => 25,
|
169
169
|
:stop_timeout => 60,
|
170
|
-
:log_file_activity_timeout => 12
|
170
|
+
:log_file_activity_timeout => 12,
|
171
|
+
:dont_stop_if_pid_file_invalid => true
|
171
172
|
}
|
172
173
|
end
|
173
174
|
|
@@ -48,7 +48,12 @@ module PhusionPassenger
|
|
48
48
|
end
|
49
49
|
if running
|
50
50
|
@controller.stop
|
51
|
-
|
51
|
+
if @options[:engine] == "nginx" && @options[:socket_file]
|
52
|
+
begin
|
53
|
+
File.delete(@options[:socket_file])
|
54
|
+
rescue Errno::ENOENT
|
55
|
+
end
|
56
|
+
end
|
52
57
|
else
|
53
58
|
Standalone::ControlUtils.warn_pid_file_not_found(@options)
|
54
59
|
exit 1
|
@@ -167,6 +167,14 @@ class DaemonController
|
|
167
167
|
#
|
168
168
|
# The default value is 7.
|
169
169
|
#
|
170
|
+
# [:dont_stop_if_pid_file_invalid]
|
171
|
+
# If the :stop_command option is given, then normally daemon_controller will
|
172
|
+
# always execute this command upon calling #stop. But if :dont_stop_if_pid_file_invalid
|
173
|
+
# is given, then daemon_controller will not do that if the PID file does not contain
|
174
|
+
# a valid number.
|
175
|
+
#
|
176
|
+
# The default is false.
|
177
|
+
#
|
170
178
|
# [:daemonize_for_me]
|
171
179
|
# Normally daemon_controller will wait until the daemon has daemonized into the
|
172
180
|
# background, in order to capture any errors that it may print on stdout or
|
@@ -203,6 +211,7 @@ class DaemonController
|
|
203
211
|
@start_timeout = options[:start_timeout] || 15
|
204
212
|
@stop_timeout = options[:stop_timeout] || 15
|
205
213
|
@log_file_activity_timeout = options[:log_file_activity_timeout] || 7
|
214
|
+
@dont_stop_if_pid_file_invalid = options[:dont_stop_if_pid_file_invalid]
|
206
215
|
@daemonize_for_me = options[:daemonize_for_me]
|
207
216
|
@keep_ios = options[:keep_ios] || []
|
208
217
|
@lock_file = determine_lock_file(options, @identifier, @pid_file)
|
@@ -430,6 +439,9 @@ private
|
|
430
439
|
|
431
440
|
def kill_daemon
|
432
441
|
if @stop_command
|
442
|
+
if @dont_stop_if_pid_file_invalid && read_pid_file.nil?
|
443
|
+
return
|
444
|
+
end
|
433
445
|
begin
|
434
446
|
run_command(@stop_command)
|
435
447
|
rescue StartError => e
|
@@ -472,7 +484,11 @@ private
|
|
472
484
|
end
|
473
485
|
|
474
486
|
def read_pid_file
|
475
|
-
|
487
|
+
begin
|
488
|
+
pid = File.read(@pid_file).strip
|
489
|
+
rescue Errno::ENOENT
|
490
|
+
return nil
|
491
|
+
end
|
476
492
|
if pid =~ /\A\d+\Z/
|
477
493
|
pid.to_i
|
478
494
|
else
|