passenger 5.0.6 → 5.0.7

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.

Files changed (74) hide show
  1. checksums.yaml +8 -8
  2. checksums.yaml.gz.asc +7 -7
  3. data.tar.gz.asc +7 -7
  4. data/CHANGELOG +26 -0
  5. data/Rakefile +0 -1
  6. data/bin/passenger-install-apache2-module +46 -12
  7. data/bin/passenger-status +6 -3
  8. data/build/packaging.rb +9 -1
  9. data/dev/ci/run_travis.sh +0 -36
  10. data/doc/ServerOptimizationGuide.html +12 -11
  11. data/doc/ServerOptimizationGuide.txt.md +12 -11
  12. data/doc/Users guide Apache.html +81 -75
  13. data/doc/Users guide Apache.idmap.txt +15 -13
  14. data/doc/Users guide Apache.txt +9 -1
  15. data/doc/Users guide Nginx.html +81 -76
  16. data/doc/Users guide Nginx.idmap.txt +15 -13
  17. data/doc/Users guide Nginx.txt +8 -0
  18. data/doc/Users guide Standalone.html +183 -24
  19. data/doc/Users guide Standalone.idmap.txt +19 -11
  20. data/doc/Users guide Standalone.txt +4 -0
  21. data/doc/users_guide_snippets/environment_variables.txt +2 -1
  22. data/doc/users_guide_snippets/installation.txt +15 -2
  23. data/doc/users_guide_snippets/tips.txt +19 -31
  24. data/doc/users_guide_snippets/under_the_hood/relationship_with_ruby.txt +7 -0
  25. data/ext/apache2/ConfigurationCommands.cpp +7 -0
  26. data/ext/apache2/ConfigurationFields.hpp +2 -0
  27. data/ext/apache2/ConfigurationSetters.cpp +8 -0
  28. data/ext/apache2/CreateDirConfig.cpp +1 -0
  29. data/ext/apache2/MergeDirConfig.cpp +7 -0
  30. data/ext/apache2/SetHeaders.cpp +5 -0
  31. data/ext/common/ApplicationPool2/Options.h +9 -0
  32. data/ext/common/Constants.h +3 -1
  33. data/ext/common/Logging.cpp +2 -2
  34. data/ext/common/ServerKit/HttpHeaderParser.h +13 -1
  35. data/ext/common/ServerKit/Implementation.cpp +7 -1
  36. data/ext/common/agents/Base.cpp +1 -1
  37. data/ext/common/agents/HelperAgent/OptionParser.h +15 -0
  38. data/ext/common/agents/HelperAgent/RequestHandler.h +3 -1
  39. data/ext/common/agents/HelperAgent/RequestHandler/BufferBody.cpp +3 -3
  40. data/ext/common/agents/HelperAgent/RequestHandler/InitRequest.cpp +12 -1
  41. data/ext/common/agents/HelperAgent/RequestHandler/Utils.cpp +7 -3
  42. data/ext/common/agents/HelperAgent/ResponseCache.h +7 -1
  43. data/ext/common/agents/LoggingAgent/Main.cpp +4 -1
  44. data/ext/nginx/CacheLocationConfig.c +20 -0
  45. data/ext/nginx/Configuration.c +7 -0
  46. data/ext/nginx/ConfigurationCommands.c +10 -0
  47. data/ext/nginx/ConfigurationFields.h +2 -0
  48. data/ext/nginx/ContentHandler.c +10 -0
  49. data/ext/nginx/CreateLocationConfig.c +5 -0
  50. data/ext/nginx/MergeLocationConfig.c +6 -0
  51. data/helper-scripts/meteor-loader.rb +15 -2
  52. data/helper-scripts/rack-loader.rb +2 -6
  53. data/helper-scripts/rack-preloader.rb +1 -5
  54. data/lib/phusion_passenger.rb +3 -3
  55. data/lib/phusion_passenger/apache2/config_options.rb +5 -0
  56. data/lib/phusion_passenger/config/command.rb +9 -0
  57. data/lib/phusion_passenger/config/install_standalone_runtime_command.rb +4 -0
  58. data/lib/phusion_passenger/config/validate_install_command.rb +478 -46
  59. data/lib/phusion_passenger/constants.rb +1 -0
  60. data/lib/phusion_passenger/loader_shared_helpers.rb +26 -3
  61. data/lib/phusion_passenger/nginx/config_options.rb +4 -0
  62. data/lib/phusion_passenger/packaging.rb +0 -8
  63. data/lib/phusion_passenger/platform_info/apache.rb +40 -28
  64. data/lib/phusion_passenger/platform_info/apache_detector.rb +29 -3
  65. data/lib/phusion_passenger/rack/thread_handler_extension.rb +12 -7
  66. data/lib/phusion_passenger/request_handler/thread_handler.rb +5 -0
  67. data/lib/phusion_passenger/standalone/start_command.rb +46 -5
  68. data/lib/phusion_passenger/standalone/start_command/builtin_engine.rb +5 -3
  69. data/resources/templates/apache2/config_snippets.txt.erb +1 -1
  70. data/resources/templates/apache2/run_installer_as_root_for_apache_analysis.txt.erb +9 -0
  71. data/resources/templates/standalone/config.erb +16 -1
  72. metadata +3 -3
  73. metadata.gz.asc +7 -7
  74. data/build/debian.rb +0 -213
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZTMzY2I0N2RkY2E0MjZlYzk2NjViZWIyMzA1ZmQ0OTM1MTU1ZGRhMg==
4
+ ZGVkMzYyMTlmMjgxNzMzZjM2OGUwZjcyZTA2NzNiYjMxODc0NzBiMg==
5
5
  data.tar.gz: !binary |-
