passenger 5.3.4 → 6.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +69 -0
- data/CONTRIBUTORS +1 -0
- data/README.md +2 -1
- data/Rakefile +0 -5
- data/build/agent.rb +6 -3
- data/build/cxx_tests.rb +28 -19
- data/build/integration_tests.rb +6 -2
- data/build/misc.rb +2 -1
- data/build/packaging.rb +2 -0
- data/build/support/cplusplus.rb +2 -2
- data/build/support/cxx_dependency_map.rb +2651 -2189
- data/dev/colorize-logs +272 -0
- data/dev/show-latest-crashlog-dir +27 -0
- data/resources/templates/standalone/http.erb +2 -0
- data/resources/templates/standalone/server.erb +1 -0
- data/src/agent/AgentMain.cpp +4 -0
- data/src/agent/Core/AdminPanelConnector.h +6 -6
- data/src/agent/Core/ApiServer.h +4 -4
- data/src/agent/Core/ApplicationPool/BasicProcessInfo.h +2 -2
- data/src/agent/Core/ApplicationPool/Context.h +5 -1
- data/src/agent/Core/ApplicationPool/Group/InternalUtils.cpp +2 -2
- data/src/agent/Core/ApplicationPool/Group/LifetimeAndBasics.cpp +5 -0
- data/src/agent/Core/ApplicationPool/Group/Miscellaneous.cpp +2 -1
- data/src/agent/Core/ApplicationPool/Group/OutOfBandWork.cpp +3 -3
- data/src/agent/Core/ApplicationPool/Group/ProcessListManagement.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/StateInspection.cpp +13 -20
- data/src/agent/Core/ApplicationPool/Group.h +4 -2
- data/src/agent/Core/ApplicationPool/Implementation.cpp +5 -5
- data/src/agent/Core/ApplicationPool/Options.h +42 -38
- data/src/agent/Core/ApplicationPool/Pool/GroupUtils.cpp +2 -1
- data/src/agent/Core/ApplicationPool/Pool.h +4 -4
- data/src/agent/Core/ApplicationPool/Process.h +13 -15
- data/src/agent/Core/ApplicationPool/Socket.h +5 -5
- data/src/agent/Core/ApplicationPool/TestSession.h +3 -3
- data/src/agent/Core/Config.h +50 -10
- data/src/agent/Core/ConfigChange.cpp +13 -1
- data/src/agent/Core/Controller/Config.h +41 -17
- data/src/agent/Core/Controller/ForwardResponse.cpp +4 -0
- data/src/agent/Core/Controller/InitRequest.cpp +14 -8
- data/src/agent/Core/Controller/InitializationAndShutdown.cpp +5 -0
- data/src/agent/Core/Controller/SendRequest.cpp +9 -9
- data/src/agent/Core/Controller/TurboCaching.h +2 -2
- data/src/agent/Core/Controller.h +7 -5
- data/src/agent/Core/CoreMain.cpp +204 -60
- data/src/agent/Core/OptionParser.h +20 -3
- data/src/agent/Core/ResponseCache.h +3 -3
- data/src/agent/Core/SecurityUpdateChecker.h +4 -2
- data/src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h +1 -1
- data/src/agent/Core/SpawningKit/Config.h +3 -2
- data/src/agent/Core/SpawningKit/Context.h +8 -2
- data/src/agent/Core/SpawningKit/DirectSpawner.h +4 -4
- data/src/agent/Core/SpawningKit/DummySpawner.h +3 -3
- data/src/agent/Core/SpawningKit/ErrorRenderer.h +1 -1
- data/src/agent/Core/SpawningKit/Exceptions.h +21 -14
- data/src/agent/Core/SpawningKit/Factory.h +1 -1
- data/src/agent/Core/SpawningKit/Handshake/BackgroundIOCapturer.h +1 -1
- data/src/agent/Core/SpawningKit/Handshake/Perform.h +14 -2
- data/src/agent/Core/SpawningKit/Handshake/Prepare.h +3 -3
- data/src/agent/Core/SpawningKit/Handshake/WorkDir.h +1 -1
- data/src/agent/Core/SpawningKit/Journey.h +4 -5
- data/src/agent/Core/SpawningKit/PipeWatcher.h +1 -1
- data/src/agent/Core/SpawningKit/README.md +34 -17
- data/src/agent/Core/SpawningKit/Result/AutoGeneratedCode.h +1 -1
- data/src/agent/Core/SpawningKit/Result.h +20 -8
- data/src/agent/Core/SpawningKit/SmartSpawner.h +7 -7
- data/src/agent/Core/SpawningKit/Spawner.h +25 -8
- data/src/agent/Core/SpawningKit/UserSwitchingRules.h +17 -7
- data/src/agent/Core/TelemetryCollector.h +681 -0
- data/src/agent/ExecHelper/ExecHelperMain.cpp +1 -1
- data/src/agent/FileReadHelper/FileReadHelperMain.cpp +198 -0
- data/src/agent/README.md +1 -1
- data/src/agent/Shared/ApiAccountUtils.h +1 -1
- data/src/agent/Shared/ApiServerUtils.h +3 -3
- data/src/agent/Shared/ApplicationPoolApiKey.h +2 -2
- data/src/agent/Shared/Fundamentals/AbortHandler.cpp +324 -98
- data/src/agent/Shared/Fundamentals/AbortHandler.h +31 -4
- data/src/agent/Shared/Fundamentals/Initialization.cpp +4 -5
- data/src/agent/Shared/Fundamentals/Initialization.h +9 -1
- data/src/agent/SpawnEnvSetupper/SpawnEnvSetupperMain.cpp +1 -1
- data/src/agent/SystemMetrics/SystemMetricsMain.cpp +4 -3
- data/src/agent/TempDirToucher/TempDirToucherMain.cpp +3 -3
- data/src/agent/Watchdog/ApiServer.h +3 -3
- data/src/agent/Watchdog/Config.h +24 -5
- data/src/agent/Watchdog/CoreWatcher.cpp +2 -2
- data/src/agent/Watchdog/WatchdogMain.cpp +97 -28
- data/src/apache2_module/Config.cpp +14 -14
- data/src/apache2_module/Config.h +8 -16
- data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp +510 -481
- data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp.cxxcodebuilder +39 -17
- data/src/apache2_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.cpp +5 -0
- data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp +69 -1
- data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp.cxxcodebuilder +31 -1
- data/src/apache2_module/ConfigGeneral/Common.h +45 -0
- data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp +17 -1
- data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp.cxxcodebuilder +16 -1
- data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp +19 -5
- data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp.cxxcodebuilder +26 -9
- data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp +19 -1
- data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp.cxxcodebuilder +10 -1
- data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp +14 -1
- data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp.cxxcodebuilder +11 -1
- data/src/apache2_module/DirConfig/AutoGeneratedStruct.h +36 -1
- data/src/apache2_module/DirConfig/AutoGeneratedStruct.h.cxxcodebuilder +34 -1
- data/src/apache2_module/DirectoryMapper.h +36 -37
- data/src/apache2_module/Hooks.cpp +27 -8
- data/src/apache2_module/ServerConfig/AutoGeneratedManifestGeneration.cpp +20 -0
- data/src/apache2_module/ServerConfig/AutoGeneratedStruct.h +48 -1
- data/src/apache2_module/ServerConfig/AutoGeneratedStruct.h.cxxcodebuilder +36 -1
- data/src/cxx_supportlib/{Utils → Algorithms}/Hasher.cpp +2 -2
- data/src/cxx_supportlib/{Utils → Algorithms}/Hasher.h +4 -4
- data/src/cxx_supportlib/AppLocalConfigFileUtils.h +148 -0
- data/src/cxx_supportlib/AppTypeDetector/CBindings.cpp +147 -0
- data/src/cxx_supportlib/AppTypeDetector/CBindings.h +75 -0
- data/src/cxx_supportlib/{AppTypes.h → AppTypeDetector/Detector.h} +92 -131
- data/src/cxx_supportlib/ConfigKit/README.md +90 -2
- data/src/cxx_supportlib/ConfigKit/Schema.h +60 -15
- data/src/cxx_supportlib/ConfigKit/Store.h +129 -5
- data/src/cxx_supportlib/Constants.h +1 -1
- data/src/cxx_supportlib/{Utils → DataStructures}/HashMap.h +4 -4
- data/src/cxx_supportlib/DataStructures/HashedStaticString.h +5 -5
- data/src/cxx_supportlib/DataStructures/LString.h +3 -3
- data/src/cxx_supportlib/{Utils → DataStructures}/StringMap.h +36 -36
- data/src/cxx_supportlib/FileTools/FileManip.cpp +1 -1
- data/src/cxx_supportlib/FileTools/PathManip.cpp +2 -2
- data/src/cxx_supportlib/FileTools/PathSecurityCheck.cpp +1 -1
- data/src/cxx_supportlib/Hooks.h +2 -2
- data/src/cxx_supportlib/{Utils → IOTools}/BufferedIO.h +5 -5
- data/src/cxx_supportlib/{Utils → IOTools}/IOUtils.cpp +4 -3
- data/src/cxx_supportlib/{Utils → IOTools}/IOUtils.h +3 -3
- data/src/cxx_supportlib/{Utils → IOTools}/MessageIO.h +7 -7
- data/src/cxx_supportlib/{MessageReadersWriters.h → IOTools/MessageSerialization.h} +5 -5
- data/src/cxx_supportlib/InstanceDirectory.h +4 -4
- data/src/cxx_supportlib/Integrations/LibevJsonUtils.h +3 -3
- data/src/cxx_supportlib/{Utils → JsonTools}/JsonUtils.h +5 -5
- data/src/cxx_supportlib/LoggingKit/Context.h +2 -2
- data/src/cxx_supportlib/LoggingKit/Implementation.cpp +3 -3
- data/src/cxx_supportlib/MemoryKit/mbuf.cpp +2 -2
- data/src/cxx_supportlib/ProcessManagement/Ruby.cpp +3 -3
- data/src/cxx_supportlib/ProcessManagement/Ruby.h +7 -2
- data/src/cxx_supportlib/ProcessManagement/Spawn.cpp +19 -12
- data/src/cxx_supportlib/ProcessManagement/Spawn.h +21 -2
- data/src/cxx_supportlib/ProcessManagement/Utils.h +10 -0
- data/src/cxx_supportlib/RandomGenerator.h +2 -2
- data/src/cxx_supportlib/ResourceLocator.h +1 -1
- data/src/cxx_supportlib/{Crypto.cpp → SecurityKit/Crypto.cpp} +4 -4
- data/src/cxx_supportlib/{Crypto.h → SecurityKit/Crypto.h} +4 -4
- data/src/cxx_supportlib/{Utils → SecurityKit}/MemZeroGuard.h +0 -0
- data/src/cxx_supportlib/ServerKit/AcceptLoadBalancer.h +2 -2
- data/src/cxx_supportlib/ServerKit/Channel.h +1 -1
- data/src/cxx_supportlib/ServerKit/ClientRef.h +17 -7
- data/src/cxx_supportlib/ServerKit/Context.h +2 -2
- data/src/cxx_supportlib/ServerKit/FileBufferedChannel.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpHeaderParser.h +3 -3
- data/src/cxx_supportlib/ServerKit/HttpHeaderParserState.h +2 -2
- data/src/cxx_supportlib/ServerKit/HttpRequestRef.h +17 -7
- data/src/cxx_supportlib/ServerKit/HttpServer.h +16 -10
- data/src/cxx_supportlib/ServerKit/Server.h +3 -4
- data/src/cxx_supportlib/{Utils → StrIntTools}/DateParsing.h +5 -5
- data/src/cxx_supportlib/{Utils → StrIntTools}/StrIntUtils.cpp +3 -3
- data/src/cxx_supportlib/{Utils → StrIntTools}/StrIntUtils.h +0 -0
- data/src/cxx_supportlib/{Utils → StrIntTools}/StrIntUtilsNoStrictAliasing.cpp +12 -12
- data/src/cxx_supportlib/{Utils → StrIntTools}/StringScanning.h +5 -5
- data/src/cxx_supportlib/{Utils → StrIntTools}/Template.h +30 -5
- data/src/cxx_supportlib/SystemTools/ContainerHelpers.h +88 -0
- data/src/cxx_supportlib/{Utils → SystemTools}/ProcessMetricsCollector.h +15 -12
- data/src/cxx_supportlib/{Utils → SystemTools}/SystemMetricsCollector.h +3 -3
- data/src/cxx_supportlib/{Utils → SystemTools}/SystemTime.cpp +1 -1
- data/src/cxx_supportlib/{Utils → SystemTools}/SystemTime.h +0 -0
- data/src/cxx_supportlib/SystemTools/UserDatabase.h +1 -1
- data/src/cxx_supportlib/Utils/CachedFileStat.hpp +3 -3
- data/src/cxx_supportlib/Utils/Curl.h +2 -2
- data/src/cxx_supportlib/Utils/FileChangeChecker.h +2 -2
- data/src/cxx_supportlib/Utils/MessagePassing.h +1 -1
- data/src/cxx_supportlib/Utils/SpeedMeter.h +2 -2
- data/src/cxx_supportlib/Utils/Timer.h +2 -2
- data/src/cxx_supportlib/Utils/VariantMap.h +3 -3
- data/src/cxx_supportlib/Utils.cpp +2 -2
- data/src/cxx_supportlib/WatchdogLauncher.h +3 -3
- data/src/cxx_supportlib/WebSocketCommandReverseServer.h +1 -1
- data/src/cxx_supportlib/WrapperRegistry/CBindings.cpp +85 -0
- data/src/cxx_supportlib/{Utils/MemoryBarrier.h → WrapperRegistry/CBindings.h} +30 -27
- data/src/cxx_supportlib/WrapperRegistry/Entry.h +112 -0
- data/src/cxx_supportlib/WrapperRegistry/README.md +37 -0
- data/src/cxx_supportlib/WrapperRegistry/Registry.h +309 -0
- data/src/cxx_supportlib/vendor-modified/psg_sysqueue.h +3 -0
- data/src/helper-scripts/download_binaries/extconf.rb +6 -2
- data/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c +32 -0
- data/src/nginx_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c +12 -0
- data/src/nginx_module/ConfigGeneral/AutoGeneratedSetterFuncs.c +36 -0
- data/src/nginx_module/Configuration.c +23 -3
- data/src/nginx_module/ContentHandler.c +331 -32
- data/src/nginx_module/ContentHandler.h +8 -3
- data/src/nginx_module/LocationConfig/AutoGeneratedCreateFunction.c +10 -0
- data/src/nginx_module/LocationConfig/AutoGeneratedManifestGeneration.c +27 -0
- data/src/nginx_module/LocationConfig/AutoGeneratedMergeFunction.c +3 -0
- data/src/nginx_module/LocationConfig/AutoGeneratedStruct.h +7 -0
- data/src/nginx_module/MainConfig/AutoGeneratedCreateFunction.c +11 -0
- data/src/nginx_module/MainConfig/AutoGeneratedManifestGeneration.c +23 -0
- data/src/nginx_module/MainConfig/AutoGeneratedStruct.h +8 -0
- data/src/nginx_module/config +2 -1
- data/src/nginx_module/ngx_http_passenger_module.c +9 -3
- data/src/nginx_module/ngx_http_passenger_module.h +10 -3
- data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +19 -0
- data/src/ruby_supportlib/phusion_passenger/common_library.rb +19 -16
- data/src/ruby_supportlib/phusion_passenger/config/agent_compiler.rb +4 -4
- data/src/ruby_supportlib/phusion_passenger/config/download_agent_command.rb +6 -2
- data/src/ruby_supportlib/phusion_passenger/config/download_nginx_engine_command.rb +6 -2
- data/src/ruby_supportlib/phusion_passenger/config/nginx_engine_compiler.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/message_channel.rb +2 -2
- data/src/ruby_supportlib/phusion_passenger/native_support.rb +7 -3
- data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +29 -0
- data/src/ruby_supportlib/phusion_passenger/packaging.rb +20 -19
- data/src/ruby_supportlib/phusion_passenger/platform_info/apache.rb +22 -4
- data/src/ruby_supportlib/phusion_passenger/platform_info/ruby.rb +33 -13
- data/src/ruby_supportlib/phusion_passenger/standalone/app_finder.rb +1 -0
- data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +22 -2
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb +4 -1
- data/src/ruby_supportlib/phusion_passenger.rb +7 -5
- data/src/schema_printer/SchemaPrinterMain.cpp +2 -0
- metadata +40 -89
- data/.editorconfig +0 -134
- data/CODE_OF_CONDUCT.md +0 -52
- data/dev/boost-patches/0001-Patch-boost-thread-so-that-oxt-thread-can-use-it.patch +0 -48
- data/dev/boost-patches/0002-Make-boost-thread_interrupted-derive-from-oxt-tracab.patch +0 -33
- data/dev/boost-patches/0003-Disable-a-Clang-pragma-to-prevent-warnings-on-OS-X.patch +0 -25
- data/dev/ci/README.md +0 -134
- data/dev/ci/lib/functions.sh +0 -129
- data/dev/ci/lib/set-container-envvars.sh +0 -53
- data/dev/ci/lib/setup-container.sh +0 -46
- data/dev/ci/run-tests-natively +0 -24
- data/dev/ci/run-tests-with-docker +0 -42
- data/dev/ci/scripts/debug-console-wrapper.sh +0 -29
- data/dev/ci/scripts/docker-entrypoint-stage2.sh +0 -17
- data/dev/ci/scripts/docker-entrypoint.sh +0 -17
- data/dev/ci/scripts/inituidgid +0 -17
- data/dev/ci/scripts/run-tests-natively-stage2.sh +0 -17
- data/dev/ci/scripts/setup-host-natively.sh +0 -11
- data/dev/ci/setup-host +0 -56
- data/dev/ci/tests/apache2/run +0 -6
- data/dev/ci/tests/apache2/setup +0 -4
- data/dev/ci/tests/binaries/Jenkinsfile +0 -105
- data/dev/ci/tests/binaries/build-linux +0 -38
- data/dev/ci/tests/binaries/build-macos +0 -40
- data/dev/ci/tests/binaries/prepare-macos +0 -38
- data/dev/ci/tests/binaries/test-linux +0 -45
- data/dev/ci/tests/binaries/test-macos +0 -38
- data/dev/ci/tests/cxx/run +0 -9
- data/dev/ci/tests/cxx/setup +0 -4
- data/dev/ci/tests/debian/Jenkinsfile +0 -89
- data/dev/ci/tests/debian/run +0 -60
- data/dev/ci/tests/nginx/run +0 -5
- data/dev/ci/tests/nginx/setup +0 -4
- data/dev/ci/tests/nginx-dynamic/run +0 -20
- data/dev/ci/tests/nginx-dynamic/setup +0 -4
- data/dev/ci/tests/nodejs/run +0 -4
- data/dev/ci/tests/nodejs/setup +0 -4
- data/dev/ci/tests/rpm/Jenkinsfile +0 -68
- data/dev/ci/tests/rpm/run +0 -63
- data/dev/ci/tests/ruby/run +0 -4
- data/dev/ci/tests/ruby/setup +0 -4
- data/dev/ci/tests/source-packaging/run +0 -4
- data/dev/ci/tests/source-packaging/setup +0 -4
- data/dev/ci/tests/standalone/run +0 -4
- data/dev/ci/tests/standalone/setup +0 -4
- data/dev/configkit-schemas/index.json +0 -1748
- data/dev/configkit-schemas/update_schema_inline_comments.rb +0 -118
- data/dev/rack.test/config.ru +0 -5
- data/dev/rack.test/public/asset.txt +0 -1
- data/dev/vagrant/apache_default_site.conf +0 -35
- data/dev/vagrant/apache_passenger.conf +0 -5
- data/dev/vagrant/apache_passenger.load +0 -1
- data/dev/vagrant/apache_ports.conf +0 -24
- data/dev/vagrant/apache_rack_test.conf +0 -9
- data/dev/vagrant/bashrc +0 -23
- data/dev/vagrant/nginx.conf +0 -39
- data/dev/vagrant/nginx_rakefile +0 -33
- data/dev/vagrant/nginx_start +0 -32
- data/dev/vagrant/provision.sh +0 -117
- data/dev/vagrant/sudoers.conf +0 -5
- data/resources/templates/error_renderer/.editorconfig +0 -19
- data/src/cxx_supportlib/AppTypes.cpp +0 -109
- data/src/cxx_supportlib/vendor-modified/SmallVector.h +0 -653
data/dev/colorize-logs
ADDED
@@ -0,0 +1,272 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'optparse'
|
3
|
+
|
4
|
+
RED = "\e[31m"
|
5
|
+
YELLOW = "\e[33m"
|
6
|
+
WHITE = "\e[37m"
|
7
|
+
BRIGHTWHITE = "\e[37;1m"
|
8
|
+
ORANGE = "\e[38;5;208m"
|
9
|
+
GREEN34 = "\e[38;5;34m"
|
10
|
+
GREEN48 = "\e[38;5;48m"
|
11
|
+
UNDERLINE = "\e[4m"
|
12
|
+
BOLD = "\e[1m"
|
13
|
+
RESET = "\e[0m"
|
14
|
+
|
15
|
+
TERMINATION_SIGNALS = [
|
16
|
+
Signal.list['INT'],
|
17
|
+
Signal.list['TERM'],
|
18
|
+
Signal.list['HUP']
|
19
|
+
]
|
20
|
+
|
21
|
+
def main
|
22
|
+
STDOUT.sync = true
|
23
|
+
STDERR.sync = true
|
24
|
+
|
25
|
+
options = parse_options(ARGV)
|
26
|
+
|
27
|
+
if should_use_pager?(options)
|
28
|
+
# Pipe our output to 'less'. We *must* replace the current
|
29
|
+
# process with 'less' (and move ourselves into the background),
|
30
|
+
# instead of having 'less' run as a child process. This is
|
31
|
+
# in order to properly handle signals sent to the entire
|
32
|
+
# process group, such as when the user presses Ctrl-C.
|
33
|
+
#
|
34
|
+
# The problem with running 'less' as a child process is as follows:
|
35
|
+
#
|
36
|
+
# Imagine you're running the following pipeline in
|
37
|
+
# bash:
|
38
|
+
#
|
39
|
+
# tail -n 1000 -f nginx-error.log | ./dev/colorize-logs | less
|
40
|
+
#
|
41
|
+
# No problem here when we press Ctrl-C. Ctrl-C sends SIGINT to
|
42
|
+
# the entire process group, so to all three processes. 'tail' and
|
43
|
+
# 'colorize-logs' exit, while 'less' ignores the signal and keeps
|
44
|
+
# running until you press 'q'.
|
45
|
+
#
|
46
|
+
# Now consider the following pipeline:
|
47
|
+
#
|
48
|
+
# tail -n 1000 -f nginx-error.log | ./dev/colorize-logs
|
49
|
+
#
|
50
|
+
# Same thing, but colorize-logs spawns 'less'. Bash does not know
|
51
|
+
# about it: it only waits for 'tail' and 'colorize-logs', not 'less'.
|
52
|
+
# When you press Ctrl-C now, bash tries to take back control of the
|
53
|
+
# terminal as soon as 'tail' and 'colorize-logs' exit. So although
|
54
|
+
# 'less' ignores SIGINT, the fact that bash tries to take control
|
55
|
+
# of the terminal breaks it.
|
56
|
+
#
|
57
|
+
# To avoid this scenario from happening, we inverse the process
|
58
|
+
# hierarchy. We replace 'colorize-logs' with 'less' (through the use
|
59
|
+
# of #exec) so that it's as if bash waits for 'tail' and 'less'.
|
60
|
+
|
61
|
+
a, b = IO.pipe
|
62
|
+
|
63
|
+
fork do
|
64
|
+
begin
|
65
|
+
a.close
|
66
|
+
STDOUT.reopen(b)
|
67
|
+
input = open_input(options)
|
68
|
+
begin
|
69
|
+
process_input(input)
|
70
|
+
ensure
|
71
|
+
kill_input_program(input)
|
72
|
+
end
|
73
|
+
rescue SignalException => e
|
74
|
+
if TERMINATION_SIGNALS.include?(e.signo)
|
75
|
+
# Stop upon receiving any of these signals.
|
76
|
+
exit 1
|
77
|
+
else
|
78
|
+
raise e
|
79
|
+
end
|
80
|
+
rescue Errno::EPIPE
|
81
|
+
# Stop when 'less' exits.
|
82
|
+
rescue Exception => e
|
83
|
+
STDERR.puts "#{e} (#{e.class})\n#{e.backtrace.join("\n")}"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
STDIN.reopen(a)
|
88
|
+
b.close
|
89
|
+
exec('less', '-R')
|
90
|
+
else
|
91
|
+
input = open_input(options)
|
92
|
+
begin
|
93
|
+
process_input(input)
|
94
|
+
rescue SignalException => e
|
95
|
+
if TERMINATION_SIGNALS.include?(e.signo)
|
96
|
+
# Stop upon receiving any of these signals.
|
97
|
+
exit 1
|
98
|
+
else
|
99
|
+
raise e
|
100
|
+
end
|
101
|
+
rescue Errno::EPIPE
|
102
|
+
# Ignore error when unable to write to piped program.
|
103
|
+
ensure
|
104
|
+
kill_input_program(input)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def parse_options(argv)
|
110
|
+
options = {}
|
111
|
+
|
112
|
+
parser = OptionParser.new do |opts|
|
113
|
+
opts.banner =
|
114
|
+
"Usage 1: ./dev/colorize-logs [options] <filename>\n" \
|
115
|
+
"Usage 2: some command | ./dev/colorize-logs [options]"
|
116
|
+
|
117
|
+
opts.separator ''
|
118
|
+
opts.separator 'This is a tool for reading big Passenger log files,' \
|
119
|
+
' which can be hard to parse because they contain so much information.' \
|
120
|
+
' This tool colorizes the logs based on log level (error, warning,' \
|
121
|
+
' notice, debug, etc.) and type (LoggingKit vs app output), hopefully' \
|
122
|
+
' making it easier to read.'
|
123
|
+
opts.separator ''
|
124
|
+
opts.separator 'You can have it read a file (usage 1), or you can pipe' \
|
125
|
+
' data into it (usage 2).'
|
126
|
+
opts.separator ''
|
127
|
+
opts.separator "Output will automatically be displayed in 'less' if:" \
|
128
|
+
" (1) running in a terminal, (2) a filename is given, and (3) -f is NOT given."
|
129
|
+
opts.separator ''
|
130
|
+
opts.separator 'Options:'
|
131
|
+
|
132
|
+
opts.on('-f', '--follow', "Follow given file (like 'tail -f'). Only applicable when given a filename") do
|
133
|
+
options[:follow] = true
|
134
|
+
end
|
135
|
+
opts.on('-h', '--help', 'Display this help message') do
|
136
|
+
options[:help] = true
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
begin
|
141
|
+
parser.parse!(argv)
|
142
|
+
rescue OptionParser::ParseError => e
|
143
|
+
STDERR.puts e
|
144
|
+
STDERR.puts
|
145
|
+
STDERR.puts "Please see '--help' for valid options."
|
146
|
+
exit 1
|
147
|
+
end
|
148
|
+
|
149
|
+
if options[:help]
|
150
|
+
puts parser
|
151
|
+
exit
|
152
|
+
end
|
153
|
+
|
154
|
+
if argv.size > 1
|
155
|
+
STDERR.puts 'ERROR: too many filenames given.'
|
156
|
+
STDERR.puts
|
157
|
+
STDERR.puts "Please see '--help' for usage."
|
158
|
+
exit 1
|
159
|
+
end
|
160
|
+
|
161
|
+
if argv.size == 1 && argv[0] != '-'
|
162
|
+
options[:filename] = argv[0]
|
163
|
+
end
|
164
|
+
|
165
|
+
if options[:follow] && !options[:filename]
|
166
|
+
STDERR.puts 'ERROR: --follow can only be used when given a filename.'
|
167
|
+
STDERR.puts
|
168
|
+
STDERR.puts "Please see '--help' for usage."
|
169
|
+
exit 1
|
170
|
+
end
|
171
|
+
|
172
|
+
options
|
173
|
+
end
|
174
|
+
|
175
|
+
def open_input(options)
|
176
|
+
if options[:filename]
|
177
|
+
if options[:follow]
|
178
|
+
IO.popen(['tail', '-n', '0', '-f', options[:filename]], 'r:utf-8')
|
179
|
+
else
|
180
|
+
File.open(options[:filename], 'r:utf-8')
|
181
|
+
end
|
182
|
+
else
|
183
|
+
STDIN
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
def kill_input_program(input)
|
188
|
+
if input.pid
|
189
|
+
begin
|
190
|
+
Process.kill('TERM', input.pid)
|
191
|
+
rescue Errno::ESRCH
|
192
|
+
# Ignore error
|
193
|
+
rescue SystemCallError => e
|
194
|
+
STDERR.puts "WARNING: unable to kill 'tail -f' (PID #{input.pid}): #{e}"
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
def should_use_pager?(options)
|
200
|
+
STDOUT.tty? && options[:filename] && !options[:follow]
|
201
|
+
end
|
202
|
+
|
203
|
+
def process_input(input)
|
204
|
+
last_message_color = nil
|
205
|
+
while !input.eof?
|
206
|
+
line, last_message_color = colorize(input.readline.chomp, last_message_color)
|
207
|
+
puts line
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
def colorize(line, last_message_color)
|
212
|
+
if line=~ /^\[ .+? \]: /
|
213
|
+
colorize_loggingkit_line(line)
|
214
|
+
elsif line =~ /^App [0-9]+ output: /
|
215
|
+
colorize_app_output_line(line)
|
216
|
+
else
|
217
|
+
["#{last_message_color}#{line}#{RESET}", last_message_color]
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
def colorize_loggingkit_line(line)
|
222
|
+
case line
|
223
|
+
when /^\[ [CE]/
|
224
|
+
prefix_color = "\e[38;5;88m"
|
225
|
+
message_color = RED
|
226
|
+
when /^\[ W/
|
227
|
+
prefix_color = "\e[38;5;136m"
|
228
|
+
message_color = YELLOW
|
229
|
+
when /^\[ N/
|
230
|
+
prefix_color = "\e[38;5;250m"
|
231
|
+
message_color = BRIGHTWHITE
|
232
|
+
when /^\[ I/
|
233
|
+
prefix_color = "\e[38;5;246m"
|
234
|
+
message_color = "\e[38;5;255m"
|
235
|
+
when /^\[ D /
|
236
|
+
prefix_color = "\e[38;5;169m"
|
237
|
+
message_color = "\e[38;5;213m"
|
238
|
+
when /^\[ D2/
|
239
|
+
prefix_color = "\e[38;5;96m"
|
240
|
+
message_color = "\e[38;5;132m"
|
241
|
+
when /^\[ D3/
|
242
|
+
prefix_color = "\e[38;5;74m"
|
243
|
+
message_color = "\e[38;5;117m"
|
244
|
+
else
|
245
|
+
prefix_color = "\e[38;5;245m"
|
246
|
+
message_color = RESET
|
247
|
+
end
|
248
|
+
|
249
|
+
message_start_index = line.index(' ]: ') + 3
|
250
|
+
prefix = line[0 .. message_start_index - 1]
|
251
|
+
message = line[message_start_index + 1 .. -1]
|
252
|
+
|
253
|
+
if message =~ /^\[.+?\]/
|
254
|
+
offset = Regexp.last_match.offset(0)
|
255
|
+
subprefix = message[0 .. offset.last - 1]
|
256
|
+
submessage = message[offset.last + 1 .. -1]
|
257
|
+
|
258
|
+
["#{prefix_color}#{prefix}#{RESET} #{UNDERLINE}#{message_color}#{subprefix}#{RESET} #{message_color}#{submessage}#{RESET}", message_color]
|
259
|
+
else
|
260
|
+
["#{prefix_color}#{prefix}#{RESET} #{message_color}#{message}#{RESET}", message_color]
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
def colorize_app_output_line(line)
|
265
|
+
message_start_index = line.index(' output: ') + 8
|
266
|
+
prefix = line[0 .. message_start_index - 1]
|
267
|
+
message = line[message_start_index .. -1]
|
268
|
+
|
269
|
+
["#{GREEN34}#{prefix}#{RESET}#{GREEN48}#{message}#{RESET}", WHITE]
|
270
|
+
end
|
271
|
+
|
272
|
+
main
|
@@ -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) %>
|
@@ -41,6 +41,7 @@ passenger_enabled on;
|
|
41
41
|
<%= nginx_option(app, :spawn_method) %>
|
42
42
|
<%= nginx_option(app, :app_type) %>
|
43
43
|
<%= nginx_option(app, :startup_file) %>
|
44
|
+
<%= nginx_option(app, :app_start_command) %>
|
44
45
|
<%= nginx_option(app, :start_timeout) %>
|
45
46
|
<%= nginx_option(app, :min_instances) %>
|
46
47
|
<%= nginx_option(app, :max_request_queue_size) %>
|
data/src/agent/AgentMain.cpp
CHANGED
@@ -36,6 +36,7 @@ int systemMetricsMain(int argc, char *argv[]);
|
|
36
36
|
int tempDirToucherMain(int argc, char *argv[]);
|
37
37
|
int spawnEnvSetupperMain(int argc, char *argv[]);
|
38
38
|
int execHelperMain(int argc, char *argv[]);
|
39
|
+
int fileReadHelperMain(int argc, char *argv[]);
|
39
40
|
|
40
41
|
static bool
|
41
42
|
isHelp(const char *arg) {
|
@@ -58,6 +59,7 @@ usage(int argc, char *argv[]) {
|
|
58
59
|
printf("Utility subcommands:\n");
|
59
60
|
printf(" system-metrics\n");
|
60
61
|
printf(" exec-helper\n");
|
62
|
+
printf(" file-read-helper\n");
|
61
63
|
}
|
62
64
|
|
63
65
|
static bool
|
@@ -90,6 +92,8 @@ dispatchSubcommand(int argc, char *argv[]) {
|
|
90
92
|
exit(spawnEnvSetupperMain(argc, argv));
|
91
93
|
} else if (strcmp(argv[1], "exec-helper") == 0) {
|
92
94
|
exit(execHelperMain(argc, argv));
|
95
|
+
} else if (strcmp(argv[1], "file-read-helper") == 0) {
|
96
|
+
exit(fileReadHelperMain(argc, argv));
|
93
97
|
} else if (strcmp(argv[1], "test-binary") == 0) {
|
94
98
|
printf("PASS\n");
|
95
99
|
exit(0);
|
@@ -49,8 +49,8 @@
|
|
49
49
|
#include <FileTools/FileManip.h>
|
50
50
|
#include <SystemTools/UserDatabase.h>
|
51
51
|
#include <Utils.h>
|
52
|
-
#include <
|
53
|
-
#include <
|
52
|
+
#include <StrIntTools/StrIntUtils.h>
|
53
|
+
#include <IOTools/IOUtils.h>
|
54
54
|
#include <Utils/AsyncSignalSafeUtils.h>
|
55
55
|
#include <LoggingKit/Context.h>
|
56
56
|
|
@@ -193,7 +193,7 @@ private:
|
|
193
193
|
args.push_back("system-properties");
|
194
194
|
|
195
195
|
int status = 0;
|
196
|
-
|
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
|
|
@@ -433,7 +433,7 @@ private:
|
|
433
433
|
pair<uid_t, gid_t> ids;
|
434
434
|
try {
|
435
435
|
ids = appPool->getGroupRunUidAndGids(key);
|
436
|
-
} catch (RuntimeException
|
436
|
+
} catch (const RuntimeException &) {
|
437
437
|
files = Json::nullValue;
|
438
438
|
}
|
439
439
|
if (!files.isNull()) {
|
@@ -470,7 +470,7 @@ private:
|
|
470
470
|
dup2(pipe.second, STDOUT_FILENO);
|
471
471
|
pipe.first.close();
|
472
472
|
pipe.second.close();
|
473
|
-
closeAllFileDescriptors(2
|
473
|
+
closeAllFileDescriptors(2);
|
474
474
|
|
475
475
|
execvp(execArgs[0], (char * const *) &execArgs[0]);
|
476
476
|
|
data/src/agent/Core/ApiServer.h
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
-
* Copyright (c) 2013-
|
3
|
+
* Copyright (c) 2013-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.
|
@@ -50,9 +50,9 @@
|
|
50
50
|
#include <LoggingKit/LoggingKit.h>
|
51
51
|
#include <LoggingKit/Context.h>
|
52
52
|
#include <Constants.h>
|
53
|
-
#include <
|
54
|
-
#include <
|
55
|
-
#include <
|
53
|
+
#include <IOTools/BufferedIO.h>
|
54
|
+
#include <IOTools/MessageIO.h>
|
55
|
+
#include <StrIntTools/StrIntUtils.h>
|
56
56
|
|
57
57
|
namespace Passenger {
|
58
58
|
namespace Core {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
-
* Copyright (c) 2014-
|
3
|
+
* Copyright (c) 2014-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.
|
@@ -33,7 +33,7 @@
|
|
33
33
|
|
34
34
|
#include <StaticString.h>
|
35
35
|
#include <Exceptions.h>
|
36
|
-
#include <
|
36
|
+
#include <JsonTools/JsonUtils.h>
|
37
37
|
#include <Core/ApplicationPool/BasicGroupInfo.h>
|
38
38
|
#include <Core/SpawningKit/Result.h>
|
39
39
|
|
@@ -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
|
}
|
@@ -295,7 +295,7 @@ Group::assignSessionsToGetWaitersQuickly(Lock &lock) {
|
|
295
295
|
return;
|
296
296
|
}
|
297
297
|
|
298
|
-
|
298
|
+
boost::container::small_vector<GetAction, 8> actions;
|
299
299
|
unsigned int i = 0;
|
300
300
|
bool done = false;
|
301
301
|
|
@@ -320,7 +320,7 @@ Group::assignSessionsToGetWaitersQuickly(Lock &lock) {
|
|
320
320
|
|
321
321
|
verifyInvariants();
|
322
322
|
lock.unlock();
|
323
|
-
|
323
|
+
boost::container::small_vector<GetAction, 50>::const_iterator it, end = actions.end();
|
324
324
|
for (it = actions.begin(); it != end; it++) {
|
325
325
|
it->callback(it->session, ExceptionPtr());
|
326
326
|
}
|
@@ -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
|
56
|
+
return uid == 0 || SpawningKit::prepareUserSwitching(options,
|
57
|
+
getWrapperRegistry()).uid == uid;
|
57
58
|
}
|
58
59
|
|
59
60
|
bool
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
-
* Copyright (c) 2011-
|
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.
|
@@ -24,7 +24,7 @@
|
|
24
24
|
* THE SOFTWARE.
|
25
25
|
*/
|
26
26
|
#include <Core/ApplicationPool/Group.h>
|
27
|
-
#include <
|
27
|
+
#include <IOTools/MessageSerialization.h>
|
28
28
|
|
29
29
|
/*************************************************************************
|
30
30
|
*
|
@@ -228,7 +228,7 @@ Group::spawnThreadOOBWRequest(GroupPtr self, ProcessPtr process) {
|
|
228
228
|
// This is copied from Core::Controller when it is sending data using the
|
229
229
|
// "session" protocol.
|
230
230
|
char sizeField[sizeof(boost::uint32_t)];
|
231
|
-
|
231
|
+
boost::container::small_vector<StaticString, 10> data;
|
232
232
|
|
233
233
|
data.push_back(StaticString(sizeField, sizeof(boost::uint32_t)));
|
234
234
|
data.push_back(P_STATIC_STRING_WITH_NULL("REQUEST_METHOD"));
|
@@ -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("
|
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-
|
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(
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
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;
|
@@ -240,7 +233,7 @@ Group::inspectConfigInAdminPanelFormat(Json::Value &result) const {
|
|
240
233
|
|
241
234
|
result["type"] = NON_EMPTY_SVAL(options.appType);
|
242
235
|
result["startup_file"] = NON_EMPTY_SVAL(options.startupFile);
|
243
|
-
result["start_command"] = NON_EMPTY_SVAL(replaceAll(options.
|
236
|
+
result["start_command"] = NON_EMPTY_SVAL(replaceAll(options.appStartCommand,
|
244
237
|
P_STATIC_STRING("\t"), P_STATIC_STRING(" ")));
|
245
238
|
result["ruby"] = SVAL(options.ruby, DEFAULT_RUBY);
|
246
239
|
result["python"] = SVAL(options.python, DEFAULT_PYTHON);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
-
* Copyright (c) 2011-
|
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.
|
@@ -36,6 +36,7 @@
|
|
36
36
|
#include <boost/shared_ptr.hpp>
|
37
37
|
#include <boost/make_shared.hpp>
|
38
38
|
#include <boost/container/vector.hpp>
|
39
|
+
#include <boost/container/small_vector.hpp>
|
39
40
|
#include <boost/atomic.hpp>
|
40
41
|
#include <oxt/macros.hpp>
|
41
42
|
#include <oxt/thread.hpp>
|
@@ -44,8 +45,8 @@
|
|
44
45
|
#include <sys/stat.h>
|
45
46
|
#include <cstdlib>
|
46
47
|
#include <cassert>
|
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
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
-
* Copyright (c) 2011-
|
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.
|
@@ -37,12 +37,12 @@
|
|
37
37
|
#include <oxt/backtrace.hpp>
|
38
38
|
#include <Exceptions.h>
|
39
39
|
#include <Hooks.h>
|
40
|
-
#include <
|
40
|
+
#include <IOTools/MessageSerialization.h>
|
41
41
|
#include <Utils.h>
|
42
|
-
#include <
|
42
|
+
#include <IOTools/IOUtils.h>
|
43
43
|
#include <Utils/ScopeGuard.h>
|
44
|
-
#include <
|
45
|
-
#include <
|
44
|
+
#include <IOTools/MessageIO.h>
|
45
|
+
#include <JsonTools/JsonUtils.h>
|
46
46
|
#include <Core/ApplicationPool/Pool.h>
|
47
47
|
#include <Core/ApplicationPool/Group.h>
|
48
48
|
#include <Core/ApplicationPool/Pool/InitializationAndShutdown.cpp>
|