passenger 5.3.4 → 5.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +13 -0
  3. data/CODE_OF_CONDUCT.md +1 -1
  4. data/build/cxx_tests.rb +12 -1
  5. data/build/misc.rb +2 -1
  6. data/build/packaging.rb +2 -0
  7. data/build/support/cplusplus.rb +2 -2
  8. data/build/support/cxx_dependency_map.rb +653 -383
  9. data/dev/configkit-schemas/index.json +105 -3
  10. data/dev/show-latest-crashlog-dir +27 -0
  11. data/resources/templates/standalone/http.erb +2 -0
  12. data/src/agent/Core/AdminPanelConnector.h +2 -2
  13. data/src/agent/Core/ApplicationPool/Context.h +5 -1
  14. data/src/agent/Core/ApplicationPool/Group.h +2 -0
  15. data/src/agent/Core/ApplicationPool/Group/LifetimeAndBasics.cpp +5 -0
  16. data/src/agent/Core/ApplicationPool/Group/Miscellaneous.cpp +2 -1
  17. data/src/agent/Core/ApplicationPool/Group/ProcessListManagement.cpp +1 -1
  18. data/src/agent/Core/ApplicationPool/Group/StateInspection.cpp +12 -19
  19. data/src/agent/Core/ApplicationPool/Options.h +35 -31
  20. data/src/agent/Core/ApplicationPool/Pool/GroupUtils.cpp +2 -1
  21. data/src/agent/Core/ApplicationPool/Socket.h +1 -1
  22. data/src/agent/Core/Config.h +38 -7
  23. data/src/agent/Core/ConfigChange.cpp +13 -1
  24. data/src/agent/Core/Controller.h +3 -1
  25. data/src/agent/Core/Controller/Config.h +14 -11
  26. data/src/agent/Core/Controller/InitRequest.cpp +6 -5
  27. data/src/agent/Core/Controller/InitializationAndShutdown.cpp +3 -0
  28. data/src/agent/Core/CoreMain.cpp +149 -34
  29. data/src/agent/Core/OptionParser.h +12 -1
  30. data/src/agent/Core/SpawningKit/Config.h +1 -1
  31. data/src/agent/Core/SpawningKit/Context.h +7 -1
  32. data/src/agent/Core/SpawningKit/Exceptions.h +15 -12
  33. data/src/agent/Core/SpawningKit/README.md +34 -17
  34. data/src/agent/Core/SpawningKit/Spawner.h +5 -3
  35. data/src/agent/Core/SpawningKit/UserSwitchingRules.h +5 -2
  36. data/src/agent/Core/TelemetryCollector.h +674 -0
  37. data/src/agent/Shared/Fundamentals/AbortHandler.cpp +309 -83
  38. data/src/agent/Shared/Fundamentals/AbortHandler.h +18 -3
  39. data/src/agent/Watchdog/Config.h +21 -4
  40. data/src/agent/Watchdog/WatchdogMain.cpp +4 -1
  41. data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp +10 -0
  42. data/src/apache2_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.cpp +5 -0
  43. data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp +30 -0
  44. data/src/apache2_module/DirectoryMapper.h +24 -36
  45. data/src/apache2_module/Hooks.cpp +13 -5
  46. data/src/apache2_module/ServerConfig/AutoGeneratedManifestGeneration.cpp +20 -0
  47. data/src/apache2_module/ServerConfig/AutoGeneratedStruct.h +24 -0
  48. data/src/cxx_supportlib/AppTypeDetector/CBindings.cpp +136 -0
  49. data/src/cxx_supportlib/AppTypeDetector/CBindings.h +73 -0
  50. data/src/cxx_supportlib/{AppTypes.h → AppTypeDetector/Detector.h} +59 -132
  51. data/src/cxx_supportlib/ConfigKit/README.md +90 -2
  52. data/src/cxx_supportlib/ConfigKit/Schema.h +58 -13
  53. data/src/cxx_supportlib/ConfigKit/Store.h +128 -4
  54. data/src/cxx_supportlib/Constants.h +1 -1
  55. data/src/cxx_supportlib/ProcessManagement/Ruby.cpp +3 -3
  56. data/src/cxx_supportlib/ProcessManagement/Ruby.h +7 -2
  57. data/src/cxx_supportlib/ProcessManagement/Spawn.cpp +14 -7
  58. data/src/cxx_supportlib/ProcessManagement/Spawn.h +21 -2
  59. data/src/cxx_supportlib/ResourceLocator.h +1 -1
  60. data/src/cxx_supportlib/ServerKit/ClientRef.h +17 -7
  61. data/src/cxx_supportlib/ServerKit/HttpRequestRef.h +17 -7
  62. data/src/cxx_supportlib/Utils/IOUtils.cpp +2 -1
  63. data/src/cxx_supportlib/Utils/ProcessMetricsCollector.h +9 -6
  64. data/src/cxx_supportlib/WrapperRegistry/CBindings.cpp +85 -0
  65. data/src/cxx_supportlib/WrapperRegistry/CBindings.h +56 -0
  66. data/src/cxx_supportlib/WrapperRegistry/Entry.h +112 -0
  67. data/src/cxx_supportlib/WrapperRegistry/README.md +37 -0
  68. data/src/cxx_supportlib/WrapperRegistry/Registry.h +309 -0
  69. data/src/helper-scripts/download_binaries/extconf.rb +6 -2
  70. data/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c +16 -0
  71. data/src/nginx_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c +6 -0
  72. data/src/nginx_module/ConfigGeneral/AutoGeneratedSetterFuncs.c +24 -0
  73. data/src/nginx_module/ContentHandler.c +34 -13
  74. data/src/nginx_module/ContentHandler.h +3 -3
  75. data/src/nginx_module/MainConfig/AutoGeneratedCreateFunction.c +11 -0
  76. data/src/nginx_module/MainConfig/AutoGeneratedManifestGeneration.c +23 -0
  77. data/src/nginx_module/MainConfig/AutoGeneratedStruct.h +8 -0
  78. data/src/nginx_module/config +2 -1
  79. data/src/nginx_module/ngx_http_passenger_module.c +9 -3
  80. data/src/nginx_module/ngx_http_passenger_module.h +4 -2
  81. data/src/ruby_supportlib/phusion_passenger.rb +2 -1
  82. data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +13 -0
  83. data/src/ruby_supportlib/phusion_passenger/common_library.rb +8 -5
  84. data/src/ruby_supportlib/phusion_passenger/config/download_agent_command.rb +6 -2
  85. data/src/ruby_supportlib/phusion_passenger/config/download_nginx_engine_command.rb +6 -2
  86. data/src/ruby_supportlib/phusion_passenger/native_support.rb +7 -3
  87. data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +15 -0
  88. data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +11 -1
  89. data/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb +3 -1
  90. metadata +12 -4
  91. data/src/cxx_supportlib/AppTypes.cpp +0 -109