6
- YjBkMzFiNmJkMjQ4NzJhM2EzZjMyZjM1YWYwOTVmYjA0ODkyZTI5YQ==
6
+ OTBhOGFhYWM3MDY4YzU5Y2M2YmQ1MWQ0MWQ4YjQyNDVkNzc5ZDk5Nw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTI4MGU1MjdhMzFmNDI5YzYwODc3ODI5Mjc5OTBiMGI5OTQ0N2FkOTExMTc2
10
- MDI1ZDZiMzNkNDc3Yzk3OTM3ZDE2OThjOTQ4OTE1OWRlM2UwYzUxMjE3MDlk
11
- ZjRkYzcwOTE3N2ZjZWNmZTk5NGNjYzQ4MTI3NjA5N2I0MmUyNjY=
9
+ NzU3MDE1MGEzYzExOTg2NmZlNDYxYzQ4YmQ0YzUwYWJhMjdlY2NiNWYxYTE1
10
+ Nzc1ZDcxZWMxNWI1ZTY1Mzc5NDYxNWZlZWMwOGVlMjJjZGI4NTJjMGQxNzZk
11
+ YjZiZTQ3OWI1ODZiNTMzMjU5MjEwZDY4ZmI2OWJkNDM1NDFkMTk=
12
12
  data.tar.gz: !binary |-
13
- YTQwODBlYjJiMzM1ZGZiYzRlNGIwZDcyNTBlYmRmMzg5NDNiN2JiM2U0NGE0
14
- ZmQ5ODlmMzQyYThjNjczZjRmNzkxMDA2ZTZjM2Q2ZmVmNzZmNjZiOWYwNjNk
15
- M2FjMDA1Zjk4YmM1ZTU1N2VkM2I2ODIyNTBlYjI0Zjk0ODI4ZmE=
13
+ ZThmNTdiODU2MDIwODgwNmJjM2FkYzNhMjhlNDNhNjAzNDk4MGQ1ZGJkYWZk
14
+ OGEyMzM5MWNkNDcxMWNmNmEyNGFjOWNjYzAyMjNmNjRkNjViZTA4ODJjMTUw
15
+ NjNmZjQzNmRjNTM3ODhmZTIyYWU1NGY0MzA4YzBlNzIzNzllYTY=
@@ -2,11 +2,11 @@
2
2
  Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
3
3
  Comment: GPGTools - http://gpgtools.org
4
4
 
5
- iQEcBAABAgAGBQJVGmsTAAoJECrHRaUKISqMWU4IAJ1i9nlQrPUlu6bOF8uOfMe1
6
- 0GNRr2q37ZeB5lzeqUxFb/qD3IoUast1H7tGaO6/7uFkgDIBLM9eCDfXtaT2oR52
7
- +zSYQQ6uICIuzw5hGLKQyA+za20NRspYhgOal1Seh9Urn4uRXDiuwwcAaaH2BuCg
8
- NorUslin3YoWxmDO/fEHPmoNe5YqgzxZvWGZBDebfhuHMi7YYKlaPESqLvGWNfSR
9
- rr6ygaqpWNU5FFbibVy6+fNkbBIH8tYow7RURBaQ1VPnwu51Fb+AiLumQsi1RJ5i
10
- 6tHTNyqrRd9+DOQZctYGIt+RPGWN1XfQ2o8Ydp22qyVed45yhz8bYGrDxV/JevE=
11
- =my8R
5
+ iQEcBAABAgAGBQJVP5XZAAoJECrHRaUKISqMKj8IAIGrbTDuXh7udR1pCe9K5JHf
6
+ wsBtEQvDAZpp+mPdwddODK5a/2e0UsXoHPniq9kZIESGv/plrlW5QdO8ISjPClHB
7
+ H/VxlnaHFgqqCoIZUxNwtO6wMHaKRM80BJZj74UcZ5GtWhKi3fymgoJDXjKpltsv
8
+ 6Og68fJdLKEDY9fYr9/V/32B7wk06cW6VTcZmZKYqUsKcroqcKUZqFmHmUddp6rf
9
+ WUQb/ftEn2/kzOEvO4KemikyAjVVFftSLLXMAcpKqEPcEf8maaXALMdxffUPmdYm
10
+ ljSQULByzhttNz+Aj+3l8P/UC6iMAGgZk0v6LGvm7acaSutMMOuE6Kxpc3XcM54=
11
+ =/84R
12
12
  -----END PGP SIGNATURE-----
