passenger 5.2.3 → 5.3.0

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 (241) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +13 -0
  3. data/CONTRIBUTORS +5 -1
  4. data/build/agent.rb +22 -2
  5. data/build/cxx_tests.rb +41 -5
  6. data/build/misc.rb +4 -1
  7. data/build/support/cxx_dependency_map.rb +1746 -908
  8. data/build/support/vendor/cxx_hinted_parser/CxxHintedParser.sublime-project +8 -0
  9. data/build/support/vendor/cxx_hinted_parser/Gemfile +5 -0
  10. data/build/support/vendor/cxx_hinted_parser/Gemfile.lock +30 -0
  11. data/{src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core → build/support/vendor/cxx_hinted_parser}/LICENSE.md +1 -1
  12. data/build/support/vendor/cxx_hinted_parser/README.md +95 -0
  13. data/build/support/vendor/cxx_hinted_parser/Rakefile +4 -0
  14. data/{src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/initialize.rb → build/support/vendor/cxx_hinted_parser/lib/cxx_hinted_parser.rb} +2 -9
  15. data/build/support/vendor/cxx_hinted_parser/lib/cxx_hinted_parser/parser.rb +239 -0
  16. data/dev/ci/README.md +15 -2
  17. data/dev/ci/lib/set-container-envvars.sh +6 -0
  18. data/dev/ci/lib/setup-container.sh +4 -1
  19. data/dev/ci/scripts/debug-console-wrapper.sh +3 -1
  20. data/dev/ci/setup-host +5 -0
  21. data/dev/ci/tests/binaries/Jenkinsfile +105 -0
  22. data/dev/ci/tests/binaries/build-linux +38 -0
  23. data/dev/ci/tests/binaries/build-macos +40 -0
  24. data/dev/ci/tests/binaries/prepare-macos +38 -0
  25. data/dev/ci/tests/binaries/test-linux +45 -0
  26. data/dev/ci/tests/binaries/test-macos +38 -0
  27. data/dev/ci/tests/debian/Jenkinsfile +2 -2
  28. data/dev/ci/tests/rpm/Jenkinsfile +1 -1
  29. data/dev/configkit-schemas/index.json +3 -24
  30. data/dev/vagrant/nginx_rakefile +0 -1
  31. data/package.json +15 -5
  32. data/resources/templates/error_renderer/.editorconfig +19 -0
  33. data/resources/templates/error_renderer/with_details/README.md +9 -0
  34. data/resources/templates/error_renderer/with_details/dist/bundle.js +33 -0
  35. data/resources/templates/error_renderer/with_details/dist/styles.css +17 -0
  36. data/resources/templates/error_renderer/with_details/src/DetailsView.jsx +52 -0
  37. data/resources/templates/error_renderer/with_details/src/GetHelpView.jsx +61 -0
  38. data/resources/templates/error_renderer/with_details/src/JourneyView.css +50 -0
  39. data/resources/templates/error_renderer/with_details/src/JourneyView.jsx +621 -0
  40. data/resources/templates/error_renderer/with_details/src/PageMain.css +114 -0
  41. data/resources/templates/error_renderer/with_details/src/PageMain.jsx +136 -0
  42. data/resources/templates/error_renderer/with_details/src/ProblemDescriptionView.jsx +14 -0
  43. data/resources/templates/error_renderer/with_details/src/ProcessDetailsView.jsx +56 -0
  44. data/resources/templates/error_renderer/with_details/src/SolutionDescriptionView.css +5 -0
  45. data/resources/templates/error_renderer/with_details/src/SolutionDescriptionView.jsx +15 -0
  46. data/resources/templates/error_renderer/with_details/src/SummaryView.jsx +35 -0
  47. data/resources/templates/error_renderer/with_details/src/SystemComponentView.css +34 -0
  48. data/resources/templates/error_renderer/with_details/src/SystemComponentView.jsx +168 -0
  49. data/resources/templates/error_renderer/with_details/src/SystemComponentsView.css +13 -0
  50. data/resources/templates/error_renderer/with_details/src/SystemComponentsView.jsx +116 -0
  51. data/resources/templates/error_renderer/with_details/src/Tab.jsx +12 -0
  52. data/resources/templates/error_renderer/with_details/src/Tabs.jsx +104 -0
  53. data/resources/templates/error_renderer/with_details/src/bootstrap/bootstrap.css +3446 -0
  54. data/resources/templates/error_renderer/with_details/src/bootstrap/bootstrap.js +293 -0
  55. data/resources/templates/error_renderer/with_details/src/bootstrap/config.json +401 -0
  56. data/resources/templates/error_renderer/with_details/src/index.html.template +22 -0
  57. data/resources/templates/error_renderer/with_details/src/index.jsx +23 -0
  58. data/resources/templates/error_renderer/with_details/webpack.config.js +47 -0
  59. data/resources/templates/error_renderer/without_details/dist/bundle.js +1 -0
  60. data/resources/templates/error_renderer/without_details/dist/styles.css +1 -0
  61. data/resources/templates/{undisclosed_error.html.template → error_renderer/without_details/src/index.html.template} +7 -11
  62. data/resources/templates/error_renderer/without_details/src/index.js +1 -0
  63. data/resources/templates/{error_layout.css → error_renderer/without_details/src/main.css} +5 -2
  64. data/resources/templates/error_renderer/without_details/webpack.config.js +42 -0
  65. data/src/agent/AgentMain.cpp +3 -3
  66. data/src/agent/Core/ApplicationPool/BasicProcessInfo.h +13 -0
  67. data/src/agent/Core/ApplicationPool/Common.h +3 -4
  68. data/src/agent/Core/ApplicationPool/Context.h +27 -17
  69. data/src/agent/Core/ApplicationPool/Group.h +3 -1
  70. data/src/agent/Core/ApplicationPool/Group/InitializationAndShutdown.cpp +2 -12
  71. data/src/agent/Core/ApplicationPool/Group/InternalUtils.cpp +55 -10
  72. data/src/agent/Core/ApplicationPool/Group/LifetimeAndBasics.cpp +1 -1
  73. data/src/agent/Core/ApplicationPool/Group/OutOfBandWork.cpp +1 -1
  74. data/src/agent/Core/ApplicationPool/Group/SpawningAndRestarting.cpp +13 -6
  75. data/src/agent/Core/ApplicationPool/Implementation.cpp +16 -100
  76. data/src/agent/Core/ApplicationPool/Options.h +8 -65
  77. data/src/agent/Core/ApplicationPool/Pool.h +4 -21
  78. data/src/agent/Core/ApplicationPool/Pool/AnalyticsCollection.cpp +1 -60
  79. data/src/agent/Core/ApplicationPool/Pool/GeneralUtils.cpp +10 -13
  80. data/src/agent/Core/ApplicationPool/Pool/InitializationAndShutdown.cpp +3 -8
  81. data/src/agent/Core/ApplicationPool/Pool/Miscellaneous.cpp +2 -34
  82. data/src/agent/Core/ApplicationPool/Pool/StateInspection.cpp +1 -1
  83. data/src/agent/Core/ApplicationPool/Process.cpp +17 -12
  84. data/src/agent/Core/ApplicationPool/Process.h +146 -93
  85. data/src/agent/Core/ApplicationPool/Session.h +2 -2
  86. data/src/agent/Core/ApplicationPool/Socket.h +28 -27
  87. data/src/agent/Core/Config.h +1 -3
  88. data/src/agent/Core/ConfigChange.cpp +2 -4
  89. data/src/agent/Core/Controller.h +2 -8
  90. data/src/agent/Core/Controller/BufferBody.cpp +0 -2
  91. data/src/agent/Core/Controller/CheckoutSession.cpp +12 -24
  92. data/src/agent/Core/Controller/Config.h +1 -9
  93. data/src/agent/Core/Controller/ForwardResponse.cpp +0 -34
  94. data/src/agent/Core/Controller/Hooks.cpp +0 -7
  95. data/src/agent/Core/Controller/InitRequest.cpp +0 -43
  96. data/src/agent/Core/Controller/InitializationAndShutdown.cpp +0 -4
  97. data/src/agent/Core/Controller/Request.h +1 -35
  98. data/src/agent/Core/Controller/SendRequest.cpp +0 -32
  99. data/src/agent/Core/CoreMain.cpp +19 -32
  100. data/src/agent/Core/SpawningKit/Config.h +329 -55
  101. data/src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h +369 -0
  102. data/src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h.cxxcodebuilder +307 -0
  103. data/src/agent/Core/SpawningKit/Context.h +211 -0
  104. data/src/agent/Core/SpawningKit/DirectSpawner.h +112 -122
  105. data/src/agent/Core/SpawningKit/DummySpawner.h +59 -20
  106. data/src/agent/Core/SpawningKit/ErrorRenderer.h +117 -0
  107. data/src/agent/Core/SpawningKit/Exceptions.h +1157 -0
  108. data/src/agent/Core/SpawningKit/Factory.h +24 -17
  109. data/src/agent/Core/SpawningKit/{BackgroundIOCapturer.h → Handshake/BackgroundIOCapturer.h} +48 -18
  110. data/src/agent/Core/SpawningKit/Handshake/Perform.h +1650 -0
  111. data/src/agent/Core/SpawningKit/Handshake/Prepare.h +582 -0
  112. data/src/agent/Core/SpawningKit/Handshake/Session.h +91 -0
  113. data/src/agent/Core/SpawningKit/Handshake/WorkDir.h +100 -0
  114. data/src/agent/Core/SpawningKit/Journey.h +561 -0
  115. data/src/agent/Core/SpawningKit/PipeWatcher.h +41 -18
  116. data/src/agent/Core/SpawningKit/README.md +534 -0
  117. data/src/agent/Core/SpawningKit/Result.h +182 -7
  118. data/src/agent/Core/SpawningKit/Result/AutoGeneratedCode.h +69 -0
  119. data/src/agent/Core/SpawningKit/Result/AutoGeneratedCode.h.cxxcodebuilder +110 -0
  120. data/src/agent/Core/SpawningKit/SmartSpawner.h +1027 -562
  121. data/src/agent/Core/SpawningKit/Spawner.h +70 -1134
  122. data/src/agent/Core/SpawningKit/UserSwitchingRules.h +3 -33
  123. data/src/agent/README.md +2 -3
  124. data/src/agent/Shared/ApiServerUtils.h +2 -3
  125. data/src/agent/SpawnEnvSetupper/SpawnEnvSetupperMain.cpp +932 -0
  126. data/src/agent/Watchdog/Config.h +1 -3
  127. data/src/agent/Watchdog/WatchdogMain.cpp +2 -1
  128. data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp +5 -0
  129. data/src/apache2_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.cpp +5 -0
  130. data/src/apache2_module/ConfigGeneral/ManifestGeneration.h +22 -13
  131. data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp +5 -0
  132. data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp +3 -0
  133. data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp +13 -0
  134. data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp +7 -0
  135. data/src/apache2_module/DirConfig/AutoGeneratedStruct.h +13 -0
  136. data/src/cxx_supportlib/Constants.h +3 -1
  137. data/src/cxx_supportlib/Exceptions.h +0 -121
  138. data/src/cxx_supportlib/LoggingKit/Implementation.cpp +7 -6
  139. data/src/cxx_supportlib/LoggingKit/Logging.h +3 -1
  140. data/src/cxx_supportlib/Utils.cpp +42 -0
  141. data/src/cxx_supportlib/Utils.h +7 -0
  142. data/src/cxx_supportlib/Utils/IOUtils.cpp +58 -0
  143. data/src/cxx_supportlib/Utils/IOUtils.h +13 -0
  144. data/src/cxx_supportlib/Utils/JsonUtils.h +130 -23
  145. data/src/cxx_supportlib/Utils/ScopeGuard.h +9 -4
  146. data/src/cxx_supportlib/Utils/StrIntUtils.cpp +7 -0
  147. data/src/cxx_supportlib/Utils/StrIntUtils.h +1 -0
  148. data/src/cxx_supportlib/Utils/SystemTime.h +1 -1
  149. data/src/cxx_supportlib/Utils/Timer.h +1 -1
  150. data/src/cxx_supportlib/WebSocketCommandReverseServer.h +6 -4
  151. data/src/cxx_supportlib/vendor-copy/adhoc_lve.h +1 -0
  152. data/src/helper-scripts/node-loader.js +54 -59
  153. data/src/helper-scripts/rack-loader.rb +63 -60
  154. data/src/helper-scripts/rack-preloader.rb +125 -72
  155. data/src/helper-scripts/wsgi-loader.py +100 -43
  156. data/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c +120 -112
  157. data/src/nginx_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c +15 -8
  158. data/src/nginx_module/ConfigGeneral/AutoGeneratedSetterFuncs.c +142 -142
  159. data/src/nginx_module/ConfigGeneral/ManifestGeneration.c +26 -15
  160. data/src/nginx_module/ConfigGeneral/ManifestGeneration.h +3 -0
  161. data/src/nginx_module/LocationConfig/AutoGeneratedCreateFunction.c +76 -70
  162. data/src/nginx_module/LocationConfig/AutoGeneratedHeaderSerialization.c +114 -99
  163. data/src/nginx_module/LocationConfig/AutoGeneratedManifestGeneration.c +170 -156
  164. data/src/nginx_module/LocationConfig/AutoGeneratedMergeFunction.c +38 -35
  165. data/src/nginx_module/LocationConfig/AutoGeneratedStruct.h +5 -1
  166. data/src/ruby_supportlib/phusion_passenger.rb +5 -5
  167. data/src/ruby_supportlib/phusion_passenger/admin_tools/instance.rb +14 -1
  168. data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +8 -0
  169. data/src/ruby_supportlib/phusion_passenger/common_library.rb +0 -3
  170. data/src/ruby_supportlib/phusion_passenger/config/nginx_engine_compiler.rb +0 -1
  171. data/src/ruby_supportlib/phusion_passenger/constants.rb +2 -0
  172. data/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb +646 -238
  173. data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +117 -95
  174. data/src/ruby_supportlib/phusion_passenger/packaging.rb +0 -1
  175. data/src/ruby_supportlib/phusion_passenger/platform_info/depcheck_specs/apache2.rb +5 -1
  176. data/src/ruby_supportlib/phusion_passenger/preloader_shared_helpers.rb +92 -69
  177. data/src/ruby_supportlib/phusion_passenger/public_api.rb +0 -17
  178. data/src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb +0 -3
  179. data/src/ruby_supportlib/phusion_passenger/request_handler.rb +4 -5
  180. data/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb +0 -22
  181. metadata +64 -67
  182. data/resources/templates/error_layout.html.template +0 -86
  183. data/resources/templates/general_error.html.template +0 -1
  184. data/resources/templates/general_error_with_html.html.template +0 -1
  185. data/src/agent/Core/ApplicationPool/ErrorRenderer.h +0 -131
  186. data/src/agent/Core/SpawningKit/Options.h +0 -41
  187. data/src/agent/Core/UnionStation/Connection.h +0 -173
  188. data/src/agent/Core/UnionStation/Context.h +0 -536
  189. data/src/agent/Core/UnionStation/StopwatchLog.h +0 -147
  190. data/src/agent/Core/UnionStation/Transaction.h +0 -249
  191. data/src/agent/SpawnPreparer/SpawnPreparerMain.cpp +0 -208
  192. data/src/cxx_supportlib/UnionStationFilterSupport.cpp +0 -67
  193. data/src/cxx_supportlib/UnionStationFilterSupport.h +0 -1622
  194. data/src/nodejs_supportlib/phusion_passenger/log_express.js +0 -106
  195. data/src/nodejs_supportlib/phusion_passenger/log_mongodb.js +0 -202
  196. data/src/nodejs_supportlib/phusion_passenger/ustreporter.js +0 -227
  197. data/src/nodejs_supportlib/phusion_passenger/ustrouter_connector.js +0 -448
  198. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/CONFIG.md +0 -37
  199. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/Gemfile +0 -17
  200. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/Gemfile.lock +0 -59
  201. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/README-API.md +0 -5
  202. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/README.md +0 -117
  203. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/Rakefile +0 -115
  204. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core.rb +0 -423
  205. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/api.rb +0 -238
  206. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/connection.rb +0 -67
  207. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/context.rb +0 -281
  208. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/lock.rb +0 -62
  209. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/log.rb +0 -66
  210. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/message_channel.rb +0 -157
  211. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter.rb +0 -150
  212. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/basics.rb +0 -199
  213. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/controllers.rb +0 -187
  214. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/misc.rb +0 -303
  215. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/view_rendering.rb +0 -91
  216. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/simple_json.rb +0 -396
  217. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/spec_helper.rb +0 -279
  218. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/time_point.rb +0 -39
  219. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/transaction.rb +0 -173
  220. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/utils.rb +0 -177
  221. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/version.rb +0 -32
  222. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/version_data.rb +0 -44
  223. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.example +0 -16
  224. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.travis +0 -20
  225. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.travis-with-sudo +0 -18
  226. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/union_station_hooks_core.gemspec +0 -23
  227. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/Gemfile +0 -14
  228. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/Gemfile.lock +0 -45
  229. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/LICENSE.md +0 -19
  230. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/README.md +0 -104
  231. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/Rakefile +0 -160
  232. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails.rb +0 -200
  233. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/action_controller_extension.rb +0 -45
  234. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/action_view_subscriber.rb +0 -55
  235. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/active_record_subscriber.rb +0 -41
  236. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/active_support_benchmarkable_extension.rb +0 -47
  237. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/active_support_cache_subscriber.rb +0 -79
  238. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/exception_logger.rb +0 -57
  239. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/version.rb +0 -32
  240. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/version_data.rb +0 -44
  241. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/union_station_hooks_rails.gemspec +0 -34
