passenger 4.0.23 → 4.0.24

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 (54) hide show
  1. data.tar.gz.asc +7 -7
  2. data/NEWS +17 -0
  3. data/bin/passenger-config +3 -0
  4. data/bin/passenger-install-apache2-module +1 -1
  5. data/bin/passenger-install-nginx-module +1 -1
  6. data/build/integration_tests.rb +5 -3
  7. data/debian.template/control.template +6 -4
  8. data/doc/Users guide Apache.idmap.txt +9 -5
  9. data/doc/Users guide Apache.txt +38 -3
  10. data/doc/Users guide Nginx.idmap.txt +58 -54
  11. data/doc/Users guide Nginx.txt +126 -63
  12. data/doc/Users guide Standalone.idmap.txt +19 -15
  13. data/doc/Users guide Standalone.txt +92 -0
  14. data/doc/users_guide_snippets/environment_variables.txt +11 -0
  15. data/doc/users_guide_snippets/installation.txt +8 -8
  16. data/doc/users_guide_snippets/troubleshooting/default.txt +12 -4
  17. data/ext/apache2/Configuration.cpp +0 -10
  18. data/ext/apache2/Configuration.hpp +0 -3
  19. data/ext/apache2/ConfigurationCommands.cpp +18 -0
  20. data/ext/apache2/ConfigurationFields.hpp +12 -6
  21. data/ext/apache2/ConfigurationFields.hpp.erb +10 -5
  22. data/ext/apache2/ConfigurationSetters.cpp +27 -0
  23. data/ext/apache2/CreateDirConfig.cpp +3 -0
  24. data/ext/apache2/Hooks.cpp +15 -74
  25. data/ext/apache2/MergeDirConfig.cpp +21 -0
  26. data/ext/apache2/SetHeaders.cpp +8 -0
  27. data/ext/common/ApplicationPool2/Group.h +1 -1
  28. data/ext/common/ApplicationPool2/Implementation.cpp +22 -5
  29. data/ext/common/ApplicationPool2/Options.h +10 -1
  30. data/ext/common/ApplicationPool2/Pool.h +4 -0
  31. data/ext/common/Constants.h +4 -2
  32. data/ext/common/agents/HelperAgent/RequestHandler.h +1 -0
  33. data/ext/nginx/CacheLocationConfig.c +20 -0
  34. data/ext/nginx/ConfigurationCommands.c +10 -0
  35. data/ext/nginx/ConfigurationFields.h +2 -0
  36. data/ext/nginx/CreateLocationConfig.c +5 -0
  37. data/ext/nginx/MergeLocationConfig.c +6 -0
  38. data/ext/nginx/config +14 -14
  39. data/lib/phusion_passenger.rb +1 -1
  40. data/lib/phusion_passenger/apache2/config_options.rb +23 -0
  41. data/lib/phusion_passenger/constants.rb +3 -1
  42. data/lib/phusion_passenger/nginx/config_options.rb +4 -0
  43. data/lib/phusion_passenger/platform_info/operating_system.rb +2 -0
  44. data/lib/phusion_passenger/platform_info/ruby.rb +24 -0
  45. data/lib/phusion_passenger/standalone/app_finder.rb +65 -25
  46. data/lib/phusion_passenger/standalone/command.rb +1 -1
  47. data/lib/phusion_passenger/standalone/start_command.rb +6 -5
  48. data/resources/templates/installer_common/run_installer_as_root.txt.erb +4 -1
  49. data/resources/templates/standalone/config.erb +1 -1
  50. data/test/cxx/ApplicationPool2/PoolTest.cpp +18 -0
  51. metadata +13 -5
  52. metadata.gz.asc +7 -7
  53. checksums.yaml +0 -15
  54. checksums.yaml.gz.asc +0 -12
@@ -30,7 +30,7 @@ module PhusionPassenger
30
30
 
31
31
  PACKAGE_NAME = 'passenger'
32
32
  # Run 'rake ext/common/Constants.h' after changing this number.
33
- VERSION_STRING = '4.0.23'
33
+ VERSION_STRING = '4.0.24'
34
34
 
35
35
  PREFERRED_NGINX_VERSION = '1.4.3'
36
36
  NGINX_SHA256_CHECKSUM = 'ae123885c923a6c3f5bab0a8b7296ef21c4fdf6087834667ebbc16338177de84'