data.tar.gz.asc CHANGED
@@ -2,11 +2,11 @@
2
2
  Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
3
3
  Comment: GPGTools - http://gpgtools.org
4
4
 
5
- iQEcBAABAgAGBQJVGmsTAAoJECrHRaUKISqMgCMIAICYJu67lJmPueuE4lvXNTPc
6
- xHKXjRfCpNyzINRWBkdu2G/hz6QGUcZsZwBchcstmFanh0YESg9c3NM67SVdMO4v
7
- U+s3S6uPW3UbkrWp57y0zqldnoqlGJu4f9NqO30MIQtGJlaEJQq6T7ndkK+dJbqc
8
- lOQZZWrenr7DiRDR1XjUnHKvM1rY9Lop8X+tikIoQh804TUUqe5h71BAQUu2YzS6
9
- KfPRDEPU4m6jmC1Ook72dLV9HZs8iXvOQLhV8zWmAlkPg/lF8FEx5tmLzUuNkQMl
10
- WXVNlqujpGw/BpaI64NJrbAsDrU+JCaS1CBgYV2P8J46Ba4O/VU1buaL+SeBwaE=
11
- =qiL8
5
+ iQEcBAABAgAGBQJVP5XZAAoJECrHRaUKISqMA/4IAJ2gXqVHccGedmr4esxxyFYS
6
+ RNHZgu+S/dmaC+BhuboGroSqnB3SMgR2R9efGU54NmnrDb6VJfeaj+iSSy9hTX4g
7
+ 3TL849nKlZmwc/bY1A47aZ6CXsm5XoxFsry+j4eUD4yrkJasIAvJjlBhiOy2oVyO
8
+ cgAt18iqpdN1SyA39akeX15Qufw6sDK+4XBlXzIR2w0pXG0aCIkvil3TYCVDxlRv
9
+ ZEABXT+63H6wuGRk3rFut8JYGFspE1PXP6u0/KSauo+EcJvzASo8Z1Tkdu7WqZtZ
10
+ HOpaspDAJaCosT2Is23dwoAqi6EK4NIFxWqD6mm9SnK9pChXbqJ8JqrYZjqtFtA=
11
+ =jxZu
12
12
  -----END PGP SIGNATURE-----