@@ -293,7 +293,7 @@
293
293
  "type" : "unsigned integer"
294
294
  },
295
295
  "server_software" : {
296
- "default_value" : "Phusion_Passenger/5.3.4",
296
+ "default_value" : "Phusion_Passenger/5.3.5",
297
297
  "has_default_value" : "static",
298
298
  "type" : "string"
299
299
  },
@@ -795,7 +795,7 @@
795
795
  "type" : "string"
796
796
  },
797
797
  "server_software" : {
798
- "default_value" : "Phusion_Passenger/5.3.4",
798
+ "default_value" : "Phusion_Passenger/5.3.5",
799
799
  "has_default_value" : "static",
800
800
  "type" : "string"
801
801
  },
@@ -826,6 +826,57 @@
826
826
  "has_default_value" : "static",
827
827
  "type" : "unsigned integer"
828
828
  },
829
+ "telemetry_collector_ca_certificate_path" : {
830
+ "type" : "string"
831
+ },
832
+ "telemetry_collector_debug_curl" : {
833
+ "default_value" : false,
834
+ "has_default_value" : "static",
835
+ "type" : "boolean"
836
+ },
837
+ "telemetry_collector_disabled" : {
838
+ "default_value" : false,
839
+ "has_default_value" : "static",
840
+ "type" : "boolean"
841
+ },
842
+ "telemetry_collector_final_run_timeout" : {
843
+ "default_value" : 5,
844
+ "has_default_value" : "static",
845
+ "type" : "unsigned integer"
846
+ },
847
+ "telemetry_collector_first_interval" : {
848
+ "default_value" : 7200,
849
+ "has_default_value" : "static",
850
+ "type" : "unsigned integer"
851
+ },
852
+ "telemetry_collector_interval" : {
853
+ "default_value" : 21600,
854
+ "has_default_value" : "static",
855
+ "type" : "unsigned integer"
856
+ },
857
+ "telemetry_collector_interval_jitter" : {
858
+ "default_value" : 7200,
859
+ "has_default_value" : "static",
860
+ "type" : "unsigned integer"
861
+ },
862
+ "telemetry_collector_proxy_url" : {
863
+ "type" : "string"
864
+ },
865
+ "telemetry_collector_timeout" : {
866
+ "default_value" : 180,
867
+ "has_default_value" : "static",
868
+ "type" : "unsigned integer"
869
+ },
870
+ "telemetry_collector_url" : {
871
+ "default_value" : "https://anontelemetry.phusionpassenger.com/v1/collect.json",
872
+ "has_default_value" : "static",
873
+ "type" : "string"
874
+ },
875
+ "telemetry_collector_verify_server" : {
876
+ "default_value" : true,
877
+ "has_default_value" : "static",
878
+ "type" : "boolean"
879
+ },
829
880
  "turbocaching" : {
830
881
  "default_value" : true,
831
882
  "has_default_value" : "static",
@@ -1517,7 +1568,7 @@
1517
1568
  "type" : "string"
1518
1569
  },
