passenger 5.0.10 → 5.0.11

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 (124) hide show
  1. checksums.yaml +8 -8
  2. checksums.yaml.gz.asc +7 -7
  3. data.tar.gz.asc +7 -7
  4. data/CHANGELOG +18 -0
  5. data/CONTRIBUTING.md +3 -3
  6. data/bin/passenger-status +12 -4
  7. data/build/agents.rb +45 -45
  8. data/build/apache2.rb +1 -1
  9. data/build/basics.rb +1 -1
  10. data/build/cxx_tests.rb +12 -12
  11. data/doc/CloudLicensingConfiguration.html +10 -10
  12. data/doc/CloudLicensingConfiguration.txt.md +10 -10
  13. data/doc/DebuggingAndStressTesting.md +3 -3
  14. data/doc/Design and Architecture.html +30 -30
  15. data/doc/Design and Architecture.txt +28 -28
  16. data/doc/ServerOptimizationGuide.html +3 -3
  17. data/doc/ServerOptimizationGuide.txt.md +3 -3
  18. data/doc/Users guide Apache.html +24 -12
  19. data/doc/Users guide Apache.txt +2 -2
  20. data/doc/Users guide Nginx.html +24 -12
  21. data/doc/Users guide Nginx.txt +2 -2
  22. data/doc/Users guide Standalone.html +18 -6
  23. data/doc/images/passenger_architecture.png +0 -0
  24. data/doc/images/passenger_architecture.svg +10 -9
  25. data/doc/images/{helper_agent_core_architecture.png → passenger_core_architecture.png} +0 -0
  26. data/doc/users_guide_snippets/environment_variables.txt +1 -1
  27. data/doc/users_guide_snippets/installation/verify_running_epilogue.txt +1 -1
  28. data/doc/users_guide_snippets/support_information.txt +1 -1
  29. data/doc/users_guide_snippets/tips.txt +2 -2
  30. data/doc/users_guide_snippets/under_the_hood/relationship_with_ruby.txt +1 -1
  31. data/ext/apache2/Bucket.h +5 -5
  32. data/ext/apache2/Configuration.cpp +1 -1
  33. data/ext/apache2/Configuration.hpp +2 -3
  34. data/ext/apache2/ConfigurationFields.hpp +3 -0
  35. data/ext/apache2/ConfigurationFields.hpp.erb +3 -0
  36. data/ext/apache2/Hooks.cpp +42 -34
  37. data/ext/common/Account.h +3 -3
  38. data/ext/common/AgentsStarter.cpp +7 -7
  39. data/ext/common/AgentsStarter.h +20 -20
  40. data/ext/common/ApplicationPool2/Options.h +12 -12
  41. data/ext/common/Constants.h +10 -8
  42. data/ext/common/Logging.cpp +22 -1
  43. data/ext/common/Logging.h +19 -2
  44. data/ext/common/ServerKit/AcceptLoadBalancer.h +3 -3
  45. data/ext/common/ServerKit/Server.h +24 -0
  46. data/ext/common/UnionStation/Connection.h +1 -1
  47. data/ext/common/UnionStation/Core.h +21 -21
  48. data/ext/common/UnionStation/Transaction.h +3 -3
  49. data/ext/common/Utils.cpp +2 -2
  50. data/ext/common/Utils/IOUtils.cpp +5 -1
  51. data/ext/common/{agents → agent}/ApiServerUtils.h +3 -3
  52. data/ext/common/{agents → agent}/Base.cpp +2 -2
  53. data/ext/common/{agents → agent}/Base.h +0 -0
  54. data/ext/common/{agents/HelperAgent → agent/Core}/ApiServer.h +33 -9
  55. data/ext/common/{agents/HelperAgent → agent/Core}/Main.cpp +60 -59
  56. data/ext/common/{agents/HelperAgent → agent/Core}/OptionParser.h +32 -25
  57. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler.h +17 -17
  58. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/AppResponse.h +0 -0
  59. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/BufferBody.cpp +0 -0
  60. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/CheckoutSession.cpp +0 -0
  61. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/Client.h +2 -2
  62. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/ForwardResponse.cpp +0 -0
  63. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/Hooks.cpp +0 -0
  64. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/InitRequest.cpp +4 -3
  65. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/Request.h +1 -1
  66. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/SendRequest.cpp +0 -0
  67. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/TurboCaching.h +1 -1
  68. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/Utils.cpp +0 -0
  69. data/ext/common/{agents/HelperAgent → agent/Core}/ResponseCache.h +0 -0
  70. data/ext/common/{agents → agent}/Main.cpp +9 -9
  71. data/ext/common/{agents → agent}/SpawnPreparer/Main.cpp +0 -0
  72. data/ext/common/{agents/HelperAgent/SystemMetricsTool.cpp → agent/SystemMetrics/Main.cpp} +0 -0
  73. data/ext/common/{agents → agent}/TempDirToucher/Main.cpp +0 -0
  74. data/ext/common/{agents/LoggingAgent → agent/UstRouter}/ApiServer.h +7 -7
  75. data/ext/common/{agents/LoggingAgent → agent/UstRouter}/DataStoreId.h +0 -0
  76. data/ext/common/{agents/LoggingAgent → agent/UstRouter}/FilterSupport.cpp +0 -0
  77. data/ext/common/{agents/LoggingAgent → agent/UstRouter}/FilterSupport.h +0 -0
  78. data/ext/common/{agents/LoggingAgent → agent/UstRouter}/LoggingServer.h +4 -4
  79. data/ext/common/{agents/LoggingAgent → agent/UstRouter}/Main.cpp +45 -45
  80. data/ext/common/{agents/LoggingAgent → agent/UstRouter}/OptionParser.h +20 -20
  81. data/ext/common/{agents/LoggingAgent → agent/UstRouter}/RemoteSender.h +0 -0
  82. data/ext/common/{agents → agent}/Watchdog/AgentWatcher.cpp +0 -0
  83. data/ext/common/{agents → agent}/Watchdog/ApiServer.h +1 -1
  84. data/ext/common/{agents/Watchdog/HelperAgentWatcher.cpp → agent/Watchdog/CoreWatcher.cpp} +14 -10
  85. data/ext/common/{agents → agent}/Watchdog/InstanceDirToucher.cpp +0 -0
  86. data/ext/common/{agents → agent}/Watchdog/Main.cpp +131 -75
  87. data/ext/common/{agents/Watchdog/LoggingAgentWatcher.cpp → agent/Watchdog/UstRouterWatcher.cpp} +13 -9
  88. data/ext/nginx/CacheLocationConfig.c +11 -6
  89. data/ext/nginx/CacheLocationConfig.c.erb +11 -6
  90. data/ext/nginx/Configuration.c +22 -7
  91. data/ext/nginx/Configuration.h +1 -19
  92. data/ext/nginx/ConfigurationFields.h +19 -0
  93. data/ext/nginx/ConfigurationFields.h.erb +19 -0
  94. data/ext/nginx/ContentHandler.c +33 -33
  95. data/ext/nginx/CreateLocationConfig.c +3 -1
  96. data/ext/nginx/CreateLocationConfig.c.erb +3 -1
  97. data/ext/nginx/MergeLocationConfig.c +8 -4
  98. data/ext/nginx/MergeLocationConfig.c.erb +7 -3
  99. data/ext/nginx/ngx_http_passenger_module.c +33 -42
  100. data/helper-scripts/backtrace-sanitizer.rb +2 -2
  101. data/lib/phusion_passenger.rb +1 -1
  102. data/lib/phusion_passenger/admin_tools/instance.rb +2 -2
  103. data/lib/phusion_passenger/admin_tools/instance_registry.rb +7 -3
  104. data/lib/phusion_passenger/common_library.rb +8 -8
  105. data/lib/phusion_passenger/config/about_command.rb +1 -1
  106. data/lib/phusion_passenger/config/api_call_command.rb +3 -3
  107. data/lib/phusion_passenger/config/installation_utils.rb +34 -21
  108. data/lib/phusion_passenger/config/reopen_logs_command.rb +2 -2
  109. data/lib/phusion_passenger/config/restart_app_command.rb +18 -4
  110. data/lib/phusion_passenger/constants.rb +7 -5
  111. data/lib/phusion_passenger/loader_shared_helpers.rb +2 -6
  112. data/lib/phusion_passenger/message_client.rb +8 -8
  113. data/lib/phusion_passenger/platform_info/ruby.rb +1 -2
  114. data/lib/phusion_passenger/preloader_shared_helpers.rb +1 -1
  115. data/lib/phusion_passenger/request_handler.rb +3 -2
  116. data/lib/phusion_passenger/request_handler/thread_handler.rb +4 -4
  117. data/lib/phusion_passenger/standalone/start_command.rb +13 -3
  118. data/lib/phusion_passenger/standalone/start_command/builtin_engine.rb +2 -1
  119. data/lib/phusion_passenger/union_station/core.rb +18 -18
  120. data/lib/phusion_passenger/union_station/transaction.rb +5 -5
  121. data/resources/oss-binaries.phusionpassenger.com.crt +0 -84
  122. data/resources/templates/standalone/config.erb +1 -0
  123. metadata +40 -40
  124. metadata.gz.asc +7 -7
