passenger 4.0.10 → 4.0.13
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/.gitignore +66 -0
- data/.travis.yml +2 -5
- data/CONTRIBUTORS +2 -1
- data/NEWS +24 -0
- data/README.md +5 -10
- data/bin/passenger +1 -0
- data/bin/passenger-config +29 -3
- data/bin/passenger-install-nginx-module +1 -1
- data/build/basics.rb +8 -2
- data/build/debian.rb +22 -0
- data/build/integration_tests.rb +16 -2
- data/build/misc.rb +3 -0
- data/build/packaging.rb +77 -29
- data/build/preprocessor.rb +13 -10
- data/build/test_basics.rb +6 -0
- data/debian.template/locations.ini.template +13 -0
- data/debian.template/ruby-passenger-dev.install.template +3 -0
- data/debian.template/ruby-passenger-doc.install.template +2 -0
- data/debian.template/ruby-passenger.install.template +12 -0
- data/debian.template/rules.template +1 -0
- data/dev/run_travis.sh +46 -14
- data/doc/Architectural overview.html +25 -34
- data/doc/Packaging.html +31 -23
- data/doc/Packaging.txt.md +32 -23
- data/doc/Security of user switching support.html +16 -18
- data/doc/Users guide Apache.html +231 -239
- data/doc/Users guide Nginx.html +219 -227
- data/doc/Users guide Standalone.html +12 -15
- data/doc/users_guide_snippets/installation.txt +3 -2
- data/ext/common/ApplicationPool2/Implementation.cpp +6 -16
- data/ext/common/Constants.h +1 -1
- data/ext/common/ResourceLocator.h +6 -6
- data/ext/common/UnionStation.h +11 -15
- data/ext/common/Utils/ProcessMetricsCollector.h +7 -4
- data/ext/common/agents/HelperAgent/AgentOptions.h +6 -0
- data/ext/common/agents/HelperAgent/Main.cpp +5 -0
- data/ext/common/agents/HelperAgent/RequestHandler.h +9 -1
- data/ext/common/agents/LoggingAgent/Main.cpp +4 -0
- data/ext/common/agents/Watchdog/Main.cpp +7 -0
- data/ext/nginx/config +1 -1
- data/ext/oxt/Readme.txt +15 -0
- data/helper-scripts/download_binaries/extconf.rb +83 -0
- data/lib/phusion_passenger.rb +78 -80
- data/lib/phusion_passenger/abstract_installer.rb +22 -8
- data/lib/phusion_passenger/console_text_template.rb +1 -1
- data/lib/phusion_passenger/loader_shared_helpers.rb +2 -1
- data/lib/phusion_passenger/native_support.rb +22 -9
- data/lib/phusion_passenger/packaging.rb +7 -2
- data/lib/phusion_passenger/platform_info.rb +28 -1
- data/lib/phusion_passenger/platform_info/apache.rb +246 -26
- data/lib/phusion_passenger/platform_info/apache_detector.rb +232 -0
- data/lib/phusion_passenger/platform_info/depcheck_specs/ruby.rb +4 -0
- data/lib/phusion_passenger/platform_info/linux.rb +7 -0
- data/lib/phusion_passenger/public_api.rb +11 -2
- data/lib/phusion_passenger/standalone/command.rb +11 -14
- data/lib/phusion_passenger/standalone/runtime_installer.rb +313 -275
- data/lib/phusion_passenger/standalone/runtime_locator.rb +163 -0
- data/lib/phusion_passenger/standalone/start_command.rb +38 -46
- data/lib/phusion_passenger/utils/json.rb +329 -0
- data/lib/phusion_passenger/utils/tmpio.rb +1 -0
- data/passenger.gemspec +4 -0
- data/resources/mime.types +1 -0
- data/resources/oss-binaries.phusionpassenger.com.crt +84 -0
- data/resources/release.txt +0 -0
- data/resources/templates/standalone/download_tool_missing.txt.erb +18 -0
- data/rpm/README.rdoc +117 -0
- data/rpm/config/apache-passenger.conf.in +19 -0
- data/rpm/config/nginx-passenger.conf.in +10 -0
- data/rpm/config/rubygem-passenger.te +10 -0
- data/rpm/doc/README.nginx-alternatives +5 -0
- data/rpm/doc/example_yum_repository_htaccess +5 -0
- data/rpm/doc/footer.shtml +12 -0
- data/rpm/doc/header.shtml +156 -0
- data/rpm/nginx-alternatives.spec +97 -0
- data/rpm/passenger-release.spec +91 -0
- data/rpm/passenger.spec +667 -0
- data/rpm/patches/passenger-force-native.patch +63 -0
- data/rpm/release/RPM-GPG-KEY-stealthymonkeys +33 -0
- data/rpm/release/build-release.sh +35 -0
- data/rpm/release/build.rb +301 -0
- data/rpm/release/create-mirrors.sh +16 -0
- data/rpm/release/mirrors +1 -0
- data/rpm/release/mock-repo/comps.xml +21 -0
- data/rpm/release/mock-repo/rubygem-daemon_controller-0.2.5-1.noarch.rpm +0 -0
- data/rpm/release/mock-repo/rubygem-file-tail-1.0.5-1.noarch.rpm +0 -0
- data/rpm/release/mock-repo/rubygem-spruz-0.2.2-1.noarch.rpm +0 -0
- data/rpm/release/mocksetup-first.sh +102 -0
- data/rpm/release/mocksetup.sh +67 -0
- data/test/integration_tests/apache2_tests.rb +1 -1
- data/test/integration_tests/downloaded_binaries_tests.rb +76 -0
- data/test/integration_tests/native_packaging_spec.rb +38 -6
- data/test/integration_tests/source_packaging_test.rb +198 -0
- data/test/integration_tests/standalone_tests.rb +275 -0
- data/test/ruby/admin_tools_spec.rb +1 -1
- data/test/ruby/rails4.0/loader_spec.rb +28 -0
- data/test/ruby/rails4.0/preloader_spec.rb +34 -0
- data/test/ruby/spec_helper.rb +5 -1
- data/test/ruby/standalone/runtime_installer_spec.rb +399 -0
- data/test/ruby/standalone/runtime_locator_spec.rb +214 -0
- data/test/stub/apache2/httpd.conf.erb +18 -1
- data/test/stub/rack/tmp/.gitignore +0 -0
- data/test/stub/rails2.3/log/.gitignore +1 -0
- data/test/stub/rails2.3/public/.gitignore +1 -0
- data/test/stub/rails2.3/tmp/cache/.gitignore +1 -0
- data/test/stub/rails2.3/tmp/pids/.gitignore +1 -0
- data/test/stub/rails2.3/tmp/sessions/.gitignore +1 -0
- data/test/stub/rails2.3/tmp/sockets/.gitignore +1 -0
- data/test/stub/rails3.0/.gitignore +4 -0
- data/test/stub/rails3.0/Gemfile +1 -1
- data/test/stub/rails3.0/Gemfile.lock +1 -1
- data/test/stub/rails3.0/lib/tasks/.gitkeep +0 -0
- data/test/stub/rails3.0/log/.gitignore +0 -0
- data/test/stub/rails3.0/public/stylesheets/.gitkeep +0 -0
- data/test/stub/rails3.0/vendor/plugins/.gitkeep +0 -0
- data/test/stub/rails3.1/.gitignore +15 -0
- data/test/stub/rails3.1/Gemfile +1 -1
- data/test/stub/rails3.1/Gemfile.lock +1 -1
- data/test/stub/rails3.1/app/mailers/.gitkeep +0 -0
- data/test/stub/rails3.1/app/models/.gitkeep +0 -0
- data/test/stub/rails3.1/lib/assets/.gitkeep +0 -0
- data/test/stub/rails3.1/lib/tasks/.gitkeep +0 -0
- data/test/stub/rails3.1/log/.gitkeep +0 -0
- data/test/stub/rails3.1/test/fixtures/.gitkeep +0 -0
- data/test/stub/rails3.1/test/functional/.gitkeep +0 -0
- data/test/stub/rails3.1/test/integration/.gitkeep +0 -0
- data/test/stub/rails3.1/test/unit/.gitkeep +0 -0
- data/test/stub/rails3.1/vendor/assets/stylesheets/.gitkeep +0 -0
- data/test/stub/rails3.1/vendor/plugins/.gitkeep +0 -0
- data/test/stub/rails3.2/.gitignore +15 -0
- data/test/stub/rails3.2/app/mailers/.gitkeep +0 -0
- data/test/stub/rails3.2/app/models/.gitkeep +0 -0
- data/test/stub/rails3.2/lib/assets/.gitkeep +0 -0
- data/test/stub/rails3.2/lib/tasks/.gitkeep +0 -0
- data/test/stub/rails3.2/log/.gitkeep +0 -0
- data/test/stub/rails3.2/test/fixtures/.gitkeep +0 -0
- data/test/stub/rails3.2/test/functional/.gitkeep +0 -0
- data/test/stub/rails3.2/test/integration/.gitkeep +0 -0
- data/test/stub/rails3.2/test/unit/.gitkeep +0 -0
- data/test/stub/rails3.2/vendor/assets/stylesheets/.gitkeep +0 -0
- data/test/stub/rails3.2/vendor/plugins/.gitkeep +0 -0
- data/test/stub/rails4.0/.gitignore +16 -0
- data/test/stub/rails4.0/Gemfile +45 -0
- data/test/stub/rails4.0/Gemfile.lock +126 -0
- data/test/stub/rails4.0/README.rdoc +28 -0
- data/test/stub/rails4.0/Rakefile +6 -0
- data/test/stub/rails4.0/app/assets/images/.keep +0 -0
- data/test/stub/rails4.0/app/assets/javascripts/application.js +16 -0
- data/test/stub/rails4.0/app/assets/stylesheets/application.css +13 -0
- data/test/stub/rails4.0/app/controllers/application_controller.rb +5 -0
- data/test/stub/rails4.0/app/controllers/concerns/.keep +0 -0
- data/test/stub/rails4.0/app/helpers/application_helper.rb +2 -0
- data/test/stub/rails4.0/app/mailers/.keep +0 -0
- data/test/stub/rails4.0/app/models/.keep +0 -0
- data/test/stub/rails4.0/app/models/concerns/.keep +0 -0
- data/test/stub/rails4.0/app/views/layouts/application.html.erb +14 -0
- data/test/stub/rails4.0/bin/bundle +3 -0
- data/test/stub/rails4.0/bin/rails +4 -0
- data/test/stub/rails4.0/bin/rake +4 -0
- data/test/stub/rails4.0/config.ru +4 -0
- data/test/stub/rails4.0/config/application.rb +23 -0
- data/test/stub/rails4.0/config/boot.rb +4 -0
- data/test/stub/rails4.0/config/database.yml +25 -0
- data/test/stub/rails4.0/config/environment.rb +5 -0
- data/test/stub/rails4.0/config/environments/development.rb +29 -0
- data/test/stub/rails4.0/config/environments/production.rb +80 -0
- data/test/stub/rails4.0/config/environments/test.rb +36 -0
- data/test/stub/rails4.0/config/initializers/backtrace_silencers.rb +7 -0
- data/test/stub/rails4.0/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/stub/rails4.0/config/initializers/inflections.rb +16 -0
- data/test/stub/rails4.0/config/initializers/mime_types.rb +5 -0
- data/test/stub/rails4.0/config/initializers/passenger.rb +1 -0
- data/test/stub/rails4.0/config/initializers/secret_token.rb +12 -0
- data/test/stub/rails4.0/config/initializers/session_store.rb +3 -0
- data/test/stub/rails4.0/config/initializers/wrap_parameters.rb +14 -0
- data/test/stub/rails4.0/config/locales/en.yml +23 -0
- data/test/stub/rails4.0/config/routes.rb +57 -0
- data/test/stub/rails4.0/db/seeds.rb +7 -0
- data/test/stub/rails4.0/lib/assets/.keep +0 -0
- data/test/stub/rails4.0/lib/tasks/.keep +0 -0
- data/test/stub/rails4.0/log/.keep +0 -0
- data/test/stub/rails4.0/public/404.html +58 -0
- data/test/stub/rails4.0/public/422.html +58 -0
- data/test/stub/rails4.0/public/500.html +57 -0
- data/test/stub/rails4.0/public/favicon.ico +0 -0
- data/test/stub/rails4.0/public/robots.txt +5 -0
- data/test/stub/rails4.0/test/controllers/.keep +0 -0
- data/test/stub/rails4.0/test/fixtures/.keep +0 -0
- data/test/stub/rails4.0/test/helpers/.keep +0 -0
- data/test/stub/rails4.0/test/integration/.keep +0 -0
- data/test/stub/rails4.0/test/mailers/.keep +0 -0
- data/test/stub/rails4.0/test/models/.keep +0 -0
- data/test/stub/rails4.0/test/test_helper.rb +15 -0
- data/test/stub/rails4.0/vendor/assets/javascripts/.keep +0 -0
- data/test/stub/rails4.0/vendor/assets/stylesheets/.keep +0 -0
- data/test/stub/rails_apps/1.2/empty/.gitignore +3 -0
- data/test/stub/rails_apps/1.2/empty/app/models/.gitignore +0 -0
- data/test/stub/rails_apps/1.2/empty/db/.gitignore +0 -0
- data/test/stub/rails_apps/1.2/empty/public/.htaccess +40 -0
- data/test/stub/rails_apps/1.2/empty/public/stylesheets/.gitignore +0 -0
- data/test/stub/rails_apps/2.0/empty/.gitignore +3 -0
- data/test/stub/rails_apps/2.0/empty/app/models/.gitignore +0 -0
- data/test/stub/rails_apps/2.0/empty/db/.gitignore +0 -0
- data/test/stub/rails_apps/2.0/empty/public/.htaccess +40 -0
- data/test/stub/rails_apps/2.0/empty/public/stylesheets/.gitignore +0 -0
- data/test/stub/rails_apps/2.2/empty/.gitignore +3 -0
- data/test/stub/rails_apps/2.2/empty/app/models/.gitignore +0 -0
- data/test/stub/rails_apps/2.2/empty/db/.gitignore +0 -0
- data/test/stub/rails_apps/2.2/empty/public/stylesheets/.gitignore +0 -0
- data/test/stub/rails_apps/2.3/empty/.gitignore +3 -0
- data/test/stub/rails_apps/2.3/empty/app/models/.gitignore +0 -0
- data/test/stub/rails_apps/2.3/empty/db/.gitignore +0 -0
- data/test/stub/rails_apps/2.3/empty/public/stylesheets/.gitignore +0 -0
- data/test/stub/rails_apps/2.3/mycook/public/.htaccess +42 -0
- data/test/stub/rails_apps/2.3/mycook/public/uploads/.gitignore +0 -0
- data/test/stub/wsgi/tmp/.gitignore +0 -0
- data/test/valgrind-osx.supp +7 -0
- metadata +162 -8
- metadata.gz.asc +7 -7
- data/debian.template/locations.ini +0 -12
- data/debian.template/ruby-passenger-dev.install +0 -3
- data/debian.template/ruby-passenger-doc.install +0 -2
- data/debian.template/ruby-passenger.install +0 -11
- data/resources/templates/installer_common/freebsd9_broken_cxx_runtime.txt.erb +0 -19
@@ -0,0 +1,232 @@
|
|
1
|
+
# Phusion Passenger - https://www.phusionpassenger.com/
|
2
|
+
# Copyright (c) 2013 Phusion
|
3
|
+
#
|
4
|
+
# "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in
|
14
|
+
# all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
# THE SOFTWARE.
|
23
|
+
|
24
|
+
require 'phusion_passenger'
|
25
|
+
require 'phusion_passenger/platform_info'
|
26
|
+
require 'phusion_passenger/platform_info/ruby'
|
27
|
+
require 'phusion_passenger/platform_info/apache'
|
28
|
+
require 'phusion_passenger/utils/ansi_colors'
|
29
|
+
|
30
|
+
module PhusionPassenger
|
31
|
+
module PlatformInfo
|
32
|
+
|
33
|
+
# Detects all possible Apache installations on the system, and presents the
|
34
|
+
# autodetection information to the user in a friendly way. It turns out too
|
35
|
+
# many people have multiple Apache installations on their system, but they
|
36
|
+
# don't know about that, or they don't know how to compile against the
|
37
|
+
# correct Apache installation. This tool helps them.
|
38
|
+
class ApacheDetector
|
39
|
+
class Result
|
40
|
+
# These are required and are never nil.
|
41
|
+
attr_accessor :apxs2, :httpd, :ctl, :version, :config_file
|
42
|
+
# These are optional and may be nil.
|
43
|
+
attr_accessor :a2enmod, :a2dismod
|
44
|
+
# This may be nil. It depends on how well we can infer information from the config file.
|
45
|
+
attr_accessor :error_log
|
46
|
+
|
47
|
+
def initialize(detector)
|
48
|
+
@detector = detector
|
49
|
+
end
|
50
|
+
|
51
|
+
def report
|
52
|
+
log " <b>* Found Apache #{version}!</b>"
|
53
|
+
log " Information:"
|
54
|
+
log " apxs2 : #{apxs2}"
|
55
|
+
log " Main executable: #{httpd}"
|
56
|
+
log " Control command: #{ctl}"
|
57
|
+
log " Config file : #{config_file}"
|
58
|
+
log " Error log file : #{error_log}"
|
59
|
+
log ""
|
60
|
+
log " To install Phusion Passenger against this specific Apache version:"
|
61
|
+
log " #{PlatformInfo.ruby_command} #{PhusionPassenger.bin_dir}/passenger-install-apache2-module --apxs2-path='#{apxs2}'"
|
62
|
+
log ""
|
63
|
+
log " To start, stop or restart this specific Apache version:"
|
64
|
+
log " #{ctl} start"
|
65
|
+
log " #{ctl} stop"
|
66
|
+
log " #{ctl} restart"
|
67
|
+
log ""
|
68
|
+
log " To troubleshoot, please read the logs in this file:"
|
69
|
+
log " #{error_log}"
|
70
|
+
log ""
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
def log(message)
|
75
|
+
@detector.send(:log, message)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def initialize(output)
|
80
|
+
@output = output
|
81
|
+
@results = []
|
82
|
+
PlatformInfo.verbose = true
|
83
|
+
PlatformInfo.log_implementation = lambda do |message|
|
84
|
+
if message =~ /: found$/
|
85
|
+
log("<green> * #{message}</green>")
|
86
|
+
else
|
87
|
+
log(" * #{message}")
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def finish
|
93
|
+
PlatformInfo.verbose = false
|
94
|
+
PlatformInfo.log_implementation = nil
|
95
|
+
end
|
96
|
+
|
97
|
+
def detect_all
|
98
|
+
log "<banner>Looking for possible Apache installations...</banner>"
|
99
|
+
apxses = PlatformInfo.find_all_commands("apxs2") +
|
100
|
+
PlatformInfo.find_all_commands("apxs")
|
101
|
+
apxses = remove_symlink_duplications(apxses)
|
102
|
+
log ""
|
103
|
+
apxses.each do |apxs2|
|
104
|
+
detect_one(apxs2)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def detect_one(apxs2)
|
109
|
+
log "<banner>Analyzing #{apxs2}...</banner>"
|
110
|
+
add_result do |result|
|
111
|
+
result.apxs2 = apxs2
|
112
|
+
log "Detecting main Apache executable..."
|
113
|
+
result.httpd = PlatformInfo.httpd(:apxs2 => apxs2)
|
114
|
+
if result.httpd
|
115
|
+
if result.version = PlatformInfo.httpd_version(:httpd => result.httpd)
|
116
|
+
log "Version detected: #{result.version}"
|
117
|
+
else
|
118
|
+
log "<red>Cannot detect version!</red>"
|
119
|
+
result.httpd = nil
|
120
|
+
end
|
121
|
+
end
|
122
|
+
if result.httpd
|
123
|
+
log "Detecting control command..."
|
124
|
+
result.ctl = PlatformInfo.apache2ctl(:apxs2 => apxs2)
|
125
|
+
result.httpd = nil if !result.ctl
|
126
|
+
end
|
127
|
+
if result.httpd
|
128
|
+
result.config_file = PlatformInfo.httpd_default_config_file(:httpd => result.httpd)
|
129
|
+
if result.config_file
|
130
|
+
log "Default config file location detected: #{result.config_file}"
|
131
|
+
else
|
132
|
+
log "<red>Cannot detect default config file location!</red>"
|
133
|
+
result.httpd = nil
|
134
|
+
end
|
135
|
+
end
|
136
|
+
if result.httpd
|
137
|
+
result.error_log = PlatformInfo.httpd_actual_error_log(:httpd => result.httpd)
|
138
|
+
if result.error_log
|
139
|
+
log "Error log file detected: #{result.error_log}"
|
140
|
+
else
|
141
|
+
log "<red>Cannot detect error log file!</red>"
|
142
|
+
result.httpd = nil
|
143
|
+
end
|
144
|
+
end
|
145
|
+
if result.httpd
|
146
|
+
if PlatformInfo.httpd_supports_a2enmod?(:httpd => result.httpd)
|
147
|
+
log "This Apache installation does not support a2enmod."
|
148
|
+
else
|
149
|
+
log "Detecting a2enmod and a2dismod..."
|
150
|
+
result.a2enmod = PlatformInfo.a2enmod(:apxs2 => apxs2)
|
151
|
+
result.a2dismod = PlatformInfo.a2dismod(:apxs2 => apxs2)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
if result.httpd
|
155
|
+
log "<green>Found a usable Apache installation using #{apxs2}.</green>"
|
156
|
+
true
|
157
|
+
else
|
158
|
+
log "<yellow>Cannot find a usable Apache installation using #{apxs2}.</yellow>"
|
159
|
+
false
|
160
|
+
end
|
161
|
+
end
|
162
|
+
log ""
|
163
|
+
end
|
164
|
+
|
165
|
+
def report
|
166
|
+
log "<banner>Final autodetection results</banner>"
|
167
|
+
@results.each do |result|
|
168
|
+
result.report
|
169
|
+
end
|
170
|
+
if @results.empty?
|
171
|
+
log "<red>Sorry, this program cannot find an Apache installation.</red>"
|
172
|
+
log ""
|
173
|
+
log "To install Apache, please run the following. It will tell you how to install Apache."
|
174
|
+
log ""
|
175
|
+
log " <b>#{PhusionPassenger.bin_dir}/passenger-install-apache2-module</b>"
|
176
|
+
log ""
|
177
|
+
log "If you are sure that you have Apache installed, please read the documentation:"
|
178
|
+
log " * <b>#{PhusionPassenger.doc_dir}/Users guide Apache.html</b>, section"
|
179
|
+
log " section 'Installation' -> 'Customizing the compilation process' ->"
|
180
|
+
log " 'Forcing location of command line tools and dependencies'"
|
181
|
+
log " * Or visit the online version:"
|
182
|
+
log " <b>http://www.modrails.com/documentation/Users%20guide%20Apache.html#_forcing_location_of_command_line_tools_and_dependencies</b>"
|
183
|
+
elsif @results.size > 1
|
184
|
+
log "<yellow>WARNING: You have multiple Apache installations on your system!</yellow>"
|
185
|
+
log "You are strongly recommended to read this section of the documentation:"
|
186
|
+
log " * <b>#{PhusionPassenger.doc_dir}/Users guide Apache.html</b>, section"
|
187
|
+
log " section 'Installation' -> 'Customizing the compilation process' ->"
|
188
|
+
log " 'Forcing location of command line tools and dependencies'"
|
189
|
+
log " * Or visit the online version:"
|
190
|
+
log " <b>http://www.modrails.com/documentation/Users%20guide%20Apache.html#_forcing_location_of_command_line_tools_and_dependencies</b>"
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
private
|
195
|
+
def log(message)
|
196
|
+
@output.puts(Utils::AnsiColors.ansi_colorize(message))
|
197
|
+
end
|
198
|
+
|
199
|
+
# On Ubuntu, /usr/bin/apxs2 is a symlink to /usr/bin/apxs. We're only
|
200
|
+
# supposed to detect one Apache in that case so we need to resolve symlinks.
|
201
|
+
def remove_symlink_duplications(filenames)
|
202
|
+
result = []
|
203
|
+
symlink_files = []
|
204
|
+
|
205
|
+
filenames.each do |filename|
|
206
|
+
if File.symlink?(filename)
|
207
|
+
symlink_files << filename
|
208
|
+
else
|
209
|
+
result << filename
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
symlink_files.each do |filename|
|
214
|
+
full_filename = File.expand_path(File.readlink(filename), File.dirname(filename))
|
215
|
+
if result.include?(full_filename)
|
216
|
+
log "#{filename} is a symlink to #{full_filename}. Ignoring it."
|
217
|
+
else
|
218
|
+
result << full_filename
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
return result
|
223
|
+
end
|
224
|
+
|
225
|
+
def add_result
|
226
|
+
result = Result.new(self)
|
227
|
+
@results << result if yield(result)
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
end
|
232
|
+
end # module Phusion Passenger
|
@@ -62,6 +62,13 @@ module PlatformInfo
|
|
62
62
|
# "Red Hat Enterprise Linux Server release 5.1 (Tikanga)"
|
63
63
|
return [:rhel, :redhat]
|
64
64
|
end
|
65
|
+
elsif File.exist?("/etc/system-release")
|
66
|
+
system_release = read_file("/etc/system-release")
|
67
|
+
if system_release =~ /Amazon Linux/
|
68
|
+
return [:amazon, :redhat]
|
69
|
+
else
|
70
|
+
return [:unknown]
|
71
|
+
end
|
65
72
|
elsif File.exist?("/etc/suse-release")
|
66
73
|
return [:suse]
|
67
74
|
elsif File.exist?("/etc/gentoo-release")
|
@@ -29,7 +29,8 @@ class << self
|
|
29
29
|
@@event_credentials = []
|
30
30
|
@@event_after_installing_signal_handlers = []
|
31
31
|
@@event_oob_work = []
|
32
|
-
|
32
|
+
@@advertised_concurrency_level = nil
|
33
|
+
|
33
34
|
def on_event(name, &block)
|
34
35
|
callback_list_for_event(name) << block
|
35
36
|
end
|
@@ -42,11 +43,19 @@ class << self
|
|
42
43
|
|
43
44
|
def install_framework_extensions!(*args)
|
44
45
|
require 'rails/version' if defined?(::Rails) && !defined?(::Rails::VERSION)
|
45
|
-
if defined?(::Rails) && ::Rails::VERSION::MAJOR
|
46
|
+
if defined?(::Rails) && ::Rails::VERSION::MAJOR >= 3
|
46
47
|
require 'phusion_passenger/rails3_extensions/init'
|
47
48
|
Rails3Extensions.init!(PhusionPassenger::App.options, *args)
|
48
49
|
end
|
49
50
|
end
|
51
|
+
|
52
|
+
def advertised_concurrency_level
|
53
|
+
@@advertised_concurrency_level
|
54
|
+
end
|
55
|
+
|
56
|
+
def advertised_concurrency_level=(value)
|
57
|
+
@@advertised_concurrency_level = value
|
58
|
+
end
|
50
59
|
|
51
60
|
def benchmark(env = nil, title = "Benchmarking")
|
52
61
|
log = lookup_analytics_log(env)
|
@@ -187,24 +187,21 @@ private
|
|
187
187
|
@config_filename = "#{@temp_dir}/config"
|
188
188
|
location_config_filename = "#{@temp_dir}/locations.ini"
|
189
189
|
File.chmod(0755, @temp_dir)
|
190
|
+
|
191
|
+
locations_ini_fields =
|
192
|
+
PhusionPassenger::REQUIRED_LOCATIONS_INI_FIELDS +
|
193
|
+
PhusionPassenger::OPTIONAL_LOCATIONS_INI_FIELDS -
|
194
|
+
[:agents_dir, :lib_dir]
|
190
195
|
|
191
196
|
File.open(location_config_filename, 'w') do |f|
|
192
197
|
f.puts '[locations]'
|
193
198
|
f.puts "natively_packaged=false"
|
194
|
-
f.puts "
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
f.puts "
|
199
|
+
f.puts "lib_dir=#{@runtime_locator.find_lib_dir}"
|
200
|
+
f.puts "agents_dir=#{@runtime_locator.find_agents_dir}"
|
201
|
+
locations_ini_fields.each do |field|
|
202
|
+
value = PhusionPassenger.send(field)
|
203
|
+
f.puts "#{field}=#{value}" if value
|
199
204
|
end
|
200
|
-
f.puts "libdir=#{PhusionPassenger.lib_dir}"
|
201
|
-
f.puts "helper_scripts=#{PhusionPassenger.helper_scripts_dir}"
|
202
|
-
f.puts "resources=#{PhusionPassenger.resources_dir}"
|
203
|
-
f.puts "includedir=#{PhusionPassenger.include_dir}"
|
204
|
-
f.puts "doc=#{PhusionPassenger.doc_dir}"
|
205
|
-
f.puts "rubylibdir=#{PhusionPassenger.ruby_libdir}"
|
206
|
-
f.puts "apache2_module=#{PhusionPassenger.apache2_module_path}"
|
207
|
-
f.puts "ruby_extension_source=#{PhusionPassenger.ruby_extension_source_dir}"
|
208
205
|
end
|
209
206
|
puts File.read(location_config_filename) if debugging?
|
210
207
|
|
@@ -227,7 +224,7 @@ private
|
|
227
224
|
if @options[:nginx_bin]
|
228
225
|
nginx_bin = @options[:nginx_bin]
|
229
226
|
else
|
230
|
-
nginx_bin =
|
227
|
+
nginx_bin = @runtime_locator.find_nginx_binary
|
231
228
|
end
|
232
229
|
return "#{nginx_bin} -c '#{@config_filename}' -p '#{@temp_dir}/'"
|
233
230
|
end
|
@@ -27,6 +27,7 @@ require 'phusion_passenger'
|
|
27
27
|
require 'phusion_passenger/abstract_installer'
|
28
28
|
require 'phusion_passenger/packaging'
|
29
29
|
require 'phusion_passenger/common_library'
|
30
|
+
require 'phusion_passenger/platform_info'
|
30
31
|
require 'phusion_passenger/platform_info/ruby'
|
31
32
|
require 'phusion_passenger/platform_info/binary_compatibility'
|
32
33
|
require 'phusion_passenger/standalone/utils'
|
@@ -35,22 +36,25 @@ require 'phusion_passenger/utils/tmpio'
|
|
35
36
|
module PhusionPassenger
|
36
37
|
module Standalone
|
37
38
|
|
38
|
-
# Installs the Phusion Passenger Standalone runtime by downloading
|
39
|
-
#
|
40
|
-
#
|
41
|
-
# non-interactive.
|
39
|
+
# Installs the Phusion Passenger Standalone runtime by downloading or compiling
|
40
|
+
# the Phusion Passenger support binaries and Nginx, and then storing them
|
41
|
+
# in the designated directories. This installer is entirely non-interactive.
|
42
42
|
#
|
43
43
|
# The following option must be given:
|
44
44
|
# - targets: An array containing at least one of:
|
45
|
-
# * :
|
46
|
-
# * :support_binaries - to indicate that you want to compile and install the
|
45
|
+
# * :support_binaries - to indicate that you want to install the
|
47
46
|
# Phusion Passenger support binary files.
|
48
|
-
# * :
|
49
|
-
# extension files.
|
47
|
+
# * :nginx - to indicate that you want to install Nginx.
|
50
48
|
#
|
51
|
-
# If
|
49
|
+
# If `targets` contains `:support_binaries`, then you must also specify this
|
50
|
+
# options:
|
51
|
+
# - support_dir: The support binary files will be installed here.
|
52
|
+
#
|
53
|
+
# If `targets` contains `:nginx`, then you must also specify these options:
|
52
54
|
# - nginx_dir: Nginx will be installed into this directory.
|
53
|
-
# -
|
55
|
+
# - lib_dir: Path to the Phusion Passenger libraries, which Nginx will link to.
|
56
|
+
# This may be the same path as `support_dir`; Nginx will be compiled
|
57
|
+
# after the support binary files are installed.
|
54
58
|
# - nginx_version (optional): The Nginx version to download. If not given then a
|
55
59
|
# hardcoded version number will be used.
|
56
60
|
# - nginx_tarball (optional): The location to the Nginx tarball. This tarball *must*
|
@@ -58,29 +62,32 @@ module Standalone
|
|
58
62
|
# then Nginx will not be downloaded; it will be extracted from this tarball
|
59
63
|
# instead.
|
60
64
|
#
|
61
|
-
# If targets contains ':support_binaries', then you must also specify this
|
62
|
-
# options:
|
63
|
-
# - support_dir: The support binary files will be installed here.
|
64
|
-
#
|
65
|
-
# If targets contains ':ruby', then you must also specify this option:
|
66
|
-
# - ruby_dir: The support binary files will be installed here.
|
67
|
-
#
|
68
65
|
# Other optional options:
|
69
66
|
# - download_binaries: If true then RuntimeInstaller will attempt to download
|
70
|
-
# precompiled Nginx
|
71
|
-
#
|
72
|
-
#
|
67
|
+
# a precompiled Nginx binary and precompiled Phusion Passenger support binaries
|
68
|
+
# from the network, if they exist for the current platform. The default is
|
69
|
+
# true. Note that binary downloading only happens when Phusion Passenger is
|
70
|
+
# installed from an official release package.
|
73
71
|
# - binaries_url_root: The URL on which to look for the aforementioned binaries.
|
74
72
|
# The default points to the Phusion website.
|
75
|
-
#
|
76
|
-
# Please note that RuntimeInstaller will try to avoid compiling/installing things
|
77
|
-
# that don't need to be compiled/installed. This is done by checking whether some
|
78
|
-
# key files exist, and concluding that something doesn't need to be
|
79
|
-
# compiled/installed if they do. This quick check is of course not perfect; if you
|
80
|
-
# want to force a recompilation/reinstall then you should remove +nginx_dir+
|
81
|
-
# and +support_dir+ before starting this installer.
|
82
73
|
class RuntimeInstaller < AbstractInstaller
|
83
74
|
include Utils
|
75
|
+
|
76
|
+
def initialize(*args)
|
77
|
+
super(*args)
|
78
|
+
raise ArgumentError, "At least one target must be given" if @targets.nil? || @targets.empty?
|
79
|
+
if @targets.include?(:support_binaries)
|
80
|
+
if PhusionPassenger.natively_packaged?
|
81
|
+
raise ArgumentError, "You cannot specify :support_binaries as a " +
|
82
|
+
"target when natively packaged"
|
83
|
+
end
|
84
|
+
raise ArgumentError, ":support_dir must be given" if !@support_dir
|
85
|
+
end
|
86
|
+
if @targets.include?(:nginx)
|
87
|
+
raise ArgumentError, ":nginx_dir must be given" if !@nginx_dir
|
88
|
+
raise ArgumentError, ":lib_dir must be given" if !@lib_dir
|
89
|
+
end
|
90
|
+
end
|
84
91
|
|
85
92
|
protected
|
86
93
|
def dependencies
|
@@ -95,8 +102,6 @@ protected
|
|
95
102
|
'gcc',
|
96
103
|
'g++',
|
97
104
|
'gmake',
|
98
|
-
'download-tool',
|
99
|
-
PlatformInfo.passenger_needs_ruby_dev_header? ? 'ruby-dev' : nil,
|
100
105
|
'ruby-openssl',
|
101
106
|
'rubygems',
|
102
107
|
'rake',
|
@@ -113,133 +118,281 @@ protected
|
|
113
118
|
def users_guide
|
114
119
|
return "#{PhusionPassenger.doc_dir}/Users guide Standalone.html"
|
115
120
|
end
|
116
|
-
|
121
|
+
|
117
122
|
def run_steps
|
118
|
-
if @
|
119
|
-
show_welcome_screen
|
120
|
-
end
|
121
|
-
check_dependencies(false) || exit(1)
|
123
|
+
show_welcome_screen if @nginx_dir
|
122
124
|
check_whether_os_is_broken
|
123
|
-
|
125
|
+
check_for_download_tool
|
126
|
+
download_or_compile_binaries
|
124
127
|
puts
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
128
|
+
puts "<green><b>All done!</b></green>"
|
129
|
+
puts
|
130
|
+
end
|
131
|
+
|
132
|
+
def before_install
|
133
|
+
super
|
134
|
+
@plugin.call_hook(:runtime_installer_start, self) if @plugin
|
135
|
+
@working_dir = PhusionPassenger::Utils.mktmpdir("passenger.", PlatformInfo.tmpexedir)
|
136
|
+
@nginx_version ||= PREFERRED_NGINX_VERSION
|
137
|
+
@download_binaries = true if !defined?(@download_binaries)
|
138
|
+
@binaries_url_root ||= BINARIES_URL_ROOT
|
139
|
+
end
|
140
|
+
|
141
|
+
def after_install
|
142
|
+
super
|
143
|
+
FileUtils.remove_entry_secure(@working_dir) if @working_dir
|
144
|
+
@plugin.call_hook(:runtime_installer_cleanup) if @plugin
|
145
|
+
end
|
146
|
+
|
147
|
+
private
|
148
|
+
def show_welcome_screen
|
149
|
+
render_template 'standalone/welcome',
|
150
|
+
:version => @nginx_version,
|
151
|
+
:dir => @nginx_dir
|
152
|
+
puts
|
153
|
+
end
|
154
|
+
|
155
|
+
def check_for_download_tool
|
156
|
+
puts "<banner>Checking for basic prerequities...</banner>"
|
157
|
+
puts
|
158
|
+
|
159
|
+
require 'phusion_passenger/platform_info/depcheck'
|
160
|
+
PlatformInfo::Depcheck.load('depcheck_specs/utilities')
|
161
|
+
runner = PlatformInfo::Depcheck::ConsoleRunner.new
|
162
|
+
runner.add('download-tool')
|
163
|
+
|
164
|
+
if !runner.check_all
|
165
|
+
@download_binaries = false
|
166
|
+
puts
|
167
|
+
line
|
168
|
+
puts
|
169
|
+
render_template 'standalone/download_tool_missing',
|
170
|
+
:runner => runner
|
171
|
+
wait
|
132
172
|
end
|
133
|
-
|
134
|
-
|
135
|
-
|
173
|
+
end
|
174
|
+
|
175
|
+
def download_or_compile_binaries
|
176
|
+
if should_install_support_binaries?
|
177
|
+
support_binaries_downloaded = download_support_binaries
|
136
178
|
end
|
137
|
-
if
|
138
|
-
|
139
|
-
total_phases += 4
|
179
|
+
if should_install_nginx?
|
180
|
+
nginx_binary_downloaded = download_nginx_binary
|
140
181
|
end
|
141
182
|
|
142
|
-
|
143
|
-
|
144
|
-
|
183
|
+
should_compile_support_binaries = should_install_support_binaries? &&
|
184
|
+
!support_binaries_downloaded
|
185
|
+
should_compile_nginx = should_install_nginx? && !nginx_binary_downloaded
|
186
|
+
|
187
|
+
if should_compile_support_binaries || should_compile_nginx
|
188
|
+
if @dont_compile_runtime
|
189
|
+
@stderr.puts "*** ERROR: Refusing to compile the Phusion Passenger Standalone runtime " +
|
190
|
+
"because --no-compile-runtime is given."
|
191
|
+
exit(1)
|
145
192
|
end
|
193
|
+
check_dependencies(false) || exit(1)
|
146
194
|
puts
|
147
|
-
|
148
|
-
|
149
|
-
if ruby_extension_should_be_installed? && should_download_binaries?
|
150
|
-
download_and_extract_ruby_extension(@ruby_dir) do |progress, total|
|
151
|
-
show_progress(progress, total, 1, 1, "Extracting Ruby extension...")
|
195
|
+
if should_compile_support_binaries
|
196
|
+
check_whether_we_can_write_to(@support_dir) || exit(1)
|
152
197
|
end
|
198
|
+
if should_compile_nginx
|
199
|
+
check_whether_we_can_write_to(@nginx_dir) || exit(1)
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
if should_compile_nginx
|
204
|
+
nginx_source_dir = download_and_extract_nginx_sources
|
205
|
+
end
|
206
|
+
if should_compile_support_binaries
|
207
|
+
compile_support_binaries
|
208
|
+
end
|
209
|
+
if should_compile_nginx
|
210
|
+
compile_nginx(nginx_source_dir)
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
# If this method returns true, then PhusionPassenger.originally_packaged? is also true.
|
215
|
+
def should_install_support_binaries?
|
216
|
+
return @targets.include?(:support_binaries)
|
217
|
+
end
|
218
|
+
|
219
|
+
def should_install_nginx?
|
220
|
+
return @targets.include?(:nginx)
|
221
|
+
end
|
222
|
+
|
223
|
+
def should_download_binaries?
|
224
|
+
return PhusionPassenger.installed_from_release_package? &&
|
225
|
+
@download_binaries &&
|
226
|
+
@binaries_url_root
|
227
|
+
end
|
228
|
+
|
229
|
+
def download_support_binaries
|
230
|
+
return false if !should_download_binaries?
|
231
|
+
|
232
|
+
puts "<banner>Downloading Passenger support binaries for your platform, if available...</banner>"
|
233
|
+
basename = "support-#{PlatformInfo.cxx_binary_compatibility_id}.tar.gz"
|
234
|
+
url = "#{@binaries_url_root}/#{PhusionPassenger::VERSION_STRING}/#{basename}"
|
235
|
+
tarball = "#{@working_dir}/#{basename}"
|
236
|
+
if !download(url, tarball, :cacert => PhusionPassenger.binaries_ca_cert_path, :use_cache => true)
|
237
|
+
puts "<b>No binaries are available for your platform. But don't worry, the " +
|
238
|
+
"necessary binaries will be compiled from source instead.</b>"
|
153
239
|
puts
|
154
|
-
|
240
|
+
return false
|
241
|
+
end
|
242
|
+
|
243
|
+
FileUtils.mkdir_p(@support_dir)
|
244
|
+
Dir.mkdir("#{@working_dir}/support")
|
245
|
+
Dir.chdir("#{@working_dir}/support") do
|
246
|
+
puts "Extracting tarball..."
|
247
|
+
return false if !extract_tarball(tarball)
|
248
|
+
return false if !check_support_binaries
|
249
|
+
end
|
250
|
+
|
251
|
+
if system("mv '#{@working_dir}/support'/* '#{@support_dir}'/")
|
252
|
+
return true
|
253
|
+
else
|
254
|
+
@stderr.puts "Error: could not move extracted files to the support directory"
|
255
|
+
return false
|
155
256
|
end
|
156
|
-
|
157
|
-
|
158
|
-
|
257
|
+
rescue Interrupt
|
258
|
+
exit 2
|
259
|
+
end
|
260
|
+
|
261
|
+
def check_support_binaries
|
262
|
+
["PassengerWatchdog", "PassengerHelperAgent", "PassengerLoggingAgent"].each do |exe|
|
263
|
+
puts "Checking whether the downloaded #{exe} binary is usable..."
|
264
|
+
output = `env LD_BIND_NOW=1 DYLD_BIND_AT_LAUNCH=1 ./agents/#{exe} --test-binary 1`
|
265
|
+
if !$? || $?.exitstatus != 0 || output != "PASS\n"
|
266
|
+
@stderr.puts "Binary #{exe} is not usable."
|
267
|
+
return false
|
159
268
|
end
|
269
|
+
end
|
270
|
+
puts "Binaries are usable."
|
271
|
+
return true
|
272
|
+
end
|
273
|
+
|
274
|
+
def download_nginx_binary
|
275
|
+
return false if !should_download_binaries?
|
276
|
+
|
277
|
+
puts "<banner>Downloading Nginx binary for your platform, if available...</banner>"
|
278
|
+
basename = "nginx-#{@nginx_version}-#{PlatformInfo.cxx_binary_compatibility_id}.tar.gz"
|
279
|
+
url = "#{@binaries_url_root}/#{PhusionPassenger::VERSION_STRING}/#{basename}"
|
280
|
+
tarball = "#{@working_dir}/#{basename}"
|
281
|
+
if !download(url, tarball, :cacert => PhusionPassenger.binaries_ca_cert_path, :use_cache => true)
|
282
|
+
puts "<b>No binary available for your platform. But don't worry, the " +
|
283
|
+
"necessary binary will be compiled from source instead.</b>"
|
160
284
|
puts
|
161
|
-
|
285
|
+
return false
|
162
286
|
end
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
287
|
+
|
288
|
+
FileUtils.mkdir_p(@nginx_dir)
|
289
|
+
Dir.mkdir("#{@working_dir}/nginx")
|
290
|
+
Dir.chdir("#{@working_dir}/nginx") do
|
291
|
+
puts "Extracting tarball..."
|
292
|
+
result = extract_tarball(tarball)
|
293
|
+
return false if !result
|
294
|
+
if check_nginx_binary
|
295
|
+
if system("mv '#{@working_dir}/nginx'/* '#{@nginx_dir}'/")
|
296
|
+
return true
|
297
|
+
else
|
298
|
+
@stderr.puts "Error: could not move extracted Nginx binary to the right directory"
|
299
|
+
return false
|
300
|
+
end
|
301
|
+
else
|
302
|
+
return false
|
167
303
|
end
|
168
|
-
|
169
|
-
|
304
|
+
end
|
305
|
+
rescue Interrupt
|
306
|
+
exit 2
|
307
|
+
end
|
308
|
+
|
309
|
+
def check_nginx_binary
|
310
|
+
puts "Checking whether the downloaded binary is usable..."
|
311
|
+
output = `env LD_BIND_NOW=1 DYLD_BIND_AT_LAUNCH=1 ./nginx -v 2>&1`
|
312
|
+
if $? && $?.exitstatus == 0 && output =~ /nginx version:/
|
313
|
+
puts "Binary is usable."
|
314
|
+
return true
|
315
|
+
else
|
316
|
+
@stderr.puts "Binary is not usable."
|
317
|
+
return false
|
318
|
+
end
|
319
|
+
end
|
320
|
+
|
321
|
+
def download_and_extract_nginx_sources
|
322
|
+
begin_progress_bar
|
323
|
+
puts "Downloading Nginx..."
|
324
|
+
if @nginx_tarball
|
325
|
+
tarball = @nginx_tarball
|
326
|
+
else
|
327
|
+
basename = "nginx-#{@nginx_version}.tar.gz"
|
328
|
+
tarball = "#{@working_dir}/#{basename}"
|
329
|
+
if !download("http://nginx.org/download/#{basename}", tarball)
|
170
330
|
puts
|
171
331
|
show_possible_solutions_for_download_and_extraction_problems
|
172
332
|
exit(1)
|
173
333
|
end
|
174
334
|
end
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
if subphase == 0
|
183
|
-
show_progress(progress, total, phase, total_phases, status_text)
|
184
|
-
else
|
185
|
-
show_progress(progress, total, phase + 1 .. phase + 3, total_phases, status_text)
|
335
|
+
nginx_sources_name = "nginx-#{@nginx_version}"
|
336
|
+
|
337
|
+
Dir.chdir(@working_dir) do
|
338
|
+
begin_progress_bar
|
339
|
+
begin
|
340
|
+
result = extract_tarball(tarball) do |progress, total|
|
341
|
+
show_progress(progress / total * 0.1, 1.0, 1, 1, "Extracting Nginx sources...")
|
186
342
|
end
|
343
|
+
rescue Exception
|
344
|
+
puts
|
345
|
+
raise
|
187
346
|
end
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
347
|
+
if result
|
348
|
+
return "#{@working_dir}/#{nginx_sources_name}"
|
349
|
+
else
|
350
|
+
puts
|
351
|
+
show_possible_solutions_for_download_and_extraction_problems
|
352
|
+
exit(1)
|
193
353
|
end
|
194
|
-
phase += 3
|
195
354
|
end
|
196
|
-
|
197
|
-
|
198
|
-
puts "<green><b>All done!</b></green>"
|
199
|
-
puts
|
200
|
-
end
|
201
|
-
|
202
|
-
def before_install
|
203
|
-
super
|
204
|
-
@plugin.call_hook(:runtime_installer_start, self) if @plugin
|
205
|
-
@working_dir = PhusionPassenger::Utils.mktmpdir("passenger.", PlatformInfo.tmpexedir)
|
206
|
-
@download_binaries = true if !defined?(@download_binaries)
|
207
|
-
@binaries_url_root ||= STANDALONE_BINARIES_URL_ROOT
|
355
|
+
rescue Interrupt
|
356
|
+
exit 2
|
208
357
|
end
|
209
358
|
|
210
|
-
def
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
359
|
+
def compile_support_binaries
|
360
|
+
begin_progress_bar
|
361
|
+
show_progress(0, 1, 1, 1, "Preparing Phusion Passenger...")
|
362
|
+
Dir.chdir(PhusionPassenger.source_root) do
|
363
|
+
args = "nginx_without_native_support" +
|
364
|
+
" CACHING=false" +
|
365
|
+
" OUTPUT_DIR='#{@support_dir}'"
|
366
|
+
begin
|
367
|
+
run_rake_task!(args) do |progress, total|
|
368
|
+
show_progress(progress, total, 1, 1, "Compiling Phusion Passenger...")
|
369
|
+
end
|
370
|
+
ensure
|
371
|
+
puts
|
372
|
+
end
|
215
373
|
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
end
|
233
|
-
|
234
|
-
def should_download_binaries?
|
235
|
-
return @download_binaries && @binaries_url_root
|
374
|
+
system "rm -rf '#{@support_dir}'/agents/{*.o,*.dSYM}"
|
375
|
+
system "rm -rf '#{@support_dir}'/common/libboost_oxt"
|
376
|
+
system "rm -rf '#{@support_dir}'/*/{*.lo,*.h,*.log,Makefile,libtool,stamp-h1,config.status,.deps}"
|
377
|
+
system "rm -rf '#{@support_dir}'/{libeio,libev}/*.o"
|
378
|
+
|
379
|
+
# Retain only the object files that are needed for linking the Phusion Passenger module into Nginx.
|
380
|
+
nginx_libs = COMMON_LIBRARY.
|
381
|
+
only(*NGINX_LIBS_SELECTOR).
|
382
|
+
set_output_dir("#{@support_dir}/libpassenger_common").
|
383
|
+
link_objects
|
384
|
+
Dir["#{@support_dir}/libpassenger_common/**/*"].each do |filename|
|
385
|
+
if !nginx_libs.include?(filename) && File.file?(filename)
|
386
|
+
File.unlink(filename)
|
387
|
+
end
|
388
|
+
end
|
389
|
+
end
|
236
390
|
end
|
237
|
-
|
238
|
-
def
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
puts
|
391
|
+
|
392
|
+
def compile_nginx(nginx_source_dir)
|
393
|
+
install_nginx_from_source(nginx_source_dir) do |progress, total, status_text|
|
394
|
+
show_progress(0.1 + progress / total.to_f * 0.9, 1.0, 1, 1, status_text)
|
395
|
+
end
|
243
396
|
end
|
244
397
|
|
245
398
|
def check_whether_we_can_write_to(dir)
|
@@ -272,8 +425,17 @@ private
|
|
272
425
|
status_text)
|
273
426
|
text = text.ljust(max_width)
|
274
427
|
text = text[0 .. max_width - 1]
|
275
|
-
|
276
|
-
|
428
|
+
if @stdout.tty?
|
429
|
+
@stdout.write("#{text}\r")
|
430
|
+
@stdout.flush
|
431
|
+
else
|
432
|
+
if @last_status_text != status_text
|
433
|
+
@last_status_text = status_text
|
434
|
+
@stdout.write("[#{status_text.sub(/\.*$/, '')}]")
|
435
|
+
end
|
436
|
+
@stdout.write(".")
|
437
|
+
@stdout.flush
|
438
|
+
end
|
277
439
|
@plugin.call_hook(:runtime_installer_progress, total_progress, status_text) if @plugin
|
278
440
|
end
|
279
441
|
|
@@ -301,7 +463,7 @@ private
|
|
301
463
|
buffer = buffer.force_encoding('binary') if buffer.respond_to?(:force_encoding)
|
302
464
|
total_size = File.size(filename)
|
303
465
|
bytes_read = 0
|
304
|
-
yield(bytes_read, total_size)
|
466
|
+
yield(bytes_read, total_size) if block_given?
|
305
467
|
begin
|
306
468
|
doing_our_io = true
|
307
469
|
while !f.eof?
|
@@ -310,7 +472,7 @@ private
|
|
310
472
|
io.flush
|
311
473
|
bytes_read += buffer.size
|
312
474
|
doing_our_io = false
|
313
|
-
yield(bytes_read, total_size)
|
475
|
+
yield(bytes_read, total_size) if block_given?
|
314
476
|
doing_our_io = true
|
315
477
|
end
|
316
478
|
rescue Errno::EPIPE
|
@@ -340,9 +502,9 @@ private
|
|
340
502
|
end
|
341
503
|
end
|
342
504
|
if $?.exitstatus != 0
|
343
|
-
|
344
|
-
|
345
|
-
|
505
|
+
@stderr.puts
|
506
|
+
@stderr.puts backlog
|
507
|
+
@stderr.puts "*** ERROR: command failed: #{command}"
|
346
508
|
exit 1
|
347
509
|
end
|
348
510
|
end
|
@@ -382,148 +544,20 @@ private
|
|
382
544
|
end
|
383
545
|
end
|
384
546
|
if $?.exitstatus != 0
|
385
|
-
|
386
|
-
|
387
|
-
|
547
|
+
@stderr.puts
|
548
|
+
@stderr.puts "*** ERROR: the following command failed:"
|
549
|
+
@stderr.puts(backlog)
|
388
550
|
exit 1
|
389
551
|
end
|
390
552
|
end
|
391
553
|
|
392
|
-
def download_and_extract_binary_support_files(target, &block)
|
393
|
-
puts "<banner>Downloading Passenger support binaries for your platform, if available...</banner>"
|
394
|
-
basename = "support-#{PlatformInfo.cxx_binary_compatibility_id}.tar.gz"
|
395
|
-
url = "#{@binaries_url_root}/#{PhusionPassenger::VERSION_STRING}/#{basename}"
|
396
|
-
tarball = "#{@working_dir}/#{basename}"
|
397
|
-
if !download(url, tarball)
|
398
|
-
puts "<b>Looks like it's not. But don't worry, the " +
|
399
|
-
"necessary binaries will be compiled from source instead.</b>"
|
400
|
-
return nil
|
401
|
-
end
|
402
|
-
|
403
|
-
FileUtils.mkdir_p(target)
|
404
|
-
Dir.chdir(target) do
|
405
|
-
return extract_tarball(tarball, &block)
|
406
|
-
end
|
407
|
-
rescue Interrupt
|
408
|
-
exit 2
|
409
|
-
end
|
410
|
-
|
411
|
-
def download_and_extract_ruby_extension(target, &block)
|
412
|
-
puts "<banner>Downloading Ruby extension for your Ruby and platform, if available...</banner>"
|
413
|
-
basename = "rubyext-#{PlatformInfo.ruby_extension_binary_compatibility_id}.tar.gz"
|
414
|
-
url = "#{@binaries_url_root}/#{PhusionPassenger::VERSION_STRING}/#{basename}"
|
415
|
-
tarball = "#{@working_dir}/#{basename}"
|
416
|
-
if !download(url, tarball)
|
417
|
-
puts "<b>Looks like it's not. But don't worry, the " +
|
418
|
-
"necessary binaries will be compiled from source instead.</b>"
|
419
|
-
return nil
|
420
|
-
end
|
421
|
-
|
422
|
-
FileUtils.mkdir_p(target)
|
423
|
-
Dir.chdir(target) do
|
424
|
-
return extract_tarball(tarball, &block)
|
425
|
-
end
|
426
|
-
rescue Interrupt
|
427
|
-
exit 2
|
428
|
-
end
|
429
|
-
|
430
|
-
def download_and_extract_nginx_binaries(target, &block)
|
431
|
-
puts "<banner>Downloading Nginx binaries for your platform, if available...</banner>"
|
432
|
-
basename = "nginx-#{@nginx_version}-#{PlatformInfo.cxx_binary_compatibility_id}.tar.gz"
|
433
|
-
url = "#{@binaries_url_root}/#{PhusionPassenger::VERSION_STRING}/#{basename}"
|
434
|
-
tarball = "#{@working_dir}/#{basename}"
|
435
|
-
if !download(url, tarball)
|
436
|
-
puts "<b>Looks like it's not. But don't worry, the " +
|
437
|
-
"necessary binaries will be compiled from source instead.</b>"
|
438
|
-
return nil
|
439
|
-
end
|
440
|
-
|
441
|
-
FileUtils.mkdir_p(target)
|
442
|
-
Dir.chdir(target) do
|
443
|
-
return extract_tarball(tarball, &block)
|
444
|
-
end
|
445
|
-
rescue Interrupt
|
446
|
-
exit 2
|
447
|
-
end
|
448
|
-
|
449
|
-
def download_and_extract_nginx_sources(&block)
|
450
|
-
if @nginx_tarball
|
451
|
-
tarball = @nginx_tarball
|
452
|
-
else
|
453
|
-
puts "<banner>Downloading Nginx...</banner>"
|
454
|
-
basename = "nginx-#{@nginx_version}.tar.gz"
|
455
|
-
tarball = "#{@working_dir}/#{basename}"
|
456
|
-
if !download("http://nginx.org/download/#{basename}", tarball)
|
457
|
-
return nil
|
458
|
-
end
|
459
|
-
end
|
460
|
-
nginx_sources_name = "nginx-#{@nginx_version}"
|
461
|
-
|
462
|
-
Dir.chdir(@working_dir) do
|
463
|
-
begin_progress_bar
|
464
|
-
if extract_tarball(tarball, &block)
|
465
|
-
return "#{@working_dir}/#{nginx_sources_name}"
|
466
|
-
else
|
467
|
-
return nil
|
468
|
-
end
|
469
|
-
end
|
470
|
-
rescue Interrupt
|
471
|
-
exit 2
|
472
|
-
end
|
473
|
-
|
474
|
-
def install_ruby_extension
|
475
|
-
begin_progress_bar
|
476
|
-
yield(0, 1, 0, "Preparing Ruby extension...")
|
477
|
-
Dir.chdir(PhusionPassenger.source_root) do
|
478
|
-
run_rake_task!("native_support CACHING=false ONLY_RUBY=yes RUBY_EXTENSION_OUTPUT_DIR='#{@ruby_dir}'") do |progress, total|
|
479
|
-
yield(progress, total, 1, "Compiling Ruby extension...")
|
480
|
-
end
|
481
|
-
system "rm -rf '#{@ruby_dir}'/{*.log,*.o,Makefile}"
|
482
|
-
end
|
483
|
-
return 2
|
484
|
-
end
|
485
|
-
|
486
|
-
def install_binary_support_files
|
487
|
-
begin_progress_bar
|
488
|
-
yield(0, 1, 0, "Preparing Phusion Passenger...")
|
489
|
-
Dir.chdir(PhusionPassenger.source_root) do
|
490
|
-
args = "nginx_without_native_support" +
|
491
|
-
" CACHING=false" +
|
492
|
-
" OUTPUT_DIR='#{@support_dir}'"
|
493
|
-
run_rake_task!(args) do |progress, total|
|
494
|
-
yield(progress, total, 1, "Compiling Phusion Passenger...")
|
495
|
-
end
|
496
|
-
|
497
|
-
system "rm -rf '#{@support_dir}'/agents/{*.o,*.dSYM}"
|
498
|
-
system "rm -rf '#{@support_dir}'/common/libboost_oxt"
|
499
|
-
system "rm -rf '#{@support_dir}'/*/{*.lo,*.h,*.log,Makefile,libtool,stamp-h1,config.status,.deps}"
|
500
|
-
system "rm -rf '#{@support_dir}'/{libeio,libev}/*.o"
|
501
|
-
|
502
|
-
# Retain only the object files that are needed for linking the Phusion Passenger module into Nginx.
|
503
|
-
nginx_libs = COMMON_LIBRARY.
|
504
|
-
only(*NGINX_LIBS_SELECTOR).
|
505
|
-
set_output_dir("#{@support_dir}/libpassenger_common").
|
506
|
-
link_objects
|
507
|
-
Dir["#{@support_dir}/libpassenger_common/**/*"].each do |filename|
|
508
|
-
if !nginx_libs.include?(filename) && File.file?(filename)
|
509
|
-
File.unlink(filename)
|
510
|
-
end
|
511
|
-
end
|
512
|
-
end
|
513
|
-
return 2
|
514
|
-
end
|
515
|
-
|
516
554
|
def install_nginx_from_source(source_dir)
|
517
555
|
require 'phusion_passenger/platform_info/compiler'
|
518
556
|
Dir.chdir(source_dir) do
|
519
557
|
shell = PlatformInfo.find_command('bash') || "sh"
|
520
558
|
command = ""
|
521
559
|
if @targets.include?(:support_binaries)
|
522
|
-
|
523
|
-
output_dir = "#{PhusionPassenger.source_root}/buildout/common/libpassenger_common"
|
524
|
-
else
|
525
|
-
output_dir = "#{@support_dir}/common/libpassenger_common"
|
526
|
-
end
|
560
|
+
output_dir = "#{@support_dir}/common/libpassenger_common"
|
527
561
|
nginx_libs = COMMON_LIBRARY.only(*NGINX_LIBS_SELECTOR).
|
528
562
|
set_output_dir(output_dir).
|
529
563
|
link_objects_as_string
|
@@ -545,7 +579,7 @@ private
|
|
545
579
|
"--without-http_uwsgi_module " <<
|
546
580
|
"--with-http_gzip_static_module " <<
|
547
581
|
"--with-http_stub_status_module " <<
|
548
|
-
"'--add-module=#{PhusionPassenger.
|
582
|
+
"'--add-module=#{PhusionPassenger.nginx_module_source_dir}'"
|
549
583
|
run_command_with_throbber(command, "Preparing Nginx...") do |status_text|
|
550
584
|
yield(0, 1, status_text)
|
551
585
|
end
|
@@ -562,25 +596,29 @@ private
|
|
562
596
|
end
|
563
597
|
end
|
564
598
|
if $?.exitstatus != 0
|
565
|
-
|
566
|
-
|
567
|
-
|
599
|
+
@stderr.puts
|
600
|
+
@stderr.puts "*** ERROR: unable to compile Nginx."
|
601
|
+
@stderr.puts backlog
|
568
602
|
exit 1
|
569
603
|
end
|
570
604
|
|
571
605
|
yield(1, 1, 'Copying files...')
|
572
606
|
if !system("cp -pR objs/nginx '#{@nginx_dir}/'")
|
573
|
-
|
574
|
-
|
607
|
+
@stderr.puts
|
608
|
+
@stderr.puts "*** ERROR: unable to copy Nginx binary."
|
575
609
|
exit 1
|
576
610
|
end
|
577
|
-
if !
|
578
|
-
|
579
|
-
|
611
|
+
if !strip_binary("#{@nginx_dir}/nginx")
|
612
|
+
@stderr.puts
|
613
|
+
@stderr.puts "*** ERROR: unable to strip debugging symbols from the Nginx binary."
|
580
614
|
exit 1
|
581
615
|
end
|
582
616
|
end
|
583
617
|
end
|
618
|
+
|
619
|
+
def strip_binary(filename)
|
620
|
+
return system("strip", filename)
|
621
|
+
end
|
584
622
|
end
|
585
623
|
|
586
624
|
end # module Standalone
|