1519
1570
  "server_software" : {
1520
- "default_value" : "Phusion_Passenger/5.3.4",
1571
+ "default_value" : "Phusion_Passenger/5.3.5",
1521
1572
  "has_default_value" : "static",
1522
1573
  "type" : "string"
1523
1574
  },
@@ -1556,6 +1607,57 @@
1556
1607
  "has_default_value" : "static",
1557
1608
  "type" : "unsigned integer"
1558
1609
  },
1610
+ "telemetry_collector_ca_certificate_path" : {
1611
+ "type" : "string"
1612
+ },
1613
+ "telemetry_collector_debug_curl" : {
1614
+ "default_value" : false,
1615
+ "has_default_value" : "static",
1616
+ "type" : "boolean"
1617
+ },
1618
+ "telemetry_collector_disabled" : {
1619
+ "default_value" : false,
1620
+ "has_default_value" : "static",
1621
+ "type" : "boolean"
1622
+ },
1623
+ "telemetry_collector_final_run_timeout" : {
1624
+ "default_value" : 5,
1625
+ "has_default_value" : "static",
1626
+ "type" : "unsigned integer"
1627
+ },
1628
+ "telemetry_collector_first_interval" : {
1629
+ "default_value" : 7200,
1630
+ "has_default_value" : "static",
1631
+ "type" : "unsigned integer"
1632
+ },
1633
+ "telemetry_collector_interval" : {
1634
+ "default_value" : 21600,
1635
+ "has_default_value" : "static",
1636
+ "type" : "unsigned integer"
1637
+ },
1638
+ "telemetry_collector_interval_jitter" : {
1639
+ "default_value" : 7200,
1640
+ "has_default_value" : "static",
1641
+ "type" : "unsigned integer"
1642
+ },
1643
+ "telemetry_collector_proxy_url" : {
1644
+ "type" : "string"
1645
+ },
1646
+ "telemetry_collector_timeout" : {
1647
+ "default_value" : 180,
1648
+ "has_default_value" : "static",
1649
+ "type" : "unsigned integer"
1650
+ },
1651
+ "telemetry_collector_url" : {
1652
+ "default_value" : "https://anontelemetry.phusionpassenger.com/v1/collect.json",
1653
+ "has_default_value" : "static",
1654
+ "type" : "string"
1655
+ },
1656
+ "telemetry_collector_verify_server" : {
1657
+ "default_value" : true,
1658
+ "has_default_value" : "static",
1659
+ "type" : "boolean"
1660
+ },
1559
1661
  "turbocaching" : {
1560
1662
  "default_value" : true,
1561
1663
  "has_default_value" : "static",
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+ # Finds the latest Passenger crash log directory and prints its path.
3
+ # This tool is meant to make it easy to analyze local Passenger crash
4
+ # logs during debugging sessions. Instead of searching for the crash
5
+ # log directory path in the output and then copy-pasting that to the
6
+ # terminal, one can simply invoke one shell command:
7
+ #
8
+ # less $(./dev/show-latest-crashlog-dir)/backtrace.log
9
+ #
10
+ # This will open the latest crash log's backtrace.log in 'less'.
11
+
12
+ def parse_path(path)
13
+ File.basename(path).split('.')[1].to_i
14
+ end
15
+
16
+ def main
17
+ dirs = Dir["/var/tmp/passenger-crash-log.*.*"].sort do |a, b|
18
+ parse_path(a) <=> parse_path(b)
19
+ end
20
+ if dirs.empty?
21
+ abort "No /var/tmp/passenger-crash-log.* directories found."
22
+ else
23
+ puts dirs.last
24
+ end
25
+ end
26
+
27
+ main
@@ -34,6 +34,8 @@ passenger_user_switching off;
34
34
  <%= nginx_http_option(:instance_registry_dir) %>
35
35
  <%= nginx_http_option(:disable_security_update_check) %>
36
36
  <%= nginx_http_option(:security_update_check_proxy) %>
37
+ <%= nginx_http_option(:disable_anonymous_telemetry) %>
38
+ <%= nginx_http_option(:anonymous_telemetry_proxy) %>
37
39
  <%= nginx_http_option(:data_buffer_dir) %>
38
40
  <%= nginx_http_option(:core_file_descriptor_ulimit) %>
39
41
  <%= nginx_http_option(:admin_panel_url) %>
@@ -193,7 +193,7 @@ private:
193
193
  args.push_back("system-properties");
194
194
 
195
195
  int status = 0;
196
- string output;
196
+ SubprocessOutput output;
197
197
  try {
198
198
  runInternalRubyTool(*resourceLocator, ruby, args, &status, &output);
199
199
  } catch (const std::exception &e) {
@@ -206,7 +206,7 @@ private:
206
206
 
207
207
  server.getIoService().post(boost::bind(
208
208
  &AdminPanelConnector::onGetServerPropertiesDone, this,
209
- conn, doc, output, status, string()
209
+ conn, doc, output.data, status, string()
210
210
  ));
211
211
  }
212
212
 
@@ -86,10 +86,14 @@ public:
86
86
  return spawningKitFactory->getContext();
87
87
  }
