passenger 4.0.48 → 4.0.49
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 +8 -8
- checksums.yaml.gz.asc +7 -7
- data.tar.gz.asc +7 -7
- data/.editorconfig +36 -2
- data/.travis.yml +1 -1
- data/CHANGELOG +16 -0
- data/Rakefile +0 -1
- data/build/apache2.rb +4 -4
- data/build/common_library.rb +18 -18
- data/build/cplusplus_support.rb +2 -2
- data/build/documentation.rb +1 -1
- data/build/integration_tests.rb +12 -4
- data/build/misc.rb +12 -7
- data/build/packaging.rb +14 -14
- data/build/preprocessor.rb +10 -10
- data/build/rake_extensions.rb +11 -11
- data/build/ruby_extension.rb +2 -2
- data/dev/ci/inituidgid +24 -0
- data/dev/ci/run_jenkins.sh +57 -0
- data/dev/ci/run_rpm_tests.sh +77 -0
- data/dev/{run_travis.sh → ci/run_travis.sh} +60 -4
- data/doc/Users guide Nginx.txt +2 -2
- data/doc/users_guide_snippets/environment_variables.txt +0 -2
- data/doc/users_guide_snippets/tips.txt +20 -1
- data/ext/apache2/Bucket.cpp +18 -18
- data/ext/apache2/Bucket.h +4 -4
- data/ext/apache2/Configuration.cpp +7 -7
- data/ext/apache2/Configuration.hpp +43 -43
- data/ext/apache2/DirectoryMapper.h +5 -5
- data/ext/apache2/Hooks.cpp +142 -142
- data/ext/apache2/MergeDirConfig.cpp +40 -40
- data/ext/common/Account.h +17 -17
- data/ext/common/AccountsDatabase.h +9 -9
- data/ext/common/AgentsStarter.cpp +2 -2
- data/ext/common/AgentsStarter.h +40 -40
- data/ext/common/ApplicationPool2/Common.h +10 -6
- data/ext/common/ApplicationPool2/ComponentInfo.h +2 -2
- data/ext/common/ApplicationPool2/DirectSpawner.h +17 -17
- data/ext/common/ApplicationPool2/DummySpawner.h +5 -5
- data/ext/common/ApplicationPool2/Group.h +54 -38
- data/ext/common/ApplicationPool2/Implementation.cpp +76 -49
- data/ext/common/ApplicationPool2/Options.h +98 -91
- data/ext/common/ApplicationPool2/Pool.h +70 -69
- data/ext/common/ApplicationPool2/Process.h +21 -21
- data/ext/common/ApplicationPool2/Session.h +11 -11
- data/ext/common/ApplicationPool2/SmartSpawner.h +60 -60
- data/ext/common/ApplicationPool2/Socket.h +19 -19
- data/ext/common/ApplicationPool2/Spawner.h +64 -72
- data/ext/common/ApplicationPool2/SpawnerFactory.h +4 -4
- data/ext/common/ApplicationPool2/SuperGroup.h +41 -41
- data/ext/common/BackgroundEventLoop.cpp +1 -1
- data/ext/common/BackgroundEventLoop.h +2 -2
- data/ext/common/Constants.h +1 -1
- data/ext/common/EventedBufferedInput.h +5 -5
- data/ext/common/EventedClient.h +51 -51
- data/ext/common/EventedMessageServer.h +39 -39
- data/ext/common/EventedServer.h +32 -32
- data/ext/common/Exceptions.h +23 -23
- data/ext/common/FileDescriptor.h +18 -18
- data/ext/common/Logging.cpp +1 -1
- data/ext/common/MessageClient.h +27 -27
- data/ext/common/MessageReadersWriters.h +79 -79
- data/ext/common/MessageServer.h +59 -59
- data/ext/common/RandomGenerator.h +12 -12
- data/ext/common/ResourceLocator.h +8 -8
- data/ext/common/SafeLibev.h +54 -25
- data/ext/common/ServerInstanceDir.h +31 -31
- data/ext/common/StaticString.h +50 -48
- data/ext/common/Utils.cpp +73 -78
- data/ext/common/Utils.h +6 -6
- data/ext/common/Utils/Base64.cpp +3 -3
- data/ext/common/Utils/Base64.h +7 -7
- data/ext/common/Utils/BlockingQueue.h +9 -9
- data/ext/common/Utils/BufferedIO.h +17 -17
- data/ext/common/Utils/CachedFileStat.hpp +16 -16
- data/ext/common/Utils/Dechunker.h +25 -25
- data/ext/common/Utils/FileChangeChecker.h +10 -10
- data/ext/common/Utils/MemZeroGuard.h +5 -5
- data/ext/common/Utils/MemoryBarrier.h +1 -1
- data/ext/common/Utils/MessageIO.h +61 -61
- data/ext/common/Utils/ProcessMetricsCollector.h +40 -40
- data/ext/common/Utils/ScopeGuard.h +7 -7
- data/ext/common/Utils/SpeedMeter.h +1 -1
- data/ext/common/Utils/StrIntUtils.cpp +13 -13
- data/ext/common/Utils/StrIntUtils.h +3 -3
- data/ext/common/Utils/StringScanning.h +5 -5
- data/ext/common/Utils/SystemMetricsCollector.h +2 -2
- data/ext/common/Utils/SystemTime.h +10 -10
- data/ext/common/Utils/Template.h +2 -2
- data/ext/common/Utils/Timer.h +6 -6
- data/ext/common/Utils/VariantMap.h +29 -29
- data/ext/common/agents/Base.cpp +19 -19
- data/ext/common/agents/HelperAgent/AgentOptions.h +1 -1
- data/ext/common/agents/HelperAgent/FileBackedPipe.h +6 -6
- data/ext/common/agents/HelperAgent/Main.cpp +44 -43
- data/ext/common/agents/HelperAgent/RequestHandler.cpp +4 -4
- data/ext/common/agents/HelperAgent/RequestHandler.h +29 -28
- data/ext/common/agents/HelperAgent/ScgiRequestParser.h +56 -50
- data/ext/common/agents/LoggingAgent/AdminController.h +8 -8
- data/ext/common/agents/LoggingAgent/DataStoreId.h +17 -17
- data/ext/common/agents/LoggingAgent/FilterSupport.h +167 -167
- data/ext/common/agents/LoggingAgent/LoggingServer.h +122 -122
- data/ext/common/agents/LoggingAgent/Main.cpp +7 -7
- data/ext/common/agents/LoggingAgent/RemoteSender.h +54 -54
- data/ext/common/agents/SpawnPreparer.cpp +4 -4
- data/ext/common/agents/TempDirToucher.c +2 -2
- data/ext/common/agents/Watchdog/AgentWatcher.cpp +47 -47
- data/ext/common/agents/Watchdog/HelperAgentWatcher.cpp +7 -7
- data/ext/common/agents/Watchdog/LoggingAgentWatcher.cpp +7 -7
- data/ext/common/agents/Watchdog/Main.cpp +22 -22
- data/ext/common/agents/Watchdog/ServerInstanceDirToucher.cpp +9 -9
- data/ext/libeio/eio.c +1 -1
- data/ext/nginx/Configuration.c +30 -30
- data/ext/nginx/Configuration.h +1 -1
- data/ext/nginx/ContentHandler.c +54 -54
- data/ext/nginx/ContentHandler.h +3 -3
- data/ext/nginx/StaticContentHandler.c +2 -2
- data/ext/nginx/ngx_http_passenger_module.c +21 -21
- data/ext/oxt/detail/backtrace_enabled.hpp +1 -1
- data/ext/oxt/detail/context.hpp +1 -1
- data/ext/oxt/detail/spin_lock_darwin.hpp +4 -4
- data/ext/oxt/detail/spin_lock_gcc_x86.hpp +3 -3
- data/ext/oxt/detail/spin_lock_pthreads.hpp +4 -4
- data/ext/oxt/detail/tracable_exception_disabled.hpp +1 -1
- data/ext/oxt/dynamic_thread_group.hpp +18 -18
- data/ext/oxt/implementation.cpp +9 -8
- data/ext/oxt/macros.hpp +2 -2
- data/ext/oxt/system_calls.cpp +11 -11
- data/ext/oxt/system_calls.hpp +13 -13
- data/ext/oxt/thread.hpp +22 -14
- data/ext/ruby/passenger_native_support.c +55 -55
- data/lib/phusion_passenger.rb +24 -24
- data/lib/phusion_passenger/common_library.rb +2 -0
- data/lib/phusion_passenger/loader_shared_helpers.rb +18 -18
- data/lib/phusion_passenger/packaging.rb +9 -4
- data/lib/phusion_passenger/platform_info/apache.rb +45 -31
- data/lib/phusion_passenger/platform_info/compiler.rb +11 -11
- data/lib/phusion_passenger/rack/thread_handler_extension.rb +1 -1
- data/lib/phusion_passenger/request_handler/thread_handler.rb +8 -8
- data/lib/phusion_passenger/standalone/app_finder.rb +16 -16
- data/lib/phusion_passenger/standalone/command.rb +22 -22
- data/packaging/rpm/LICENSE.txt +19 -0
- data/packaging/rpm/Makefile +13 -0
- data/packaging/rpm/README.md +41 -0
- data/packaging/rpm/Vagrantfile +38 -0
- data/{rpm/Vagrantfile → packaging/rpm/Vagrantfile.centos} +0 -0
- data/packaging/rpm/build +170 -0
- data/packaging/rpm/create_project +41 -0
- data/packaging/rpm/git_update +88 -0
- data/packaging/rpm/image/Dockerfile +37 -0
- data/packaging/rpm/image/Gemfile +3 -0
- data/packaging/rpm/image/Gemfile.lock +12 -0
- data/packaging/rpm/image/RPM-GPG-KEY-amazon-ga +19 -0
- data/packaging/rpm/image/amazon2014-i386.cfg +96 -0
- data/packaging/rpm/image/amazon2014-x86_64.cfg +96 -0
- data/packaging/rpm/image/site-defaults.cfg +168 -0
- data/packaging/rpm/internal/build_tasks.rb +238 -0
- data/packaging/rpm/internal/dummygpg +11 -0
- data/packaging/rpm/internal/exec_build +42 -0
- data/packaging/rpm/internal/get_distro_arch +14 -0
- data/packaging/rpm/internal/get_distro_id +10 -0
- data/packaging/rpm/internal/git_update +27 -0
- data/packaging/rpm/internal/inituidgid +17 -0
- data/packaging/rpm/internal/my_init +344 -0
- data/packaging/rpm/internal/python27 +3 -0
- data/packaging/rpm/internal/repo_update +46 -0
- data/packaging/rpm/internal/setuser +26 -0
- data/packaging/rpm/internal/tracking_helper +40 -0
- data/packaging/rpm/jenkins_release +99 -0
- data/packaging/rpm/lib/build_tasks_support.rb +402 -0
- data/packaging/rpm/lib/preprocessor.rb +341 -0
- data/packaging/rpm/nginx_spec/404.html +119 -0
- data/packaging/rpm/nginx_spec/50x.html +119 -0
- data/packaging/rpm/nginx_spec/index.html +116 -0
- data/packaging/rpm/nginx_spec/nginx-auto-cc-gcc.patch +13 -0
- data/packaging/rpm/nginx_spec/nginx-logo.png +0 -0
- data/packaging/rpm/nginx_spec/nginx-upgrade +13 -0
- data/packaging/rpm/nginx_spec/nginx-upgrade.8 +151 -0
- data/packaging/rpm/nginx_spec/nginx.conf +131 -0
- data/packaging/rpm/nginx_spec/nginx.init +144 -0
- data/packaging/rpm/nginx_spec/nginx.logrotate +13 -0
- data/packaging/rpm/nginx_spec/nginx.service +15 -0
- data/packaging/rpm/nginx_spec/nginx.spec.template +559 -0
- data/packaging/rpm/nginx_spec/nginx.sysconfig +4 -0
- data/packaging/rpm/nginx_spec/passenger.conf +9 -0
- data/packaging/rpm/nginx_spec/poweredby.png +0 -0
- data/{rpm → packaging/rpm/passenger_spec}/apache-passenger.conf.in +0 -0
- data/{rpm → packaging/rpm/passenger_spec}/config.json +0 -0
- data/{rpm → packaging/rpm/passenger_spec}/passenger.logrotate +0 -0
- data/{rpm → packaging/rpm/passenger_spec}/passenger.spec.template +58 -31
- data/{rpm → packaging/rpm/passenger_spec}/passenger_dynamic_thread_group.patch +0 -0
- data/{rpm → packaging/rpm/passenger_spec}/passenger_tests_default_config_example.patch +0 -0
- data/{rpm → packaging/rpm/passenger_spec}/rubygem-passenger-4.0.18-GLIBC_HAVE_LONG_LONG.patch +0 -0
- data/{rpm → packaging/rpm/passenger_spec}/rubygem-passenger-4.0.18-gcc47-include-sys_types.patch +0 -0
- data/packaging/rpm/repo_update +114 -0
- data/packaging/rpm/setup-system +60 -0
- data/packaging/rpm/shell +10 -0
- data/resources/templates/standalone/config.erb +3 -1
- data/test/config.json.rpm-automation +1 -1
- data/test/cxx/ApplicationPool2/DirectSpawnerTest.cpp +11 -11
- data/test/cxx/ApplicationPool2/OptionsTest.cpp +5 -5
- data/test/cxx/ApplicationPool2/PoolTest.cpp +129 -89
- data/test/cxx/ApplicationPool2/ProcessTest.cpp +15 -15
- data/test/cxx/ApplicationPool2/SmartSpawnerTest.cpp +22 -22
- data/test/cxx/ApplicationPool2/SpawnerTestCases.cpp +11 -11
- data/test/cxx/ScgiRequestParserTest.cpp +75 -61
- data/test/cxx/UtilsTest.cpp +86 -85
- data/test/gdbinit.example +3 -0
- data/test/integration_tests/nginx_tests.rb +3 -3
- data/test/integration_tests/source_packaging_test.rb +3 -1
- data/test/stub/nginx/nginx.conf.erb +8 -1
- data/test/support/nginx_controller.rb +7 -7
- metadata +62 -17
- metadata.gz.asc +7 -7
- data/build/rpm.rb +0 -128
- data/dev/rpmtool +0 -21
- data/dev/test_rpm_packaging.sh +0 -28
- data/rpm/get_distro_id.py +0 -4
@@ -145,7 +145,7 @@ public
|
|
145
145
|
return string_env('CC', default_cc)
|
146
146
|
end
|
147
147
|
memoize :cc
|
148
|
-
|
148
|
+
|
149
149
|
def self.cxx
|
150
150
|
return string_env('CXX', default_cxx)
|
151
151
|
end
|
@@ -203,7 +203,7 @@ public
|
|
203
203
|
memoize :cc_is_sun_studio?
|
204
204
|
|
205
205
|
def self.cxx_is_sun_studio?
|
206
|
-
`#{cxx} -V 2>&1` =~ /Sun C/ || `#{
|
206
|
+
`#{cxx} -V 2>&1` =~ /Sun C/ || `#{cxx} -flags 2>&1` =~ /Sun C/
|
207
207
|
end
|
208
208
|
memoize :cxx_is_sun_studio?
|
209
209
|
|
@@ -271,7 +271,7 @@ public
|
|
271
271
|
return result && result[:result] && result[:output] !~ /unknown warning option/i
|
272
272
|
end
|
273
273
|
end
|
274
|
-
|
274
|
+
|
275
275
|
def self.try_link(description, language, source, flags = nil)
|
276
276
|
extension = detect_language_extension(language)
|
277
277
|
create_temp_file("passenger-link-check.#{extension}") do |filename, f|
|
@@ -283,7 +283,7 @@ public
|
|
283
283
|
return run_compiler(description, command, filename, source)
|
284
284
|
end
|
285
285
|
end
|
286
|
-
|
286
|
+
|
287
287
|
def self.try_compile_and_run(description, language, source, flags = nil)
|
288
288
|
extension = detect_language_extension(language)
|
289
289
|
create_temp_file("passenger-run-check.#{extension}", tmpexedir) do |filename, f|
|
@@ -315,7 +315,7 @@ public
|
|
315
315
|
return try_compile("Checking for C compiler '-arch' support",
|
316
316
|
:c, '', "-arch #{arch}")
|
317
317
|
end
|
318
|
-
|
318
|
+
|
319
319
|
def self.cc_supports_visibility_flag?
|
320
320
|
return false if os_name =~ /aix/
|
321
321
|
return try_compile("Checking for C compiler '-fvisibility' support",
|
@@ -329,7 +329,7 @@ public
|
|
329
329
|
:cxx, '', '-fvisibility=hidden')
|
330
330
|
end
|
331
331
|
memoize :cxx_supports_visibility_flag?, true
|
332
|
-
|
332
|
+
|
333
333
|
def self.cc_supports_wno_attributes_flag?
|
334
334
|
return try_compile_with_warning_flag(
|
335
335
|
"Checking for C compiler '-Wno-attributes' support",
|
@@ -442,7 +442,7 @@ public
|
|
442
442
|
end
|
443
443
|
end
|
444
444
|
memoize :cxx_visibility_flag_generates_warnings?, true
|
445
|
-
|
445
|
+
|
446
446
|
def self.adress_sanitizer_flag
|
447
447
|
if cc_is_clang?
|
448
448
|
if `#{cc} --help` =~ /-fsanitize=/
|
@@ -487,7 +487,7 @@ public
|
|
487
487
|
:c, "int main() { return 0; }\n", '-lmath')
|
488
488
|
end
|
489
489
|
memoize :has_math_library?, true
|
490
|
-
|
490
|
+
|
491
491
|
def self.has_alloca_h?
|
492
492
|
return try_compile("Checking for alloca.h",
|
493
493
|
:c, '#include <alloca.h>')
|
@@ -502,7 +502,7 @@ public
|
|
502
502
|
})
|
503
503
|
end
|
504
504
|
memoize :has_accept4?, true
|
505
|
-
|
505
|
+
|
506
506
|
# C compiler flags that should be passed in order to enable debugging information.
|
507
507
|
def self.debugging_cflags
|
508
508
|
# According to OpenBSD's pthreads man page, pthreads do not work
|
@@ -549,7 +549,7 @@ public
|
|
549
549
|
end
|
550
550
|
end
|
551
551
|
memoize :electric_fence_ldflags
|
552
|
-
|
552
|
+
|
553
553
|
def self.export_dynamic_flags
|
554
554
|
if os_name == "linux"
|
555
555
|
return '-rdynamic'
|
@@ -586,7 +586,7 @@ public
|
|
586
586
|
end
|
587
587
|
end
|
588
588
|
memoize :gnu_make, true
|
589
|
-
|
589
|
+
|
590
590
|
def self.xcode_select_version
|
591
591
|
if find_command('xcode-select')
|
592
592
|
`xcode-select --version` =~ /version (.+)\./
|
@@ -102,7 +102,7 @@ class ThreadHandler
|
|
102
102
|
channel = MessageChannel.new
|
103
103
|
buffer = ''
|
104
104
|
buffer.force_encoding('binary') if buffer.respond_to?(:force_encoding)
|
105
|
-
|
105
|
+
|
106
106
|
begin
|
107
107
|
finish_callback.call
|
108
108
|
while true
|
@@ -205,13 +205,13 @@ private
|
|
205
205
|
"HTTP header size exceeded maximum.")
|
206
206
|
return
|
207
207
|
end
|
208
|
-
|
208
|
+
|
209
209
|
# Like parse_session_request, but parses an HTTP request. This is a very minimalistic
|
210
210
|
# HTTP parser and is not intended to be complete, fast or secure, since the HTTP server
|
211
211
|
# socket is intended to be used for debugging purposes only.
|
212
212
|
def parse_http_request(connection, channel, buffer)
|
213
213
|
headers = {}
|
214
|
-
|
214
|
+
|
215
215
|
data = ""
|
216
216
|
while data !~ /\r\n\r\n/ && data.size < MAX_HEADER_SIZE
|
217
217
|
data << connection.readpartial(16 * 1024)
|
@@ -221,7 +221,7 @@ private
|
|
221
221
|
"HTTP header size exceeded maximum.")
|
222
222
|
return
|
223
223
|
end
|
224
|
-
|
224
|
+
|
225
225
|
data.gsub!(/\r\n\r\n.*/, '')
|
226
226
|
data.split("\r\n").each_with_index do |line, i|
|
227
227
|
if i == 0
|
@@ -250,7 +250,7 @@ private
|
|
250
250
|
end
|
251
251
|
end
|
252
252
|
end
|
253
|
-
|
253
|
+
|
254
254
|
if @connect_password && headers["HTTP_X_PASSENGER_CONNECT_PASSWORD"] != @connect_password
|
255
255
|
warn "*** Passenger RequestHandler warning: " <<
|
256
256
|
"someone tried to connect with an invalid connect password."
|
@@ -303,10 +303,10 @@ private
|
|
303
303
|
end
|
304
304
|
transaction.begin_measure("app request handler processing")
|
305
305
|
end
|
306
|
-
|
306
|
+
|
307
307
|
#################
|
308
308
|
end
|
309
|
-
|
309
|
+
|
310
310
|
def finalize_request(connection, headers, has_error)
|
311
311
|
transaction = headers[UNION_STATION_REQUEST_TRANSACTION]
|
312
312
|
Thread.current[UNION_STATION_CORE] = nil
|
@@ -354,7 +354,7 @@ private
|
|
354
354
|
end
|
355
355
|
end
|
356
356
|
end
|
357
|
-
|
357
|
+
|
358
358
|
#################
|
359
359
|
end
|
360
360
|
|
@@ -28,7 +28,7 @@ module Standalone
|
|
28
28
|
class AppFinder
|
29
29
|
attr_accessor :dirs
|
30
30
|
attr_reader :apps
|
31
|
-
|
31
|
+
|
32
32
|
def self.looks_like_app_directory?(dir)
|
33
33
|
return File.exist?("#{dir}/config.ru") ||
|
34
34
|
File.exist?("#{dir}/config/environment.rb") ||
|
@@ -36,7 +36,7 @@ class AppFinder
|
|
36
36
|
File.exist?("#{dir}/app.js") ||
|
37
37
|
File.exist?("#{dir}/.meteor")
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
def initialize(dirs, options = {})
|
41
41
|
@dirs = dirs
|
42
42
|
@options = options.dup
|
@@ -45,11 +45,11 @@ class AppFinder
|
|
45
45
|
def global_options
|
46
46
|
return @options
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
49
|
def scan
|
50
50
|
apps = []
|
51
51
|
watchlist = []
|
52
|
-
|
52
|
+
|
53
53
|
if single_mode?
|
54
54
|
app_root = find_app_root
|
55
55
|
apps << {
|
@@ -59,7 +59,7 @@ class AppFinder
|
|
59
59
|
watchlist << app_root
|
60
60
|
watchlist << "#{app_root}/config" if File.exist?("#{app_root}/config")
|
61
61
|
watchlist << "#{app_root}/passenger-standalone.json" if File.exist?("#{app_root}/passenger-standalone.json")
|
62
|
-
|
62
|
+
|
63
63
|
config_filename = File.join(app_root, "passenger-standalone.json")
|
64
64
|
if File.exist?(config_filename)
|
65
65
|
global_options = load_config_file!(:global_config, config_filename)
|
@@ -75,15 +75,15 @@ class AppFinder
|
|
75
75
|
@watchlist = watchlist
|
76
76
|
return apps
|
77
77
|
end
|
78
|
-
|
78
|
+
|
79
79
|
def monitor(termination_pipe)
|
80
80
|
raise "You must call #scan first" if !@apps
|
81
|
-
|
81
|
+
|
82
82
|
watcher = PhusionPassenger::Utils::FileSystemWatcher.new(@watchlist, termination_pipe)
|
83
83
|
if wait_on_io(termination_pipe, 3)
|
84
84
|
return
|
85
85
|
end
|
86
|
-
|
86
|
+
|
87
87
|
while true
|
88
88
|
changed = watcher.wait_for_change
|
89
89
|
watcher.close
|
@@ -94,13 +94,13 @@ class AppFinder
|
|
94
94
|
if wait_on_io(termination_pipe, 0.25)
|
95
95
|
return
|
96
96
|
end
|
97
|
-
|
97
|
+
|
98
98
|
new_apps = scan
|
99
99
|
watcher = PhusionPassenger::Utils::FileSystemWatcher.new(@watchlist, termination_pipe)
|
100
100
|
if old_apps != new_apps
|
101
101
|
yield(new_apps)
|
102
102
|
end
|
103
|
-
|
103
|
+
|
104
104
|
# Don't process change events again for a short while,
|
105
105
|
# but do detect changes while waiting.
|
106
106
|
if wait_on_io(termination_pipe, 3)
|
@@ -117,11 +117,11 @@ class AppFinder
|
|
117
117
|
def single_mode?
|
118
118
|
return true
|
119
119
|
end
|
120
|
-
|
120
|
+
|
121
121
|
def multi_mode?
|
122
122
|
return !single_mode?
|
123
123
|
end
|
124
|
-
|
124
|
+
|
125
125
|
##################
|
126
126
|
|
127
127
|
private
|
@@ -135,7 +135,7 @@ private
|
|
135
135
|
return File.expand_path(@dirs[0])
|
136
136
|
end
|
137
137
|
end
|
138
|
-
|
138
|
+
|
139
139
|
def load_config_file!(context, filename)
|
140
140
|
PhusionPassenger.require_passenger_lib 'utils/json' if !defined?(PhusionPassenger::Utils::JSON)
|
141
141
|
begin
|
@@ -168,11 +168,11 @@ private
|
|
168
168
|
STDERR.puts "*** Warning: #{e.message}"
|
169
169
|
return {}
|
170
170
|
end
|
171
|
-
|
171
|
+
|
172
172
|
def looks_like_app_directory?(dir)
|
173
173
|
return AppFinder.looks_like_app_directory?(dir)
|
174
174
|
end
|
175
|
-
|
175
|
+
|
176
176
|
def filename_to_server_names(filename)
|
177
177
|
basename = File.basename(filename)
|
178
178
|
names = [basename]
|
@@ -181,7 +181,7 @@ private
|
|
181
181
|
end
|
182
182
|
return names
|
183
183
|
end
|
184
|
-
|
184
|
+
|
185
185
|
# Wait until the given IO becomes readable, or until the timeout has
|
186
186
|
# been reached. Returns true if the IO became readable, false if the
|
187
187
|
# timeout has been reached.
|
@@ -40,17 +40,17 @@ class Command
|
|
40
40
|
:thread_count => DEFAULT_THREAD_COUNT,
|
41
41
|
:nginx_version => PREFERRED_NGINX_VERSION
|
42
42
|
}.freeze
|
43
|
-
|
43
|
+
|
44
44
|
include Utils
|
45
|
-
|
45
|
+
|
46
46
|
def self.show_in_command_list
|
47
47
|
return true
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
def self.description
|
51
51
|
return nil
|
52
52
|
end
|
53
|
-
|
53
|
+
|
54
54
|
def initialize(args)
|
55
55
|
@args = args.dup
|
56
56
|
@original_args = args.dup
|
@@ -73,7 +73,7 @@ private
|
|
73
73
|
gem_command = PlatformInfo.gem_command(:sudo => true)
|
74
74
|
error "Your version of daemon_controller is too old. " <<
|
75
75
|
"You must install 1.1.0 or later. Please upgrade:\n\n" <<
|
76
|
-
|
76
|
+
|
77
77
|
" #{gem_command} uninstall FooBarWidget-daemon_controller\n" <<
|
78
78
|
" #{gem_command} install daemon_controller",
|
79
79
|
:wrap => false
|
@@ -88,7 +88,7 @@ private
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
def require_erb
|
93
93
|
require 'erb' unless defined?(ERB)
|
94
94
|
end
|
@@ -96,23 +96,23 @@ private
|
|
96
96
|
def require_etc
|
97
97
|
require 'etc' unless defined?(Etc)
|
98
98
|
end
|
99
|
-
|
99
|
+
|
100
100
|
def require_optparse
|
101
101
|
require 'optparse' unless defined?(OptionParser)
|
102
102
|
end
|
103
|
-
|
103
|
+
|
104
104
|
def require_app_finder
|
105
105
|
PhusionPassenger.require_passenger_lib 'standalone/app_finder' unless defined?(AppFinder)
|
106
106
|
end
|
107
|
-
|
107
|
+
|
108
108
|
def debugging?
|
109
109
|
return ENV['PASSENGER_DEBUG'] && !ENV['PASSENGER_DEBUG'].empty?
|
110
110
|
end
|
111
|
-
|
111
|
+
|
112
112
|
def parse_options!(command_name, description = nil)
|
113
113
|
require_etc
|
114
114
|
help = false
|
115
|
-
|
115
|
+
|
116
116
|
home_dir = PhusionPassenger::Utils.home_dir
|
117
117
|
global_config_file = File.join(home_dir, USER_NAMESPACE_DIRNAME, "standalone", "config")
|
118
118
|
if File.exist?(global_config_file)
|
@@ -120,7 +120,7 @@ private
|
|
120
120
|
global_options = ConfigFile.new(:global_config, global_config_file).options
|
121
121
|
@options.merge!(global_options)
|
122
122
|
end
|
123
|
-
|
123
|
+
|
124
124
|
require_optparse
|
125
125
|
parser = OptionParser.new do |opts|
|
126
126
|
opts.banner = "Usage: passenger #{command_name} [options]"
|
@@ -137,7 +137,7 @@ private
|
|
137
137
|
exit 0
|
138
138
|
end
|
139
139
|
end
|
140
|
-
|
140
|
+
|
141
141
|
def error(message, options = {})
|
142
142
|
wrap = options.fetch(:wrap, true)
|
143
143
|
if message =~ /\n/
|
@@ -157,7 +157,7 @@ private
|
|
157
157
|
end
|
158
158
|
@plugin.call_hook(:error, message) if @plugin
|
159
159
|
end
|
160
|
-
|
160
|
+
|
161
161
|
# Word wrap the given option description text so that it is formatted
|
162
162
|
# nicely in the --help output.
|
163
163
|
def wrap_desc(description_text, max_width = 43, newline_prefix_size = 37)
|
@@ -173,7 +173,7 @@ private
|
|
173
173
|
FileUtils.mkdir_p(dir)
|
174
174
|
end
|
175
175
|
end
|
176
|
-
|
176
|
+
|
177
177
|
def determine_various_resource_locations(create_subdirs = true)
|
178
178
|
require_app_finder
|
179
179
|
if @options[:socket_file]
|
@@ -200,7 +200,7 @@ private
|
|
200
200
|
@options[:log_file] ||= File.expand_path(File.join(@args[0], log_basename))
|
201
201
|
end
|
202
202
|
end
|
203
|
-
|
203
|
+
|
204
204
|
def write_nginx_config_file
|
205
205
|
PhusionPassenger.require_passenger_lib 'platform_info/ruby'
|
206
206
|
PhusionPassenger.require_passenger_lib 'utils/tmpio'
|
@@ -220,7 +220,7 @@ private
|
|
220
220
|
PhusionPassenger::REQUIRED_LOCATIONS_INI_FIELDS +
|
221
221
|
PhusionPassenger::OPTIONAL_LOCATIONS_INI_FIELDS -
|
222
222
|
[:agents_dir, :lib_dir]
|
223
|
-
|
223
|
+
|
224
224
|
File.open(location_config_filename, 'w') do |f|
|
225
225
|
f.puts '[locations]'
|
226
226
|
f.puts "natively_packaged=#{PhusionPassenger.natively_packaged?}"
|
@@ -235,13 +235,13 @@ private
|
|
235
235
|
end
|
236
236
|
end
|
237
237
|
puts File.read(location_config_filename) if debugging?
|
238
|
-
|
238
|
+
|
239
239
|
File.open(@config_filename, 'w') do |f|
|
240
240
|
f.chmod(0644)
|
241
241
|
require_erb
|
242
242
|
erb = ERB.new(File.read(nginx_config_template_filename), nil, "-")
|
243
243
|
current_user = Etc.getpwuid(Process.uid).name
|
244
|
-
|
244
|
+
|
245
245
|
# The template requires some helper methods which are defined in start_command.rb.
|
246
246
|
output = erb.result(binding)
|
247
247
|
f.write(output)
|
@@ -271,7 +271,7 @@ private
|
|
271
271
|
end
|
272
272
|
return [items.join(null)].pack('m*').gsub("\n", "").strip
|
273
273
|
end
|
274
|
-
|
274
|
+
|
275
275
|
def determine_nginx_start_command
|
276
276
|
if @options[:nginx_bin]
|
277
277
|
nginx_bin = @options[:nginx_bin]
|
@@ -280,7 +280,7 @@ private
|
|
280
280
|
end
|
281
281
|
return "#{nginx_bin} -c '#{@config_filename}' -p '#{@temp_dir}/'"
|
282
282
|
end
|
283
|
-
|
283
|
+
|
284
284
|
# Returns the port on which to ping Nginx.
|
285
285
|
def nginx_ping_port
|
286
286
|
if @options[:ping_port]
|
@@ -289,7 +289,7 @@ private
|
|
289
289
|
return @options[:port]
|
290
290
|
end
|
291
291
|
end
|
292
|
-
|
292
|
+
|
293
293
|
def create_nginx_controller(extra_options = {})
|
294
294
|
require_daemon_controller
|
295
295
|
require 'socket' unless defined?(UNIXSocket)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2014 Phusion
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|