passenger 5.0.21 → 5.0.22

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 (203) hide show
  1. checksums.yaml +8 -8
  2. checksums.yaml.gz.asc +7 -7
  3. data.tar.gz.asc +7 -7
  4. data/CHANGELOG +38 -2
  5. data/CONTRIBUTORS +3 -0
  6. data/README.md +5 -1
  7. data/bin/passenger-status +2 -7
  8. data/build/agent.rb +2 -0
  9. data/build/cxx_dependency_map.rb +1464 -162
  10. data/build/node_tests.rb +1 -1
  11. data/build/packaging.rb +1 -1
  12. data/dev/ci/run_travis.sh +1 -1
  13. data/dev/vagrant/provision.sh +1 -1
  14. data/npm-shrinkwrap.json +635 -125
  15. data/package.json +1 -1
  16. data/resources/templates/standalone/config.erb +33 -161
  17. data/resources/templates/standalone/global.erb +15 -0
  18. data/resources/templates/standalone/http.erb +40 -0
  19. data/resources/templates/standalone/mass_deployment_default_server.erb +11 -0
  20. data/resources/templates/standalone/rails_asset_pipeline.erb +22 -0
  21. data/resources/templates/standalone/server.erb +58 -0
  22. data/src/agent/Core/ApiServer.h +37 -32
  23. data/src/agent/Core/ApplicationPool/BasicGroupInfo.h +1 -1
  24. data/src/agent/Core/ApplicationPool/BasicProcessInfo.h +6 -0
  25. data/src/agent/Core/ApplicationPool/Common.h +1 -1
  26. data/src/agent/Core/ApplicationPool/Group/OutOfBandWork.cpp +1 -1
  27. data/src/agent/Core/ApplicationPool/Group/ProcessListManagement.cpp +4 -0
  28. data/src/agent/Core/ApplicationPool/Implementation.cpp +2 -2
  29. data/src/agent/Core/ApplicationPool/Options.h +18 -1
  30. data/src/agent/Core/ApplicationPool/Pool.h +1 -1
  31. data/src/agent/Core/ApplicationPool/Pool/AnalyticsCollection.cpp +6 -6
  32. data/src/agent/Core/ApplicationPool/Pool/GeneralUtils.cpp +3 -3
  33. data/src/agent/Core/ApplicationPool/Pool/InitializationAndShutdown.cpp +1 -1
  34. data/src/agent/Core/ApplicationPool/Pool/Miscellaneous.cpp +6 -0
  35. data/src/agent/Core/ApplicationPool/Process.h +6 -1
  36. data/src/agent/Core/ApplicationPool/Socket.h +9 -12
  37. data/src/agent/Core/Controller.h +422 -0
  38. data/src/agent/Core/{RequestHandler → Controller}/AppResponse.h +2 -0
  39. data/src/agent/Core/{RequestHandler → Controller}/BufferBody.cpp +27 -5
  40. data/src/agent/Core/{RequestHandler → Controller}/CheckoutSession.cpp +61 -31
  41. data/src/agent/Core/{RequestHandler → Controller}/Client.h +5 -2
  42. data/src/agent/Core/{RequestHandler → Controller}/ForwardResponse.cpp +93 -42
  43. data/src/agent/Core/{RequestHandler → Controller}/Hooks.cpp +107 -60
  44. data/src/agent/Core/Controller/Implementation.cpp +38 -0
  45. data/src/agent/Core/{RequestHandler → Controller}/InitRequest.cpp +134 -80
  46. data/src/agent/Core/Controller/InitializationAndShutdown.cpp +165 -0
  47. data/src/agent/Core/{RequestHandler/Utils.cpp → Controller/InternalUtils.cpp} +49 -32
  48. data/src/agent/Core/Controller/Miscellaneous.cpp +116 -0
  49. data/src/agent/Core/{RequestHandler → Controller}/Request.h +6 -4
  50. data/src/agent/Core/{RequestHandler → Controller}/SendRequest.cpp +205 -130
  51. data/src/agent/Core/Controller/StateInspectionAndConfiguration.cpp +161 -0
  52. data/src/agent/Core/{RequestHandler → Controller}/TurboCaching.h +3 -0
  53. data/src/agent/Core/CoreMain.cpp +62 -51
  54. data/src/agent/Core/OptionParser.h +24 -0
  55. data/src/agent/Core/ResponseCache.h +5 -5
  56. data/src/agent/Core/SpawningKit/Config.h +2 -2
  57. data/src/agent/Core/SpawningKit/SmartSpawner.h +1 -1
  58. data/src/agent/Core/UnionStation/{Core.h → Context.h} +14 -18
  59. data/src/agent/Core/UnionStation/StopwatchLog.h +3 -2
  60. data/src/agent/Core/UnionStation/Transaction.h +7 -7
  61. data/src/agent/Shared/ApiServerUtils.h +9 -1
  62. data/src/agent/UstRouter/ApiServer.h +5 -2
  63. data/src/agent/UstRouter/Controller.h +27 -9
  64. data/src/agent/UstRouter/UstRouterMain.cpp +1 -0
  65. data/src/agent/Watchdog/ApiServer.h +5 -2
  66. data/src/apache2_module/ConfigurationCommands.cpp +7 -0
  67. data/src/apache2_module/ConfigurationFields.hpp +2 -0
  68. data/src/apache2_module/ConfigurationSetters.cpp +24 -0
  69. data/src/apache2_module/CreateDirConfig.cpp +1 -0
  70. data/src/apache2_module/Hooks.cpp +6 -5
  71. data/src/apache2_module/MergeDirConfig.cpp +7 -0
  72. data/src/apache2_module/SetHeaders.cpp +5 -0
  73. data/src/cxx_supportlib/Constants.h +5 -3
  74. data/src/cxx_supportlib/SafeLibev.h +2 -1
  75. data/src/cxx_supportlib/UnionStationFilterSupport.h +2 -1
  76. data/src/cxx_supportlib/Utils/ReleaseableScopedPointer.h +70 -0
  77. data/src/cxx_supportlib/vendor-modified/boost/libs/regex/src/regex_raw_buffer.cpp +6 -6
  78. data/src/helper-scripts/node-loader.js +59 -0
  79. data/src/nginx_module/CacheLocationConfig.c +48 -0
  80. data/src/nginx_module/ConfigurationCommands.c +20 -0
  81. data/src/nginx_module/ConfigurationFields.h +4 -0
  82. data/src/nginx_module/CreateLocationConfig.c +8 -0
  83. data/src/nginx_module/MergeLocationConfig.c +12 -0
  84. data/src/nodejs_supportlib/phusion_passenger/log_express.js +106 -0
  85. data/src/nodejs_supportlib/phusion_passenger/log_mongodb.js +203 -0
  86. data/src/nodejs_supportlib/phusion_passenger/ustreporter.js +227 -0
  87. data/src/nodejs_supportlib/phusion_passenger/ustrouter_connector.js +446 -0
  88. data/src/nodejs_supportlib/vendor-copy/codify/codify.js +44 -0
  89. data/src/nodejs_supportlib/vendor-copy/codify/package.json +29 -0
  90. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/context.js +200 -0
  91. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/async-listener/glue.js +488 -0
  92. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/async-listener/index.js +407 -0
  93. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/async-listener/node_modules/shimmer/index.js +90 -0
  94. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/async-listener/node_modules/shimmer/package.json +40 -0
  95. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/async-listener/package.json +54 -0
  96. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/emitter-listener/listener.js +160 -0
  97. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/emitter-listener/node_modules/shimmer/index.js +90 -0
  98. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/emitter-listener/node_modules/shimmer/package.json +40 -0
  99. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/emitter-listener/package.json +46 -0
  100. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/package.json +56 -0
  101. data/src/nodejs_supportlib/vendor-copy/network-byte-order/lib/index.js +102 -0
  102. data/src/nodejs_supportlib/vendor-copy/network-byte-order/package.json +51 -0
  103. data/src/nodejs_supportlib/vendor-copy/winston/LICENSE +19 -0
  104. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston.js +165 -0
  105. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/common.js +483 -0
  106. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/config.js +62 -0
  107. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/config/cli-config.js +35 -0
  108. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/config/npm-config.js +27 -0
  109. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/config/syslog-config.js +31 -0
  110. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/container.js +127 -0
  111. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/exception.js +56 -0
  112. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/logger.js +701 -0
  113. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports.js +34 -0
  114. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/console.js +128 -0
  115. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/daily-rotate-file.js +601 -0
  116. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/file.js +675 -0
  117. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/http.js +232 -0
  118. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/memory.js +89 -0
  119. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/transport.js +135 -0
  120. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/webhook.js +146 -0
  121. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/async/LICENSE +19 -0
  122. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/async/lib/async.js +1283 -0
  123. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/async/package.json +66 -0
  124. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/async/support/sync-package-managers.js +53 -0
  125. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/MIT-LICENSE.txt +23 -0
  126. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/colors.js +176 -0
  127. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/custom/trap.js +45 -0
  128. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/custom/zalgo.js +104 -0
  129. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/extendStringPrototype.js +118 -0
  130. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/index.js +12 -0
  131. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/maps/america.js +12 -0
  132. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/maps/rainbow.js +13 -0
  133. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/maps/random.js +8 -0
  134. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/maps/zebra.js +5 -0
  135. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/styles.js +77 -0
  136. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/system/supports-colors.js +61 -0
  137. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/package.json +35 -0
  138. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/safe.js +9 -0
  139. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/themes/generic-logging.js +12 -0
  140. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/cycle/cycle.js +170 -0
  141. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/cycle/package.json +30 -0
  142. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/eyes/LICENSE +20 -0
  143. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/eyes/lib/eyes.js +236 -0
  144. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/eyes/package.json +42 -0
  145. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/isstream/LICENSE.md +11 -0
  146. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/isstream/isstream.js +27 -0
  147. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/isstream/package.json +42 -0
  148. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/pkginfo/LICENSE +19 -0
  149. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/pkginfo/lib/pkginfo.js +136 -0
  150. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/pkginfo/package.json +56 -0
  151. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/stack-trace/License +19 -0
  152. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/stack-trace/lib/stack-trace.js +111 -0
  153. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/stack-trace/package.json +33 -0
  154. data/src/nodejs_supportlib/vendor-copy/winston/package.json +87 -0
  155. data/src/ruby_supportlib/phusion_passenger.rb +3 -4
  156. data/src/ruby_supportlib/phusion_passenger/admin_tools/instance.rb +19 -2
  157. data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +8 -0
  158. data/src/ruby_supportlib/phusion_passenger/config/list_instances_command.rb +2 -6
  159. data/src/ruby_supportlib/phusion_passenger/config/reopen_logs_command.rb +13 -0
  160. data/src/ruby_supportlib/phusion_passenger/config/restart_app_command.rb +3 -0
  161. data/src/ruby_supportlib/phusion_passenger/config/utils.rb +9 -7
  162. data/src/ruby_supportlib/phusion_passenger/config/validate_install_command.rb +8 -1
  163. data/src/ruby_supportlib/phusion_passenger/constants.rb +3 -1
  164. data/src/ruby_supportlib/phusion_passenger/native_support.rb +20 -4
  165. data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +8 -0
  166. data/src/ruby_supportlib/phusion_passenger/packaging.rb +1 -0
  167. data/src/ruby_supportlib/phusion_passenger/platform_info/apache_detector.rb +1 -1
  168. data/src/ruby_supportlib/phusion_passenger/platform_info/operating_system.rb +11 -4
  169. data/src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb +1 -1
  170. data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +647 -0
  171. data/src/ruby_supportlib/phusion_passenger/standalone/config_utils.rb +229 -15
  172. data/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb +35 -323
  173. data/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb +36 -12
  174. data/src/ruby_supportlib/phusion_passenger/standalone/start_command/nginx_engine.rb +123 -14
  175. data/src/ruby_supportlib/phusion_passenger/standalone/status_command.rb +32 -17
  176. data/src/ruby_supportlib/phusion_passenger/standalone/stop_command.rb +32 -21
  177. data/src/ruby_supportlib/phusion_passenger/standalone/version_command.rb +5 -5
  178. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/README.md +2 -2
  179. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/Rakefile +5 -1
  180. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core.rb +68 -24
  181. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/api.rb +9 -1
  182. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/context.rb +9 -7
  183. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter.rb +3 -2
  184. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/basics.rb +8 -5
  185. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/simple_json.rb +395 -0
  186. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/transaction.rb +10 -7
  187. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/utils.rb +14 -0
  188. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/version_data.rb +2 -2
  189. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml +4 -2
  190. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.example +2 -2
  191. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.travis +2 -2
  192. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.travis-with-sudo +16 -0
  193. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/Gemfile +1 -1
  194. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/Gemfile.lock +2 -2
  195. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/README.md +1 -1
  196. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails.rb +44 -17
  197. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/active_support_cache_subscriber.rb +16 -7
  198. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/version_data.rb +2 -2
  199. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/union_station_hooks_rails.gemspec +1 -1
  200. metadata +99 -16
  201. metadata.gz.asc +7 -7
  202. data/resources/oss-binaries.phusionpassenger.com.crt +0 -248
  203. data/src/agent/Core/RequestHandler.h +0 -471
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "__comment__": [
3
- "This file is only meant for shrinkwrapping the development dependencies."
3
+ "Indicate Passenger dependencies on Node modules here, and use it to regenerate npm-shrinkwrap.json via 'npm shrinkwrap'."
4
4
  ],