data/CHANGELOG CHANGED
@@ -1,3 +1,29 @@
1
+ Release 5.0.7
2
+ -------------
3
+
4
+ * Supports changed way of specifying settings for (non-bundled) Meteor apps. Closes GH-1403.
5
+ * Fixes an integer-to-string conversion bug in the code responsible for buffering chunked request bodies. This bug could cause the PassengerAgent to crash due to an exception. Thanks to Marcus Rückert of SUSE for reporting this.
6
+ * Request-specific environment variables are no longer cached. This fixes a number of issues, such as Shibboleth not working properly and conflicts between HTTPS and non-HTTPS virtual hosts. Closes GH-1472.
7
+ * Fixes a memory corruption bug that would be triggered when using `passenger_base_uri`. The memory corruption bug resided in the code for resolving symlinks. Closes GH-1388.
8
+ * Re-introduced signal catchers during shutdown, to allow clean shutdown in Foreman. Closes GH-1454.
9
+ * `passenger-status --show=xml` no longer outputs the non-XML header by default. This fixes a regression as reported in a comment in GH-1136.
10
+ * Passenger now prefers to load Rack and Bundler from RubyGems instead of from `vendor_ruby`. This solves some issues with Rack and Bundler on Debian systems. Closes GH-1480 and GH-1478.
11
+ * The turbocache no longer caches responses that contain the `X-Sendfile` or the `X-Accel-Redirect` header.
12
+ * The preferred Nginx version has been upgraded to 1.6.3.
13
+ * The logging agent no longer aborts with an error if one of the Passenger root directory's parent directories is not world-executable. Closes GH-1487.
14
+ * [Standalone] It is now possible to configure the Ruby, Node.js and Python executable to use in Passenger Standalone through the command line options --ruby, --nodejs and --python. Closes GH-1442.
15
+ * [Standalone] Running `passenger start --engine=builtin --daemonize` would fail with a timeout error. This has been fixed.
16
+ * [Standalone] Running `passenger start --nginx-version=XXX` would crash. This has been fixed. Closes GH-1490.
17
+ * [Apache] Fixed some issues with X-Sendfile. Closes GH-1376.
18
+ * [Apache] If the installer fails to autodetect Apache while the installer is running as a normal user, it will now ask you to give it root privileges. Closes GH-1289.
19
+ * [Apache] The installer now validates your Apache configuration file to check for common problems. The validator can also be accessed separately by running `passenger-config validate-install --validate-apache2`.
20
+ * [Nginx] Introduces the `passenger_read_timeout` option for rare cases when server needs more than the default 10 minute timeout. Contributed by pkmiec. Closes [GH-PR-34](https://github.com/phusion/passenger/pull/34).
21
+ * [Nginx] The Nginx module now looks for index.html if the path ends in / so that it works intuitively, without needing to use try_files.
22
+ * Fixes wrong memory address display in crash dumps. Thanks to thoughtpolice for pointing it out.
23
+ * Fixes an ugly backtrace that would be shown if an invalid request is made to an application process using the private HTTP interface. Contributed by jbergler. Closes GH-1311.
24
+ * Various documentation improvements. Closes [GH-PR-1332](https://github.com/phusion/passenger/pull/1332), [GH-PR-1354](https://github.com/phusion/passenger/pull/1354), [GH-PR-1216](https://github.com/phusion/passenger/pull/1216), [GH-PR-1385](https://github.com/phusion/passenger/pull/1385), [GH-PR-1302](https://github.com/phusion/passenger/pull/1302).
25
+
26
+
1
27
  Release 5.0.6
2
28
  -------------
3
29
 
data/Rakefile CHANGED
@@ -53,7 +53,6 @@ else
53
53
  require 'build/node_tests'
54
54
  require 'build/integration_tests'
55
55
  require 'build/misc'
56
- require 'build/debian'
57
56
  end
58
57
 
59
58
  #### Default tasks
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: binary
3
3
  # Phusion Passenger - https://www.phusionpassenger.com/
4
- # Copyright (c) 2010-2014 Phusion
4
+ # Copyright (c) 2010-2015 Phusion
5
5
  #
6
6
  # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
7
7
  #
@@ -48,6 +48,7 @@ PhusionPassenger.require_passenger_lib 'platform_info/ruby'
48
48
  PhusionPassenger.require_passenger_lib 'platform_info/apache'
49
49
  PhusionPassenger.require_passenger_lib 'platform_info/apache_detector'
50
50
  PhusionPassenger.require_passenger_lib 'abstract_installer'
51
+ PhusionPassenger.require_passenger_lib 'config/validate_install_command'
51
52
  PhusionPassenger.require_passenger_lib 'utils/terminal_choice_menu'
52
53
 
53
54
  class Installer < PhusionPassenger::AbstractInstaller
@@ -133,6 +134,7 @@ class Installer < PhusionPassenger::AbstractInstaller
133
134
  check_write_permission_to_web_server_config_files || exit(1)
134
135
  if compile_apache2_module
135
136
  install_apache2_config_snippets || exit(1)
137
+ validate_install
136
138
  show_deployment_example
137
139
  else
138
140
  show_possible_solutions_for_compilation_and_installation_problems
@@ -188,7 +190,7 @@ private
188
190
 
189
191
  def check_whether_there_are_multiple_apache_installs
190
192
  new_screen
191
- puts '<banner>Sanity checking Apache installation...</banner>'
193
+ puts '<banner>Checking whether there are multiple Apache installations...</banner>'
192
194
 
193
195
  output = StringIO.new
194
196
  detector = PlatformInfo::ApacheDetector.new(output)
@@ -197,14 +199,25 @@ private
197
199
  detector.report
198
200
  @apache2 = detector.result_for(PlatformInfo.apxs2)
199
201
  if @apache2.nil?
200
- render_template 'apache2/apache_install_broken',
201
- :apxs2 => PlatformInfo.apxs2,
202
- :sudo_s_e => PhusionPassenger::PlatformInfo.ruby_sudo_shell_command("-E"),
203
- :ruby => PhusionPassenger::PlatformInfo.ruby_command,
204
- :passenger_config => "#{PhusionPassenger.bin_dir}/passenger-config"
202
+ # Print an extra newline because the autodetection routines
203
+ # may have run some commands which printed stuff to stderr.
204
+ puts
205
+
206
+ if Process.uid == 0
207
+ render_template 'apache2/apache_install_broken',
208
+ :apxs2 => PlatformInfo.apxs2,
209
+ :sudo_s_e => PhusionPassenger::PlatformInfo.ruby_sudo_shell_command("-E"),
210
+ :ruby => PhusionPassenger::PlatformInfo.ruby_command,
211
+ :passenger_config => "#{PhusionPassenger.bin_dir}/passenger-config"
212
+ else
213
+ render_template 'apache2/run_installer_as_root_for_apache_analysis',
214
+ :sudo => PhusionPassenger::PlatformInfo.ruby_sudo_command,
215
+ :sudo_s_e => PhusionPassenger::PlatformInfo.ruby_sudo_shell_command("-E"),
216
+ :ruby => PhusionPassenger::PlatformInfo.ruby_command,
217
+ :installer => "#{PhusionPassenger.bin_dir}/passenger-install-apache2-module #{ORIG_ARGV.join(' ')}"
218
+ end
205
219
  return false
206
- end
207
- if detector.results.size > 1
220
+ elsif detector.results.size > 1
208
221
  other_installs = detector.results - [@apache2]
209
222
  render_template 'apache2/multiple_apache_installations_detected',
210
223
  :current => @apache2,
@@ -225,7 +238,7 @@ private
225
238
  return true
226
239
  end
227
240
  else
228
- puts '<green>All good!</green>'
241
+ puts '<green>Only a single installation detected. This is good.</green>'
229
242
  return true
230
243
  end
231
244
  ensure
@@ -234,13 +247,13 @@ private
234
247
  end
235
248
 
236
249
  def check_whether_apache_uses_compatible_mpm
237
- # 'httpd -V' output is in the form of:
250
+ # 'apache2ctl -V' output is in the form of:
238
251
  #
239
252
  # Server MPM: Prefork # <--- this line is not always available!
240
253
  # ...
241
254
  # Server compiled with....
242
255
  # -D APACHE_MPM_DIR="server/mpm/prefork"
243
- output = PlatformInfo.httpd_V
256
+ output = PlatformInfo.apache2ctl_V
244
257
  output =~ /^Server MPM: +(.*)$/
245
258
  if $1
246
259
  mpm = $1.downcase
@@ -765,6 +778,27 @@ private
765
778
  wait
766
779
  end
767
780
 
781
+ def validate_install
782
+ new_screen
783
+ puts "<banner>Validating installation...</banner>"
784
+ puts
785
+ validator = PhusionPassenger::Config::ValidateInstallCommand.new([
786
+ "--auto", "--validate-apache2", "--invoked-from-installer"])
787
+ exit_code = validator.run_and_get_exit_code
788
+ STDOUT.write(@colors.default_terminal_color)
789
+
790
+ case exit_code
791
+ when PhusionPassenger::Config::ValidateInstallCommand::FAIL_EXIT_CODE
792
+ puts "<b>Please solve the above issues, then press ENTER to continue.</b>"
793
+ wait
794
+ when PhusionPassenger::Config::ValidateInstallCommand::WARN_EXIT_CODE
795
+ puts "<b>Press ENTER to continue.</b>"
796
+ wait
797
+ else
798
+ exit(exit_code)
799
+ end
800
+ end
801
+
768
802
  def show_deployment_example
769
803
  new_screen
770
804
  render_template 'apache2/deployment_example',
@@ -45,7 +45,7 @@ include PhusionPassenger::SharedConstants
45
45
  include PhusionPassenger::AdminTools
46
46
  include PhusionPassenger::Utils::AnsiColors
47
47
 
48
- DEFAULT_OPTIONS = { :show => 'pool', :color => STDOUT.tty?, :header => true }.freeze
48
+ DEFAULT_OPTIONS = { :show => 'pool', :color => STDOUT.tty? }.freeze
49
49
 
50
50
 
51
51
  ##### Show status command #####
@@ -105,7 +105,10 @@ def find_instance_by_name_prefix(name)
105
105
  end
106
106
 
107
107
  def show_status(instance, options)
108
- print_header(STDOUT, instance) if options[:header]
108
+ # if the noshow override is not specified, the default is to show the header, unless show=xml
109
+ if options[:noheader] != true && options[:show] != 'xml'
110
+ print_header(STDOUT, instance)
111
+ end
109
112
 
110
113
  case options[:show]
111
114
  when 'pool'
@@ -265,7 +268,7 @@ def create_option_parser(options)
265
268
  opts.on("--no-header", "Do not display an informative header#{nl}" <<
266
269
  "containing the timestamp, version number,#{nl}" <<
267
270
  "etc.") do
268
- options[:header] = false
271
+ options[:noheader] = true
269
272
  end
270
273
  opts.on("--force-colors", "Display colors even if stdout is not a TTY") do
271
274
  options[:color] = true
@@ -95,6 +95,14 @@ def git_tag
95
95
  return "#{git_tag_prefix}-#{VERSION_STRING}"
96
96
  end
97
97
 
98
+ def apt_repo_name
99
+ if is_open_source?
100
+ "passenger"
101
+ else
102
+ "passenger-enterprise"
103
+ end
104
+ end
105
+
98
106
  def homebrew_dir
99
107
  return "/tmp/homebrew"
100
108
  end
@@ -436,7 +444,7 @@ task 'package:initiate_debian_building' do
436
444
  end
437
445
 
438
446
  uri = URI.parse("https://oss-jenkins.phusion.nl/buildByToken/buildWithParameters?" +
439
- "job=Passenger%20#{type}%20Debian%20packages%20(release)&ref=#{git_tag}")
447
+ "job=Passenger%20#{type}%20Debian%20packages%20(release)&ref=#{git_tag}&repo=#{apt_repo_name}")
440
448
  http = Net::HTTP.new(uri.host, uri.port)
441
449
  http.use_ssl = true
442
450
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER
@@ -74,16 +74,6 @@ function retry_run()
74
74
  function apt_get_update() {
75
75
  if [[ "$apt_get_updated" = "" ]]; then
76
76
  apt_get_updated=1
77
- if [[ "$TEST_DEBIAN_PACKAGING" = 1 ]]; then
78
- if ! [[ -e /usr/bin/add-apt-repository ]]; then
79
- run sudo apt-get update
80
- run sudo apt-get install -y --no-install-recommends python-software-properties
81
- if ! [[ -e /usr/bin/add-apt-repository ]]; then
82
- run sudo apt-get install -y --no-install-recommends software-properties-common
83
- fi
84
- fi
85
- run sudo add-apt-repository -y ppa:phusion.nl/misc
86
- fi
87
77
  run sudo apt-get update
88
78
  fi
89
79
  }
@@ -218,32 +208,6 @@ if [[ "$TEST_STANDALONE" = 1 ]]; then
218
208
  run bundle exec drake -j$COMPILE_CONCURRENCY test:integration:standalone
219
209
  fi
220
210
 
221
- if [[ "$TEST_DEBIAN_PACKAGING" = 1 ]]; then
222
- apt_get_update
223
- run sudo apt-get install -y --no-install-recommends \
224
- devscripts debhelper rake apache2-mpm-worker apache2-threaded-dev \
225
- libev-dev gdebi-core source-highlight
226
- if [[ `lsb_release -r -s` = 12.04 ]]; then
227
- sudo apt-get install -y --no-install-recommends \
228
- ruby1.8 ruby1.8-dev ruby1.9.1 ruby1.9.1-dev rubygems
229
- else
230
- sudo apt-get install -y --no-install-recommends \
231
- ruby1.9.1 ruby1.9.1-dev ruby2.0 ruby2.0-dev
232
- fi
233
- install_test_deps_with_doctools
234
- install_node_and_modules
235
- run bundle exec rake debian:dev debian:dev:reinstall
236
- run bundle exec drake -j$COMPILE_CONCURRENCY test:integration:native_packaging SUDO=1 PRINT_FAILED_COMMAND_OUTPUT=1
237
- (
238
- export GEM_PATH="$ORIG_GEM_PATH"
239
- if ! env NOEXEC_DISABLE=1 rvmsudo -E ruby -rrack -e '' 2>/dev/null; then
240
- retry_run 3 gem install rack --no-rdoc --no-ri
241
- fi
242
- )
243
- run env PASSENGER_LOCATION_CONFIGURATION_FILE=/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini \
244
- bundle exec drake -j$COMPILE_CONCURRENCY test:integration:apache2 SUDO=1
245
- fi
246
-
247
211
  if [[ "$TEST_RPM_PACKAGING" = 1 ]]; then
248
212
  if [[ "$TEST_RPM_BUILDING" != 0 ]]; then
249
213
  pushd packaging/rpm
@@ -235,7 +235,7 @@ PassengerPreStart http://your-website-url.com
235
235
 
236
236
  <h4>Step 2: determine the system's limits</h4>
237
237
 
238
- <p>First, let's define the maximum number of (single-threaded) processes, or the number of threads, that you can comfortably have given the amount of RAM you have. This is a reasonable upper limit that you can reach without degrading system performance. This number is not the final optimal number, but is merely used for further caculations in later steps.</p>
238
+ <p>First, let's define the maximum number of (single-threaded) processes, or the total number of threads, that you can comfortably have given the amount of RAM you have. This is a reasonable upper limit that you can reach without degrading system performance. This number is not the final optimal number, but is merely used for further caculations in later steps.</p>
239
239
 
240
240
  <p>There are two formulas that we can use, depending on what kind of concurrency model your application is using in production.</p>
241
241
 
@@ -262,7 +262,8 @@ PassengerPreStart http://your-website-url.com
262
262
 
263
263
  <pre><code>max_app_threads_per_process =
264
264
  ((TOTAL_RAM * 0.75) - (CHOSEN_NUMBER_OF_PROCESSES * RAM_PER_PROCESS * 0.9)) /
265
- (RAM_PER_PROCESS / 10)
265
+ (RAM_PER_PROCESS / 10) /
266
+ CHOSEN_NUMBER_OF_PROCESSES
266
267
  </code></pre>
267
268
 
268
269
  <p>Here, <code>CHOSEN_NUMBER_OF_PROCESSES</code> is the number of application processes you want to use. In case of Ruby, Python, Node.js and Meteor, this should be equal to <code>NUMBER_OF_CPUS</code>. This is because all these languages can only utilize a single CPU core per process. If you're using a language runtime that does not have a Global Interpreter Lock, e.g. JRuby or Rubinius, then <code>CHOSEN_NUMBER_OF_PROCESSES</code> can be 1.</p>
@@ -271,8 +272,8 @@ PassengerPreStart http://your-website-url.com
271
272
 
272
273
  <ul>
273
274
  <li><code>(TOTAL_RAM * 0.75)</code>: The same as explained earlier.</li>
274
- <li><code>(CHOSEN_NUMBER_OF_PROCESSES * RAM_PER_PROCESS)</code>: In multithreaded scenarios, the application processes consume a constant amount of memory, so we deduct this from the RAM that is available to applications. The result is the amount of RAM available to application threads.</li>
275
- <li><code>/ (RAM_PER_PROCESS / 10)</code>: A thread consumes about 10% of the amount of memory a process would, so we divide the amount of RAM available to threads with this number. What we get is the number of threads that the system can handle.</li>
275
+ <li><code>(CHOSEN_NUMBER_OF_PROCESSES * RAM_PER_PROCESS * 0.9)</code>: This calculates the amount of memory that all the processes together would consume, assuming they're not running any threads. When this is deducted from <code>TOTAL_RAM * 0.75</code>, we end up with the amount of RAM available to application threads.</li>
276
+ <li><code>/ (RAM_PER_PROCESS / 10)</code>: We estimate that a thread consumes ~10% of the amount of memory a process would, so we divide the amount of RAM available to threads with this number. What we get is the number of threads that the system can handle.</li>
276
277
  </ul>
277
278
 
278
279
 
@@ -462,26 +463,26 @@ PassengerMinInstances 163
462
463
 
463
464
  <pre><code># Use this formula for multithreaded deployments.
464
465
  max_app_threads_per_process
465
- = ((1024 * 32 * 0.75) - (8 * 150)) / (150 / 10)
466
- = 1558.4
466
+ = ((1024 * 32 * 0.75) - (8 * 150)) / (150 / 10) / 8
467
+ = 194.8
467
468
  </code></pre>
468
469
 
469
- <p>Conclusion: you should use 1558 threads per process.</p>
470
+ <p>Conclusion: you should use 195 threads per process.</p>
470
471
 
471
472
  <pre><code># Standalone
472
- passenger start --max-pool-size=8 --min-instances=8 --concurrency-model=thread --thread-count=1558
473
+ passenger start --max-pool-size=8 --min-instances=8 --concurrency-model=thread --thread-count=195
473
474
 
474
475
  # Nginx
475
476
  passenger_max_pool_size 8;
476
477
  passenger_min_instances 8;
477
478
  passenger_concurrency_model thread;
478
- passenger_thread_count 1558;
479
+ passenger_thread_count 195;
479
480
 
480
481
  # Apache
481
482
  PassengerMaxPoolSize 8
482
- PassengerMinInstances *
483
+ PassengerMinInstances 8
483
484
  PassengerConcurrencyModel thread
484
- PassengerThreadCount 1558
485
+ PassengerThreadCount 195
485
486
  </code></pre>
486
487
 
487
488
  <p>Because of the huge number of threads, this only works on a 64-bit platform. If you're on a 32-bit platform, consider lowering the number of threads while raising the number of processes. For example, you can double the number of processes (to 16) and halve the number of threads (to 779).</p>
@@ -87,7 +87,7 @@ In our experience, a typical medium-sized single-threaded Rails application proc
87
87
 
88
88
  #### Step 2: determine the system's limits
89
89
 
90
- First, let's define the maximum number of (single-threaded) processes, or the number of threads, that you can comfortably have given the amount of RAM you have. This is a reasonable upper limit that you can reach without degrading system performance. This number is not the final optimal number, but is merely used for further caculations in later steps.
90
+ First, let's define the maximum number of (single-threaded) processes, or the total number of threads, that you can comfortably have given the amount of RAM you have. This is a reasonable upper limit that you can reach without degrading system performance. This number is not the final optimal number, but is merely used for further caculations in later steps.
91
91
 
92
92
  There are two formulas that we can use, depending on what kind of concurrency model your application is using in production.
93
93
 
@@ -110,15 +110,16 @@ The formula for multithreaded concurrency is as follows:
110
110
 
111
111
  max_app_threads_per_process =
112
112
  ((TOTAL_RAM * 0.75) - (CHOSEN_NUMBER_OF_PROCESSES * RAM_PER_PROCESS * 0.9)) /
113
- (RAM_PER_PROCESS / 10)
113
+ (RAM_PER_PROCESS / 10) /
114
+ CHOSEN_NUMBER_OF_PROCESSES
114
115
 
115
116
  Here, `CHOSEN_NUMBER_OF_PROCESSES` is the number of application processes you want to use. In case of Ruby, Python, Node.js and Meteor, this should be equal to `NUMBER_OF_CPUS`. This is because all these languages can only utilize a single CPU core per process. If you're using a language runtime that does not have a Global Interpreter Lock, e.g. JRuby or Rubinius, then `CHOSEN_NUMBER_OF_PROCESSES` can be 1.
116
117
 
117
118
  The formula is derived as follows:
118
119
 
119
120
  * `(TOTAL_RAM * 0.75)`: The same as explained earlier.
120
- * `(CHOSEN_NUMBER_OF_PROCESSES * RAM_PER_PROCESS)`: In multithreaded scenarios, the application processes consume a constant amount of memory, so we deduct this from the RAM that is available to applications. The result is the amount of RAM available to application threads.
121
- * `/ (RAM_PER_PROCESS / 10)`: A thread consumes about 10% of the amount of memory a process would, so we divide the amount of RAM available to threads with this number. What we get is the number of threads that the system can handle.
121
+ * `(CHOSEN_NUMBER_OF_PROCESSES * RAM_PER_PROCESS * 0.9)`: This calculates the amount of memory that all the processes together would consume, assuming they're not running any threads. When this is deducted from `TOTAL_RAM * 0.75`, we end up with the amount of RAM available to application threads.
122
+ * `/ (RAM_PER_PROCESS / 10)`: We estimate that a thread consumes ~10% of the amount of memory a process would, so we divide the amount of RAM available to threads with this number. What we get is the number of threads that the system can handle.
122
123
 
123
124
  On 32-bit systems, `max_app_threads_per_process` should not be higher than about 200. Assuming an 8 MB stack size per thread, you will run out of virtual address space if you go much further. On 64-bit systems you don’t have to worry about this problem.
124
125
 
@@ -263,25 +264,25 @@ But this time you're using multithreading with 8 application processes (because
263
264
 
264
265
  # Use this formula for multithreaded deployments.
265
266
  max_app_threads_per_process
266
- = ((1024 * 32 * 0.75) - (8 * 150)) / (150 / 10)
267
- = 1558.4
267
+ = ((1024 * 32 * 0.75) - (8 * 150)) / (150 / 10) / 8
268
+ = 194.8
268
269
 
269
- Conclusion: you should use 1558 threads per process.
270
+ Conclusion: you should use 195 threads per process.
270
271
 
271
272
  # Standalone
272
- passenger start --max-pool-size=8 --min-instances=8 --concurrency-model=thread --thread-count=1558
273
+ passenger start --max-pool-size=8 --min-instances=8 --concurrency-model=thread --thread-count=195
273
274
 
274
275
  # Nginx
275
276
  passenger_max_pool_size 8;
276
277
  passenger_min_instances 8;
277
278
  passenger_concurrency_model thread;
278
- passenger_thread_count 1558;
279
+ passenger_thread_count 195;
279
280
 
280
281
  # Apache
281
282
  PassengerMaxPoolSize 8
282
- PassengerMinInstances *
283
+ PassengerMinInstances 8
283
284
  PassengerConcurrencyModel thread
284
- PassengerThreadCount 1558
285
+ PassengerThreadCount 195
285
286
 
286
287
  Because of the huge number of threads, this only works on a 64-bit platform. If you're on a 32-bit platform, consider lowering the number of threads while raising the number of processes. For example, you can double the number of processes (to 16) and halve the number of threads (to 779).
287
288