Module: PhusionPassenger
- Defined in:
- lib/phusion_passenger.rb,
lib/phusion_passenger/utils.rb,
lib/phusion_passenger/plugin.rb,
lib/phusion_passenger/constants.rb,
lib/phusion_passenger/packaging.rb,
lib/phusion_passenger/public_api.rb,
lib/phusion_passenger/utils/json.rb,
lib/phusion_passenger/admin_tools.rb,
lib/phusion_passenger/utils/tmpio.rb,
lib/phusion_passenger/utils/tmpdir.rb,
lib/phusion_passenger/debug_logging.rb,
lib/phusion_passenger/platform_info.rb,
lib/phusion_passenger/message_client.rb,
lib/phusion_passenger/native_support.rb,
lib/phusion_passenger/message_channel.rb,
lib/phusion_passenger/request_handler.rb,
lib/phusion_passenger/standalone/main.rb,
lib/phusion_passenger/utils/tee_input.rb,
lib/phusion_passenger/analytics_logger.rb,
lib/phusion_passenger/standalone/utils.rb,
lib/phusion_passenger/utils/ansi_colors.rb,
lib/phusion_passenger/abstract_installer.rb,
lib/phusion_passenger/platform_info/curl.rb,
lib/phusion_passenger/platform_info/ruby.rb,
lib/phusion_passenger/platform_info/zlib.rb,
lib/phusion_passenger/standalone/command.rb,
lib/phusion_passenger/platform_info/linux.rb,
lib/phusion_passenger/rack/out_of_band_gc.rb,
lib/phusion_passenger/platform_info/apache.rb,
lib/phusion_passenger/console_text_template.rb,
lib/phusion_passenger/loader_shared_helpers.rb,
lib/phusion_passenger/standalone/app_finder.rb,
lib/phusion_passenger/platform_info/compiler.rb,
lib/phusion_passenger/platform_info/depcheck.rb,
lib/phusion_passenger/standalone/config_file.rb,
lib/phusion_passenger/classic_rails/cgi_fixed.rb,
lib/phusion_passenger/standalone/help_command.rb,
lib/phusion_passenger/standalone/stop_command.rb,
lib/phusion_passenger/utils/hosts_file_parser.rb,
lib/phusion_passenger/utils/unseekable_socket.rb,
lib/phusion_passenger/admin_tools/memory_stats.rb,
lib/phusion_passenger/preloader_shared_helpers.rb,
lib/phusion_passenger/standalone/start_command.rb,
lib/phusion_passenger/standalone/status_command.rb,
lib/phusion_passenger/utils/file_system_watcher.rb,
lib/phusion_passenger/standalone/runtime_locator.rb,
lib/phusion_passenger/standalone/version_command.rb,
lib/phusion_passenger/admin_tools/server_instance.rb,
lib/phusion_passenger/standalone/runtime_installer.rb,
lib/phusion_passenger/platform_info/apache_detector.rb,
lib/phusion_passenger/platform_info/cxx_portability.rb,
lib/phusion_passenger/rack/thread_handler_extension.rb,
lib/phusion_passenger/platform_info/operating_system.rb,
lib/phusion_passenger/request_handler/thread_handler.rb,
lib/phusion_passenger/active_support3_extensions/init.rb,
lib/phusion_passenger/platform_info/binary_compatibility.rb,
lib/phusion_passenger/standalone/package_runtime_command.rb,
lib/phusion_passenger/classic_rails/thread_handler_extension.rb,
ext/ruby/passenger_native_support.c
Overview
Phusion Passenger - www.phusionpassenger.com/
Copyright (c) 2010 Phusion
"Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Defined Under Namespace
Modules: ActiveSupport3Extensions, AdminTools, ClassicRails, DebugLogging, LoaderSharedHelpers, NativeSupport, Packaging, PlatformInfo, PreloaderSharedHelpers, Rack, SharedConstants, Standalone, Utils
Classes: AbstractInstaller, AnalyticsLogger, ConsoleTextTemplate, MessageChannel, MessageClient, NativeSupportLoader, Plugin, RequestHandler
Constant Summary
collapse
- FILE_LOCATION =
File.expand_path(__FILE__)
- PACKAGE_NAME =
Names and version numbers ######
'passenger'
- VERSION_STRING =
Run ‘rake ext/common/Constants.h’ after changing this number.
'4.0.24'
- PREFERRED_NGINX_VERSION =
'1.4.3'
- NGINX_SHA256_CHECKSUM =
'ae123885c923a6c3f5bab0a8b7296ef21c4fdf6087834667ebbc16338177de84'
- PREFERRED_PCRE_VERSION =
'8.32'
- PCRE_SHA256_CHECKSUM =
'd5d8634b36baf3d08be442a627001099583b397f456bc795304a013383b6423a'
- STANDALONE_INTERFACE_VERSION =
1
- GLOBAL_NAMESPACE_DIRNAME =
"passenger"
- USER_NAMESPACE_DIRNAME =
Subdirectory under $HOME to use for storing stuff.
".passenger"
- PLUGIN_DIRS =
Directories in which to look for plugins.
[
"/usr/share/#{GLOBAL_NAMESPACE_DIRNAME}/plugins",
"/usr/local/share/#{GLOBAL_NAMESPACE_DIRNAME}/plugins",
"~/#{USER_NAMESPACE_DIRNAME}/plugins"
]
- REQUIRED_LOCATIONS_INI_FIELDS =
[
:bin_dir,
:agents_dir,
:lib_dir,
:helper_scripts_dir,
:resources_dir,
:include_dir,
:doc_dir,
:ruby_libdir,
:node_libdir,
:apache2_module_path,
:ruby_extension_source_dir,
:nginx_module_source_dir
].freeze
- OPTIONAL_LOCATIONS_INI_FIELDS =
[
:download_cache_dir
].freeze
- BINARIES_URL_ROOT =
Other resource locations ######
"https://oss-binaries.phusionpassenger.com/binaries/passenger/by_release"
- INDEX_DOC_NAME =
"Users guide.html"
- APACHE2_DOC_NAME =
"Users guide Apache.html"
- NGINX_DOC_NAME =
"Users guide Nginx.html"
- STANDALONE_DOC_NAME =
"Users guide Standalone.html"
- PASSENGER_ANALYTICS_WEB_LOG =
"PASSENGER_ANALYTICS_WEB_LOG".freeze
- PASSENGER_TXN_ID =
"PASSENGER_TXN_ID".freeze
- PASSENGER_UNION_STATION_KEY =
"UNION_STATION_KEY".freeze
- RACK_HIJACK_IO =
"rack.hijack_io".freeze
- @@event_starting_worker_process =
[]
- @@event_stopping_worker_process =
[]
- @@event_starting_request_handler_thread =
[]
- @@event_credentials =
[]
- @@event_after_installing_signal_handlers =
[]
- @@event_oob_work =
[]
- @@advertised_concurrency_level =
nil
Class Method Summary
collapse
Class Method Details
.advertised_concurrency_level ⇒ Object
52
53
54
|
# File 'lib/phusion_passenger/public_api.rb', line 52
def advertised_concurrency_level
@@advertised_concurrency_level
end
|
.advertised_concurrency_level=(value) ⇒ Object
56
57
58
|
# File 'lib/phusion_passenger/public_api.rb', line 56
def advertised_concurrency_level=(value)
@@advertised_concurrency_level = value
end
|
.apache2_doc_path ⇒ Object
157
158
159
|
# File 'lib/phusion_passenger.rb', line 157
def self.apache2_doc_path
return "#{doc_dir}/#{APACHE2_DOC_NAME}"
end
|
.benchmark(env = nil, title = "Benchmarking") ⇒ Object
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/phusion_passenger/public_api.rb', line 60
def benchmark(env = nil, title = "Benchmarking")
log = lookup_analytics_log(env)
if log
log.measure("BENCHMARK: #{title}") do
yield
end
else
yield
end
end
|
.binaries_ca_cert_path ⇒ Object
178
179
180
|
# File 'lib/phusion_passenger.rb', line 178
def self.binaries_ca_cert_path
return "#{resources_dir}/oss-binaries.phusionpassenger.com.crt"
end
|
.call_event(name, *args) ⇒ Object
38
39
40
41
42
|
# File 'lib/phusion_passenger/public_api.rb', line 38
def call_event(name, *args)
callback_list_for_event(name).each do |callback|
callback.call(*args)
end
end
|
.index_doc_path ⇒ Object
153
154
155
|
# File 'lib/phusion_passenger.rb', line 153
def self.index_doc_path
return "#{doc_dir}/#{INDEX_DOC_NAME}"
end
|
.install_framework_extensions!(*args) ⇒ Object
44
45
46
47
48
49
50
|
# File 'lib/phusion_passenger/public_api.rb', line 44
def install_framework_extensions!(*args)
require 'active_support/version' if defined?(::ActiveSupport) && !defined?(::ActiveSupport::VERSION)
if defined?(::ActiveSupport) && ::ActiveSupport::VERSION::MAJOR >= 3
require 'phusion_passenger/active_support3_extensions/init'
ActiveSupport3Extensions.init!(PhusionPassenger::App.options, *args)
end
end
|
.installed_from_release_package? ⇒ Boolean
Whether the current Phusion Passenger installation is installed from a release package, e.g. an official gem or official tarball. Retruns false if e.g. the gem was built by the user, or if this install is from a git repository.
131
132
133
|
# File 'lib/phusion_passenger.rb', line 131
def self.installed_from_release_package?
File.exist?("#{resources_dir}/release.txt")
end
|
.locate_directories(source_root_or_location_configuration_file = nil) ⇒ Object
Follows the logic of ext/common/ResourceLocator.h, so don’t forget to modify that too.
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
# File 'lib/phusion_passenger.rb', line 78
def self.locate_directories(source_root_or_location_configuration_file = nil)
source_root_or_location_configuration_file ||= find_location_configuration_file
root_or_file = @source_root = source_root_or_location_configuration_file
if root_or_file && File.file?(root_or_file)
filename = root_or_file
options = parse_ini_file(filename)
@natively_packaged = get_bool_option(filename, options, 'natively_packaged')
REQUIRED_LOCATIONS_INI_FIELDS.each do |field|
instance_variable_set("@#{field}", get_option(filename, options, field.to_s).freeze)
end
OPTIONAL_LOCATIONS_INI_FIELDS.each do |field|
instance_variable_set("@#{field}", get_option(filename, options, field.to_s, false).freeze)
end
else
@source_root = File.dirname(File.dirname(FILE_LOCATION))
@natively_packaged = false
@bin_dir = "#{@source_root}/bin".freeze
@agents_dir = "#{@source_root}/buildout/agents".freeze
@lib_dir = "#{@source_root}/buildout".freeze
@helper_scripts_dir = "#{@source_root}/helper-scripts".freeze
@resources_dir = "#{@source_root}/resources".freeze
@include_dir = "#{@source_root}/ext".freeze
@doc_dir = "#{@source_root}/doc".freeze
@ruby_libdir = File.dirname(FILE_LOCATION)
@node_libdir = "#{@source_root}/node_lib".freeze
@apache2_module_path = "#{@source_root}/buildout/apache2/mod_passenger.so".freeze
@ruby_extension_source_dir = "#{@source_root}/ext/ruby"
@nginx_module_source_dir = "#{@source_root}/ext/nginx"
@download_cache_dir = "#{@source_root}/download_cache"
REQUIRED_LOCATIONS_INI_FIELDS.each do |field|
if instance_variable_get("@#{field}").nil?
raise "BUG: @#{field} not set"
end
end
end
end
|
.log_cache_hit(env, name) ⇒ Object
71
72
73
74
75
76
77
78
79
|
# File 'lib/phusion_passenger/public_api.rb', line 71
def log_cache_hit(env, name)
log = lookup_analytics_log(env)
if log
log.message("Cache hit: #{name}")
return true
else
return false
end
end
|
.log_cache_miss(env, name, generation_time = nil) ⇒ Object
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/phusion_passenger/public_api.rb', line 81
def log_cache_miss(env, name, generation_time = nil)
log = lookup_analytics_log(env)
if log
if generation_time
log.message("Cache miss (#{generation_time.to_i}): #{name}")
else
log.message("Cache miss: #{name}")
end
return true
else
return false
end
end
|
.natively_packaged? ⇒ Boolean
123
124
125
|
# File 'lib/phusion_passenger.rb', line 123
def self.natively_packaged?
return @natively_packaged
end
|
.nginx_doc_path ⇒ Object
161
162
163
|
# File 'lib/phusion_passenger.rb', line 161
def self.nginx_doc_path
return "#{doc_dir}/#{NGINX_DOC_NAME}"
end
|
.on_event(name, &block) ⇒ Object
34
35
36
|
# File 'lib/phusion_passenger/public_api.rb', line 34
def on_event(name, &block)
callback_list_for_event(name) << block
end
|
.originally_packaged? ⇒ Boolean
Returns whether this Phusion Passenger installation is in the ‘originally packaged’ configuration (as opposed to the ‘natively packaged’ configuration.
119
120
121
|
# File 'lib/phusion_passenger.rb', line 119
def self.originally_packaged?
return !@natively_packaged
end
|
.source_root ⇒ Object
When originally packaged, returns the source root. When natively packaged, returns the location of the location configuration file.
137
138
139
|
# File 'lib/phusion_passenger.rb', line 137
def self.source_root
return @source_root
end
|
.standalone_doc_path ⇒ Object
165
166
167
|
# File 'lib/phusion_passenger.rb', line 165
def self.standalone_doc_path
return "#{doc_dir}/#{STANDALONE_DOC_NAME}"
end
|