5
5
  "name": "passenger",
6
6
  "version": "0.0.0",
@@ -1,103 +1,41 @@
1
- ##############################################################
2
- # Phusion Passenger Standalone uses a template file to
3
- # generate an Nginx configuration file. The original template
4
- # file can be found by running the following command:
1
+ ##########################################################################
2
+ # Passenger Standalone is built on the same technology that powers
3
+ # Passenger for Nginx, so any configuration option supported by Passenger
4
+ # for Nginx can be applied to Passenger Standalone as well. You can do
5
+ # this by direct editing the Nginx configuration template that is used by
6
+ # Passenger Standalone.
5
7
  #
6
- # ls $(passenger-config about resourcesdir)/templates/standalone/config.erb
8
+ # This file is the original template. DO NOT EDIT THIS FILE DIRECTLY.
9
+ # Instead, make a copy of this file and pass the `--nginx-config-template`
10
+ # parameter to Passenger Standalone.
7
11
  #
8
- # You can create a copy of this template file and customize it
9
- # to your liking. Just make sure you tell Phusion Passenger Standalone
10
- # to use your template file by passing the --nginx-config-template
11
- # parameter.
12
+ # Learn more about using the Nginx configuration template at:
13
+ # https://www.phusionpassenger.com/library/config/standalone/intro.html#nginx-configuration-template
12
14
  #
