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_LOGGING_AGENT_OPTION_PARSER_H_
26
- #define _PASSENGER_LOGGING_AGENT_OPTION_PARSER_H_
25
+ #ifndef _PASSENGER_UST_ROUTER_OPTION_PARSER_H_
26
+ #define _PASSENGER_UST_ROUTER_OPTION_PARSER_H_
27
27
 
28
28
  #include <cstdio>
29
29
  #include <cstdlib>
@@ -39,25 +39,25 @@ using namespace std;
39
39
 
40
40
 
41
41
  inline void
42
- loggingAgentUsage() {
43
- printf("Usage: " AGENT_EXE " logger <OPTIONS...>\n");
44
- printf("Runs the " PROGRAM_NAME " logging agent.\n");
42
+ ustRouterUsage() {
43
+ printf("Usage: " AGENT_EXE " ust-router <OPTIONS...>\n");
44
+ printf("Runs the " PROGRAM_NAME " UstRouter.\n");
45
45
  printf("\n");
46
46
  printf("Required options:\n");
47
47
  printf(" --passenger-root PATH The location to the " PROGRAM_NAME " source\n");
48
48
  printf(" directory\n");
49
- printf(" --password-file PATH Protect the logging server with the password in\n");
49
+ printf(" --password-file PATH Protect the UstRouter controller with the password in\n");
50
50
  printf(" this file\n");
51
51
  printf("\n");
52
52
  printf("Other options (optional):\n");
53
53
  printf(" -l, --listen ADDRESS Listen on the given address. The address must be\n");
54
54
  printf(" formatted as tcp://IP:PORT for TCP sockets, or\n");
55
55
  printf(" unix:PATH for Unix domain sockets.\n");
56
- printf(" " DEFAULT_LOGGING_AGENT_LISTEN_ADDRESS "\n");
56
+ printf(" " DEFAULT_UST_ROUTER_LISTEN_ADDRESS "\n");
57
57
  printf("\n");
58
58
  printf(" --api-listen ADDRESS Listen on the given address for API commands.\n");
59
59
  printf(" The address must be in the same format as that\n");
60
- printf(" of --listen. Default: " DEFAULT_LOGGING_AGENT_API_LISTEN_ADDRESS "\n");
60
+ printf(" of --listen. Default: " DEFAULT_UST_ROUTER_API_LISTEN_ADDRESS "\n");
61
61
  printf(" --authorize [LEVEL]:USERNAME:PASSWORDFILE\n");
62
62
  printf(" Enables authentication on the API server,\n");
63
63
  printf(" through the given API account. LEVEL indicates\n");
@@ -84,18 +84,18 @@ loggingAgentUsage() {
84
84
  }
85
85
 
86
86
  inline bool
87
- parseLoggingAgentOption(int argc, const char *argv[], int &i, VariantMap &options) {
88
- OptionParser p(loggingAgentUsage);
87
+ parseUstRouterOption(int argc, const char *argv[], int &i, VariantMap &options) {
88
+ OptionParser p(ustRouterUsage);
89
89
 
90
90
  if (p.isValueFlag(argc, i, argv[i], '\0', "--passenger-root")) {
91
91
  options.set("passenger_root", argv[i + 1]);
92
92
  i += 2;
93
93
  } else if (p.isValueFlag(argc, i, argv[i], '\0', "--password-file")) {
94
- options.set("logging_agent_password_file", argv[i + 1]);
94
+ options.set("ust_router_password_file", argv[i + 1]);
95
95
  i += 2;
96
96
  } else if (p.isValueFlag(argc, i, argv[i], 'l', "--listen")) {
97
97
  if (getSocketAddressType(argv[i + 1]) != SAT_UNKNOWN) {
98
- options.set("logging_agent_address", argv[i + 1]);
98
+ options.set("ust_router_address", argv[i + 1]);
99
99
  i += 2;
100
100
  } else {
101
101
  fprintf(stderr, "ERROR: invalid address format for --listen. The address "
@@ -105,7 +105,7 @@ parseLoggingAgentOption(int argc, const char *argv[], int &i, VariantMap &option
105
105
  }
106
106
  } else if (p.isValueFlag(argc, i, argv[i], '\0', "--api-listen")) {
107
107
  if (getSocketAddressType(argv[i + 1]) != SAT_UNKNOWN) {
108
- vector<string> addresses = options.getStrSet("logging_agent_api_addresses",
108
+ vector<string> addresses = options.getStrSet("ust_router_api_addresses",
109
109
  false);
110
110
  if (addresses.size() == SERVER_KIT_MAX_SERVER_ENDPOINTS) {
111
111
  fprintf(stderr, "ERROR: you may specify up to %u --api-listen addresses.\n",
@@ -113,7 +113,7 @@ parseLoggingAgentOption(int argc, const char *argv[], int &i, VariantMap &option
113
113
  exit(1);
114
114
  }
115
115
  addresses.push_back(argv[i + 1]);
116
- options.setStrSet("logging_agent_api_addresses", addresses);
116
+ options.setStrSet("ust_router_api_addresses", addresses);
117
117
  i += 2;
118
118
  } else {
119
119
  fprintf(stderr, "ERROR: invalid address format for --api-listen. The address "
@@ -123,7 +123,7 @@ parseLoggingAgentOption(int argc, const char *argv[], int &i, VariantMap &option
123
123
  }
124
124
  } else if (p.isValueFlag(argc, i, argv[i], '\0', "--authorize")) {
125
125
  vector<string> args;
126
- vector<string> authorizations = options.getStrSet("logging_agent_authorizations",
126
+ vector<string> authorizations = options.getStrSet("ust_router_authorizations",
127
127
  false);
128
128
 
129
129
  split(argv[i + 1], ':', args);
@@ -134,10 +134,10 @@ parseLoggingAgentOption(int argc, const char *argv[], int &i, VariantMap &option
134
134
  }
135
135
 
136
136
  authorizations.push_back(argv[i + 1]);
137
- options.setStrSet("logging_agent_authorizations", authorizations);
137
+ options.setStrSet("ust_router_authorizations", authorizations);
138
138
  i += 2;
139
139
  } else if (p.isValueFlag(argc, i, argv[i], '\0', "--dump-file")) {
140
- options.set("analytics_dump_file", argv[i + 1]);
140
+ options.set("ust_router_dump_file", argv[i + 1]);
141
141
  i += 2;
142
142
  } else if (p.isValueFlag(argc, i, argv[i], '\0', "--user")) {
143
143
  options.set("analytics_log_user", argv[i + 1]);
@@ -148,12 +148,12 @@ parseLoggingAgentOption(int argc, const char *argv[], int &i, VariantMap &option
148
148
  } else if (p.isValueFlag(argc, i, argv[i], '\0', "--log-level")) {
149
149
  // We do not set log_level because, when this function is called from
150
150
  // the Watchdog, we don't want to affect the Watchdog's own log level.
151
- options.setInt("logging_agent_log_level", atoi(argv[i + 1]));
151
+ options.setInt("ust_router_log_level", atoi(argv[i + 1]));
152
152
  i += 2;
153
153
  } else if (p.isValueFlag(argc, i, argv[i], '\0', "--log-file")) {
154
154
  // We do not set debug_log_file because, when this function is called from
155
155
  // the Watchdog, we don't want to affect the Watchdog's own log file.
156
- options.set("logging_agent_log_file", argv[i + 1]);
156
+ options.set("ust_router_log_file", argv[i + 1]);
157
157
  i += 2;
158
158
  } else {
159
159
  return false;
@@ -164,4 +164,4 @@ parseLoggingAgentOption(int argc, const char *argv[], int &i, VariantMap &option
164
164
 
165
165
  } // namespace Passenger
166
166
 
167
- #endif /* _PASSENGER_LOGGING_AGENT_OPTION_PARSER_H_ */
167
+ #endif /* _PASSENGER_UST_ROUTER_OPTION_PARSER_H_ */
@@ -29,7 +29,7 @@
29
29
  #include <string>
30
30
  #include <cstring>
31
31
 
32
- #include <agents/ApiServerUtils.h>
32
+ #include <agent/ApiServerUtils.h>
33
33
  #include <ServerKit/HttpServer.h>
34
34
  #include <DataStructures/LString.h>
35
35
  #include <Exceptions.h>
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2010-2014 Phusion
3
+ * Copyright (c) 2010-2015 Phusion
4
4
  *
5
5
  * "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
6
  *
@@ -23,12 +23,12 @@
23
23
  * THE SOFTWARE.
24
24
  */
25
25
 
26
- class HelperAgentWatcher: public AgentWatcher {
26
+ class CoreWatcher: public AgentWatcher {
27
27
  protected:
28
28
  string agentFilename;
29
29
 
30
30
  virtual const char *name() const {
31
- return PROGRAM_NAME " helper agent";
31
+ return SHORT_PROGRAM_NAME " core";
32
32
  }
33
33
 
34
34
  virtual string getExeFilename() const {
@@ -36,13 +36,13 @@ protected:
36
36
  }
37
37
 
38
38
  virtual void execProgram() const {
39
- if (hasEnvOption("PASSENGER_RUN_HELPER_AGENT_IN_VALGRIND", false)) {
39
+ if (hasEnvOption("PASSENGER_RUN_CORE_IN_VALGRIND", false)) {
40
40
  execlp("valgrind", "valgrind", "--dsymutil=yes", "--track-origins=yes", "--leak-check=full",
41
- agentFilename.c_str(), "server",
41
+ agentFilename.c_str(), "core",
42
42
  // Some extra space to allow the child process to change its process title.
43
43
  " ", (char *) 0);
44
44
  } else {
45
- execl(agentFilename.c_str(), AGENT_EXE, "server",
45
+ execl(agentFilename.c_str(), AGENT_EXE, "core",
46
46
  // Some extra space to allow the child process to change its process title.
47
47
  " ", (char *) 0);
48
48
  }
@@ -50,7 +50,7 @@ protected:
50
50
 
51
51
  virtual void sendStartupArguments(pid_t pid, FileDescriptor &fd) {
52
52
  VariantMap options = *agentsOptions;
53
- options.erase("logging_agent_authorizations");
53
+ options.erase("ust_router_authorizations");
54
54
  options.writeToFd(fd);
55
55
  }
56
56
 
@@ -59,7 +59,7 @@ protected:
59
59
  }
60
60
 
61
61
  public:
62
- HelperAgentWatcher(const WorkingObjectsPtr &wo)
62
+ CoreWatcher(const WorkingObjectsPtr &wo)
63
63
  : AgentWatcher(wo)
64
64
  {
65
65
  agentFilename = wo->resourceLocator->findSupportBinary(AGENT_EXE);
@@ -67,8 +67,12 @@ public:
67
67
 
68
68
  virtual void reportAgentsInformation(VariantMap &report) {
69
69
  const VariantMap &options = *agentsOptions;
70
- vector<string> addresses = options.getStrSet("server_addresses");
70
+ vector<string> addresses = options.getStrSet("core_addresses");
71
+ report.set("core_address", addresses.front());
72
+ report.set("core_password", options.get("core_password"));
73
+
74
+ // For backwards compatibility:
71
75
  report.set("server_address", addresses.front());
72
- report.set("server_password", options.get("server_password"));
76
+ report.set("server_password", options.get("core_password"));
73
77
  }
74
78
  };
@@ -57,11 +57,11 @@
57
57
  #include <cstring>
58
58
  #include <cerrno>
59
59
 
60
- #include <agents/Base.h>
61
- #include <agents/ApiServerUtils.h>
62
- #include <agents/HelperAgent/OptionParser.h>
63
- #include <agents/LoggingAgent/OptionParser.h>
64
- #include <agents/Watchdog/ApiServer.h>
60
+ #include <agent/Base.h>
61
+ #include <agent/ApiServerUtils.h>
62
+ #include <agent/Core/OptionParser.h>
63
+ #include <agent/UstRouter/OptionParser.h>
64
+ #include <agent/Watchdog/ApiServer.h>
65
65
  #include <Constants.h>
66
66
  #include <InstanceDirectory.h>
67
67
  #include <FileDescriptor.h>
@@ -154,8 +154,8 @@ static void cleanup(const WorkingObjectsPtr &wo);
154
154
 
155
155
  #include "AgentWatcher.cpp"
156
156
  #include "InstanceDirToucher.cpp"
157
- #include "HelperAgentWatcher.cpp"
158
- #include "LoggingAgentWatcher.cpp"
157
+ #include "CoreWatcher.cpp"
158
+ #include "UstRouterWatcher.cpp"
159
159
 
160
160
 
161
161
  /***** Functions *****/
@@ -529,22 +529,22 @@ usage() {
529
529
  printf("Usage: " AGENT_EXE " watchdog <OPTIONS...>\n");
530
530
  printf("Runs the " PROGRAM_NAME " watchdog.\n\n");
531
531
  printf("The watchdog runs and supervises various " PROGRAM_NAME " agent processes,\n");
532
- printf("namely the HTTP server and logging server. Arguments marked with \"[A]\", e.g.\n");
532
+ printf("namely the core and the UstRouter. Arguments marked with \"[A]\", e.g.\n");
533
533
  printf("--passenger-root and --log-level, are automatically passed to all supervised\n");
534
534
  printf("agents, unless you explicitly override them by passing extra arguments to a\n");
535
535
  printf("supervised agent specifically. You can pass arguments to a supervised agent by\n");
536
- printf("wrapping those arguments between --BS/--ES and --BL/--EL.\n");
536
+ printf("wrapping those arguments between --BC/--EC and --BU/--EU.\n");
537
537
  printf("\n");
538
- printf(" Example 1: pass some arguments to the HTTP server.\n\n");
539
- printf(" " AGENT_EXE " watchdog --passenger-root /opt/passenger \\\n");
540
- printf(" --BS --listen tcp://127.0.0.1:4000 /webapps/foo\n");
538
+ printf(" Example 1: pass some arguments to the core.\n\n");
539
+ printf(" " SHORT_PROGRAM_NAME " watchdog --passenger-root /opt/passenger \\\n");
540
+ printf(" --BC --listen tcp://127.0.0.1:4000 /webapps/foo\n");
541
541
  printf("\n");
542
- printf(" Example 2: pass some arguments to the HTTP server, and some others to the\n");
543
- printf(" logging server. The watchdog itself and the HTTP server will use logging\n");
544
- printf(" level 3, while the logging server will use logging level 1.\n\n");
545
- printf(" " AGENT_EXE " watchdog --passenger-root /opt/passenger \\\n");
546
- printf(" --BS --listen tcp://127.0.0.1:4000 /webapps/foo --ES \\\n");
547
- printf(" --BL --log-level 1 --EL \\\n");
542
+ printf(" Example 2: pass some arguments to the core, and some others to the\n");
543
+ printf(" UstRouter. The watchdog itself and the core will use logging\n");
544
+ printf(" level 3, while the UstRouter will use logging level 1.\n\n");
545
+ printf(" " SHORT_PROGRAM_NAME " watchdog --passenger-root /opt/passenger \\\n");
546
+ printf(" --BC --listen tcp://127.0.0.1:4000 /webapps/foo --EC \\\n");
547
+ printf(" --BU --log-level 1 --EU \\\n");
548
548
  printf(" --log-level 3\n");
549
549
  printf("\n");
550
550
  printf("Required options:\n");
@@ -552,14 +552,16 @@ usage() {
552
552
  printf(" directory [A]\n");
553
553
  printf("\n");
554
554
  printf("Argument passing options (optional):\n");
555
- printf(" --BS, --begin-server-args Signals the beginning of arguments to pass to the\n");
556
- printf(" HTTP server\n");
557
- printf(" --ES, --end-server-args Signals the end of arguments to pass to the HTTP\n");
558
- printf(" server\n");
559
- printf(" --BL, --begin-logger-args Signals the beginning of arguments to pass to the\n");
560
- printf(" logging server\n");
561
- printf(" --EL, --end-logger-args Signals the end of arguments to pass to the\n");
562
- printf(" logging server\n");
555
+ printf(" --BC, --begin-core-args Signals the beginning of arguments to pass to the\n");
556
+ printf(" Passenger core\n");
557
+ printf(" --EC, --end-core-args Signals the end of arguments to pass to the\n");
558
+ printf(" Passenger core\n");
559
+ printf(" --BU, --begin-ust-router-args\n");
560
+ printf(" Signals the beginning of arguments to pass to the\n");
561
+ printf(" UstRouter\n");
562
+ printf(" --EU, --end-ust-router-args\n");
563
+ printf(" Signals the end of arguments to pass to the\n");
564
+ printf(" UstRouter\n");
563
565
  printf("\n");
564
566
  printf("Other options (optional):\n");
565
567
  printf(" --api-listen ADDRESS Listen on the given address for API commands.\n");
@@ -616,43 +618,43 @@ parseOptions(int argc, const char *argv[], VariantMap &options) {
616
618
  if (p.isValueFlag(argc, i, argv[i], '\0', "--passenger-root")) {
617
619
  options.set("passenger_root", argv[i + 1]);
618
620
  i += 2;
619
- } else if (p.isFlag(argv[i], '\0', "--BS")
620
- || p.isFlag(argv[i], '\0', "--begin-server-args"))
621
+ } else if (p.isFlag(argv[i], '\0', "--BC")
622
+ || p.isFlag(argv[i], '\0', "--begin-core-args"))
621
623
  {
622
624
  i++;
623
625
  while (i < argc) {
624
- if (p.isFlag(argv[i], '\0', "--ES")
625
- || p.isFlag(argv[i], '\0', "--end-server-args"))
626
+ if (p.isFlag(argv[i], '\0', "--EC")
627
+ || p.isFlag(argv[i], '\0', "--end-core-args"))
626
628
  {
627
629
  i++;
628
630
  break;
629
- } else if (p.isFlag(argv[i], '\0', "--BL")
630
- || p.isFlag(argv[i], '\0', "--begin-logger-args"))
631
+ } else if (p.isFlag(argv[i], '\0', "--BU")
632
+ || p.isFlag(argv[i], '\0', "--begin-ust-router-args"))
631
633
  {
632
634
  break;
633
- } else if (!parseServerOption(argc, argv, i, options)) {
634
- fprintf(stderr, "ERROR: unrecognized HTTP server argument %s. Please "
635
- "type '%s server --help' for usage.\n", argv[i], argv[0]);
635
+ } else if (!parseCoreOption(argc, argv, i, options)) {
636
+ fprintf(stderr, "ERROR: unrecognized core argument %s. Please "
637
+ "type '%s core --help' for usage.\n", argv[i], argv[0]);
636
638
  exit(1);
637
639
  }
638
640
  }
639
- } else if (p.isFlag(argv[i], '\0', "--BL")
640
- || p.isFlag(argv[i], '\0', "--begin-logger-args"))
641
+ } else if (p.isFlag(argv[i], '\0', "--BU")
642
+ || p.isFlag(argv[i], '\0', "--begin-ust-router-args"))
641
643
  {
642
644
  i++;
643
645
  while (i < argc) {
644
- if (p.isFlag(argv[i], '\0', "--EL")
645
- || p.isFlag(argv[i], '\0', "--end-logger-args"))
646
+ if (p.isFlag(argv[i], '\0', "--EU")
647
+ || p.isFlag(argv[i], '\0', "--end-ust-router-args"))
646
648
  {
647
649
  i++;
648
650
  break;
649
- } else if (p.isFlag(argv[i], '\0', "--BS")
650
- || p.isFlag(argv[i], '\0', "--begin-server-args"))
651
+ } else if (p.isFlag(argv[i], '\0', "--BC")
652
+ || p.isFlag(argv[i], '\0', "--begin-core-args"))
651
653
  {
652
654
  break;
653
- } else if (!parseLoggingAgentOption(argc, argv, i, options)) {
654
- fprintf(stderr, "ERROR: unrecognized logging agent argument %s. Please "
655
- "type '%s logger --help' for usage.\n", argv[i], argv[0]);
655
+ } else if (!parseUstRouterOption(argc, argv, i, options)) {
656
+ fprintf(stderr, "ERROR: unrecognized UstRouter argument %s. Please "
657
+ "type '%s ust-router --help' for usage.\n", argv[i], argv[0]);
656
658
  exit(1);
657
659
  }
658
660
  }
@@ -776,7 +778,7 @@ initializeBareEssentials(int argc, char *argv[], WorkingObjectsPtr &wo) {
776
778
  oldOomScore = setOomScoreNeverKill();
777
779
 
778
780
  agentsOptions = new VariantMap();
779
- *agentsOptions = initializeAgent(argc, &argv, AGENT_EXE " watchdog",
781
+ *agentsOptions = initializeAgent(argc, &argv, SHORT_PROGRAM_NAME " watchdog",
780
782
  parseOptions, NULL, 2);
781
783
 
782
784
  // Start all sub-agents with this environment variable.
@@ -912,19 +914,19 @@ lowerPrivilege() {
912
914
 
913
915
  if (initgroups(userName.c_str(), gid) != 0) {
914
916
  int e = errno;
915
- throw SystemException("Unable to lower " AGENT_EXE " watchdog's privilege "
917
+ throw SystemException("Unable to lower " SHORT_PROGRAM_NAME " watchdog's privilege "
916
918
  "to that of user '" + userName + "' and group '" + groupName +
917
919
  "': cannot set supplementary groups", e);
918
920
  }
919
921
  if (setgid(gid) != 0) {
920
922
  int e = errno;
921
- throw SystemException("Unable to lower " AGENT_EXE " watchdog's privilege "
923
+ throw SystemException("Unable to lower " SHORT_PROGRAM_NAME " watchdog's privilege "
922
924
  "to that of user '" + userName + "' and group '" + groupName +
923
925
  "': cannot set group ID to " + toString(gid), e);
924
926
  }
925
927
  if (setuid(pwUser->pw_uid) != 0) {
926
928
  int e = errno;
927
- throw SystemException("Unable to lower " AGENT_EXE " watchdog's privilege "
929
+ throw SystemException("Unable to lower " SHORT_PROGRAM_NAME " watchdog's privilege "
928
930
  "to that of user '" + userName + "' and group '" + groupName +
929
931
  "': cannot set user ID to " + toString(pwUser->pw_uid), e);
930
932
  }
@@ -987,6 +989,16 @@ initializeWorkingObjects(const WorkingObjectsPtr &wo, InstanceDirToucherPtr &ins
987
989
  instanceOptions.defaultGid = wo->defaultGid;
988
990
  instanceOptions.properties["name"] = wo->randomGenerator.generateAsciiString(8);
989
991
  instanceOptions.properties["server_software"] = options.get("server_software");
992
+ if (options.has("web_server_config_files")) {
993
+ vector<string> configFiles = options.getStrSet("web_server_config_files");
994
+ Json::Value array(Json::arrayValue);
995
+
996
+ foreach (string configFile, configFiles) {
997
+ array.append(configFile);
998
+ }
999
+
1000
+ instanceOptions.properties["web_server_config_files"] = array;
1001
+ }
990
1002
  wo->instanceDir = boost::make_shared<InstanceDirectory>(instanceOptions,
991
1003
  options.get("instance_registry_dir"));
992
1004
  options.set("instance_dir", wo->instanceDir->getPath());
@@ -1018,57 +1030,57 @@ initializeWorkingObjects(const WorkingObjectsPtr &wo, InstanceDirToucherPtr &ins
1018
1030
  createFile(wo->instanceDir->getPath() + "/full_admin_password.txt",
1019
1031
  fullAdminPassword, S_IRUSR | S_IWUSR);
1020
1032
  }
1021
- options.setDefault("server_pid_file", wo->instanceDir->getPath() + "/server.pid");
1033
+ options.setDefault("core_pid_file", wo->instanceDir->getPath() + "/core.pid");
1022
1034
  options.set("watchdog_fd_passing_password", wo->randomGenerator.generateAsciiString(24));
1023
1035
 
1024
1036
  UPDATE_TRACE_POINT();
1025
- strset = options.getStrSet("server_addresses", false);
1037
+ strset = options.getStrSet("core_addresses", false);
1026
1038
  strset.insert(strset.begin(),
1027
- "unix:" + wo->instanceDir->getPath() + "/agents.s/server");
1028
- options.setStrSet("server_addresses", strset);
1029
- options.setDefault("server_password",
1039
+ "unix:" + wo->instanceDir->getPath() + "/agents.s/core");
1040
+ options.setStrSet("core_addresses", strset);
1041
+ options.setDefault("core_password",
1030
1042
  wo->randomGenerator.generateAsciiString(24));
1031
1043
 
1032
- strset = options.getStrSet("server_api_addresses", false);
1044
+ strset = options.getStrSet("core_api_addresses", false);
1033
1045
  strset.insert(strset.begin(),
1034
- "unix:" + wo->instanceDir->getPath() + "/agents.s/server_api");
1035
- options.setStrSet("server_api_addresses", strset);
1046
+ "unix:" + wo->instanceDir->getPath() + "/agents.s/core_api");
1047
+ options.setStrSet("core_api_addresses", strset);
1036
1048
 
1037
1049
  UPDATE_TRACE_POINT();
1038
- options.setDefault("logging_agent_address",
1039
- "unix:" + wo->instanceDir->getPath() + "/agents.s/logging");
1040
- options.setDefault("logging_agent_password",
1050
+ options.setDefault("ust_router_address",
1051
+ "unix:" + wo->instanceDir->getPath() + "/agents.s/ust_router");
1052
+ options.setDefault("ust_router_password",
1041
1053
  wo->randomGenerator.generateAsciiString(24));
1042
- strset = options.getStrSet("logging_agent_api_addresses", false);
1054
+ strset = options.getStrSet("ust_router_api_addresses", false);
1043
1055
  strset.insert(strset.begin(),
1044
- "unix:" + wo->instanceDir->getPath() + "/agents.s/logging_api");
1045
- options.setStrSet("logging_agent_api_addresses", strset);
1056
+ "unix:" + wo->instanceDir->getPath() + "/agents.s/ust_router_api");
1057
+ options.setStrSet("ust_router_api_addresses", strset);
1046
1058
 
1047
1059
  UPDATE_TRACE_POINT();
1048
- strset = options.getStrSet("logging_agent_authorizations", false);
1060
+ strset = options.getStrSet("ust_router_authorizations", false);
1049
1061
  strset.insert(strset.begin(),
1050
1062
  "readonly:ro_admin:" + wo->instanceDir->getPath() +
1051
1063
  "/read_only_admin_password.txt");
1052
1064
  strset.insert(strset.begin(),
1053
1065
  "full:admin:" + wo->instanceDir->getPath() +
1054
1066
  "/full_admin_password.txt");
1055
- options.setStrSet("logging_agent_authorizations", strset);
1067
+ options.setStrSet("ust_router_authorizations", strset);
1056
1068
 
1057
- strset = options.getStrSet("server_authorizations", false);
1069
+ strset = options.getStrSet("core_authorizations", false);
1058
1070
  strset.insert(strset.begin(),
1059
1071
  "readonly:ro_admin:" + wo->instanceDir->getPath() +
1060
1072
  "/read_only_admin_password.txt");
1061
1073
  strset.insert(strset.begin(),
1062
1074
  "full:admin:" + wo->instanceDir->getPath() +
1063
1075
  "/full_admin_password.txt");
1064
- options.setStrSet("server_authorizations", strset);
1076
+ options.setStrSet("core_authorizations", strset);
1065
1077
  }
1066
1078
 
1067
1079
  static void
1068
1080
  initializeAgentWatchers(const WorkingObjectsPtr &wo, vector<AgentWatcherPtr> &watchers) {
1069
1081
  TRACE_POINT();
1070
- watchers.push_back(boost::make_shared<HelperAgentWatcher>(wo));
1071
- watchers.push_back(boost::make_shared<LoggingAgentWatcher>(wo));
1082
+ watchers.push_back(boost::make_shared<CoreWatcher>(wo));
1083
+ watchers.push_back(boost::make_shared<UstRouterWatcher>(wo));
1072
1084
  }
1073
1085
 
1074
1086
  static void
@@ -1139,13 +1151,11 @@ initializeApiServer(const WorkingObjectsPtr &wo) {
1139
1151
 
1140
1152
  static void
1141
1153
  createCompatSymlinks(const WorkingObjectsPtr &wo) {
1142
- /* In 5.0.10, 'watchdog' has been renamed to 'watchdog_api',
1143
- * 'server_admin' has been renamed to 'server_api',
1144
- * and 'logging_admin' has been renamed to 'logging_api'.
1145
- * To maintain backward compatibility with older versions of
1154
+ /* To maintain backward compatibility with older versions of
1146
1155
  * passenger-status etc, we create compatibility symlinks.
1147
1156
  */
1148
1157
  int ret, e;
1158
+ string instanceDir = wo->instanceDir->getPath() + "/";
1149
1159
  string prefix = wo->instanceDir->getPath() + "/agents.s/";
1150
1160
 
1151
1161
  do {
@@ -1158,7 +1168,16 @@ createCompatSymlinks(const WorkingObjectsPtr &wo) {
1158
1168
  }
1159
1169
 
1160
1170
  do {
1161
- ret = symlink("server_api", (prefix + "server_admin").c_str());
1171
+ ret = symlink("core", (prefix + "server").c_str());
1172
+ } while (ret == -1 && errno == EAGAIN);
1173
+ if (ret == -1) {
1174
+ e = errno;
1175
+ throw FileSystemException("Cannot create symlink: " + prefix + "server",
1176
+ e, prefix + "server");
1177
+ }
1178
+
1179
+ do {
1180
+ ret = symlink("core_api", (prefix + "server_admin").c_str());
1162
1181
  } while (ret == -1 && errno == EAGAIN);
1163
1182
  if (ret == -1) {
1164
1183
  e = errno;
@@ -1167,13 +1186,50 @@ createCompatSymlinks(const WorkingObjectsPtr &wo) {
1167
1186
  }
1168
1187
 
1169
1188
  do {
1170
- ret = symlink("logging_api", (prefix + "logging_admin").c_str());
1189
+ ret = symlink("core_api", (prefix + "server_api").c_str());
1190
+ } while (ret == -1 && errno == EAGAIN);
1191
+ if (ret == -1) {
1192
+ e = errno;
1193
+ throw FileSystemException("Cannot create symlink: " + prefix + "server_api",
1194
+ e, prefix + "server_api");
1195
+ }
1196
+
1197
+ do {
1198
+ ret = symlink("ust_router", (prefix + "logging").c_str());
1199
+ } while (ret == -1 && errno == EAGAIN);
1200
+ if (ret == -1) {
1201
+ e = errno;
1202
+ throw FileSystemException("Cannot create symlink: " + prefix + "logging",
1203
+ e, prefix + "logging");
1204
+ }
1205
+
1206
+ do {
1207
+ ret = symlink("ust_router_api", (prefix + "logging_admin").c_str());
1171
1208
  } while (ret == -1 && errno == EAGAIN);
1172
1209
  if (ret == -1) {
1173
1210
  e = errno;
1174
1211
  throw FileSystemException("Cannot create symlink: " + prefix + "logging_admin",
1175
1212
  e, prefix + "logging_admin");
1176
1213
  }
1214
+
1215
+ do {
1216
+ ret = symlink("ust_router_api", (prefix + "logging_api").c_str());
1217
+ } while (ret == -1 && errno == EAGAIN);
1218
+ if (ret == -1) {
1219
+ e = errno;
1220
+ throw FileSystemException("Cannot create symlink: " + prefix + "logging_api",
1221
+ e, prefix + "logging_api");
1222
+ }
1223
+
1224
+
1225
+ do {
1226
+ ret = symlink("core.pid", (instanceDir + "server.pid").c_str());
1227
+ } while (ret == -1 && errno == EAGAIN);
1228
+ if (ret == -1) {
1229
+ e = errno;
1230
+ throw FileSystemException("Cannot create symlink: " + instanceDir + "logging_api",
1231
+ e, instanceDir + "server.pid");
1232
+ }
1177
1233
  }
1178
1234
 
1179
1235
  static void
@@ -1290,7 +1346,7 @@ watchdogMain(int argc, char *argv[]) {
1290
1346
  initializeBareEssentials(argc, argv, wo);
1291
1347
  setAgentsOptionsDefaults();
1292
1348
  sanityCheckOptions();
1293
- P_NOTICE("Starting " AGENT_EXE " watchdog...");
1349
+ P_NOTICE("Starting " SHORT_PROGRAM_NAME " watchdog...");
1294
1350
  P_DEBUG("Watchdog options: " << agentsOptions->inspect());
1295
1351
  InstanceDirToucherPtr instanceDirToucher;
1296
1352
  vector<AgentWatcherPtr> watchers;