passenger 4.0.5 → 4.0.6
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/.travis.yml +1 -2
- data/CONTRIBUTING.md +20 -5
- data/CONTRIBUTORS +67 -0
- data/LICENSE +1 -1
- data/NEWS +48 -0
- data/Rakefile +2 -2
- data/bin/passenger-config +18 -0
- data/bin/passenger-install-apache2-module +2 -0
- data/bin/passenger-install-nginx-module +11 -12
- data/bin/passenger-memory-stats +2 -0
- data/bin/passenger-status +152 -69
- data/build/agents.rb +1 -5
- data/build/basics.rb +26 -13
- data/build/cplusplus_support.rb +9 -0
- data/build/debian.rb +129 -0
- data/build/documentation.rb +6 -2
- data/build/integration_tests.rb +13 -2
- data/build/misc.rb +16 -0
- data/build/packaging.rb +67 -51
- data/build/preprocessor.rb +314 -0
- data/build/test_basics.rb +1 -0
- data/{debian → debian.template}/README.Debian +0 -0
- data/{debian → debian.template}/changelog +131 -0
- data/debian.template/compat +1 -0
- data/debian.template/control +71 -0
- data/debian.template/copyright +385 -0
- data/debian.template/libapache2-mod-passenger.install +3 -0
- data/{debian → debian.template}/libapache2-mod-passenger.postinst +0 -0
- data/{debian → debian.template}/libapache2-mod-passenger.prerm +0 -0
- data/debian.template/locations.ini +12 -0
- data/debian.template/passenger.conf +4 -0
- data/{debian → debian.template}/passenger.load +0 -0
- data/debian.template/patches/series +0 -0
- data/debian.template/repack.sh +42 -0
- data/debian.template/ruby-passenger-dev.install +3 -0
- data/debian.template/ruby-passenger-doc.install +2 -0
- data/debian.template/ruby-passenger.docs +4 -0
- data/debian.template/ruby-passenger.install +11 -0
- data/debian.template/ruby-passenger.manpages +4 -0
- data/debian.template/rules.template +35 -0
- data/debian.template/source/format +1 -0
- data/debian.template/watch +3 -0
- data/dev/run_travis.sh +46 -46
- data/doc/Architectural overview.html +2 -2
- data/doc/Packaging.html +27 -18
- data/doc/Packaging.txt.md +27 -18
- data/doc/Security of user switching support.html +2 -2
- data/doc/Users guide Apache.html +881 -95
- data/doc/Users guide Apache.idmap.txt +48 -6
- data/doc/Users guide Apache.txt +13 -1
- data/doc/Users guide Nginx.html +1063 -190
- data/doc/Users guide Nginx.idmap.txt +89 -45
- data/doc/Users guide Nginx.txt +45 -0
- data/doc/Users guide Standalone.html +7 -7
- data/doc/users_guide_snippets/alternative_for_flying_passenger.txt +1 -0
- data/doc/users_guide_snippets/environment_variables.txt +221 -0
- data/doc/users_guide_snippets/installation.txt +66 -17
- data/doc/users_guide_snippets/support_information.txt +3 -3
- data/doc/users_guide_snippets/tips.txt +352 -40
- data/ext/common/Account.h +4 -3
- data/ext/common/AccountsDatabase.h +6 -6
- data/ext/common/AgentsStarter.h +1 -13
- data/ext/common/ApplicationPool2/DirectSpawner.h +4 -4
- data/ext/common/ApplicationPool2/DummySpawner.h +1 -1
- data/ext/common/ApplicationPool2/Group.h +9 -4
- data/ext/common/ApplicationPool2/Implementation.cpp +6 -1
- data/ext/common/ApplicationPool2/Options.h +65 -37
- data/ext/common/ApplicationPool2/Pool.h +91 -41
- data/ext/common/ApplicationPool2/Process.h +6 -6
- data/ext/common/ApplicationPool2/SmartSpawner.h +14 -14
- data/ext/common/ApplicationPool2/Socket.h +1 -1
- data/ext/common/ApplicationPool2/Spawner.h +24 -16
- data/ext/common/ApplicationPool2/SpawnerFactory.h +9 -1
- data/ext/common/ApplicationPool2/SuperGroup.h +1 -1
- data/ext/common/Constants.h +1 -1
- data/ext/common/Logging.cpp +12 -7
- data/ext/common/MessageServer.h +7 -12
- data/ext/common/MultiLibeio.cpp +5 -5
- data/ext/common/ResourceLocator.h +2 -6
- data/ext/common/ServerInstanceDir.h +37 -10
- data/ext/common/UnionStation.h +10 -10
- data/ext/common/Utils.cpp +30 -4
- data/ext/common/Utils.h +7 -0
- data/ext/common/Utils/BlockingQueue.h +2 -2
- data/ext/common/Utils/Lock.h +2 -2
- data/ext/common/Utils/MessagePassing.h +2 -2
- data/ext/common/Utils/Timer.h +4 -4
- data/ext/common/agents/HelperAgent/AgentOptions.h +2 -0
- data/ext/common/agents/HelperAgent/Main.cpp +57 -16
- data/ext/common/agents/HelperAgent/RequestHandler.h +4 -1
- data/ext/common/agents/LoggingAgent/AdminController.h +91 -0
- data/ext/common/agents/LoggingAgent/LoggingServer.h +46 -29
- data/ext/common/agents/LoggingAgent/Main.cpp +43 -16
- data/ext/common/agents/LoggingAgent/RemoteSender.h +7 -7
- data/ext/common/agents/Watchdog/AgentWatcher.cpp +11 -11
- data/ext/common/agents/Watchdog/LoggingAgentWatcher.cpp +3 -1
- data/ext/common/agents/Watchdog/Main.cpp +62 -0
- data/ext/libeio/config.guess +206 -167
- data/ext/libeio/config.sub +142 -68
- data/ext/libev/config.guess +304 -290
- data/ext/libev/config.sub +198 -77
- data/ext/nginx/config +4 -0
- data/ext/nginx/ngx_http_passenger_module.c +1 -0
- data/ext/oxt/implementation.cpp +4 -4
- data/lib/phusion_passenger.rb +14 -5
- data/lib/phusion_passenger/abstract_installer.rb +41 -0
- data/lib/phusion_passenger/admin_tools/server_instance.rb +48 -39
- data/lib/phusion_passenger/message_client.rb +31 -7
- data/lib/phusion_passenger/native_support.rb +35 -12
- data/lib/phusion_passenger/packaging.rb +16 -2
- data/lib/phusion_passenger/platform_info/binary_compatibility.rb +6 -31
- data/lib/phusion_passenger/platform_info/operating_system.rb +1 -1
- data/lib/phusion_passenger/preloader_shared_helpers.rb +3 -1
- data/lib/phusion_passenger/request_handler.rb +1 -1
- data/lib/phusion_passenger/standalone/command.rb +6 -6
- data/lib/phusion_passenger/standalone/main.rb +23 -8
- data/lib/phusion_passenger/standalone/package_runtime_command.rb +9 -5
- data/lib/phusion_passenger/standalone/runtime_installer.rb +9 -10
- data/lib/phusion_passenger/standalone/start_command.rb +20 -4
- data/resources/templates/installer_common/freebsd9_broken_cxx_runtime.txt.erb +19 -0
- data/resources/templates/installer_common/low_amount_of_memory_warning.txt.erb +22 -0
- data/resources/templates/standalone/config.erb +3 -2
- data/test/cxx/ApplicationPool2/DirectSpawnerTest.cpp +4 -4
- data/test/cxx/ApplicationPool2/PoolTest.cpp +1 -1
- data/test/cxx/ApplicationPool2/SmartSpawnerTest.cpp +7 -7
- data/test/cxx/ApplicationPool2/SpawnerTestCases.cpp +9 -9
- data/test/cxx/EventedBufferedInputTest.cpp +17 -17
- data/test/cxx/RequestHandlerTest.cpp +5 -5
- data/test/cxx/ServerInstanceDirTest.cpp +3 -1
- data/test/cxx/TestSupport.h +4 -4
- data/test/cxx/UnionStationTest.cpp +3 -1
- data/test/cxx/UtilsTest.cpp +2 -0
- data/test/integration_tests/apache2_tests.rb +2 -2
- data/test/integration_tests/native_packaging_spec.rb +170 -0
- data/test/ruby/spec_helper.rb +0 -1
- data/test/stub/apache2/httpd.conf.erb +1 -1
- data/test/stub/nginx/nginx.conf.erb +1 -0
- data/test/support/apache2_controller.rb +1 -1
- data/test/support/placebo-preloader.rb +1 -1
- data/test/support/test_helper.rb +5 -2
- metadata +32 -26
- metadata.gz.asc +7 -7
- data/debian/compat +0 -1
- data/debian/control +0 -49
- data/debian/copyright +0 -20
- data/debian/libapache2-mod-passenger.install +0 -1
- data/debian/passenger-common.install +0 -4
- data/debian/passenger.conf +0 -4
- data/debian/prerm +0 -2
- data/debian/rules +0 -37
- data/debian/watch +0 -3
- data/dev/googlecode_upload.py +0 -265
- data/ext/common/agents/HelperAgent/BacktracesServer.h +0 -60
- data/resources/templates/nginx/not_available_when_natively_packaged.txt.erb +0 -8
- data/test/stub/rails3.1/app/assets/javascripts/application.js +0 -9
- data/test/stub/rails3.2/app/assets/javascripts/application.js +0 -15
- data/test/stub/rails_apps/2.3/mycook/public/javascripts/application.js +0 -2
- data/test/stub/rails_apps/2.3/mycook/public/javascripts/controls.js +0 -963
- data/test/stub/rails_apps/2.3/mycook/public/javascripts/dragdrop.js +0 -973
- data/test/stub/rails_apps/2.3/mycook/public/javascripts/effects.js +0 -1128
- data/test/stub/rails_apps/2.3/mycook/public/javascripts/prototype.js +0 -4320
data/ext/nginx/config
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
PATH="$ngx_addon_dir/../../bin:$PATH"
|
2
2
|
export PATH
|
3
3
|
|
4
|
+
if ! ruby -v >/dev/null 2>/dev/null; then
|
5
|
+
echo '*** ERROR: Cannot find the "ruby" command in $PATH. Please fix your $PATH. You can learn more about $PATH at: http://www.modrails.com/documentation/Users%20guide%20Apache.html#_the_path_environment_variable'
|
6
|
+
fi
|
7
|
+
|
4
8
|
if test "x$PASSENGER_LIBS" = "x" && ! passenger-config --compiled; then
|
5
9
|
echo "*** The Phusion Passenger support files are not yet compiled. Compiling them for you... ***"
|
6
10
|
echo "*** Running 'rake nginx CACHING=false' in $ngx_addon_dir... ***"
|
@@ -288,6 +288,7 @@ start_helper_server(ngx_cycle_t *cycle) {
|
|
288
288
|
pp_variant_map_set_ngx_str(params, "analytics_log_user", &passenger_main_conf.analytics_log_user);
|
289
289
|
pp_variant_map_set_ngx_str(params, "analytics_log_group", &passenger_main_conf.analytics_log_group);
|
290
290
|
pp_variant_map_set_ngx_str(params, "union_station_gateway_address", &passenger_main_conf.union_station_gateway_address);
|
291
|
+
pp_variant_map_set_int (params, "union_station_gateway_port", passenger_main_conf.union_station_gateway_port);
|
291
292
|
pp_variant_map_set_ngx_str(params, "union_station_gateway_cert", &passenger_main_conf.union_station_gateway_cert);
|
292
293
|
pp_variant_map_set_ngx_str(params, "union_station_proxy_address", &passenger_main_conf.union_station_proxy_address);
|
293
294
|
pp_variant_map_set_strset (params, "prestart_urls", (const char **) prestart_uris_ary, passenger_main_conf.prestart_uris->nelts);
|
data/ext/oxt/implementation.cpp
CHANGED
@@ -298,7 +298,7 @@ thread::make_thread_name(const string &given_name) {
|
|
298
298
|
stringstream str;
|
299
299
|
str << "Thread #";
|
300
300
|
{
|
301
|
-
lock_guard<boost::mutex> l(global_context->thread_registration_mutex);
|
301
|
+
boost::lock_guard<boost::mutex> l(global_context->thread_registration_mutex);
|
302
302
|
str << global_context->next_thread_number;
|
303
303
|
}
|
304
304
|
return str.str();
|
@@ -315,7 +315,7 @@ thread::thread_main(const boost::function<void ()> func, thread_local_context_pt
|
|
315
315
|
set_thread_local_context(ctx);
|
316
316
|
|
317
317
|
if (OXT_LIKELY(global_context != NULL)) {
|
318
|
-
lock_guard<boost::mutex> l(global_context->thread_registration_mutex);
|
318
|
+
boost::lock_guard<boost::mutex> l(global_context->thread_registration_mutex);
|
319
319
|
|
320
320
|
ctx->thread = pthread_self();
|
321
321
|
global_context->next_thread_number++;
|
@@ -335,7 +335,7 @@ thread::thread_main(const boost::function<void ()> func, thread_local_context_pt
|
|
335
335
|
// We don't care about other exceptions because they'll crash the process anyway.
|
336
336
|
|
337
337
|
if (OXT_LIKELY(global_context != NULL)) {
|
338
|
-
lock_guard<boost::mutex> l(global_context->thread_registration_mutex);
|
338
|
+
boost::lock_guard<boost::mutex> l(global_context->thread_registration_mutex);
|
339
339
|
thread_local_context *ctx = get_thread_local_context();
|
340
340
|
if (ctx != 0 && ctx->thread_number != 0) {
|
341
341
|
global_context->registered_threads.erase(ctx->iterator);
|
@@ -364,7 +364,7 @@ string
|
|
364
364
|
thread::all_backtraces() throw() {
|
365
365
|
#ifdef OXT_BACKTRACE_IS_ENABLED
|
366
366
|
if (OXT_LIKELY(global_context != NULL)) {
|
367
|
-
lock_guard<boost::mutex> l(global_context->thread_registration_mutex);
|
367
|
+
boost::lock_guard<boost::mutex> l(global_context->thread_registration_mutex);
|
368
368
|
list<thread_local_context_ptr>::const_iterator it;
|
369
369
|
std::stringstream result;
|
370
370
|
|
data/lib/phusion_passenger.rb
CHANGED
@@ -29,7 +29,8 @@ module PhusionPassenger
|
|
29
29
|
###### Version numbers ######
|
30
30
|
|
31
31
|
PACKAGE_NAME = 'passenger'
|
32
|
-
|
32
|
+
# Run 'rake ext/common/Constants.h' after changing this number.
|
33
|
+
VERSION_STRING = '4.0.6'
|
33
34
|
|
34
35
|
PREFERRED_NGINX_VERSION = '1.4.1'
|
35
36
|
NGINX_SHA256_CHECKSUM = 'bca5d1e89751ba29406185e1736c390412603a7e6b604f5b4575281f6565d119'
|
@@ -42,7 +43,7 @@ module PhusionPassenger
|
|
42
43
|
|
43
44
|
###### Directories ######
|
44
45
|
|
45
|
-
GLOBAL_NAMESPACE_DIRNAME = "
|
46
|
+
GLOBAL_NAMESPACE_DIRNAME = "passenger"
|
46
47
|
GLOBAL_STANDALONE_NAMESPACE_DIRNAME = "passenger-standalone"
|
47
48
|
# Subdirectory under $HOME to use for storing stuff.
|
48
49
|
USER_NAMESPACE_DIRNAME = ".passenger"
|
@@ -97,13 +98,13 @@ module PhusionPassenger
|
|
97
98
|
@source_root = File.dirname(File.dirname(FILE_LOCATION))
|
98
99
|
@natively_packaged = false
|
99
100
|
@bin_dir = "#{@source_root}/bin".freeze
|
100
|
-
@agents_dir = "#{@source_root}/agents".freeze
|
101
|
-
@lib_dir = "#{@source_root}/
|
101
|
+
@agents_dir = "#{@source_root}/buildout/agents".freeze
|
102
|
+
@lib_dir = "#{@source_root}/buildout".freeze
|
102
103
|
@helper_scripts_dir = "#{@source_root}/helper-scripts".freeze
|
103
104
|
@resources_dir = "#{@source_root}/resources".freeze
|
104
105
|
@include_dir = "#{@source_root}/ext".freeze
|
105
106
|
@doc_dir = "#{@source_root}/doc".freeze
|
106
|
-
@apache2_module_path = "#{@source_root}/
|
107
|
+
@apache2_module_path = "#{@source_root}/buildout/apache2/mod_passenger.so".freeze
|
107
108
|
@ruby_extension_source_dir = "#{@source_root}/ext/ruby"
|
108
109
|
end
|
109
110
|
end
|
@@ -163,6 +164,14 @@ module PhusionPassenger
|
|
163
164
|
def self.ruby_extension_source_dir
|
164
165
|
return @ruby_extension_source_dir
|
165
166
|
end
|
167
|
+
|
168
|
+
def self.nginx_addon_dir
|
169
|
+
if PhusionPassenger.natively_packaged?
|
170
|
+
return "#{resources_dir}/ngx_http_passenger_module"
|
171
|
+
else
|
172
|
+
return "#{source_root}/ext/nginx"
|
173
|
+
end
|
174
|
+
end
|
166
175
|
|
167
176
|
|
168
177
|
###### Other resource locations ######
|
@@ -25,6 +25,7 @@ require 'phusion_passenger'
|
|
25
25
|
require 'phusion_passenger/constants'
|
26
26
|
require 'phusion_passenger/console_text_template'
|
27
27
|
require 'phusion_passenger/platform_info'
|
28
|
+
require 'phusion_passenger/platform_info/operating_system'
|
28
29
|
require 'phusion_passenger/utils/ansi_colors'
|
29
30
|
|
30
31
|
# IMPORTANT: do not directly or indirectly require native_support; we can't compile
|
@@ -156,6 +157,42 @@ protected
|
|
156
157
|
return false
|
157
158
|
end
|
158
159
|
end
|
160
|
+
|
161
|
+
def check_whether_os_is_broken
|
162
|
+
if PlatformInfo.os_name == "freebsd9" && `uname -r` =~ /^9\.1-/
|
163
|
+
new_screen
|
164
|
+
render_template 'installer_common/freebsd9_broken_cxx_runtime'
|
165
|
+
wait
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
def check_whether_system_has_enough_ram(required = 1024)
|
170
|
+
begin
|
171
|
+
meminfo = File.read("/proc/meminfo")
|
172
|
+
if meminfo =~ /^MemTotal: *(\d+) kB$/
|
173
|
+
ram_mb = $1.to_i / 1024
|
174
|
+
if meminfo =~ /^SwapTotal: *(\d+) kB$/
|
175
|
+
swap_mb = $1.to_i / 1024
|
176
|
+
else
|
177
|
+
swap_mb = 0
|
178
|
+
end
|
179
|
+
end
|
180
|
+
rescue Errno::ENOENT, Errno::EACCES
|
181
|
+
# Don't do anything on systems without memory information.
|
182
|
+
ram_mb = nil
|
183
|
+
swap_mb = nil
|
184
|
+
end
|
185
|
+
if ram_mb && swap_mb && ram_mb + swap_mb < required
|
186
|
+
new_screen
|
187
|
+
render_template 'installer_common/low_amount_of_memory_warning',
|
188
|
+
:required => required,
|
189
|
+
:current => ram_mb + swap_mb,
|
190
|
+
:ram => ram_mb,
|
191
|
+
:swap => swap_mb,
|
192
|
+
:doc => users_guide
|
193
|
+
wait
|
194
|
+
end
|
195
|
+
end
|
159
196
|
|
160
197
|
|
161
198
|
def use_stderr
|
@@ -229,6 +266,8 @@ protected
|
|
229
266
|
end
|
230
267
|
end
|
231
268
|
return result
|
269
|
+
rescue Interrupt
|
270
|
+
raise Abort
|
232
271
|
end
|
233
272
|
|
234
273
|
def prompt_confirmation(message)
|
@@ -241,6 +280,8 @@ protected
|
|
241
280
|
end
|
242
281
|
end
|
243
282
|
return result.downcase == 'y'
|
283
|
+
rescue Interrupt
|
284
|
+
raise Abort
|
244
285
|
end
|
245
286
|
|
246
287
|
def wait(timeout = nil)
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
# Phusion Passenger - https://www.phusionpassenger.com/
|
2
3
|
# Copyright (c) 2010-2013 Phusion
|
3
4
|
#
|
@@ -188,34 +189,30 @@ class ServerInstance
|
|
188
189
|
# - +RoleDeniedError+: The user that the current process is as is not authorized to utilize the given role.
|
189
190
|
# - +EOFError+: The server unexpectedly closed the connection during authentication.
|
190
191
|
# - +SecurityError+: The server denied our authentication credentials.
|
191
|
-
def connect(
|
192
|
-
if
|
193
|
-
|
194
|
-
|
195
|
-
username = "_passenger-status"
|
196
|
-
begin
|
197
|
-
filename = "#{@generation_path}/passenger-status-password.txt"
|
198
|
-
password = File.open(filename, "rb") do |f|
|
199
|
-
f.read
|
200
|
-
end
|
201
|
-
rescue Errno::EACCES
|
202
|
-
raise RoleDeniedError
|
203
|
-
end
|
204
|
-
else
|
205
|
-
raise ArgumentError, "Unsupported role #{role_or_username}"
|
206
|
-
end
|
192
|
+
def connect(options)
|
193
|
+
if options[:role]
|
194
|
+
username, password, default_socket_name = infer_connection_info_from_role(options[:role])
|
195
|
+
socket_name = options[:socket_name] || default_socket_name
|
207
196
|
else
|
208
|
-
username =
|
197
|
+
username = options[:username]
|
198
|
+
password = options[:password]
|
199
|
+
socket_name = options[:socket_name] || "helper_admin"
|
200
|
+
raise ArgumentError, "Either the :role or :username must be set" if !username
|
201
|
+
raise ArgumentError, ":password must be set" if !password
|
209
202
|
end
|
210
203
|
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
204
|
+
client = MessageClient.new(username, password, "unix:#{@generation_path}/#{socket_name}")
|
205
|
+
if block_given?
|
206
|
+
begin
|
207
|
+
yield client
|
208
|
+
ensure
|
209
|
+
client.close
|
210
|
+
end
|
211
|
+
else
|
212
|
+
return client
|
216
213
|
end
|
217
214
|
end
|
218
|
-
|
215
|
+
|
219
216
|
def web_server_description
|
220
217
|
return File.read("#{@generation_path}/web_server.txt")
|
221
218
|
end
|
@@ -241,18 +238,7 @@ class ServerInstance
|
|
241
238
|
return nil
|
242
239
|
end
|
243
240
|
|
244
|
-
|
245
|
-
return @client.status(*options)
|
246
|
-
end
|
247
|
-
|
248
|
-
def backtraces
|
249
|
-
return @client.backtraces
|
250
|
-
end
|
251
|
-
|
252
|
-
def xml
|
253
|
-
return @client.xml
|
254
|
-
end
|
255
|
-
|
241
|
+
# FIXME: probably broken
|
256
242
|
def stats
|
257
243
|
doc = REXML::Document.new(xml)
|
258
244
|
stats = Stats.new
|
@@ -262,12 +248,14 @@ class ServerInstance
|
|
262
248
|
return stats
|
263
249
|
end
|
264
250
|
|
251
|
+
# FIXME: probably broken
|
265
252
|
def get_wait_list_size
|
266
253
|
return stats.get_wait_list_size
|
267
254
|
end
|
268
255
|
|
269
|
-
|
270
|
-
|
256
|
+
# FIXME: probably broken
|
257
|
+
def groups(client)
|
258
|
+
doc = REXML::Document.new(client.pool_xml)
|
271
259
|
|
272
260
|
groups = []
|
273
261
|
doc.elements.each("info/supergroups/supergroup/group") do |group_xml|
|
@@ -309,8 +297,9 @@ class ServerInstance
|
|
309
297
|
return groups
|
310
298
|
end
|
311
299
|
|
312
|
-
|
313
|
-
|
300
|
+
# FIXME: probably broken
|
301
|
+
def processes(client)
|
302
|
+
return groups(client).map do |group|
|
314
303
|
group.processes
|
315
304
|
end.flatten
|
316
305
|
end
|
@@ -323,6 +312,26 @@ private
|
|
323
312
|
def self.current_time
|
324
313
|
Time.now
|
325
314
|
end
|
315
|
+
|
316
|
+
def infer_connection_info_from_role(role)
|
317
|
+
case role
|
318
|
+
when :passenger_status
|
319
|
+
username = "_passenger-status"
|
320
|
+
begin
|
321
|
+
filename = "#{@generation_path}/passenger-status-password.txt"
|
322
|
+
password = File.open(filename, "rb") do |f|
|
323
|
+
f.read
|
324
|
+
end
|
325
|
+
rescue Errno::EACCES
|
326
|
+
raise RoleDeniedError
|
327
|
+
rescue Errno::ENOENT
|
328
|
+
raise CorruptedDirectoryError
|
329
|
+
end
|
330
|
+
return [username, password, "helper_admin"]
|
331
|
+
else
|
332
|
+
raise ArgumentError, "Unsupported role #{role}"
|
333
|
+
end
|
334
|
+
end
|
326
335
|
|
327
336
|
class << self;
|
328
337
|
private :log_cleaning_action
|
@@ -74,10 +74,21 @@ class MessageClient
|
|
74
74
|
return !!@channel
|
75
75
|
end
|
76
76
|
|
77
|
-
###
|
77
|
+
### HelperAgent methods ###
|
78
78
|
|
79
|
-
def
|
80
|
-
write("
|
79
|
+
def pool_detach_process(pid)
|
80
|
+
write("detach_process", pid)
|
81
|
+
check_security_response
|
82
|
+
result = read
|
83
|
+
if result.nil?
|
84
|
+
raise EOFError
|
85
|
+
else
|
86
|
+
return result.first == "true"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def pool_detach_process_by_key(detach_key)
|
91
|
+
write("detach_process_by_key", detach_key)
|
81
92
|
check_security_response
|
82
93
|
result = read
|
83
94
|
if result.nil?
|
@@ -87,7 +98,7 @@ class MessageClient
|
|
87
98
|
end
|
88
99
|
end
|
89
100
|
|
90
|
-
def
|
101
|
+
def pool_status(options = {})
|
91
102
|
write("inspect", *options.to_a.flatten)
|
92
103
|
check_security_response
|
93
104
|
return read_scalar
|
@@ -96,19 +107,32 @@ class MessageClient
|
|
96
107
|
raise
|
97
108
|
end
|
98
109
|
|
99
|
-
def
|
110
|
+
def pool_xml
|
100
111
|
write("toXml", true)
|
101
112
|
check_security_response
|
102
113
|
return read_scalar
|
103
114
|
end
|
104
115
|
|
105
|
-
|
116
|
+
def helper_agent_requests
|
117
|
+
write("requests")
|
118
|
+
check_security_response
|
119
|
+
return read_scalar
|
120
|
+
end
|
121
|
+
|
122
|
+
### HelperAgent BacktracesServer methods ###
|
106
123
|
|
107
|
-
def
|
124
|
+
def helper_agent_backtraces
|
108
125
|
write("backtraces")
|
109
126
|
check_security_response
|
110
127
|
return read_scalar
|
111
128
|
end
|
129
|
+
|
130
|
+
### LoggingAgent AdminServer methods ###
|
131
|
+
|
132
|
+
def logging_agent_status
|
133
|
+
write("status")
|
134
|
+
return read_scalar
|
135
|
+
end
|
112
136
|
|
113
137
|
### Low level I/O methods ###
|
114
138
|
|
@@ -70,13 +70,15 @@ private
|
|
70
70
|
def native_support_dir_in_source_root
|
71
71
|
if PhusionPassenger.originally_packaged?
|
72
72
|
@native_support_dir_in_source_root ||=
|
73
|
-
File.expand_path("#{PhusionPassenger.source_root}/
|
73
|
+
File.expand_path("#{PhusionPassenger.source_root}/buildout/ruby")
|
74
74
|
else
|
75
75
|
return nil
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
79
|
def load_from_native_support_output_dir
|
80
|
+
# Quick workaround for people suffering from
|
81
|
+
# https://code.google.com/p/phusion-passenger/issues/detail?id=865
|
80
82
|
output_dir = ENV['PASSENGER_NATIVE_SUPPORT_OUTPUT_DIR']
|
81
83
|
if output_dir && !output_dir.empty?
|
82
84
|
begin
|
@@ -136,7 +138,11 @@ private
|
|
136
138
|
target_dirs << "#{home}/#{USER_NAMESPACE_DIRNAME}/native_support/#{VERSION_STRING}/#{archdir}"
|
137
139
|
|
138
140
|
target_dir = compile(target_dirs)
|
139
|
-
|
141
|
+
if target_dir
|
142
|
+
require "#{target_dir}/#{library_name}"
|
143
|
+
else
|
144
|
+
STDERR.puts "Ruby native_support extension not loaded. Continuing without native_support."
|
145
|
+
end
|
140
146
|
end
|
141
147
|
|
142
148
|
def mkdir(dir)
|
@@ -148,12 +154,16 @@ private
|
|
148
154
|
end
|
149
155
|
|
150
156
|
def sh(*args)
|
151
|
-
|
152
|
-
STDERR.puts "# #{command_string}"
|
153
|
-
if !system(*args)
|
157
|
+
if !sh_nonfatal(*args)
|
154
158
|
raise "Could not compile #{library_name} (\"#{command_string}\" failed)"
|
155
159
|
end
|
156
160
|
end
|
161
|
+
|
162
|
+
def sh_nonfatal(*args)
|
163
|
+
command_string = args.join(' ')
|
164
|
+
STDERR.puts "# #{command_string}"
|
165
|
+
return system(*args)
|
166
|
+
end
|
157
167
|
|
158
168
|
def compile(target_dirs)
|
159
169
|
result = nil
|
@@ -164,18 +174,29 @@ private
|
|
164
174
|
File.unlink("#{target_dir}/.permission_test")
|
165
175
|
STDERR.puts "# cd #{target_dir}"
|
166
176
|
Dir.chdir(target_dir) do
|
167
|
-
|
168
|
-
|
177
|
+
result =
|
178
|
+
sh_nonfatal("#{PlatformInfo.ruby_command} '#{extconf_rb}'") &&
|
179
|
+
sh_nonfatal("make")
|
180
|
+
if result
|
181
|
+
STDERR.puts "Compilation succesful."
|
182
|
+
STDERR.puts "-------------------------------"
|
183
|
+
return target_dir
|
184
|
+
else
|
185
|
+
STDERR.puts "Compilation failed."
|
186
|
+
STDERR.puts "-------------------------------"
|
187
|
+
return nil
|
188
|
+
end
|
169
189
|
end
|
170
|
-
result = target_dir
|
171
|
-
break
|
172
190
|
rescue Errno::EACCES
|
173
191
|
# If we encountered a permission error, then try
|
174
192
|
# the next target directory. If we get a permission
|
175
193
|
# error on the last one too then propagate the
|
176
194
|
# exception.
|
177
195
|
if i == target_dirs.size - 1
|
178
|
-
|
196
|
+
STDERR.puts "Encountered permission error, " +
|
197
|
+
"but no more directories to try. Giving up."
|
198
|
+
STDERR.puts "-------------------------------"
|
199
|
+
return nil
|
179
200
|
else
|
180
201
|
STDERR.puts "Encountered permission error, " +
|
181
202
|
"trying a different directory..."
|
@@ -188,14 +209,16 @@ private
|
|
188
209
|
# in Phusion Passenger Standalone. In this case
|
189
210
|
# just ignore this directory.
|
190
211
|
if i == target_dirs.size - 1
|
191
|
-
|
212
|
+
STDERR.puts "Encountered permission error, " +
|
213
|
+
"but no more directories to try. Giving up."
|
214
|
+
STDERR.puts "-------------------------------"
|
215
|
+
return nil
|
192
216
|
else
|
193
217
|
STDERR.puts "Not a valid directory. Trying a different one..."
|
194
218
|
STDERR.puts "-------------------------------"
|
195
219
|
end
|
196
220
|
end
|
197
221
|
end
|
198
|
-
return result
|
199
222
|
end
|
200
223
|
end
|
201
224
|
|