13
15
  # *** NOTE ***
14
- # If you customize the template file, make sure you keep an eye
15
- # on the original template file and merge any changes.
16
- # New Phusion Passenger features may require changes to the template
17
- # file.
16
+ # If you customize the template file, make sure you keep an eye on the
17
+ # original template file and merge any changes. New Phusion Passenger
18
+ # features may require changes to the template file.
18
19
  ##############################################################
19
20
 
21
+ <%= include_passenger_internal_template('global.erb') %>
20
22
 
21
- master_process on;
22
23
  worker_processes 1;
23
- daemon on;
24
- error_log '<%= @options[:log_file] %>' <% if @options[:log_level] >= LVL_DEBUG %>info<% end %>;
25
- pid '<%= @options[:pid_file] %>';
26
-
27
- <% if Process.euid == 0 %>
28
- <% if @options[:user] %>
29
- <%# Run workers as the given user. The master process will always run as root and will be able to bind to any port. %>
30
- user <%= @options[:user] %> <%= default_group_for(@options[:user]) %>;
31
- <% else %>
32
- <%# Prevent running Nginx workers as nobody. %>
33
- user <%= current_user %> <%= default_group_for(current_user) %>;
34
- <% end %>
35
- <% end %>
36
-
37
24
  events {
38
25
  worker_connections 1024;
39
26
  }