@@ -22,8 +22,8 @@
22
22
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
23
  * THE SOFTWARE.
24
24
  */
25
- #ifndef _PASSENGER_SERVER_OPTION_PARSER_H_
26
- #define _PASSENGER_SERVER_OPTION_PARSER_H_
25
+ #ifndef _PASSENGER_CORE_OPTION_PARSER_H_
26
+ #define _PASSENGER_CORE_OPTION_PARSER_H_
27
27
 
28
28
  #include <boost/thread.hpp>
29
29
  #include <cstdio>
@@ -40,12 +40,12 @@ using namespace std;
40
40
 
41
41
 
42
42
  inline void
43
- serverUsage() {
43
+ coreUsage() {
44
44
  // ....|---------------Keep output within standard terminal width (80 chars)------------|
45
- printf("Usage: " AGENT_EXE " server <OPTIONS...> [APP DIRECTORY]\n");
46
- printf("Runs the " PROGRAM_NAME " standalone HTTP server agent.\n");
45
+ printf("Usage: " AGENT_EXE " core <OPTIONS...> [APP DIRECTORY]\n");
46
+ printf("Runs the " PROGRAM_NAME " core.\n");
47
47
  printf("\n");
48
- printf("The server starts in single-app mode, unless --multi-app is specified. When\n");
48
+ printf("The core starts in single-app mode, unless --multi-app is specified. When\n");
49
49
  printf("in single-app mode, it serves the app at the current working directory, or the\n");
50
50
  printf("app specified by APP DIRECTORY.\n");
51
51
  printf("\n");
@@ -66,12 +66,12 @@ serverUsage() {
66
66
  printf(" are applicable\n");
67
67
  printf("\n");
68
68
  printf("Daemon options (optional):\n");
69
- printf(" --pid-file PATH Store the server's PID in the given file. The file\n");
69
+ printf(" --pid-file PATH Store the core's PID in the given file. The file\n");
70
70
  printf(" is deleted on exit\n");
71
71
  printf("\n");
72
72
  printf("Security options (optional):\n");
73
73
  printf(" --multi-app-password-file PATH\n");
74
- printf(" Password-protect access to the HTTP server\n");
74
+ printf(" Password-protect access to the core's HTTP server\n");
75
75
  printf(" (multi-app mode only)\n");
76
76
  printf(" --authorize [LEVEL]:USERNAME:PASSWORDFILE\n");
77
77
  printf(" Enables authentication on the API server, through\n");
@@ -127,6 +127,10 @@ serverUsage() {
127
127
  printf(" --pool-idle-time SECS\n");
128
128
  printf(" Maximum number of seconds an application process\n");
129
129
  printf(" may be idle. Default: %d\n", DEFAULT_POOL_IDLE_TIME);
130
+ printf(" --max-preloader-idle-time SECS\n");
131
+ printf(" Maximum time that preloader processes may be\n");
132
+ printf(" be idle. A value of 0 means that preloader\n");
133
+ printf(" processes never timeout. Default: %d\n", DEFAULT_MAX_PRELOADER_IDLE_TIME);
130
134
  printf(" --min-instances N Minimum number of application processes. Default: 1\n");
131
135
  printf("\n");
132
136
  printf("Request handling options (optional):\n");
@@ -174,22 +178,22 @@ serverUsage() {
174
178
  }
175
179
 
176
180
  inline bool
177
- parseServerOption(int argc, const char *argv[], int &i, VariantMap &options) {
178
- OptionParser p(serverUsage);
181
+ parseCoreOption(int argc, const char *argv[], int &i, VariantMap &options) {
182
+ OptionParser p(coreUsage);
179
183
 
180
184
  if (p.isValueFlag(argc, i, argv[i], '\0', "--passenger-root")) {
181
185
  options.set("passenger_root", argv[i + 1]);
182
186
  i += 2;
183
187
  } else if (p.isValueFlag(argc, i, argv[i], 'l', "--listen")) {
184
188
  if (getSocketAddressType(argv[i + 1]) != SAT_UNKNOWN) {
185
- vector<string> addresses = options.getStrSet("server_addresses", false);
189
+ vector<string> addresses = options.getStrSet("core_addresses", false);
186
190
  if (addresses.size() == SERVER_KIT_MAX_SERVER_ENDPOINTS) {
187
191
  fprintf(stderr, "ERROR: you may specify up to %u --listen addresses.\n",
188
192
  SERVER_KIT_MAX_SERVER_ENDPOINTS);
189
193
  exit(1);
190
194
  }
191
195
  addresses.push_back(argv[i + 1]);
192
- options.setStrSet("server_addresses", addresses);
196
+ options.setStrSet("core_addresses", addresses);
193
197
  i += 2;
194
198
  } else {
195
199
  fprintf(stderr, "ERROR: invalid address format for --listen. The address "
@@ -199,7 +203,7 @@ parseServerOption(int argc, const char *argv[], int &i, VariantMap &options) {
199
203
  }
200
204
  } else if (p.isValueFlag(argc, i, argv[i], '\0', "--api-listen")) {
201
205
  if (getSocketAddressType(argv[i + 1]) != SAT_UNKNOWN) {
202
- vector<string> addresses = options.getStrSet("server_api_addresses",
206
+ vector<string> addresses = options.getStrSet("core_api_addresses",
203
207
  false);
204
208
  if (addresses.size() == SERVER_KIT_MAX_SERVER_ENDPOINTS) {
205
209
  fprintf(stderr, "ERROR: you may specify up to %u --api-listen addresses.\n",
@@ -207,7 +211,7 @@ parseServerOption(int argc, const char *argv[], int &i, VariantMap &options) {
207
211
  exit(1);
208
212
  }
209
213
  addresses.push_back(argv[i + 1]);
210
- options.setStrSet("server_api_addresses", addresses);
214
+ options.setStrSet("core_api_addresses", addresses);
211
215
  i += 2;
212
216
  } else {
213
217
  fprintf(stderr, "ERROR: invalid address format for --api-listen. The address "
@@ -216,11 +220,11 @@ parseServerOption(int argc, const char *argv[], int &i, VariantMap &options) {
216
220
  exit(1);
217
221
  }
218
222
  } else if (p.isValueFlag(argc, i, argv[i], '\0', "--pid-file")) {
219
- options.set("server_pid_file", argv[i + 1]);
223
+ options.set("core_pid_file", argv[i + 1]);
220
224
  i += 2;
221
225
  } else if (p.isValueFlag(argc, i, argv[i], '\0', "--authorize")) {
222
226
  vector<string> args;
223
- vector<string> authorizations = options.getStrSet("server_authorizations",
227
+ vector<string> authorizations = options.getStrSet("core_authorizations",
224
228
  false);
225
229
 
226
230
  split(argv[i + 1], ':', args);
@@ -231,7 +235,7 @@ parseServerOption(int argc, const char *argv[], int &i, VariantMap &options) {
231
235
  }
232
236
 
233
237
  authorizations.push_back(argv[i + 1]);
234
- options.setStrSet("server_authorizations", authorizations);
238
+ options.setStrSet("core_authorizations", authorizations);
235
239
  i += 2;
236
240
  } else if (p.isFlag(argv[i], '\0', "--no-user-switching")) {
237
241
  options.setBool("user_switching", false);
@@ -248,6 +252,9 @@ parseServerOption(int argc, const char *argv[], int &i, VariantMap &options) {
248
252
  } else if (p.isValueFlag(argc, i, argv[i], '\0', "--pool-idle-time")) {
249
253
  options.setInt("pool_idle_time", atoi(argv[i + 1]));
250
254
  i += 2;
255
+ } else if (p.isValueFlag(argc, i, argv[i], '\0', "--max-preloader-idle-time")) {
256
+ options.setInt("max_preloader_idle_time", atoi(argv[i + 1]));
257
+ i += 2;
251
258
  } else if (p.isValueFlag(argc, i, argv[i], '\0', "--min-instances")) {
252
259
  options.setInt("min_instances", atoi(argv[i + 1]));
253
260
  i += 2;
@@ -320,17 +327,17 @@ parseServerOption(int argc, const char *argv[], int &i, VariantMap &options) {
320
327
  } else if (p.isValueFlag(argc, i, argv[i], '\0', "--log-level")) {
321
328
  // We do not set log_level because, when this function is called from
322
329
  // the Watchdog, we don't want to affect the Watchdog's own log level.
323
- options.setInt("server_log_level", atoi(argv[i + 1]));
330
+ options.setInt("core_log_level", atoi(argv[i + 1]));
324
331
  i += 2;
325
332
  } else if (p.isValueFlag(argc, i, argv[i], '\0', "--log-file")) {
326
333
  // We do not set log_file because, when this function is called from
327
334
  // the Watchdog, we don't want to affect the Watchdog's own log file.
328
- options.set("server_log_file", argv[i + 1]);
335
+ options.set("core_log_file", argv[i + 1]);
329
336
  i += 2;
330
337
  } else if (p.isValueFlag(argc, i, argv[i], '\0', "--fd-log-file")) {
331
338
  // We do not set file_descriptor_log_file because, when this function is called from
332
339
  // the Watchdog, we don't want to affect the Watchdog's own log file.
333
- options.set("server_file_descriptor_log_file", argv[i + 1]);
340
+ options.set("core_file_descriptor_log_file", argv[i + 1]);
334
341
  i += 2;
335
342
  } else if (p.isValueFlag(argc, i, argv[i], '\0', "--stat-throttle-rate")) {
336
343
  options.setInt("stat_throttle_rate", atoi(argv[i + 1]));
@@ -342,7 +349,7 @@ parseServerOption(int argc, const char *argv[], int &i, VariantMap &options) {
342
349
  options.setInt("data_buffer_dir", atoi(argv[i + 1]));
343
350
  i += 2;
344
351
  } else if (p.isFlag(argv[i], '\0', "--no-graceful-exit")) {
345
- options.setBool("server_graceful_exit", false);
352
+ options.setBool("core_graceful_exit", false);
346
353
  i++;
347
354
  } else if (p.isValueFlag(argc, i, argv[i], '\0', "--benchmark")) {
348
355
  options.set("benchmark_mode", argv[i + 1]);
@@ -351,10 +358,10 @@ parseServerOption(int argc, const char *argv[], int &i, VariantMap &options) {
351
358
  options.setBool("selfchecks", false);
352
359
  i++;
353
360
  } else if (p.isValueFlag(argc, i, argv[i], '\0', "--threads")) {
354
- options.setInt("server_threads", atoi(argv[i + 1]));
361
+ options.setInt("core_threads", atoi(argv[i + 1]));
355
362
  i += 2;
356
363
  } else if (p.isFlag(argv[i], '\0', "--cpu-affine")) {
357
- options.setBool("server_cpu_affine", true);
364
+ options.setBool("core_cpu_affine", true);
358
365
  i++;
359
366
  } else if (!startsWith(argv[i], "-")) {
360
367
  if (!options.has("app_root")) {
@@ -362,7 +369,7 @@ parseServerOption(int argc, const char *argv[], int &i, VariantMap &options) {
362
369
  i++;
363
370
  } else {
364
371
  fprintf(stderr, "ERROR: you may not pass multiple application directories. "
365
- "Please type '%s server --help' for usage.\n", argv[0]);
372
+ "Please type '%s core --help' for usage.\n", argv[0]);
366
373
  exit(1);
367
374
  }
368
375
  } else {
@@ -374,4 +381,4 @@ parseServerOption(int argc, const char *argv[], int &i, VariantMap &options) {
374
381
 
375
382
  } // namespace Passenger
376
383
 
377
- #endif /* _PASSENGER_SERVER_OPTION_PARSER_H_ */
384
+ #endif /* _PASSENGER_CORE_OPTION_PARSER_H_ */
@@ -68,9 +68,9 @@
68
68
  #include <Utils/HttpConstants.h>
69
69
  #include <Utils/VariantMap.h>
70
70
  #include <Utils/Timer.h>
71
- #include <agents/HelperAgent/RequestHandler/Client.h>
72
- #include <agents/HelperAgent/RequestHandler/AppResponse.h>
73
- #include <agents/HelperAgent/RequestHandler/TurboCaching.h>
71
+ #include <agent/Core/RequestHandler/Client.h>
72
+ #include <agent/Core/RequestHandler/AppResponse.h>
73
+ #include <agent/Core/RequestHandler/TurboCaching.h>
74
74
 
75
75
  namespace Passenger {
76
76
 
@@ -120,8 +120,8 @@ private:
120
120
  StringKeyTable< boost::shared_ptr<Options> > poolOptionsCache;
121
121
 
122
122
  StaticString defaultRuby;
123
- StaticString loggingAgentAddress;
124
- StaticString loggingAgentPassword;
123
+ StaticString ustRouterAddress;
124
+ StaticString ustRouterPassword;
125
125
  StaticString defaultUser;
126
126
  StaticString defaultGroup;
127
127
  StaticString defaultServerName;
@@ -170,13 +170,13 @@ public:
170
170
  UnionStation::CorePtr unionStationCore;
171
171
 
172
172
  protected:
173
- #include <agents/HelperAgent/RequestHandler/Utils.cpp>
174
- #include <agents/HelperAgent/RequestHandler/Hooks.cpp>
175
- #include <agents/HelperAgent/RequestHandler/InitRequest.cpp>
176
- #include <agents/HelperAgent/RequestHandler/BufferBody.cpp>
177
- #include <agents/HelperAgent/RequestHandler/CheckoutSession.cpp>
178
- #include <agents/HelperAgent/RequestHandler/SendRequest.cpp>
179
- #include <agents/HelperAgent/RequestHandler/ForwardResponse.cpp>
173
+ #include <agent/Core/RequestHandler/Utils.cpp>
174
+ #include <agent/Core/RequestHandler/Hooks.cpp>
175
+ #include <agent/Core/RequestHandler/InitRequest.cpp>
176
+ #include <agent/Core/RequestHandler/BufferBody.cpp>
177
+ #include <agent/Core/RequestHandler/CheckoutSession.cpp>
178
+ #include <agent/Core/RequestHandler/SendRequest.cpp>
179
+ #include <agent/Core/RequestHandler/ForwardResponse.cpp>
180
180
 
181
181
  public:
182
182
  RequestHandler(ServerKit::Context *context, const VariantMap *_agentsOptions,
@@ -189,7 +189,7 @@ public:
189
189
  singleAppMode(false),
190
190
  showVersionInHeader(_agentsOptions->getBool("show_version_in_header")),
191
191
  stickySessions(_agentsOptions->getBool("sticky_sessions")),
192
- gracefulExit(_agentsOptions->getBool("server_graceful_exit")),
192
+ gracefulExit(_agentsOptions->getBool("core_graceful_exit")),
193
193
 
194
194
  agentsOptions(_agentsOptions),
195
195
  stringPool(psg_create_pool(1024 * 4)),
@@ -221,10 +221,10 @@ public:
221
221
  {
222
222
  defaultRuby = psg_pstrdup(stringPool,
223
223
  agentsOptions->get("default_ruby"));
224
- loggingAgentAddress = psg_pstrdup(stringPool,
225
- agentsOptions->get("logging_agent_address", false));
226
- loggingAgentPassword = psg_pstrdup(stringPool,
227
- agentsOptions->get("logging_agent_password", false));
224
+ ustRouterAddress = psg_pstrdup(stringPool,
225
+ agentsOptions->get("ust_router_address", false));
226
+ ustRouterPassword = psg_pstrdup(stringPool,
227
+ agentsOptions->get("ust_router_password", false));
228
228
  defaultUser = psg_pstrdup(stringPool,
229
229
  agentsOptions->get("default_user", false));
230
230
  defaultGroup = psg_pstrdup(stringPool,
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2011-2014 Phusion
3
+ * Copyright (c) 2011-2015 Phusion
4
4
  *
5
5
  * "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
6
  *
@@ -28,7 +28,7 @@
28
28
  #include <ev++.h>
29
29
  #include <ostream>
30
30
  #include <ServerKit/HttpClient.h>
31
- #include <agents/HelperAgent/RequestHandler/Request.h>
31
+ #include <agent/Core/RequestHandler/Request.h>
32
32
 
33
33
  namespace Passenger {
34
34
 
@@ -219,9 +219,9 @@ fillPoolOptionsFromAgentsOptions(Options &options) {
219
219
  }
220
220
 
221
221
  options.logLevel = getLogLevel();
222
- options.loggingAgentAddress = loggingAgentAddress;
223
- options.loggingAgentUsername = P_STATIC_STRING("logging");
224
- options.loggingAgentPassword = loggingAgentPassword;
222
+ options.ustRouterAddress = ustRouterAddress;
223
+ options.ustRouterUsername = P_STATIC_STRING("logging");
224
+ options.ustRouterPassword = ustRouterPassword;
225
225
  options.userSwitching = agentsOptions->getBool("user_switching");
226
226
  if (agentsOptions->has("default_user")) {
227
227
  options.defaultUser = agentsOptions->get("default_user");
@@ -230,6 +230,7 @@ fillPoolOptionsFromAgentsOptions(Options &options) {
230
230
  options.defaultGroup = agentsOptions->get("default_group");
231
231
  }
232
232
  options.minProcesses = agentsOptions->getInt("min_instances");
233
+ options.maxPreloaderIdleTime = agentsOptions->getInt("max_preloader_idle_time");
233
234
  options.spawnMethod = agentsOptions->get("spawn_method");
234
235
  options.loadShellEnvvars = agentsOptions->getBool("load_shell_envvars");
235
236
  options.statThrottleRate = statThrottleRate;
@@ -36,7 +36,7 @@
36
36
  #include <UnionStation/Core.h>
37
37
  #include <UnionStation/Transaction.h>
38
38
  #include <UnionStation/ScopeLog.h>
39
- #include <agents/HelperAgent/RequestHandler/AppResponse.h>
39
+ #include <agent/Core/RequestHandler/AppResponse.h>
40
40
  #include <Logging.h>
41
41
 
42
42
  namespace Passenger {
@@ -32,7 +32,7 @@
32
32
  #include <cassert>
33
33
  #include <MemoryKit/mbuf.h>
34
34
  #include <ServerKit/Context.h>
35
- #include <agents/HelperAgent/ResponseCache.h>
35
+ #include <agent/Core/ResponseCache.h>
36
36
  #include <Constants.h>
37
37
  #include <Logging.h>
38
38
  #include <Utils/StrIntUtils.h>
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2014 Phusion
3
+ * Copyright (c) 2014-2015 Phusion
4
4
  *
5
5
  * "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
6
  *
@@ -30,8 +30,8 @@
30
30
  using namespace std;
31
31
 
32
32
  int watchdogMain(int argc, char *argv[]);
33
- int serverMain(int argc, char *argv[]);
34
- int loggingAgentMain(int argc, char *argv[]);
33
+ int coreMain(int argc, char *argv[]);
34
+ int ustRouterMain(int argc, char *argv[]);
35
35
  int systemMetricsMain(int argc, char *argv[]);
36
36
  int tempDirToucherMain(int argc, char *argv[]);
37
37
  int spawnPreparerMain(int argc, char *argv[]);
@@ -51,9 +51,9 @@ usage(int argc, char *argv[]) {
51
51
  argv[0]);
52
52
  printf("\n");
53
53
  printf("Daemon subcommands:\n");
54
- printf(" server\n");
54
+ printf(" core\n");
55
55
  printf(" watchdog\n");
56
- printf(" logger\n");
56
+ printf(" ust-router\n");
57
57
  printf("\n");
58
58
  printf("Utility subcommands:\n");
59
59
  printf(" system-metrics\n");
@@ -79,10 +79,10 @@ static void
79
79
  dispatchSubcommand(int argc, char *argv[]) {
80
80
  if (strcmp(argv[1], "watchdog") == 0) {
81
81
  exit(watchdogMain(argc, argv));
82
- } else if (strcmp(argv[1], "server") == 0) {
83
- exit(serverMain(argc, argv));
84
- } else if (strcmp(argv[1], "logger") == 0) {
85
- exit(loggingAgentMain(argc, argv));
82
+ } else if (strcmp(argv[1], "core") == 0) {
83
+ exit(coreMain(argc, argv));
84
+ } else if (strcmp(argv[1], "ust-router") == 0) {
85
+ exit(ustRouterMain(argc, argv));
86
86
  } else if (strcmp(argv[1], "system-metrics") == 0) {
87
87
  exit(systemMetricsMain(argc, argv));
88
88
  } else if (strcmp(argv[1], "temp-dir-toucher") == 0) {
@@ -22,14 +22,14 @@
22
22
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
23
  * THE SOFTWARE.
24
24
  */
25
- #ifndef _PASSENGER_LOGGING_AGENT_API_SERVER_H_
26
- #define _PASSENGER_LOGGING_AGENT_API_SERVER_H_
25
+ #ifndef _PASSENGER_UST_ROUTER_API_SERVER_H_
26
+ #define _PASSENGER_UST_ROUTER_API_SERVER_H_
27
27
 
28
28
  #include <sstream>
29
29
  #include <string>
30
30
 
31
- #include <agents/LoggingAgent/LoggingServer.h>
32
- #include <agents/ApiServerUtils.h>
31
+ #include <agent/UstRouter/LoggingServer.h>
32
+ #include <agent/ApiServerUtils.h>
33
33
  #include <ApplicationPool2/ApiKey.h>
34
34
  #include <ServerKit/HttpServer.h>
35
35
  #include <DataStructures/LString.h>
@@ -42,7 +42,7 @@
42
42
  #include <Utils/MessageIO.h>
43
43
 
44
44
  namespace Passenger {
45
- namespace LoggingAgent {
45
+ namespace UstRouter {
46
46
 
47
47
  using namespace std;
48
48
 
@@ -273,7 +273,7 @@ public:
273
273
  };
274
274
 
275
275
 
276
- } // namespace LoggingAgent
276
+ } // namespace UstRouter
277
277
  } // namespace Passenger
278
278
 
279
- #endif /* _PASSENGER_LOGGING_AGENT_API_SERVER_H_ */
279
+ #endif /* _PASSENGER_UST_ROUTER_API_SERVER_H_ */
@@ -43,9 +43,9 @@
43
43
  #include <ctime>
44
44
  #include <cassert>
45
45
 
46
- #include <agents/LoggingAgent/DataStoreId.h>
47
- #include <agents/LoggingAgent/RemoteSender.h>
48
- #include <agents/LoggingAgent/FilterSupport.h>
46
+ #include <agent/UstRouter/DataStoreId.h>
47
+ #include <agent/UstRouter/RemoteSender.h>
48
+ #include <agent/UstRouter/FilterSupport.h>
49
49
 
50
50
  #include <EventedMessageServer.h>
51
51
  #include <MessageReadersWriters.h>
@@ -1128,7 +1128,7 @@ public:
1128
1128
  garbageCollectionTimer(loop),
1129
1129
  sinkFlushingTimer(loop),
1130
1130
  exitTimer(loop),
1131
- dumpFile(options.get("analytics_dump_file", false, "/dev/null"))
1131
+ dumpFile(options.get("ust_router_dump_file", false, "/dev/null"))
1132
1132
  {
1133
1133
  int sinkFlushTimerInterval = options.getInt("analytics_sink_flush_timer_interval", false, 5);
1134
1134
  sinkFlushInterval = options.getInt("analytics_sink_flush_interval", false, 0);
@@ -42,11 +42,11 @@
42
42
  #include <stdlib.h>
43
43
  #include <signal.h>
44
44
 
45
- #include <agents/Base.h>
46
- #include <agents/ApiServerUtils.h>
47
- #include <agents/LoggingAgent/OptionParser.h>
48
- #include <agents/LoggingAgent/LoggingServer.h>
49
- #include <agents/LoggingAgent/ApiServer.h>
45
+ #include <agent/Base.h>
46
+ #include <agent/ApiServerUtils.h>
47
+ #include <agent/UstRouter/OptionParser.h>
48
+ #include <agent/UstRouter/LoggingServer.h>
49
+ #include <agent/UstRouter/ApiServer.h>
50
50
 
51
51
  #include <AccountsDatabase.h>
52
52
  #include <Account.h>
@@ -69,7 +69,7 @@ using namespace Passenger;
69
69
  /***** Constants and working objects *****/
70
70
 
71
71
  namespace Passenger {
72
- namespace LoggingAgent {
72
+ namespace UstRouter {
73
73
  struct WorkingObjects {
74
74
  string password;
75
75
  FileDescriptor serverSocketFd;
@@ -82,7 +82,7 @@ namespace LoggingAgent {
82
82
  AccountsDatabasePtr accountsDatabase;
83
83
  LoggingServer *loggingServer;
84
84
 
85
- LoggingAgent::ApiServer *apiServer;
85
+ UstRouter::ApiServer *apiServer;
86
86
  EventFd exitEvent;
87
87
  EventFd allClientsDisconnectedEvent;
88
88
 
@@ -101,10 +101,10 @@ namespace LoggingAgent {
101
101
  terminationCount(0)
102
102
  { }
103
103
  };
104
- } // namespace LoggingAgent
104
+ } // namespace UstRouter
105
105
  } // namespace Passenger
106
106
 
107
- using namespace Passenger::LoggingAgent;
107
+ using namespace Passenger::UstRouter;
108
108
 
109
109
  static VariantMap *agentsOptions;
110
110
  static WorkingObjects *workingObjects;
@@ -114,11 +114,11 @@ static WorkingObjects *workingObjects;
114
114
 
115
115
  static void printInfo(EV_P_ struct ev_signal *watcher, int revents);
116
116
  static void onTerminationSignal(EV_P_ struct ev_signal *watcher, int revents);
117
- static void apiServerShutdownFinished(LoggingAgent::ApiServer *server);
117
+ static void apiServerShutdownFinished(UstRouter::ApiServer *server);
118
118
  static void waitForExitEvent();
119
119
 
120
120
  void
121
- loggingAgentFeedbackFdBecameReadable(ev::io &watcher, int revents) {
121
+ ustRouterFeedbackFdBecameReadable(ev::io &watcher, int revents) {
122
122
  /* This event indicates that the watchdog has been killed.
123
123
  * In this case we'll kill all descendant
124
124
  * processes and exit. There's no point in keeping this agent
@@ -160,12 +160,12 @@ initializePrivilegedWorkingObjects() {
160
160
  const VariantMap &options = *agentsOptions;
161
161
  WorkingObjects *wo = workingObjects = new WorkingObjects();
162
162
 
163
- wo->password = options.get("logging_agent_password", false);
163
+ wo->password = options.get("ust_router_password", false);
164
164
  if (wo->password.empty()) {
165
- wo->password = strip(readAll(options.get("logging_agent_password_file")));
165
+ wo->password = strip(readAll(options.get("ust_router_password_file")));
166
166
  }
167
167
 
168
- vector<string> authorizations = options.getStrSet("logging_agent_authorizations",
168
+ vector<string> authorizations = options.getStrSet("ust_router_authorizations",
169
169
  false);
170
170
  string description;
171
171
 
@@ -191,7 +191,7 @@ startListening() {
191
191
  string address;
192
192
  vector<string> apiAddresses;
193
193
 
194
- address = options.get("logging_agent_address");
194
+ address = options.get("ust_router_address");
195
195
  wo->serverSocketFd.assign(createServer(address, 0, true,
196
196
  __FILE__, __LINE__), NULL, 0);
197
197
  P_LOG_FILE_DESCRIPTOR_PURPOSE(wo->serverSocketFd,
@@ -201,7 +201,7 @@ startListening() {
201
201
  }
202
202
 
203
203
  UPDATE_TRACE_POINT();
204
- apiAddresses = options.getStrSet("logging_agent_api_addresses",
204
+ apiAddresses = options.getStrSet("ust_router_api_addresses",
205
205
  false);
206
206
  foreach (address, apiAddresses) {
207
207
  wo->apiSockets.push_back(createServer(address, 0, true,
@@ -239,19 +239,19 @@ lowerPrivilege() {
239
239
 
240
240
  if (initgroups(userName.c_str(), gid) != 0) {
241
241
  int e = errno;
242
- throw SystemException("Unable to lower " AGENT_EXE " logger's privilege "
242
+ throw SystemException("Unable to lower " SHORT_PROGRAM_NAME " UstRouter's privilege "
243
243
  "to that of user '" + userName + "' and group '" + groupName +
244
244
  "': cannot set supplementary groups", e);
245
245
  }
246
246
  if (setgid(gid) != 0) {
247
247
  int e = errno;
248
- throw SystemException("Unable to lower " AGENT_EXE " logger's privilege "
248
+ throw SystemException("Unable to lower " SHORT_PROGRAM_NAME " UstRouter's privilege "
249
249
  "to that of user '" + userName + "' and group '" + groupName +
250
250
  "': cannot set group ID to " + toString(gid), e);
251
251
  }
252
252
  if (setuid(pwUser->pw_uid) != 0) {
253
253
  int e = errno;
254
- throw SystemException("Unable to lower " AGENT_EXE " logger's privilege "
254
+ throw SystemException("Unable to lower " SHORT_PROGRAM_NAME " UstRouter's privilege "
255
255
  "to that of user '" + userName + "' and group '" + groupName +
256
256
  "': cannot set user ID to " + toString(pwUser->pw_uid), e);
257
257
  }
@@ -284,7 +284,7 @@ initializeUnprivilegedWorkingObjects() {
284
284
  wo->serverSocketFd, wo->accountsDatabase, options);
285
285
 
286
286
  UPDATE_TRACE_POINT();
287
- wo->apiServer = new LoggingAgent::ApiServer(wo->serverKitContext);
287
+ wo->apiServer = new UstRouter::ApiServer(wo->serverKitContext);
288
288
  wo->apiServer->loggingServer = wo->loggingServer;
289
289
  wo->apiServer->apiAccountDatabase = &wo->apiAccountDatabase;
290
290
  wo->apiServer->instanceDir = options.get("instance_dir", false);
@@ -308,7 +308,7 @@ static void
308
308
  reportInitializationInfo() {
309
309
  TRACE_POINT();
310
310
 
311
- P_NOTICE(AGENT_EXE " logger online, PID " << getpid());
311
+ P_NOTICE(SHORT_PROGRAM_NAME " UstRouter online, PID " << getpid());
312
312
  if (feedbackFdAvailable()) {
313
313
  writeArrayMessage(FEEDBACK_FD,
314
314
  "initialized",
@@ -318,10 +318,10 @@ reportInitializationInfo() {
318
318
 
319
319
  static void
320
320
  printInfo(EV_P_ struct ev_signal *watcher, int revents) {
321
- cerr << "---------- Begin LoggingAgent status ----------\n";
321
+ cerr << "---------- Begin UstRouter status ----------\n";
322
322
  workingObjects->loggingServer->dump(cerr);
323
323
  cerr.flush();
324
- cerr << "---------- End LoggingAgent status ----------\n";
324
+ cerr << "---------- End UstRouter status ----------\n";
325
325
  }
326
326
 
327
327
  static void
@@ -354,7 +354,7 @@ shutdownApiServer() {
354
354
  }
355
355
 
356
356
  static void
357
- apiServerShutdownFinished(LoggingAgent::ApiServer *server) {
357
+ apiServerShutdownFinished(UstRouter::ApiServer *server) {
358
358
  workingObjects->allClientsDisconnectedEvent.notify();
359
359
  }
360
360
 
@@ -385,7 +385,7 @@ waitForExitEvent() {
385
385
  if (FD_ISSET(FEEDBACK_FD, &fds)) {
386
386
  UPDATE_TRACE_POINT();
387
387
  /* If the watchdog has been killed then we'll exit. There's no
388
- * point in keeping the logging agent running because we can't
388
+ * point in keeping the UstRouter running because we can't
389
389
  * detect when the web server exits, and because this logging
390
390
  * agent doesn't own the instance directory. As soon as
391
391
  * passenger-status is run, the instance directory will be
@@ -418,16 +418,16 @@ cleanup() {
418
418
  TRACE_POINT();
419
419
  WorkingObjects *wo = workingObjects;
420
420
 
421
- P_DEBUG("Shutting down " AGENT_EXE " logger...");
421
+ P_DEBUG("Shutting down " SHORT_PROGRAM_NAME " UstRouter...");
422
422
  wo->bgloop->stop();
423
423
  delete wo->apiServer;
424
- P_NOTICE(AGENT_EXE " logger shutdown finished");
424
+ P_NOTICE(SHORT_PROGRAM_NAME " UstRouter shutdown finished");
425
425
  }
426
426
 
427
427
  static int
428
- runLoggingAgent() {
428
+ runUstRouter() {
429
429
  TRACE_POINT();
430
- P_NOTICE("Starting " AGENT_EXE " logger...");
430
+ P_NOTICE("Starting " SHORT_PROGRAM_NAME " UstRouter...");
431
431
 
432
432
  try {
433
433
  UPDATE_TRACE_POINT();
@@ -458,18 +458,18 @@ runLoggingAgent() {
458
458
 
459
459
  static void
460
460
  parseOptions(int argc, const char *argv[], VariantMap &options) {
461
- OptionParser p(loggingAgentUsage);
461
+ OptionParser p(ustRouterUsage);
462
462
  int i = 2;
463
463
 
464
464
  while (i < argc) {
465
- if (parseLoggingAgentOption(argc, argv, i, options)) {
465
+ if (parseUstRouterOption(argc, argv, i, options)) {
466
466
  continue;
467
467
  } else if (p.isFlag(argv[i], 'h', "--help")) {
468
- loggingAgentUsage();
468
+ ustRouterUsage();
469
469
  exit(0);
470
470
  } else {
471
471
  fprintf(stderr, "ERROR: unrecognized argument %s. Please type "
472
- "'%s logger --help' for usage.\n", argv[i], argv[0]);
472
+ "'%s ust-router --help' for usage.\n", argv[i], argv[0]);
473
473
  exit(1);
474
474
  }
475
475
  }
@@ -479,11 +479,11 @@ static void
479
479
  preinitialize(VariantMap &options) {
480
480
  // Set log_level here so that initializeAgent() calls setLogLevel()
481
481
  // and setLogFile() with the right value.
482
- if (options.has("logging_agent_log_level")) {
483
- options.setInt("log_level", options.getInt("logging_agent_log_level"));
482
+ if (options.has("ust_router_log_level")) {
483
+ options.setInt("log_level", options.getInt("ust_router_log_level"));
484
484
  }
485
- if (options.has("logging_agent_log_file")) {
486
- options.setInt("debug_log_file", options.getInt("logging_agent_log_file"));
485
+ if (options.has("ust_router_log_file")) {
486
+ options.setInt("debug_log_file", options.getInt("ust_router_log_file"));
487
487
  }
488
488
  }
489
489
 
@@ -491,10 +491,10 @@ static void
491
491
  setAgentsOptionsDefaults() {
492
492
  VariantMap &options = *agentsOptions;
493
493
  set<string> defaultApiListenAddress;
494
- defaultApiListenAddress.insert(DEFAULT_LOGGING_AGENT_API_LISTEN_ADDRESS);
494
+ defaultApiListenAddress.insert(DEFAULT_UST_ROUTER_API_LISTEN_ADDRESS);
495
495
 
496
- options.setDefault("logging_agent_address", DEFAULT_LOGGING_AGENT_LISTEN_ADDRESS);
497
- options.setDefaultStrSet("logging_agent_api_addresses", defaultApiListenAddress);
496
+ options.setDefault("ust_router_address", DEFAULT_UST_ROUTER_LISTEN_ADDRESS);
497
+ options.setDefaultStrSet("ust_router_api_addresses", defaultApiListenAddress);
498
498
  }
499
499
 
500
500
  static void
@@ -508,8 +508,8 @@ sanityCheckOptions() {
508
508
  ok = false;
509
509
  }
510
510
 
511
- if (!options.has("logging_agent_password")
512
- && !options.has("logging_agent_password_file"))
511
+ if (!options.has("ust_router_password")
512
+ && !options.has("ust_router_password_file"))
513
513
  {
514
514
  fprintf(stderr, "ERROR: please set the --password-file argument.\n");
515
515
  ok = false;
@@ -542,9 +542,9 @@ sanityCheckOptions() {
542
542
  }
543
543
 
544
544
  int
545
- loggingAgentMain(int argc, char *argv[]) {
545
+ ustRouterMain(int argc, char *argv[]) {
546
546
  agentsOptions = new VariantMap();
547
- *agentsOptions = initializeAgent(argc, &argv, AGENT_EXE " logger",
547
+ *agentsOptions = initializeAgent(argc, &argv, SHORT_PROGRAM_NAME " ust-router",
548
548
  parseOptions, preinitialize, 2);
549
549
 
550
550
  CURLcode code = curl_global_init(CURL_GLOBAL_ALL);
@@ -555,5 +555,5 @@ loggingAgentMain(int argc, char *argv[]) {
555
555
 
556
556
  setAgentsOptionsDefaults();
557
557
  sanityCheckOptions();
558
- return runLoggingAgent();
558
+ return runUstRouter();
559
559
  }