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.
- checksums.yaml +8 -8
- checksums.yaml.gz.asc +7 -7
- data.tar.gz.asc +7 -7
- data/CHANGELOG +18 -0
- data/CONTRIBUTING.md +3 -3
- data/bin/passenger-status +12 -4
- data/build/agents.rb +45 -45
- data/build/apache2.rb +1 -1
- data/build/basics.rb +1 -1
- data/build/cxx_tests.rb +12 -12
- data/doc/CloudLicensingConfiguration.html +10 -10
- data/doc/CloudLicensingConfiguration.txt.md +10 -10
- data/doc/DebuggingAndStressTesting.md +3 -3
- data/doc/Design and Architecture.html +30 -30
- data/doc/Design and Architecture.txt +28 -28
- data/doc/ServerOptimizationGuide.html +3 -3
- data/doc/ServerOptimizationGuide.txt.md +3 -3
- data/doc/Users guide Apache.html +24 -12
- data/doc/Users guide Apache.txt +2 -2
- data/doc/Users guide Nginx.html +24 -12
- data/doc/Users guide Nginx.txt +2 -2
- data/doc/Users guide Standalone.html +18 -6
- data/doc/images/passenger_architecture.png +0 -0
- data/doc/images/passenger_architecture.svg +10 -9
- data/doc/images/{helper_agent_core_architecture.png → passenger_core_architecture.png} +0 -0
- data/doc/users_guide_snippets/environment_variables.txt +1 -1
- data/doc/users_guide_snippets/installation/verify_running_epilogue.txt +1 -1
- data/doc/users_guide_snippets/support_information.txt +1 -1
- data/doc/users_guide_snippets/tips.txt +2 -2
- data/doc/users_guide_snippets/under_the_hood/relationship_with_ruby.txt +1 -1
- data/ext/apache2/Bucket.h +5 -5
- data/ext/apache2/Configuration.cpp +1 -1
- data/ext/apache2/Configuration.hpp +2 -3
- data/ext/apache2/ConfigurationFields.hpp +3 -0
- data/ext/apache2/ConfigurationFields.hpp.erb +3 -0
- data/ext/apache2/Hooks.cpp +42 -34
- data/ext/common/Account.h +3 -3
- data/ext/common/AgentsStarter.cpp +7 -7
- data/ext/common/AgentsStarter.h +20 -20
- data/ext/common/ApplicationPool2/Options.h +12 -12
- data/ext/common/Constants.h +10 -8
- data/ext/common/Logging.cpp +22 -1
- data/ext/common/Logging.h +19 -2
- data/ext/common/ServerKit/AcceptLoadBalancer.h +3 -3
- data/ext/common/ServerKit/Server.h +24 -0
- data/ext/common/UnionStation/Connection.h +1 -1
- data/ext/common/UnionStation/Core.h +21 -21
- data/ext/common/UnionStation/Transaction.h +3 -3
- data/ext/common/Utils.cpp +2 -2
- data/ext/common/Utils/IOUtils.cpp +5 -1
- data/ext/common/{agents → agent}/ApiServerUtils.h +3 -3
- data/ext/common/{agents → agent}/Base.cpp +2 -2
- data/ext/common/{agents → agent}/Base.h +0 -0
- data/ext/common/{agents/HelperAgent → agent/Core}/ApiServer.h +33 -9
- data/ext/common/{agents/HelperAgent → agent/Core}/Main.cpp +60 -59
- data/ext/common/{agents/HelperAgent → agent/Core}/OptionParser.h +32 -25
- data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler.h +17 -17
- data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/AppResponse.h +0 -0
- data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/BufferBody.cpp +0 -0
- data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/CheckoutSession.cpp +0 -0
- data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/Client.h +2 -2
- data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/ForwardResponse.cpp +0 -0
- data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/Hooks.cpp +0 -0
- data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/InitRequest.cpp +4 -3
- data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/Request.h +1 -1
- data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/SendRequest.cpp +0 -0
- data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/TurboCaching.h +1 -1
- data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/Utils.cpp +0 -0
- data/ext/common/{agents/HelperAgent → agent/Core}/ResponseCache.h +0 -0
- data/ext/common/{agents → agent}/Main.cpp +9 -9
- data/ext/common/{agents → agent}/SpawnPreparer/Main.cpp +0 -0
- data/ext/common/{agents/HelperAgent/SystemMetricsTool.cpp → agent/SystemMetrics/Main.cpp} +0 -0
- data/ext/common/{agents → agent}/TempDirToucher/Main.cpp +0 -0
- data/ext/common/{agents/LoggingAgent → agent/UstRouter}/ApiServer.h +7 -7
- data/ext/common/{agents/LoggingAgent → agent/UstRouter}/DataStoreId.h +0 -0
- data/ext/common/{agents/LoggingAgent → agent/UstRouter}/FilterSupport.cpp +0 -0
- data/ext/common/{agents/LoggingAgent → agent/UstRouter}/FilterSupport.h +0 -0
- data/ext/common/{agents/LoggingAgent → agent/UstRouter}/LoggingServer.h +4 -4
- data/ext/common/{agents/LoggingAgent → agent/UstRouter}/Main.cpp +45 -45
- data/ext/common/{agents/LoggingAgent → agent/UstRouter}/OptionParser.h +20 -20
- data/ext/common/{agents/LoggingAgent → agent/UstRouter}/RemoteSender.h +0 -0
- data/ext/common/{agents → agent}/Watchdog/AgentWatcher.cpp +0 -0
- data/ext/common/{agents → agent}/Watchdog/ApiServer.h +1 -1
- data/ext/common/{agents/Watchdog/HelperAgentWatcher.cpp → agent/Watchdog/CoreWatcher.cpp} +14 -10
- data/ext/common/{agents → agent}/Watchdog/InstanceDirToucher.cpp +0 -0
- data/ext/common/{agents → agent}/Watchdog/Main.cpp +131 -75
- data/ext/common/{agents/Watchdog/LoggingAgentWatcher.cpp → agent/Watchdog/UstRouterWatcher.cpp} +13 -9
- data/ext/nginx/CacheLocationConfig.c +11 -6
- data/ext/nginx/CacheLocationConfig.c.erb +11 -6
- data/ext/nginx/Configuration.c +22 -7
- data/ext/nginx/Configuration.h +1 -19
- data/ext/nginx/ConfigurationFields.h +19 -0
- data/ext/nginx/ConfigurationFields.h.erb +19 -0
- data/ext/nginx/ContentHandler.c +33 -33
- data/ext/nginx/CreateLocationConfig.c +3 -1
- data/ext/nginx/CreateLocationConfig.c.erb +3 -1
- data/ext/nginx/MergeLocationConfig.c +8 -4
- data/ext/nginx/MergeLocationConfig.c.erb +7 -3
- data/ext/nginx/ngx_http_passenger_module.c +33 -42
- data/helper-scripts/backtrace-sanitizer.rb +2 -2
- data/lib/phusion_passenger.rb +1 -1
- data/lib/phusion_passenger/admin_tools/instance.rb +2 -2
- data/lib/phusion_passenger/admin_tools/instance_registry.rb +7 -3
- data/lib/phusion_passenger/common_library.rb +8 -8
- data/lib/phusion_passenger/config/about_command.rb +1 -1
- data/lib/phusion_passenger/config/api_call_command.rb +3 -3
- data/lib/phusion_passenger/config/installation_utils.rb +34 -21
- data/lib/phusion_passenger/config/reopen_logs_command.rb +2 -2
- data/lib/phusion_passenger/config/restart_app_command.rb +18 -4
- data/lib/phusion_passenger/constants.rb +7 -5
- data/lib/phusion_passenger/loader_shared_helpers.rb +2 -6
- data/lib/phusion_passenger/message_client.rb +8 -8
- data/lib/phusion_passenger/platform_info/ruby.rb +1 -2
- data/lib/phusion_passenger/preloader_shared_helpers.rb +1 -1
- data/lib/phusion_passenger/request_handler.rb +3 -2
- data/lib/phusion_passenger/request_handler/thread_handler.rb +4 -4
- data/lib/phusion_passenger/standalone/start_command.rb +13 -3
- data/lib/phusion_passenger/standalone/start_command/builtin_engine.rb +2 -1
- data/lib/phusion_passenger/union_station/core.rb +18 -18
- data/lib/phusion_passenger/union_station/transaction.rb +5 -5
- data/resources/oss-binaries.phusionpassenger.com.crt +0 -84
- data/resources/templates/standalone/config.erb +1 -0
- metadata +40 -40
- 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
|
26
|
-
#define
|
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
|
-
|
43
|
+
coreUsage() {
|
44
44
|
// ....|---------------Keep output within standard terminal width (80 chars)------------|
|
45
|
-
printf("Usage: " AGENT_EXE "
|
46
|
-
printf("Runs the " PROGRAM_NAME "
|
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
|
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
|
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
|
-
|
178
|
-
OptionParser p(
|
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("
|
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("
|
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("
|
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("
|
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("
|
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("
|
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("
|
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("
|
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("
|
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("
|
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("
|
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("
|
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("
|
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
|
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 /*
|
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 <
|
72
|
-
#include <
|
73
|
-
#include <
|
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
|
124
|
-
StaticString
|
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 <
|
174
|
-
#include <
|
175
|
-
#include <
|
176
|
-
#include <
|
177
|
-
#include <
|
178
|
-
#include <
|
179
|
-
#include <
|
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("
|
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
|
-
|
225
|
-
agentsOptions->get("
|
226
|
-
|
227
|
-
agentsOptions->get("
|
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,
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
-
* Copyright (c) 2011-
|
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 <
|
31
|
+
#include <agent/Core/RequestHandler/Request.h>
|
32
32
|
|
33
33
|
namespace Passenger {
|
34
34
|
|
File without changes
|
File without changes
|
@@ -219,9 +219,9 @@ fillPoolOptionsFromAgentsOptions(Options &options) {
|
|
219
219
|
}
|
220
220
|
|
221
221
|
options.logLevel = getLogLevel();
|
222
|
-
options.
|
223
|
-
options.
|
224
|
-
options.
|
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 <
|
39
|
+
#include <agent/Core/RequestHandler/AppResponse.h>
|
40
40
|
#include <Logging.h>
|
41
41
|
|
42
42
|
namespace Passenger {
|
File without changes
|
@@ -32,7 +32,7 @@
|
|
32
32
|
#include <cassert>
|
33
33
|
#include <MemoryKit/mbuf.h>
|
34
34
|
#include <ServerKit/Context.h>
|
35
|
-
#include <
|
35
|
+
#include <agent/Core/ResponseCache.h>
|
36
36
|
#include <Constants.h>
|
37
37
|
#include <Logging.h>
|
38
38
|
#include <Utils/StrIntUtils.h>
|
File without changes
|
File without changes
|
@@ -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
|
34
|
-
int
|
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("
|
54
|
+
printf(" core\n");
|
55
55
|
printf(" watchdog\n");
|
56
|
-
printf("
|
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], "
|
83
|
-
exit(
|
84
|
-
} else if (strcmp(argv[1], "
|
85
|
-
exit(
|
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) {
|
File without changes
|
File without changes
|
File without changes
|
@@ -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
|
26
|
-
#define
|
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 <
|
32
|
-
#include <
|
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
|
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
|
276
|
+
} // namespace UstRouter
|
277
277
|
} // namespace Passenger
|
278
278
|
|
279
|
-
#endif /*
|
279
|
+
#endif /* _PASSENGER_UST_ROUTER_API_SERVER_H_ */
|
File without changes
|
File without changes
|
File without changes
|
@@ -43,9 +43,9 @@
|
|
43
43
|
#include <ctime>
|
44
44
|
#include <cassert>
|
45
45
|
|
46
|
-
#include <
|
47
|
-
#include <
|
48
|
-
#include <
|
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("
|
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 <
|
46
|
-
#include <
|
47
|
-
#include <
|
48
|
-
#include <
|
49
|
-
#include <
|
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
|
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
|
-
|
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
|
104
|
+
} // namespace UstRouter
|
105
105
|
} // namespace Passenger
|
106
106
|
|
107
|
-
using namespace Passenger::
|
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(
|
117
|
+
static void apiServerShutdownFinished(UstRouter::ApiServer *server);
|
118
118
|
static void waitForExitEvent();
|
119
119
|
|
120
120
|
void
|
121
|
-
|
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("
|
163
|
+
wo->password = options.get("ust_router_password", false);
|
164
164
|
if (wo->password.empty()) {
|
165
|
-
wo->password = strip(readAll(options.get("
|
165
|
+
wo->password = strip(readAll(options.get("ust_router_password_file")));
|
166
166
|
}
|
167
167
|
|
168
|
-
vector<string> authorizations = options.getStrSet("
|
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("
|
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("
|
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 "
|
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 "
|
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 "
|
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
|
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(
|
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
|
321
|
+
cerr << "---------- Begin UstRouter status ----------\n";
|
322
322
|
workingObjects->loggingServer->dump(cerr);
|
323
323
|
cerr.flush();
|
324
|
-
cerr << "---------- End
|
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(
|
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
|
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 "
|
421
|
+
P_DEBUG("Shutting down " SHORT_PROGRAM_NAME " UstRouter...");
|
422
422
|
wo->bgloop->stop();
|
423
423
|
delete wo->apiServer;
|
424
|
-
P_NOTICE(
|
424
|
+
P_NOTICE(SHORT_PROGRAM_NAME " UstRouter shutdown finished");
|
425
425
|
}
|
426
426
|
|
427
427
|
static int
|
428
|
-
|
428
|
+
runUstRouter() {
|
429
429
|
TRACE_POINT();
|
430
|
-
P_NOTICE("Starting "
|
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(
|
461
|
+
OptionParser p(ustRouterUsage);
|
462
462
|
int i = 2;
|
463
463
|
|
464
464
|
while (i < argc) {
|
465
|
-
if (
|
465
|
+
if (parseUstRouterOption(argc, argv, i, options)) {
|
466
466
|
continue;
|
467
467
|
} else if (p.isFlag(argv[i], 'h', "--help")) {
|
468
|
-
|
468
|
+
ustRouterUsage();
|
469
469
|
exit(0);
|
470
470
|
} else {
|
471
471
|
fprintf(stderr, "ERROR: unrecognized argument %s. Please type "
|
472
|
-
"'%s
|
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("
|
483
|
-
options.setInt("log_level", options.getInt("
|
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("
|
486
|
-
options.setInt("debug_log_file", options.getInt("
|
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(
|
494
|
+
defaultApiListenAddress.insert(DEFAULT_UST_ROUTER_API_LISTEN_ADDRESS);
|
495
495
|
|
496
|
-
options.setDefault("
|
497
|
-
options.setDefaultStrSet("
|
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("
|
512
|
-
&& !options.has("
|
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
|
-
|
545
|
+
ustRouterMain(int argc, char *argv[]) {
|
546
546
|
agentsOptions = new VariantMap();
|
547
|
-
*agentsOptions = initializeAgent(argc, &argv,
|
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
|
558
|
+
return runUstRouter();
|
559
559
|
}
|