@@ -1,177 +0,0 @@
1
- # Union Station - https://www.unionstationapp.com/
2
- # Copyright (c) 2010-2015 Phusion Holding B.V.
3
- #
4
- # "Union Station" and "Passenger" are trademarks of Phusion Holding B.V.
5
- #
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in
14
- # all copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- # THE SOFTWARE.
23
-
24
- require 'base64'
25
-
26
- module UnionStationHooks
27
- # Various utility methods.
28
- #
29
- # @private
30
- module Utils
31
- extend self # Make methods available as class methods.
32
-
33
- def self.included(klass)
34
- # When included into another class, make sure that Utils
35
- # methods are made private.
36
- public_instance_methods(false).each do |method_name|
37
- klass.send(:private, method_name)
38
- end
39
- end
40
-
41
- def require_key(options, key)
42
- if !options.key?(key)
43
- raise ArgumentError, "Option #{key.inspect} is required"
44
- end
45
- end
46
-
47
- def require_non_empty_key(options, key)
48
- value = options[key]
49
- if value.nil? || value.empty?
50
- raise ArgumentError, "Option #{key.inspect} is required " \
51
- 'and must be non-empty'
52
- else
53
- value
54
- end
55
- end
56
-
57
- def get_socket_address_type(address)
58
- if address =~ %r{^unix:.}
59
- :unix
60
- elsif address =~ %r{^tcp://.}
61
- :tcp
62
- else
63
- :unknown
64
- end
65
- end
66
-
67
- def connect_to_server(address)
68
- case get_socket_address_type(address)
69
- when :unix
70
- UNIXSocket.new(address.sub(/^unix:/, ''))
71
- when :tcp
72
- host, port = address.sub(%r{^tcp://}, '').split(':', 2)
73
- port = port.to_i
74
- TCPSocket.new(host, port)
75
- else
76
- raise ArgumentError, "Unknown socket address type for '#{address}'."
77
- end
78
- end
79
-
80
- def local_socket_address?(address)
81
- case get_socket_address_type(address)
82
- when :unix
83
- return true
84
- when :tcp
85
- host, _port = address.sub(%r{^tcp://}, '').split(':', 2)
86
- host == '127.0.0.1' || host == '::1' || host == 'localhost'
87
- else
88
- raise ArgumentError, "Unknown socket address type for '#{address}'."
89
- end
90
- end
91
-
92
- if Process.const_defined?(:CLOCK_MONOTONIC)
93
- def monotime_usec_now
94
- Process.clock_gettime(Process::CLOCK_MONOTONIC, :microsecond)
95
- end
96
- else
97
- # Workaround for approximating the monotonic clock
98
- def monotime_usec_now
99
- monotime_usec_from_time
100
- end
101
- end
102
-
103
- def monotime_usec_from_time(time = Time.now)
104
- timestamp = time.to_i * 1_000_000 + time.usec - UnionStationHooks.get_delta_monotonic
105
- end
106
-
107
- def encoded_timestamp
108
- time = Time.now
109
- timestamp = time.to_i * 1_000_000 + time.usec
110
- timestamp.to_s(36)
111
- end
112
-
113
- if Base64.respond_to?(:strict_encode64)
114
- def base64(data)
115
- Base64.strict_encode64(data)
116
- end
117
- else
118
- # Base64-encodes the given data. Newlines are removed.
119
- # This is like `Base64.strict_encode64`, but also works
120
- # on Ruby 1.8 which doesn't have that method.
121
- def base64(data)
122
- result = Base64.encode64(data)
123
- result.delete!("\n")
124
- result
125
- end
126
- end
127
-
128
- def process_ust_router_reply(channel, error_description,
129
- error_class = RuntimeError,
130
- unexpected_error_class = RuntimeError)
131
- result = channel.read
132
- if result.nil?
133
- raise unexpected_error_class,
134
- "#{error_description}: UstRouter did not send a reply"
135
- end
136
- process_ust_router_reply_message(result, error_description,
137
- error_class, unexpected_error_class)
138
- result
139
- end
140
-
141
- def process_ust_router_reply_message(message, error_description,
142
- error_class = RuntimeError,
143
- unexpected_error_class = RuntimeError)
144
- if message[0] != 'status'
145
- raise unexpected_error_class,
146
- "#{error_description}: expected UstRouter to respond with " \
147
- "'status', but got #{message.inspect} instead"
148
- end
149
-
150
- if message[1] == 'error'
151
- if message[2]
152
- raise error_class, "#{error_description}: #{message[2]}"
153
- else
154
- raise error_class, "#{error_description} (no server message given)"
155
- end
156
- elsif message[1] != 'ok'
157
- raise unexpected_error_class,
158
- "#{error_description}: expected UstRouter to respond with " \
159
- "'ok' or 'error', but got #{message.inspect} instead"
160
- end
161
- end
162
-
163
- if defined?(PhusionPassenger::NativeSupport)
164
- def process_times
165
- PhusionPassenger::NativeSupport.process_times
166
- end
167
- else
168
- ProcessTimes = Struct.new(:utime, :stime)
169
-
170
- def process_times
171
- times = Process.times
172
- ProcessTimes.new((times.utime * 1_000_000).to_i,
173
- (times.stime * 1_000_000).to_i)
174
- end
175
- end
176
- end
177
- end
@@ -1,32 +0,0 @@
1
- # Union Station - https://www.unionstationapp.com/
2
- # Copyright (c) 2010-2015 Phusion Holding B.V.
3
- #
4
- # "Union Station" and "Passenger" are trademarks of Phusion Holding B.V.
5
- #
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in
14
- # all copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- # THE SOFTWARE.
23
-
24
-
25
- module UnionStationHooks
26
- version_file = File.expand_path('version_data.rb', File.dirname(__FILE__))
27
- version_data = eval(File.read(version_file))
28
- MAJOR_VERSION = version_data[:major]
29
- MINOR_VERSION = version_data[:minor]
30
- TINY_VERSION = version_data[:tiny]
31
- VERSION_STRING = version_data[:string]
32
- end
@@ -1,44 +0,0 @@
1
- # Union Station - https://www.unionstationapp.com/
2
- # Copyright (c) 2010-2016 Phusion Holding B.V.
3
- #
4
- # "Union Station" and "Passenger" are trademarks of Phusion Holding B.V.
5
- #
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in
14
- # all copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- # THE SOFTWARE.
23
-
24
- # This file contains union_station_hook_core's version number. It is meant
25
- # to be read and evaluated by the gemspec. We do not define any functions or
26
- # modules here because we need to support the following situation:
27
- #
28
- # 1. Passenger loads its vendored union_station_hooks_* gems. This defines
29
- # various modules.
30
- # 2. The app specified union_station_hooks_* gems in its Gemfile, which
31
- # indicates that it wants to override Passenger's vendored
32
- # union_station_hooks_* gems with its own versions. This will cause Bundler
33
- # to load union_station_hooks_*.gemspec.
34
- #
35
- # To make the gemspecs load properly and without affecting the already-loaded
36
- # union_station_hooks_* gems code, we must not define any functions or modules
37
- # here.
38
-
39
- {
40
- :major => 2,
41
- :minor => 1,
42
- :tiny => 2,
43
- :string => '2.1.2'
44
- }
@@ -1,16 +0,0 @@
1
- # This configuration file tells the test suite which Ruby interpreters to
2
- # test against. Below is an example utilizing RVM.
3
- #
4
- # If you want test coverage reporting via simplecov to work, then this list
5
- # must contain the main Ruby interpreter that you are using, and the entry
6
- # for that Ruby interpreter must execute Ruby through 'bundle exec'. In the
7
- # example below, this is the case for Ruby 1.9.3.
8
-
9
- - name: Ruby 1.8.7
10
- command: rvm-exec ruby-1.8.7-p352 ruby
11
- - name: Ruby 1.9.3
12
- command: rvm-exec ruby-1.9.3-p547 bundle exec ruby
13
- - name: Ruby 2.2.1
14
- command: rvm-exec ruby-2.2.1 ruby
15
- - name: JRuby 9.0.4.0
16
- command: rvm-exec jruby-9.0.4.0 ruby --dev
@@ -1,20 +0,0 @@
1
- # This configuration file tells the test suite which Ruby interpreters to
2
- # test against. Below is an example utilizing RVM.
3
- #
4
- # N.B. this is the environment used as part of the Submodule tests
5
- # (as opposed to the environment used for the Passenger module tests)
6
- #
7
- # If you want test coverage reporting via simplecov to work, then this list
8
- # must contain the main Ruby interpreter that you are using, and the entry
9
- # for that Ruby interpreter must execute Ruby through 'bundle exec'. In the
10
- # example below, this is the case for Ruby 1.9.3.
11
-
12
- # these are still supported so we pin to the travis version and re-pin whenever they do
13
- - name: Ruby 1.9.3-p551
14
- command: rvm-exec ruby-1.9.3-p551 bundle exec ruby
15
- - name: Ruby 2.1.5
16
- command: rvm-exec ruby-2.1.5 ruby
17
- - name: Ruby 2.2.0
18
- command: rvm-exec ruby-2.2.0 ruby
19
- - name: JRuby 9.0.0.0
20
- command: env JRUBY_OPTS= rvm-exec jruby-9.0.0.0.pre1 ruby --dev -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Xss2m -Xcompile.invokedynamic=false
@@ -1,18 +0,0 @@
1
- # This configuration file tells the test suite which Ruby interpreters to
2
- # test against. Below is an example utilizing RVM.
3
- #
4
- # N.B. this is the environment used as part of the Passenger module tests
5
- # (as opposed to the environment used for the Submodule tests)
6
- #
7
- # If you want test coverage reporting via simplecov to work, then this list
8
- # must contain the main Ruby interpreter that you are using, and the entry
9
- # for that Ruby interpreter must execute Ruby through 'bundle exec'. In the
10
- # example below, this is the case for Ruby 1.9.3.
11
-
12
- # these are still supported so we pin to the travis version and re-pin whenever they do
13
- - name: Ruby 1.9.3-p551
14
- command: rvm-exec ruby-1.9.3-p551 bundle exec ruby
15
- - name: Ruby 2.1.10
16
- command: rvm-exec ruby-2.1.10 ruby
17
- - name: Ruby 2.2.6
18
- command: rvm-exec ruby-2.2.6 ruby
@@ -1,23 +0,0 @@
1
- version_file = File.expand_path('lib/union_station_hooks_core/version_data.rb', File.dirname(__FILE__))
2
- version_data = eval(File.read(version_file))
3
-
4
- Gem::Specification.new do |s|
5
- s.name = "union_station_hooks_core"
6
- s.version = version_data[:string]
7
- s.authors = ["Hongli Lai"]
8
- s.description = "Union Station Ruby hooks core code."
9
- s.summary = "Union Station Ruby hooks core code"
10
- s.email = "info@phusion.nl"
11
- s.license = "MIT"
12
- s.files = Dir[
13
- "README.md",
14
- "LICENSE.md",
15
- "*.gemspec",
16
- "lib/**/*"
17
- ]
18
- s.homepage = "https://github.com/phusion/union_station_hooks_core"
19
- s.require_paths = ["lib"]
20
-
21
- # DO NOT ADD ANY FURTHER DEPENDENCIES! See hacking/Vendoring.md,
22
- # section "No dependencies", for more information.
23
- end
@@ -1,14 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rake'
4
- gem 'rspec'
5
-
6
- # If you update the dependency version here, also update
7
- # the version in union_station_hooks_rails.gemspec
8
- # and union_station_hooks_rails.rb method
9
- # `require_and_check_union_station_hooks_core`.
10
- gem 'union_station_hooks_core', '~> 2.0.4'
11
-
12
- group :notravis do
13
- gem 'rubocop'
14
- end
@@ -1,45 +0,0 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- ast (2.1.0)
5
- astrolabe (1.3.1)
6
- parser (~> 2.2)
7
- diff-lcs (1.2.5)
8
- parser (2.2.2.6)
9
- ast (>= 1.1, < 3.0)
10
- powerpack (0.1.1)
11
- rainbow (2.0.0)
12
- rake (10.4.2)
13
- rspec (3.3.0)
14
- rspec-core (~> 3.3.0)
15
- rspec-expectations (~> 3.3.0)
16
- rspec-mocks (~> 3.3.0)
17
- rspec-core (3.3.2)
18
- rspec-support (~> 3.3.0)
19
- rspec-expectations (3.3.1)
20
- diff-lcs (>= 1.2.0, < 2.0)
21
- rspec-support (~> 3.3.0)
22
- rspec-mocks (3.3.2)
23
- diff-lcs (>= 1.2.0, < 2.0)
24
- rspec-support (~> 3.3.0)
25
- rspec-support (3.3.0)
26
- rubocop (0.33.0)
27
- astrolabe (~> 1.3)
28
- parser (>= 2.2.2.5, < 3.0)
29
- powerpack (~> 0.1)
30
- rainbow (>= 1.99.1, < 3.0)
31
- ruby-progressbar (~> 1.4)
32
- ruby-progressbar (1.7.5)
33
- union_station_hooks_core (2.0.4)
34
-
35
- PLATFORMS
36
- ruby
37
-
38
- DEPENDENCIES
39
- rake
40
- rspec
41
- rubocop
42
- union_station_hooks_core (~> 2.0.4)
43
-
44
- BUNDLED WITH
45
- 1.10.6
@@ -1,19 +0,0 @@
1
- Copyright (c) 2010-2015 Phusion Holding B.V.
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in
11
- all copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- THE SOFTWARE.
@@ -1,104 +0,0 @@
1
- # Union Station Ruby on Rails hooks
2
-
3
- [![Build Status](https://travis-ci.org/phusion/union_station_hooks_rails.svg?branch=master)](https://travis-ci.org/phusion/union_station_hooks_rails)
4
-
5
- [Union Station](https://www.unionstationapp.com) is a web application monitoring and performance analytics platform for Ruby. In order for Union Station to analyze your application, your application must send data to Union Station. This gem allows you to do that.
6
-
7
- `union_station_hooks_rails` is a gem that automatically hooks into various parts of Rails, so that the right information is sent to Union Station. Under the hood, it makes use of the APIs provided by [union_station_hooks_core](https://github.com/phusion/union_station_hooks_core).
8
-
9
- **Resources:** [About Union Station](https://www.unionstationapp.com) | [Github](https://github.com/phusion/union_station_hooks_rails)
10
-
11
- **Table of contents**
12
-
13
- * [Installation](#installation)
14
- - [Using with Passenger](#using-with-passenger)
15
- - [Overriding Passenger's version](#overriding-passengers-version)
16
- - [Using without Passenger](#using-without-passenger)
17
- * [Legacy code](#legacy-code)
18
- * [Contributing](contributing)
19
-
20
- ---
21
-
22
- ## Installation
23
-
24
- ### Using with Passenger
25
-
26
- **Note: This documentation section only applies to Passenger 5.0.20 or later!**
27
-
28
- If you use [Passenger](https://www.phusionpassenger.com/), then you do not need to install the `union_station_hooks_rails` gem. `union_station_hooks_rails` is bundled with Passenger.
29
-
30
- The only thing you need to do is to create a file `config/initializers/union_station.rb` in which you call this code:
31
-
32
- if defined?(UnionStationHooks)
33
- UnionStationHooks.initialize!
34
- end
35
-
36
- (Are you already calling `PhusionPassenger.install_framework_extensions!` from somewhere in your codebase? Please read [Legacy code](#legacy-code) for important information.)
37
-
38
- When you have this call in place, enable Union Station support in Passenger. Here are some examples:
39
-
40
- * _Passenger with Nginx integration mode_<br>
41
-
42
- Insert the following config in your virtual host configuration, then restart Nginx:
43
-
44
- union_station_support on;
45
- union_station_key <YOUR KEY HERE>;
46
-
47
- * _Passenger with Apache integration mode_<br>
48
-
49
- Insert the following config in your virtual host configuration, then restart Apache:
50
-
51
- UnionStationSupport on
52
- UnionStationKey <YOUR KEY HERE>
53
-
54
- * _Passenger Standalone_<br>
55
-
56
- Start Passenger with the `--union-station-key` parameter:
57
-
58
- $ passenger start --union-station-key <YOUR KEY HERE>
59
-
60
- Or set the `union_station_key` configuration option in Passengerfile.json:
61
-
62
- {
63
- "union_station_key": "<YOUR KEY HERE>"
64
- }
65
-
66
- ### Overriding Passenger's version
67
-
68
- Each version of Passenger bundles its own version of the `union_station_hooks_rails` gem (and the `union_station_hooks_core` gem, which is a dependency). The Passenger maintainers regularly update their bundled versions with the latest version. Sometimes, you may wish to use a specific version of `union_station_hooks_rails` and `union_station_hooks_core`, overriding the versions that came bundled with Passenger. For example, we have may published a new version of `union_station_hooks_rails` with some bug fixes, even though Passenger hasn't been updated yet.
69
-
70
- You can override Passenger's bundled versions as follows.
71
-
72
- 1. Add the gems you want to override to your Gemfile, like this:
73
-
74
- # Uncomment the following line if you want to override Passenger's
75
- # bundled version
76
- #gem 'union_station_hooks_core'
77
-
78
- gem 'union_station_hooks_rails'
79
-
80
- 2. Install your gem bundle:
81
-
82
- bundle install
83
-
84
- ### Using without Passenger
85
-
86
- It is currently not possible to use Union Station without Passenger. If you would like to have this feature, please let us know.
87
-
88
- ## Legacy code
89
-
90
- Before Passenger 5.0.20, the Union Station setup instructions used to tell you to create a `config/initializers/passenger.rb` in which you call the following code:
91
-
92
- PhusionPassenger.install_framework_extensions! if defined?(PhusionPassenger)
93
-
94
- Since Passenger 5.0.20, `PhusionPassenger.install_framework_extensions!` has become an alias for `UnionStationHooks.initialize!`, but the former is considered deprecated. Please replace the above code with:
95
-
96
- if defined?(UnionStationHooks)
97
- UnionStationHooks.initialize!
98
- end
99
-
100
- And please also rename `config/initializers/passenger.rb` to `config/initializers/union_station.rb`.
101
-
102
- ## Contributing
103
-
104
- Looking to contribute to this gem? Please read the documentation in the [hacking/](https://github.com/phusion/union_station_hooks_rails/blob/master/hacking) directory.