88
88
 
89
- ResourceLocator *getResourceLocator() const {
89
+ const ResourceLocator *getResourceLocator() const {
90
90
  return getSpawningKitContext()->resourceLocator;
91
91
  }
92
92
 
93
+ const WrapperRegistry::Registry *getWrapperRegistry() const {
94
+ return getSpawningKitContext()->wrapperRegistry;
95
+ }
96
+
93
97
  const RandomGeneratorPtr &getRandomGenerator() const {
94
98
  return getSpawningKitContext()->randomGenerator;
95
99
  }
@@ -46,6 +46,7 @@
46
46
  #include <cassert>
47
47
  #include <SmallVector.h>
48
48
  #include <MemoryKit/palloc.h>
49
+ #include <WrapperRegistry/Registry.h>
49
50
  #include <Hooks.h>
50
51
  #include <Utils.h>
51
52
  #include <Core/ApplicationPool/Common.h>
@@ -438,6 +439,7 @@ public:
438
439
  Context *getContext() const;
439
440
  psg_pool_t *getPallocPool() const;
440
441
  const ResourceLocator &getResourceLocator() const;
442
+ const WrapperRegistry::Registry &getWrapperRegistry() const;
441
443
 
442
444
  /****** Session management ******/
443
445
 
@@ -99,6 +99,11 @@ Group::getResourceLocator() const {
99
99
  return *getPool()->getSpawningKitContext()->resourceLocator;
100
100
  }
101
101
 
102
+ const WrapperRegistry::Registry &
103
+ Group::getWrapperRegistry() const {
104
+ return *getPool()->getSpawningKitContext()->wrapperRegistry;
105
+ }
106
+
102
107
 
103
108
  } // namespace ApplicationPool2