@@ -42,6 +42,12 @@
42
42
  # * min_value - If `type` is :integer, then this specifies the minimum
43
43
  # allowed value. When nil (the default), there is no minimum.
44
44
  # * desc - A description for this configuration option. Required.
45
+ # * header - The name of the corresponding CGI header. By default CGI header
46
+ # generation code is automatically generated, using the configuration
47
+ # option's name in uppercase as the CGI header name.
48
+ # Setting this to nil will disable auto-generation of CGI header
49
+ # generation code. You are then responsible for writing CGI header
50
+ # passing code yourself in Hooks.cpp.
45
51
 
46
52
  APACHE2_DIRECTORY_CONFIGURATION_OPTIONS = [
47
53
  {
@@ -50,6 +56,16 @@ APACHE2_DIRECTORY_CONFIGURATION_OPTIONS = [
50
56
  :desc => "The Ruby interpreter to use.",
51
57
  :header_expression => "config->ruby ? config->ruby : serverConfig.defaultRuby"
52
58
  },
59
+ {
60
+ :name => "PassengerPython",
61
+ :type => :string,
62
+ :desc => "The Python interpreter to use."
63
+ },
64
+ {
65
+ :name => "PassengerNodejs",
66
+ :type => :string,
67
+ :desc => "The Node.js command to use."
68
+ },
53
69
  {
54
70
  :name => "PassengerMinInstances",
55
71
  :type => :integer,
@@ -69,6 +85,13 @@ APACHE2_DIRECTORY_CONFIGURATION_OPTIONS = [
69
85
  :context => ["ACCESS_CONF", "RSRC_CONF"],
70
86
  :desc => "The group that Ruby applications must run as."
71
87
  },
88
+ {
89
+ :name => "PassengerErrorOverride",
90
+ :type => :flag,
91
+ :context => ["OR_ALL"],
92
+ :desc => "Allow Apache to handle error response.",
93
+ :header => nil
94
+ },
72
95
  {
73
96
  :name => "PassengerMaxRequests",
74
97
  :type => :integer,
@@ -37,6 +37,7 @@ module PhusionPassenger
37
37
  DEFAULT_LOG_LEVEL = 0
38
38
  DEFAULT_RUBY = "ruby"
39
39
  DEFAULT_PYTHON = "python"
40
+ DEFAULT_NODEJS = "node"
40
41
  DEFAULT_MAX_POOL_SIZE = 6
41
42
  DEFAULT_POOL_IDLE_TIME = 300
42
43
  DEFAULT_START_TIMEOUT = 90_000
@@ -80,7 +81,8 @@ module PhusionPassenger
80
81
  "--without-http_scgi_module " <<
81
82
  "--without-http_uwsgi_module " <<
82
83
  "--with-http_gzip_static_module " <<
83
- "--with-http_stub_status_module"
84
+ "--with-http_stub_status_module " <<
85
+ "--with-http_ssl_module"
84
86
  end
85
87
 
86
88
  SharedConstants.constants.each do |name|
@@ -100,6 +100,10 @@ LOCATION_CONFIGURATION_OPTIONS = [
100
100
  :name => 'passenger_python',
101
101
  :type => :string
102
102
  },
103
+ {
104
+ :name => 'passenger_nodejs',
105
+ :type => :string
106
+ },
103
107
  {
104
108
  :name => 'passenger_app_env',
105
109
  :type => :string,
@@ -32,6 +32,8 @@ module PlatformInfo
32
32
  def self.os_name
33
33
  if rb_config['target_os'] =~ /darwin/ && (sw_vers = find_command('sw_vers'))
34
34
  return "macosx"
35
+ elsif rb_config['target_os'] == "linux-"
36
+ return "linux"
35
37
  else
36
38
  return rb_config['target_os']
37
39
  end
@@ -22,6 +22,7 @@
22
22
  # THE SOFTWARE.
23
23
 
24
24
  require 'rbconfig'
25
+ require 'etc'
25
26
  require 'phusion_passenger/platform_info'
26
27
  require 'phusion_passenger/platform_info/operating_system'
27
28
 
@@ -323,6 +324,29 @@ module PlatformInfo
323
324
  return "sudo"
324
325
  end
325
326
  end
327
+
328
+ # Returns a `sudo` or `rvmsudo` command that spawns a shell, depending
329
+ # on whether the current Ruby interpreter is managed by RVM.
330
+ def self.ruby_sudo_shell_command(args = nil)
331
+ if in_rvm?
332
+ shell = ENV['SHELL'].to_s
333
+ if shell.empty?
334
+ begin
335
+ user = Etc.getpwuid(0)
336
+ rescue ArgumentError
337
+ user = nil
338
+ end
339
+ shell = user.shell if user
340
+ shell = "bash" if !shell || shell.empty?
341
+ end
342
+ result = "rvmsudo "
343
+ result << "#{args} " if args
344
+ result << shell
345
+ return result
346
+ else
347
+ return "sudo -s #{args}".strip
348
+ end
349
+ end
326
350
 
327
351
  # Locates a Ruby tool command, e.g. 'gem', 'rake', 'bundle', etc. Instead of
328
352
  # naively looking in $PATH, this function uses a variety of search heuristics
@@ -25,7 +25,6 @@ require 'phusion_passenger/utils/file_system_watcher'
25
25
  module PhusionPassenger
26
26
  module Standalone
27
27
 
28
- # Security note: can run arbitrary ruby code by evaluating passenger.conf
29
28
  class AppFinder
30
29
  attr_accessor :dirs
31
30
  attr_reader :apps
@@ -34,42 +33,44 @@ class AppFinder
34
33
  return File.exist?("#{dir}/config.ru") ||
35
34
  File.exist?("#{dir}/config/environment.rb") ||
36
35
  File.exist?("#{dir}/passenger_wsgi.py") ||
37
- File.exist?("#{dir}/passenger_node.js")
36
+ File.exist?("#{dir}/app.js") ||
37
+ File.exist?("#{dir}/.meteor")
38
38
  end
39
39
 
40
40
  def initialize(dirs, options = {})
41
41
  @dirs = dirs
42
- @options = options
42
+ @options = options.dup
43
+ end
44
+
45
+ def global_options
46
+ return @options
43
47
  end
44
48
 
45
49
  def scan
46
50
  apps = []
47
51
  watchlist = []
48
52
 
49
- app_root = find_app_root
50
- apps << {
51
- :server_names => ["_"],
52
- :root => app_root
53
- }
54
- watchlist << app_root
55
- watchlist << "#{app_root}/config" if File.exist?("#{app_root}/config")
56
- watchlist << "#{app_root}/passenger.conf" if File.exist?("#{app_root}/passenger.conf")
57
-
58
- apps.sort! do |a, b|
59
- a[:root] <=> b[:root]
60
- end
61
- apps.map! do |app|
62
- config_filename = File.join(app[:root], "passenger.conf")
53
+ if single_mode?
54
+ app_root = find_app_root
55
+ apps << {
56
+ :server_names => ["_"],
57
+ :root => app_root
58
+ }
59
+ watchlist << app_root
60
+ watchlist << "#{app_root}/config" if File.exist?("#{app_root}/config")
61
+ watchlist << "#{app_root}/passenger-standalone.json" if File.exist?("#{app_root}/passenger-standalone.json")
62
+
63
+ config_filename = File.join(app_root, "passenger-standalone.json")
63
64
  if File.exist?(config_filename)
64
- local_options = load_config_file(:local_config, config_filename)
65
- merged_options = @options.merge(app)
66
- merged_options.merge!(local_options)
67
- merged_options
68
- else
65
+ global_options = load_config_file!(:global_config, config_filename)
66
+ @options.merge!(global_options)
67
+ end
68
+
69
+ apps.map! do |app|
69
70
  @options.merge(app)
70
71
  end
71
72
  end
72
-
73
+
73
74
  @apps = apps
74
75
  @watchlist = watchlist
75
76
  return apps
@@ -112,10 +113,21 @@ class AppFinder
112
113
  ensure
113
114
  watcher.close if watcher
114
115
  end
116
+
117
+ def single_mode?
118
+ return true
119
+ end
120
+
121
+ def multi_mode?
122
+ return !single_mode?
123
+ end
115
124
 
116
125
  ##################
117
126
 
118
127
  private
128
+ class ConfigLoadError < StandardError
129
+ end
130
+
119
131
  def find_app_root
120
132
  if @dirs.empty?
121
133
  return File.expand_path(".")
@@ -124,9 +136,37 @@ private
124
136
  end
125
137
  end
126
138
 
139
+ def load_config_file!(context, filename)
140
+ require 'phusion_passenger/utils/json' if !defined?(PhusionPassenger::Utils::JSON)
141
+ begin
142
+ data = File.open(filename, "r:utf-8") do |f|
143
+ f.read
144
+ end
145
+ rescue SystemCallError => e
146
+ raise ConfigLoadError, "cannot load config file #{filename} (#{e})"
147
+ end
148
+
149
+ begin
150
+ config = PhusionPassenger::Utils::JSON.parse(data)
151
+ rescue => e
152
+ raise ConfigLoadError, "cannot parse config file #{filename} (#{e})"
153
+ end
154
+ if !config.is_a?(Hash)
155
+ raise ConfigLoadError, "cannot parse config file #{filename} (it does not contain an object)"
156
+ end
157
+
158
+ result = {}
159
+ config.each_pair do |key, val|
160
+ result[key.to_sym] = val
161
+ end
162
+ return result
163
+ end
164
+
127
165
  def load_config_file(context, filename)
128
- require 'phusion_passenger/standalone/config_file' unless defined?(ConfigFile)
129
- return ConfigFile.new(context, filename).options
166
+ return load_config_file!(context, filename)
167
+ rescue ConfigLoadError => e
168
+ STDERR.puts "*** Warning: #{e.message}"
169
+ return {}
130
170
  end
131
171
 
132
172
  def looks_like_app_directory?(dir)
@@ -32,7 +32,7 @@ class Command
32
32
  DEFAULT_OPTIONS = {
33
33
  :address => '0.0.0.0',
34
34
  :port => 3000,
35
- :env => ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development',
35
+ :environment => ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development',
36
36
  :max_pool_size => 6,
37
37
  :min_instances => 1,
38
38
  :spawn_method => Kernel.respond_to?(:fork) ? 'smart' : 'direct',
@@ -58,10 +58,11 @@ class StartCommand < Command
58
58
  @options[:nginx_version])
59
59
  ensure_runtime_installed
60
60
  exit if @options[:runtime_check_only]
61
- determine_various_resource_locations
62
61
  require_app_finder
63
62
  @app_finder = AppFinder.new(@args, @options)
64
63
  @apps = @app_finder.scan
64
+ @options = @app_finder.global_options
65
+ determine_various_resource_locations
65
66
  @plugin.call_hook(:found_apps, @apps)
66
67
 
67
68
  extra_controller_options = {}
@@ -141,8 +142,8 @@ private
141
142
 
142
143
  opts.separator ""
143
144
  opts.on("-e", "--environment ENV", String,
144
- wrap_desc("Framework environment (default: #{@options[:env]})")) do |value|
145
- @options[:env] = value
145
+ wrap_desc("Framework environment (default: #{@options[:environment]})")) do |value|
146
+ @options[:environment] = value
146
147
  end
147
148
  opts.on("-R", "--rackup FILE", String,
148
149
  wrap_desc("If Rack application detected, run this rackup file")) do |value|
@@ -486,7 +487,7 @@ private
486
487
  puts "=============== Phusion Passenger Standalone web server started ==============="
487
488
  puts "PID file: #{@options[:pid_file]}"
488
489
  puts "Log file: #{@options[:log_file]}"
489
- puts "Environment: #{@options[:env]}"
490
+ puts "Environment: #{@options[:environment]}"
490
491
  puts "Accessible via: #{listen_url}"
491
492
 
492
493
  puts
@@ -563,7 +564,7 @@ private
563
564
  def watch_log_files_in_background
564
565
  @apps.each do |app|
565
566
  thread = Thread.new do
566
- watch_log_file("#{app[:root]}/log/#{@options[:env]}.log")
567
+ watch_log_file("#{app[:root]}/log/#{@options[:environment]}.log")
567
568
  end
568
569
  @threads << thread
569
570
  @interruptable_threads << thread
@@ -7,4 +7,7 @@ This installer must be able to write to the following directory:
7
7
  But it can't do that, because you're running the installer as <b><%= `whoami`.strip %></b>.
8
8
  Please re-run this installer using <%= @sudo %>:
9
9
 
10
- <b><%= @sudo_e %> <%= @ruby %> <%= @installer %></b>
10
+ <b>export ORIG_PATH="$PATH"
11
+ <%= @sudo_s_e %>
12
+ export PATH="$ORIG_PATH"
13
+ <%= @ruby %> <%= @installer %></b>
@@ -92,7 +92,7 @@ http {
92
92
  root '<%= app[:root] %>/public';
93
93
  passenger_app_root '<%= app[:root] %>';
94
94
  passenger_enabled on;
95
- rails_env <%= app[:env] %>;
95
+ passenger_app_env <%= app[:environment] %>;
96
96
  passenger_spawn_method <%= app[:spawn_method] %>;
97
97
  <% if app[:concurrency_model] != DEFAULT_CONCURRENCY_MODEL %>passenger_concurrency_model <%= app[:concurrency_model] %>;<% end %>
98
98
  <% if app[:thread_count] != DEFAULT_THREAD_COUNT %>passenger_thread_count <%= app[:thread_count] %>;<% end %>
@@ -1704,6 +1704,24 @@ namespace tut {
1704
1704
  );
1705
1705
  }
1706
1706
 
1707
+ TEST_METHOD(78) {
1708
+ // Test restarting while a previous restart was already being finalized.
1709
+ // The previous finalization should abort.
1710
+ Options options = createOptions();
1711
+ initPoolDebugging();
1712
+ debug->spawning = false;
1713
+ pool->get(options, &ticket);
1714
+
1715
+ ensure_equals(pool->restartSuperGroupsByAppRoot(options.appRoot), 1u);
1716
+ debug->debugger->recv("About to end restarting");
1717
+ ensure_equals(pool->restartSuperGroupsByAppRoot(options.appRoot), 1u);
1718
+ debug->debugger->recv("About to end restarting");
1719
+ debug->messages->send("Finish restarting");
1720
+ debug->messages->send("Finish restarting");
1721
+ debug->debugger->recv("Restarting done");
1722
+ debug->debugger->recv("Restarting aborted");
1723
+ }
1724
+
1707
1725
  // TODO: Persistent connections.
1708
1726
  // TODO: If one closes the session before it has reached EOF, and process's maximum concurrency
1709
1727
  // has already been reached, then the pool should ping the process so that it can detect
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passenger
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.23
4
+ version: 4.0.24
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Phusion - http://www.phusion.nl/
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-11-01 00:00:00.000000000 Z
12
+ date: 2013-11-14 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: rake
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ! '>='
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ! '>='
25
28
  - !ruby/object:Gem::Version
@@ -27,6 +30,7 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: daemon_controller
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - ! '>='
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - ! '>='
39
44
  - !ruby/object:Gem::Version
@@ -41,6 +46,7 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: rack
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
51
  - - ! '>='
46
52
  - !ruby/object:Gem::Version
@@ -48,6 +54,7 @@ dependencies:
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
59
  - - ! '>='
53
60
  - !ruby/object:Gem::Version
@@ -3010,26 +3017,27 @@ files:
3010
3017
  - test/stub/wsgi/tmp/.gitignore
3011
3018
  homepage: https://www.phusionpassenger.com/
3012
3019
  licenses: []
3013
- metadata: {}
3014
3020
  post_install_message:
3015
3021
  rdoc_options: []
3016
3022
  require_paths:
3017
3023
  - lib
3018
3024
  required_ruby_version: !ruby/object:Gem::Requirement
3025
+ none: false
3019
3026
  requirements:
3020
3027
  - - ! '>='
3021
3028
  - !ruby/object:Gem::Version
3022
3029
  version: '0'
3023
3030
  required_rubygems_version: !ruby/object:Gem::Requirement
3031
+ none: false
3024
3032
  requirements:
3025
3033
  - - ! '>='
3026
3034
  - !ruby/object:Gem::Version
3027
3035
  version: '0'
3028
3036
  requirements: []
3029
3037
  rubyforge_project: passenger
3030
- rubygems_version: 2.1.5
3038
+ rubygems_version: 1.8.23
3031
3039
  signing_key:
3032
- specification_version: 4
3040
+ specification_version: 3
3033
3041
  summary: A fast and robust web server and application server for Ruby, Python and
3034
3042
  Node.js
3035
3043
  test_files: []