40
27
 
41
28
  http {
42
- log_format debug '[$time_local] $msec "$request" $status conn=$connection sent=$bytes_sent body_sent=$body_bytes_sent';
43
- include '<%= PhusionPassenger.resources_dir %>/mime.types';
44
-
45
- <% if @options[:ruby] %>
46
- passenger_ruby <%= @options[:ruby] %>;
47
- <% else %>
48
- passenger_ruby <%= PlatformInfo.ruby_command %>;
49
- <% end %>
50
- <% if @options[:nodejs] %>
51
- passenger_nodejs <%= @options[:nodejs] %>;
52
- <% end %>
53
- <% if @options[:python] %>
54
- passenger_python <%= @options[:python] %>;
55
- <% end %>
56
-
57
- passenger_root '<%= PhusionPassenger.install_spec %>';
58
- passenger_abort_on_startup_error on;
59
- passenger_ctl cleanup_pidfiles <%= serialize_strset("#{@working_dir}/temp_dir_toucher.pid") %>;
60
- passenger_ctl integration_mode standalone;
61
- passenger_ctl standalone_engine nginx;
62
- passenger_user_switching off;
63
- <%= nginx_option :passenger_log_level, :log_level %>
64
- <%= nginx_option :passenger_max_pool_size, :max_pool_size %>
65
- <%= nginx_option :passenger_min_instances, :min_instances %>
66
- <%= nginx_option :passenger_pool_idle_time, :pool_idle_time %>
67
- <%= nginx_option :passenger_max_preloader_idle_time, :max_preloader_idle_time %>
68
- <%= nginx_option :passenger_turbocaching, :turbocaching %>
69
- <% if @options[:user] %>
70
- passenger_user <%= @options[:user] %>;
71
- passenger_default_user <%= @options[:user] %>;
72
- passenger_analytics_log_user <%= @options[:user] %>;
73
- <% else %>
74
- passenger_user <%= current_user %>;
75
- passenger_default_user <%= current_user %>;
76
- passenger_analytics_log_user <%= current_user %>;
77
- <% end %>
78
- <% if @options[:instance_registry_dir] %>passenger_instance_registry_dir '<%= @options[:instance_registry_dir] %>';<% end %>
79
- <% if @options[:data_buffer_dir] %>passenger_data_buffer_dir '<%= @options[:data_buffer_dir] %>';<% end %>
80
- <% if @options[:rolling_restarts] %>passenger_rolling_restarts on;<% end %>
81
- <% if @options[:resist_deployment_errors] %>passenger_resist_deployment_errors on;<% end %>
82
- <% if !@options[:load_shell_envvars] %>passenger_load_shell_envvars off;<% end %>
29
+ <%= include_passenger_internal_template('http.erb', 4) %>
83
30
 
84
- <% if !@options[:friendly_error_pages].nil? -%>
85
- passenger_friendly_error_pages <%= boolean_config_value(@options[:friendly_error_pages]) %>;
86
- <% end %>
87
-
88
- <% if @options[:union_station_gateway_address] %>
89
- union_station_gateway_address <%= @options[:union_station_gateway_address] %>;
90
- <% end %>
91
- <% if @options[:union_station_gateway_port] %>
92
- union_station_gateway_port <%= @options[:union_station_gateway_port] %>;
93
- <% end %>
94
- <% if @options[:union_station_gateway_cert] %>
95
- union_station_gateway_cert -;
96
- <% end %>
31
+ ### BEGIN your own configuration options ###
32
+ # This is a good place to put your own config
33
+ # options. Note that your options must not
34
+ # conflict with the ones Passenger already sets.
35
+ # Learn more at:
36
+ # https://www.phusionpassenger.com/library/config/standalone/intro.html#nginx-configuration-template
97
37
 
98
- <% @options[:ctls].each do |ctl| %>
99
- passenger_ctl '<%= ctl.split("=", 2)[0] %>' '<%= ctl.split("=", 2)[1] %>';
100
- <% end %>
38
+ ### END your own configuration options ###
101
39
 
102
40
  default_type application/octet-stream;
103
41
  types_hash_max_size 2048;
@@ -118,89 +56,23 @@ http {
118
56
  <% if @app_finder.multi_mode? %>
119
57
  # Default server entry for mass deployment mode.
120
58
  server {
121
- <% if @options[:ssl] %>
122
- <% if @options[:ssl_port] %>
123
- listen <%= nginx_listen_address %>;
124
- listen <%= nginx_listen_address_with_ssl_port %> ssl;
125
- <% else %>
126
- listen <%= nginx_listen_address %> ssl;
127
- <% end %>
128
- <% else %>
129
- listen <%= nginx_listen_address %>;
130
- <% end %>
131
- root '<%= PhusionPassenger.resources_dir %>/standalone_default_root';
59
+ <%= include_passenger_internal_template('mass_deployment_default_server.erb', 12) %>;
132
60
  }
133
61
  <% end %>
134
62
 
135
63
  <% for app in @apps %>
136
64
  server {
137
- <% if app[:ssl] %>
138
- <% if app[:ssl_port] %>
139
- listen <%= nginx_listen_address(app) %>;
140
- listen <%= nginx_listen_address_with_ssl_port(app) %> ssl;
141
- <% else %>
142
- listen <%= nginx_listen_address(app) %> ssl;
143
- <% end %>
144
- <% else %>
145
- listen <%= nginx_listen_address(app) %>;
146
- <% end %>
147
- server_name <%= app[:server_names].join(' ') %>;
148
- <% if app[:static_files_dir] %>
149
- root '<%= app[:static_files_dir] %>';
150
- <% else %>
151
- root '<%= app[:root] %>/public';
152
- <% end %>
153
- passenger_app_root '<%= app[:root] %>';
154
- passenger_enabled on;
155
- passenger_app_env <%= app[:environment] %>;
156
- passenger_spawn_method <%= app[:spawn_method] %>;
157
- <% if app[:app_type] %>passenger_app_type <%= app[:app_type] %>;<% end %>
158
- <% if app[:startup_file] %>passenger_startup_file <%= app[:startup_file] %>;<% end %>
159
- <% if app[:concurrency_model] && app[:concurrency_model] != DEFAULT_CONCURRENCY_MODEL %>passenger_concurrency_model <%= app[:concurrency_model] %>;<% end %>
160
- <% if app[:thread_count] && app[:thread_count] != DEFAULT_APP_THREAD_COUNT %>passenger_thread_count <%= app[:thread_count] %>;<% end %>
161
- <% if app[:min_instances] %>passenger_min_instances <%= app[:min_instances] %>;<% end %>
162
- <% if app[:restart_dir] %>passenger_restart_dir '<%= app[:restart_dir] %>';<% end %>
163
- <% if app[:sticky_sessions] %>passenger_sticky_sessions on;<% end %>
164
- <% if app[:sticky_sessions_cookie_name] %>passenger_sticky_sessions_cookie_name '<%= app[:sticky_sessions_cookie_name] %>';<% end %>
165
- <% if app[:vary_turbocache_by_cookie] %>passenger_vary_turbocache_by_cookie '<%= app[:vary_turbocache_by_cookie] %>';<% end %>
166
- <% if app[:union_station_key] %>
167
- union_station_support on;
168
- union_station_key <%= app[:union_station_key] %>;
169
- <% end %>
170
- <% if app[:ssl] %>
171
- ssl_certificate <%= app[:ssl_certificate] %>;
172
- ssl_certificate_key <%= app[:ssl_certificate_key] %>;
173
- <% end %>
174
- <% if @options[:meteor_app_settings] %>
175
- passenger_meteor_app_settings <%= @options[:meteor_app_settings] %>;
176
- <% end %>
177
-
178
- <% app[:envvars].each_pair do |name, value| %>
179
- passenger_env_var '<%= name %>' '<%= value %>';
180
- <% end %>
65
+ <%= include_passenger_internal_template('server.erb', 8, true, binding) %>
66
+ <%= include_passenger_internal_template('rails_asset_pipeline.erb', 8, false) %>
181
67
 
182
- # Rails asset pipeline support.
183
- location ~ "^/assets/.+-([0-9a-f]{32}|[0-9a-f]{64})\..+" {
184
- error_page 490 = @static_asset;
185
- error_page 491 = @dynamic_request;
186
- recursive_error_pages on;
68
+ ### BEGIN your own configuration options ###
69
+ # This is a good place to put your own config
70
+ # options. Note that your options must not
71
+ # conflict with the ones Passenger already sets.
72
+ # Learn more at:
73
+ # https://www.phusionpassenger.com/library/config/standalone/intro.html#nginx-configuration-template
187
74
 
188
- if (-f $request_filename) {
189
- return 490;
190
- }
191
- if (!-f $request_filename) {
192
- return 491;
193
- }
194
- }
195
- location @static_asset {
196
- gzip_static on;
197
- expires max;
198
- add_header Cache-Control public;
199
- add_header ETag "";
200
- }
201
- location @dynamic_request {
202
- passenger_enabled on;
203
- }
75
+ ### END your own configuration options ###
204
76
  }
205
77
  passenger_pre_start <%= listen_url(app) %>;
206
78
  <% end %>
@@ -0,0 +1,15 @@
1
+ master_process on;
2
+ daemon on;
3
+
4
+ error_log '<%= @options[:log_file] %>' <% if @options[:log_level] >= LVL_DEBUG %>info<% end %>;
5
+ pid '<%= @options[:pid_file] %>';
6
+
7
+ <% if Process.euid == 0 %>
8
+ <% if @options[:user] %>
9
+ <%# Run workers as the given user. The master process will always run as root and will be able to bind to any port. %>
10
+ user <%= @options[:user] %> <%= default_group_for(@options[:user]) %>;
11
+ <% else %>
12
+ <%# Prevent running Nginx workers as nobody. %>
13
+ user <%= current_user %> <%= default_group_for(current_user) %>;
14
+ <% end %>
15
+ <% end %>
@@ -0,0 +1,40 @@
1
+ log_format debug '[$time_local] $msec "$request" $status conn=$connection sent=$bytes_sent body_sent=$body_bytes_sent';
2
+ include '<%= PhusionPassenger.resources_dir %>/mime.types';
3
+
4
+ passenger_root '<%= PhusionPassenger.install_spec %>';
5
+ passenger_abort_on_startup_error on;
6
+ passenger_ctl cleanup_pidfiles <%= serialize_strset("#{@working_dir}/temp_dir_toucher.pid") %>;
7
+ passenger_ctl integration_mode standalone;
8
+ passenger_ctl standalone_engine nginx;
9
+ passenger_user_switching off;
10
+
11
+ <% if @options[:ruby] %>
12
+ passenger_ruby <%= @options[:ruby] %>;
13
+ <% else %>
14
+ passenger_ruby <%= PlatformInfo.ruby_command %>;
15
+ <% end %>
16
+ <% if @options[:user] %>
17
+ passenger_user <%= @options[:user] %>;
18
+ passenger_default_user <%= @options[:user] %>;
19
+ passenger_analytics_log_user <%= @options[:user] %>;
20
+ <% else %>
21
+ passenger_user <%= current_user %>;
22
+ passenger_default_user <%= current_user %>;
23
+ passenger_analytics_log_user <%= current_user %>;
24
+ <% end %>
25
+
26
+ <%= nginx_http_option(:python) %>
27
+ <%= nginx_http_option(:nodejs) %>
28
+ <%= nginx_http_option(:log_level) %>
29
+ <%= nginx_http_option(:max_pool_size) %>
30
+ <%= nginx_http_option(:pool_idle_time) %>
31
+ <%= nginx_http_option(:max_preloader_idle_time) %>
32
+ <%= nginx_http_option(:turbocaching) %>
33
+ <%= nginx_http_option(:instance_registry_dir) %>
34
+ <%= nginx_http_option(:data_buffer_dir) %>
35
+ <%= nginx_http_option(:union_station_gateway_address) %>
36
+ <%= nginx_http_option(:union_station_gateway_port) %>
37
+ <%= nginx_http_option(:union_station_gateway_cert) %>
38
+ <% @options[:ctls].each do |ctl| %>
39
+ passenger_ctl '<%= ctl.split("=", 2)[0] %>' '<%= ctl.split("=", 2)[1] %>';
40
+ <% end %>
@@ -0,0 +1,11 @@
1
+ <% if @options[:ssl] %>
2
+ <% if @options[:ssl_port] %>
3
+ listen <%= nginx_listen_address %>;
4
+ listen <%= nginx_listen_address_with_ssl_port %> ssl;
5
+ <% else %>
6
+ listen <%= nginx_listen_address %> ssl;
7
+ <% end %>
8
+ <% else %>
9
+ listen <%= nginx_listen_address %>;
10
+ <% end %>
11
+ root '<%= PhusionPassenger.resources_dir %>/standalone_default_root';
@@ -0,0 +1,22 @@
1
+ # Rails asset pipeline support.
2
+ location ~ "^/assets/.+-([0-9a-f]{32}|[0-9a-f]{64})\..+" {
3
+ error_page 490 = @static_asset;
4
+ error_page 491 = @dynamic_request;
5
+ recursive_error_pages on;
6
+
7
+ if (-f $request_filename) {
8
+ return 490;
9
+ }
10
+ if (!-f $request_filename) {
11
+ return 491;
12
+ }
13
+ }
14
+ location @static_asset {
15
+ gzip_static on;
16
+ expires max;
17
+ add_header Cache-Control public;
18
+ add_header ETag "";
19
+ }
20
+ location @dynamic_request {
21
+ passenger_enabled on;
22
+ }
@@ -0,0 +1,58 @@
1
+ server_name <%= app[:server_names].join(' ') %>;
2
+ <% if app[:ssl] %>
3
+ <% if app[:ssl_port] %>
4
+ listen <%= nginx_listen_address(app) %>;
5
+ listen <%= nginx_listen_address_with_ssl_port(app) %> ssl;
6
+ <% else %>
7
+ listen <%= nginx_listen_address(app) %> ssl;
8
+ <% end %>
9
+ <% else %>
10
+ listen <%= nginx_listen_address(app) %>;
11
+ <% end %>
12
+ <% if app[:static_files_dir] %>
13
+ root '<%= app[:static_files_dir] %>';
14
+ <% else %>
15
+ root '<%= app[:root] %>/public';
16
+ <% end %>
17
+
18
+ passenger_app_root '<%= app[:root] %>';
19
+ passenger_enabled on;
20
+ <% if app[:ssl] %>
21
+ ssl_certificate <%= app[:ssl_certificate] %>;
22
+ ssl_certificate_key <%= app[:ssl_certificate_key] %>;
23
+ <% end %>
24
+ <% if app[:union_station_key] %>
25
+ union_station_support on;
26
+ union_station_key <%= app[:union_station_key] %>;
27
+ <% end %>
28
+ <% app[:envvars].each_pair do |name, value| %>
29
+ passenger_env_var '<%= name %>' '<%= value %>';
30
+ <% end %>
31
+ <% if app[:concurrency_model] && app[:concurrency_model] != DEFAULT_CONCURRENCY_MODEL %>
32
+ passenger_concurrency_model <%= app[:concurrency_model] %>;
33
+ <% end %>
34
+ <% if app[:thread_count] && app[:thread_count] != DEFAULT_APP_THREAD_COUNT %>
35
+ passenger_thread_count <%= app[:thread_count] %>;
36
+ <% end %>
37
+
38
+ <%= nginx_option(app, :environment, :passenger_app_env) %>
39
+ <%= nginx_option(app, :spawn_method) %>
40
+ <%= nginx_option(app, :app_type) %>
41
+ <%= nginx_option(app, :startup_file) %>
42
+ <%= nginx_option(app, :min_instances) %>
43
+ <%= nginx_option(app, :max_request_queue_size) %>
44
+ <%= nginx_option(app, :restart_dir) %>
45
+ <%= nginx_option(app, :sticky_sessions) %>
46
+ <%= nginx_option(app, :sticky_sessions_cookie_name) %>
47
+ <%= nginx_option(app, :vary_turbocache_by_cookie) %>
48
+ <%= nginx_option(app, :meteor_app_settings) %>
49
+ <%= nginx_option(app, :load_shell_envvars) %>
50
+ <%= nginx_option(app, :friendly_error_pages) %>
51
+ <%= nginx_option(app, :abort_websockets_on_process_shutdown) %>
52
+ <%= nginx_option(app, :force_max_concurrent_requests_per_process) %>
53
+
54
+ <%= nginx_option(app, :rolling_restarts) %>
55
+ <%= nginx_option(app, :resist_deployment_errors) %>
56
+ <%= nginx_option(app, :memory_limit) %>
57
+ <%= nginx_option(app, :max_request_time) %>
58
+ <%= nginx_option(app, :debugger) %>
@@ -36,7 +36,7 @@
36
36
  #include <jsoncpp/json.h>
37
37
  #include <modp_b64.h>
38
38
 
39
- #include <Core/RequestHandler.h>
39
+ #include <Core/Controller.h>
40
40
  #include <Core/ApplicationPool/Pool.h>
41
41
  #include <Shared/ApiServerUtils.h>
42
42
  #include <ServerKit/HttpServer.h>
@@ -51,6 +51,7 @@
51
51
 
52
52
  namespace Passenger {
53
53
  namespace Core {
54
+ namespace ApiServer {
54
55
 
55
56
  using namespace std;
56
57
 
@@ -61,7 +62,7 @@ public:
61
62
  Json::Value jsonBody;
62
63
  Authorization authorization;
63
64
 
64
- DEFINE_SERVER_KIT_BASE_HTTP_REQUEST_FOOTER(Request);
65
+ DEFINE_SERVER_KIT_BASE_HTTP_REQUEST_FOOTER(Passenger::Core::ApiServer::Request);
65
66
  };
66
67
 
67
68
  class ApiServer: public ServerKit::HttpServer<ApiServer, ServerKit::HttpClient<Request> > {
@@ -89,8 +90,8 @@ private:
89
90
  return stringToUint(results.str(1));
90
91
  }
91
92
 
92
- static void disconnectClient(RequestHandler *rh, string clientName) {
93
- rh->disconnect(clientName);
93
+ static void disconnectClient(Controller *controller, string clientName) {
94
+ controller->disconnect(clientName);
94
95
  }
95
96
 
96
97
  void route(Client *client, Request *req, const StaticString &path) {
@@ -110,8 +111,11 @@ private:
110
111
  apiServerProcessBacktraces(this, client, req);
111
112
  } else if (path == P_STATIC_STRING("/ping.json")) {
112
113
  apiServerProcessPing(this, client, req);
113
- } else if (path == P_STATIC_STRING("/version.json")) {
114
- apiServerProcessVersion(this, client, req);
114
+ } else if (path == P_STATIC_STRING("/info.json")
115
+ // The "/version.json" path is deprecated
116
+ || path == P_STATIC_STRING("/version.json"))
117
+ {
118
+ apiServerProcessInfo(this, client, req);
115
119
  } else if (path == P_STATIC_STRING("/shutdown.json")) {
116
120
  apiServerProcessShutdown(this, client, req);
117
121
  } else if (path == P_STATIC_STRING("/gc.json")) {
@@ -142,7 +146,7 @@ private:
142
146
  }
143
147
 
144
148
  int threadNumber = extractThreadNumberFromClientName(results.str(1));
145
- if (threadNumber < 1 || (unsigned int) threadNumber > requestHandlers.size()) {
149
+ if (threadNumber < 1 || (unsigned int) threadNumber > controllers.size()) {
146
150
  HeaderTable headers;
147
151
  headers.insert(req->pool, "Content-Type", "application/json");
148
152
  writeSimpleResponse(client, 400, &headers,
@@ -153,8 +157,8 @@ private:
153
157
  return;
154
158
  }
155
159
 
156
- requestHandlers[threadNumber - 1]->getContext()->libev->runLater(boost::bind(
157
- disconnectClient, requestHandlers[threadNumber - 1], results.str(1)));
160
+ controllers[threadNumber - 1]->getContext()->libev->runLater(boost::bind(
161
+ disconnectClient, controllers[threadNumber - 1], results.str(1)));
158
162
 
159
163
  HeaderTable headers;
160
164
  headers.insert(req->pool, "Content-Type", "application/json");
@@ -168,8 +172,8 @@ private:
168
172
  }
169
173
  }
170
174
 
171
- static void inspectRequestHandlerState(RequestHandler *rh, Json::Value *json) {
172
- *json = rh->inspectStateAsJson();
175
+ static void inspectControllerState(Controller *controller, Json::Value *json) {
176
+ *json = controller->inspectStateAsJson();
173
177
  }
174
178
 
175
179
  void processServerStatus(Client *client, Request *req) {
@@ -178,13 +182,13 @@ private:
178
182
  headers.insert(req->pool, "Content-Type", "application/json");
179
183
 
180
184
  Json::Value doc;
181
- doc["threads"] = (Json::UInt) requestHandlers.size();
182
- for (unsigned int i = 0; i < requestHandlers.size(); i++) {
185
+ doc["threads"] = (Json::UInt) controllers.size();
186
+ for (unsigned int i = 0; i < controllers.size(); i++) {
183
187
  Json::Value json;
184
188
  string key = "thread" + toString(i + 1);
185
189
 
186
- requestHandlers[i]->getContext()->libev->runSync(boost::bind(
187
- inspectRequestHandlerState, requestHandlers[i], &json));
190
+ controllers[i]->getContext()->libev->runSync(boost::bind(
191
+ inspectControllerState, controllers[i], &json));
188
192
  doc[key] = json;
189
193
  }
190
194
 
@@ -374,14 +378,14 @@ private:
374
378
  }
375
379
  }
376
380
 
377
- static void garbageCollect(RequestHandler *rh) {
378
- ServerKit::Context *ctx = rh->getContext();
381
+ static void garbageCollect(Controller *controller) {
382
+ ServerKit::Context *ctx = controller->getContext();
379
383
  unsigned int count;
380
384
 
381
385
  count = mbuf_pool_compact(&ctx->mbuf_pool);
382
- SKS_NOTICE_FROM_STATIC(rh, "Freed " << count << " mbufs");
386
+ SKS_NOTICE_FROM_STATIC(controller, "Freed " << count << " mbufs");
383
387
 
384
- rh->compact(LVL_NOTICE);
388
+ controller->compact(LVL_NOTICE);
385
389
  }
386
390
 
387
391
  void processGc(Client *client, Request *req) {
@@ -390,9 +394,9 @@ private:
390
394
  } else if (authorizeAdminOperation(this, client, req)) {
391
395
  HeaderTable headers;
392
396
  headers.insert(req->pool, "Content-Type", "application/json");
393
- for (unsigned int i = 0; i < requestHandlers.size(); i++) {
394
- requestHandlers[i]->getContext()->libev->runLater(boost::bind(
395
- garbageCollect, requestHandlers[i]));
397
+ for (unsigned int i = 0; i < controllers.size(); i++) {
398
+ controllers[i]->getContext()->libev->runLater(boost::bind(
399
+ garbageCollect, controllers[i]));
396
400
  }
397
401
  writeSimpleResponse(client, 200, &headers, "{ \"status\": \"ok\" }");
398
402
  if (!req->ended()) {
@@ -403,8 +407,8 @@ private:
403
407
  }
404
408
  }
405
409
 
406
- static void getRequestHandlerConfig(RequestHandler *rh, Json::Value *json) {
407
- *json = rh->getConfigAsJson();
410
+ static void getControllerConfig(Controller *controller, Json::Value *json) {
411
+ *json = controller->getConfigAsJson();
408
412
  }
409
413
 
410
414
  void processConfig(Client *client, Request *req) {
@@ -419,8 +423,8 @@ private:
419
423
 
420
424
  headers.insert(req->pool, "Content-Type", "application/json");
421
425
  Json::Value doc;
422
- requestHandlers[0]->getContext()->libev->runSync(boost::bind(
423
- getRequestHandlerConfig, requestHandlers[0], &doc));
426
+ controllers[0]->getContext()->libev->runSync(boost::bind(
427
+ getControllerConfig, controllers[0], &doc));
424
428
  doc["log_level"] = getLogLevel();
425
429
  if (!logFile.empty()) {
426
430
  doc["log_file"] = logFile;
@@ -446,8 +450,8 @@ private:
446
450
  }
447
451
  }
448
452
 
449
- static void configureRequestHandler(RequestHandler *rh, Json::Value json) {
450
- rh->configure(json);
453
+ static void configureController(Controller *controller, Json::Value json) {
454
+ controller->configure(json);
451
455
  }
452
456
 
453
457
  void processConfigBody(Client *client, Request *req) {
@@ -492,9 +496,9 @@ private:
492
496
  }
493
497
  P_NOTICE("Log file opened.");
494
498
  }
495
- for (unsigned int i = 0; i < requestHandlers.size(); i++) {
496
- requestHandlers[i]->getContext()->libev->runLater(boost::bind(
497
- configureRequestHandler, requestHandlers[i], json));
499
+ for (unsigned int i = 0; i < controllers.size(); i++) {
500
+ controllers[i]->getContext()->libev->runLater(boost::bind(
501
+ configureController, controllers[i], json));
498
502
  }
499
503
 
500
504
  writeSimpleResponse(client, 200, &headers, "{ \"status\": \"ok\" }");
@@ -581,7 +585,7 @@ protected:
581
585
  }
582
586
 
583
587
  public:
584
- vector<RequestHandler *> requestHandlers;
588
+ vector<Controller *> controllers;
585
589
  ApiAccountDatabase *apiAccountDatabase;
586
590
  ApplicationPool2::PoolPtr appPool;
587
591
  string instanceDir;
@@ -619,6 +623,7 @@ public:
619
623
  };
620
624
 
621
625
 
626
+ } // namespace ApiServer
622
627
  } // namespace Core
623
628
  } // namespace Passenger
624
629