104
109
  } // namespace Passenger
@@ -53,7 +53,8 @@ Group::cleanupSpawner(boost::container::vector<Callback> &postLockActions) {
53
53
 
54
54
  bool
55
55
  Group::authorizeByUid(uid_t uid) const {
56
- return uid == 0 || SpawningKit::prepareUserSwitching(options).uid == uid;
56
+ return uid == 0 || SpawningKit::prepareUserSwitching(options,
57
+ getWrapperRegistry()).uid == uid;
57
58
  }
58
59
 
59
60
  bool
@@ -153,7 +153,7 @@ Group::addProcessToList(const ProcessPtr &process, ProcessList &destination) {
153
153
  assert(process->isAlive());
154
154
  process->enabled = Process::DETACHED;
155
155
 
156
- if (!this->options.abortWebsocketsOnProcessShutdown && this->options.appType == P_STATIC_STRING("node")) {
156
+ if (!this->options.abortWebsocketsOnProcessShutdown && this->options.appType == P_STATIC_STRING("nodejs")) {
157
157
  // When Passenger is not allowed to abort websockets the application needs a way to know graceful shutdown
158
158
  // is in progress. The solution for the most common use (Node.js) is to send a SIGINT. This is the general
159
159
  // termination signal for Node; later versions of pm2 also use it (with a 1.6 sec grace period, Passenger just waits)
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2011-2017 Phusion Holding B.V.
3
+ * Copyright (c) 2011-2018 Phusion Holding B.V.
4
4
  *
5
5
  * "Passenger", "Phusion Passenger" and "Union Station" are registered
6
6
  * trademarks of Phusion Holding B.V.
@@ -162,14 +162,15 @@ Group::inspectXml(std::ostream &stream, bool includeSecrets) const {
162
162
  P_BUG("Unknown 'lifeStatus' state " << lifeStatus);
163
163
  }
164
164
 
165
- SpawningKit::UserSwitchingInfo usInfo(SpawningKit::prepareUserSwitching(options));
165
+ SpawningKit::UserSwitchingInfo usInfo(SpawningKit::prepareUserSwitching(options,
166
+ getWrapperRegistry()));
166
167
  stream << "<user>" << escapeForXml(usInfo.username) << "</user>";
167
168
  stream << "<uid>" << usInfo.uid << "</uid>";
168
169
  stream << "<group>" << escapeForXml(usInfo.groupname) << "</group>";
169
170
  stream << "<gid>" << usInfo.gid << "</gid>";
170
171
 
171
172
  stream << "<options>";
172
- options.toXml(stream, getResourceLocator());
173
+ options.toXml(stream, getResourceLocator(), getWrapperRegistry());
173
174
  stream << "</options>";
174
175
 
175
176
  stream << "<processes>";
@@ -201,22 +202,14 @@ Group::inspectXml(std::ostream &stream, bool includeSecrets) const {
201
202
  void
202
203
  Group::inspectPropertiesInAdminPanelFormat(Json::Value &result) const {
203
204
  result["path"] = absolutizePath(options.appRoot);
204
- result["startup_file"] = absolutizePath(options.getStartupFile(), absolutizePath(options.appRoot));
205
- result["start_command"] = options.getStartCommand(getResourceLocator());
206
-
207
- if (options.appType == "rack") {
208
- result["type"] = "ruby";
209
- } else if (options.appType == "wsgi") {
210
- result["type"] = "python";
211
- } else if (options.appType == "node") {
212
- result["type"] = "nodejs";
213
- } else if (options.appType == "meteor") {
214
- result["type"] = "meteor";
215
- } else {
216
- result["type"] = "generic";
217
- }
218
-
219
- SpawningKit::UserSwitchingInfo usInfo(SpawningKit::prepareUserSwitching(options));
205
+ result["startup_file"] = absolutizePath(options.getStartupFile(getWrapperRegistry()),
206
+ absolutizePath(options.appRoot));
207
+ result["start_command"] = options.getStartCommand(getResourceLocator(),
208
+ getWrapperRegistry());
209
+ result["type"] = getWrapperRegistry().lookup(options.appType).language.toString();
210
+
211
+ SpawningKit::UserSwitchingInfo usInfo(SpawningKit::prepareUserSwitching(options,
212
+ getWrapperRegistry()));
220
213
  result["user"]["username"] = usInfo.username;
221
214
  result["user"]["uid"] = (Json::Int) usInfo.uid;
222
215
  result["group"]["groupname"] = usInfo.groupname;
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2010-2017 Phusion Holding B.V.
3
+ * Copyright (c) 2010-2018 Phusion Holding B.V.
4
4
  *
5
5
  * "Passenger", "Phusion Passenger" and "Union Station" are registered
6
6
  * trademarks of Phusion Holding B.V.
@@ -30,7 +30,7 @@
30
30
  #include <vector>
31
31
  #include <utility>
32
32
  #include <boost/shared_array.hpp>
33
- #include <AppTypes.h>
33
+ #include <WrapperRegistry/Registry.h>
34
34
  #include <DataStructures/HashedStaticString.h>
35
35
  #include <Constants.h>
36
36
  #include <ResourceLocator.h>
@@ -545,16 +545,16 @@ public:
545
545
  * the `elements` argument.
546
546
  */
547
547
  void toVector(vector<string> &vec, const ResourceLocator &resourceLocator,
548
- int fields = ALL_OPTIONS) const
548
+ const WrapperRegistry::Registry &wrapperRegistry, int fields = ALL_OPTIONS) const
549
549
  {
550
550
  if (fields & SPAWN_OPTIONS) {
551
551
  appendKeyValue (vec, "app_root", appRoot);
552
552
  appendKeyValue (vec, "app_group_name", getAppGroupName());
553
553
  appendKeyValue (vec, "app_type", appType);
554
554
  appendKeyValue (vec, "app_log_file", appLogFile);
555
- appendKeyValue (vec, "start_command", getStartCommand(resourceLocator));
556
- appendKeyValue (vec, "startup_file", absolutizePath(getStartupFile(), absolutizePath(appRoot)));
557
- appendKeyValue (vec, "process_title", getProcessTitle());
555
+ appendKeyValue (vec, "start_command", getStartCommand(resourceLocator, wrapperRegistry));
556
+ appendKeyValue (vec, "startup_file", absolutizePath(getStartupFile(wrapperRegistry), absolutizePath(appRoot)));
557
+ appendKeyValue (vec, "process_title", getProcessTitle(wrapperRegistry));
558
558
  appendKeyValue2(vec, "log_level", logLevel);
559
559
  appendKeyValue3(vec, "start_timeout", startTimeout);
560
560
  appendKeyValue (vec, "environment", environment);
@@ -589,12 +589,12 @@ public:
589
589
 
590
590
  template<typename Stream>
591
591
  void toXml(Stream &stream, const ResourceLocator &resourceLocator,
592
- int fields = ALL_OPTIONS) const
592
+ const WrapperRegistry::Registry &wrapperRegistry, int fields = ALL_OPTIONS) const
593
593
  {
594
594
  vector<string> args;
595
595
  unsigned int i;
596
596
 
597
- toVector(args, resourceLocator, fields);
597
+ toVector(args, resourceLocator, wrapperRegistry, fields);
598
598
  for (i = 0; i < args.size(); i += 2) {
599
599
  stream << "<" << args[i] << ">";
600
600
  stream << escapeForXml(args[i + 1]);
@@ -614,43 +614,47 @@ public:
614
614
  }
615
615
  }
616
616
 
617
- string getStartCommand(const ResourceLocator &resourceLocator) const {
618
- if (appType == P_STATIC_STRING("rack")) {
619
- return escapeShell(ruby) + " "
620
- + escapeShell(resourceLocator.getHelperScriptsDir() + "/rack-loader.rb");
621
- } else if (appType == P_STATIC_STRING("wsgi")) {
622
- return escapeShell(python) + " "
623
- + escapeShell(resourceLocator.getHelperScriptsDir() + "/wsgi-loader.py");
624
- } else if (appType == P_STATIC_STRING("node")) {
625
- return escapeShell(nodejs) + " "
626
- + escapeShell(resourceLocator.getHelperScriptsDir() + "/node-loader.js");
627
- } else if (appType == P_STATIC_STRING("meteor")) {
628
- return escapeShell(ruby) + " "
629
- + escapeShell(resourceLocator.getHelperScriptsDir() + "/meteor-loader.rb");
617
+ string getStartCommand(const ResourceLocator &resourceLocator,
618
+ const WrapperRegistry::Registry &wrapperRegistry) const
619
+ {
620
+ const WrapperRegistry::Entry &entry = wrapperRegistry.lookup(appType);
621
+
622
+ string interpreter;
623
+ if (entry.language == P_STATIC_STRING("ruby")) {
624
+ interpreter = escapeShell(ruby);
625
+ } else if (entry.language == P_STATIC_STRING("python")) {
626
+ interpreter = escapeShell(python);
627
+ } else if (entry.language == P_STATIC_STRING("nodejs")) {
628
+ interpreter = escapeShell(nodejs);
629
+ } else if (entry.language == P_STATIC_STRING("meteor")) {
630
+ interpreter = escapeShell(ruby);
630
631
  } else {
631
632
  return startCommand;
632
633
  }
634
+
635
+ return interpreter + " " + escapeShell(resourceLocator.getHelperScriptsDir()
636
+ + "/" + entry.path);
633
637
  }
634
638
 
635
- StaticString getStartupFile() const {
639
+ StaticString getStartupFile(const WrapperRegistry::Registry &wrapperRegistry) const {
636
640
  if (startupFile.empty()) {
637
- const char *result = getAppTypeStartupFile(getAppType(appType));
638
- if (result == NULL) {
639
- return P_STATIC_STRING("");
641
+ const WrapperRegistry::Entry &entry = wrapperRegistry.lookup(appType);
642
+ if (entry.isNull() || entry.defaultStartupFiles.empty()) {
643
+ return StaticString();
640
644
  } else {
641
- return result;
645
+ return entry.defaultStartupFiles[0];
642
646
  }
643
647
  } else {
644
648
  return startupFile;
645
649
  }
646
650
  }
647
651
 
648
- StaticString getProcessTitle() const {
649
- const char *result = getAppTypeProcessTitle(getAppType(appType));
650
- if (result == NULL) {
651
- return processTitle;
652
+ StaticString getProcessTitle(const WrapperRegistry::Registry &registry) const {
653
+ const WrapperRegistry::Entry &entry = registry.lookup(appType);
654
+ if (entry.isNull()) {
655
+ return entry.processTitle;
652
656
  } else {
653
- return result;
657
+ return StaticString();
654
658
  }
655
659
  }
656
660
 
@@ -52,7 +52,8 @@ Pool::getGroupRunUidAndGids(const StaticString &appGroupName) {
52
52
  if (!groups.lookup(appGroupName.c_str(), &group)) {
53
53
  throw RuntimeException("Could not find group: " + appGroupName);
54
54
  } else {
55
- SpawningKit::UserSwitchingInfo info = SpawningKit::prepareUserSwitching((*group)->options);
55
+ SpawningKit::UserSwitchingInfo info = SpawningKit::prepareUserSwitching((*group)->options,
56
+ *context->getWrapperRegistry());
56
57
  return pair<uid_t, gid_t>(info.uid,info.gid);
57
58
  }
58
59
  }