ed-precompiled_puma 7.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. checksums.yaml +7 -0
  2. data/History.md +3172 -0
  3. data/LICENSE +29 -0
  4. data/README.md +477 -0
  5. data/bin/puma +10 -0
  6. data/bin/puma-wild +25 -0
  7. data/bin/pumactl +12 -0
  8. data/docs/architecture.md +74 -0
  9. data/docs/compile_options.md +55 -0
  10. data/docs/deployment.md +102 -0
  11. data/docs/fork_worker.md +41 -0
  12. data/docs/images/puma-connection-flow-no-reactor.png +0 -0
  13. data/docs/images/puma-connection-flow.png +0 -0
  14. data/docs/images/puma-general-arch.png +0 -0
  15. data/docs/java_options.md +54 -0
  16. data/docs/jungle/README.md +9 -0
  17. data/docs/jungle/rc.d/README.md +74 -0
  18. data/docs/jungle/rc.d/puma +61 -0
  19. data/docs/jungle/rc.d/puma.conf +10 -0
  20. data/docs/kubernetes.md +80 -0
  21. data/docs/nginx.md +80 -0
  22. data/docs/plugins.md +42 -0
  23. data/docs/rails_dev_mode.md +28 -0
  24. data/docs/restart.md +65 -0
  25. data/docs/signals.md +98 -0
  26. data/docs/stats.md +148 -0
  27. data/docs/systemd.md +253 -0
  28. data/docs/testing_benchmarks_local_files.md +150 -0
  29. data/docs/testing_test_rackup_ci_files.md +36 -0
  30. data/ext/puma_http11/PumaHttp11Service.java +17 -0
  31. data/ext/puma_http11/ext_help.h +15 -0
  32. data/ext/puma_http11/extconf.rb +65 -0
  33. data/ext/puma_http11/http11_parser.c +1057 -0
  34. data/ext/puma_http11/http11_parser.h +65 -0
  35. data/ext/puma_http11/http11_parser.java.rl +145 -0
  36. data/ext/puma_http11/http11_parser.rl +149 -0
  37. data/ext/puma_http11/http11_parser_common.rl +54 -0
  38. data/ext/puma_http11/mini_ssl.c +852 -0
  39. data/ext/puma_http11/no_ssl/PumaHttp11Service.java +15 -0
  40. data/ext/puma_http11/org/jruby/puma/Http11.java +257 -0
  41. data/ext/puma_http11/org/jruby/puma/Http11Parser.java +455 -0
  42. data/ext/puma_http11/org/jruby/puma/MiniSSL.java +509 -0
  43. data/ext/puma_http11/puma_http11.c +507 -0
  44. data/lib/puma/app/status.rb +96 -0
  45. data/lib/puma/binder.rb +511 -0
  46. data/lib/puma/cli.rb +245 -0
  47. data/lib/puma/client.rb +720 -0
  48. data/lib/puma/cluster/worker.rb +182 -0
  49. data/lib/puma/cluster/worker_handle.rb +127 -0
  50. data/lib/puma/cluster.rb +635 -0
  51. data/lib/puma/cluster_accept_loop_delay.rb +91 -0
  52. data/lib/puma/commonlogger.rb +115 -0
  53. data/lib/puma/configuration.rb +452 -0
  54. data/lib/puma/const.rb +307 -0
  55. data/lib/puma/control_cli.rb +320 -0
  56. data/lib/puma/detect.rb +47 -0
  57. data/lib/puma/dsl.rb +1480 -0
  58. data/lib/puma/error_logger.rb +115 -0
  59. data/lib/puma/events.rb +72 -0
  60. data/lib/puma/io_buffer.rb +50 -0
  61. data/lib/puma/jruby_restart.rb +11 -0
  62. data/lib/puma/json_serialization.rb +96 -0
  63. data/lib/puma/launcher/bundle_pruner.rb +104 -0
  64. data/lib/puma/launcher.rb +496 -0
  65. data/lib/puma/log_writer.rb +147 -0
  66. data/lib/puma/minissl/context_builder.rb +96 -0
  67. data/lib/puma/minissl.rb +463 -0
  68. data/lib/puma/null_io.rb +101 -0
  69. data/lib/puma/plugin/systemd.rb +90 -0
  70. data/lib/puma/plugin/tmp_restart.rb +36 -0
  71. data/lib/puma/plugin.rb +111 -0
  72. data/lib/puma/rack/builder.rb +297 -0
  73. data/lib/puma/rack/urlmap.rb +93 -0
  74. data/lib/puma/rack_default.rb +24 -0
  75. data/lib/puma/reactor.rb +140 -0
  76. data/lib/puma/request.rb +701 -0
  77. data/lib/puma/runner.rb +211 -0
  78. data/lib/puma/sd_notify.rb +146 -0
  79. data/lib/puma/server.rb +734 -0
  80. data/lib/puma/single.rb +72 -0
  81. data/lib/puma/state_file.rb +69 -0
  82. data/lib/puma/thread_pool.rb +402 -0
  83. data/lib/puma/util.rb +134 -0
  84. data/lib/puma.rb +93 -0
  85. data/lib/rack/handler/puma.rb +144 -0
  86. data/tools/Dockerfile +18 -0
  87. data/tools/trickletest.rb +44 -0
  88. metadata +152 -0
data/lib/puma/cli.rb ADDED
@@ -0,0 +1,245 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'optparse'
4
+ require 'uri'
5
+
6
+ require_relative '../puma'
7
+ require_relative 'configuration'
8
+ require_relative 'launcher'
9
+ require_relative 'const'
10
+ require_relative 'log_writer'
11
+
12
+ module Puma
13
+ class << self
14
+ # The CLI exports a Puma::Configuration instance here to allow
15
+ # apps to pick it up. An app must load this object conditionally
16
+ # because it is not set if the app is launched via any mechanism
17
+ # other than the CLI class.
18
+ attr_accessor :cli_config
19
+ end
20
+
21
+ # Handles invoke a Puma::Server in a command line style.
22
+ #
23
+ class CLI
24
+ # Create a new CLI object using +argv+ as the command line
25
+ # arguments.
26
+ #
27
+ def initialize(argv, log_writer = LogWriter.stdio, events = Events.new, env: ENV)
28
+ @debug = false
29
+ @argv = argv.dup
30
+ @log_writer = log_writer
31
+ @events = events
32
+
33
+ @conf = nil
34
+
35
+ @stdout = nil
36
+ @stderr = nil
37
+ @append = false
38
+
39
+ @control_url = nil
40
+ @control_options = {}
41
+
42
+ begin
43
+ setup_options env
44
+
45
+ if file = @argv.shift
46
+ @conf.configure do |user_config, file_config|
47
+ file_config.rackup file
48
+ end
49
+ end
50
+ rescue UnsupportedOption
51
+ exit 1
52
+ end
53
+
54
+ @conf.configure do |user_config, file_config|
55
+ if @stdout || @stderr
56
+ user_config.stdout_redirect @stdout, @stderr, @append
57
+ end
58
+
59
+ if @control_url
60
+ user_config.activate_control_app @control_url, @control_options
61
+ end
62
+ end
63
+
64
+ @launcher = Puma::Launcher.new(@conf, env: ENV, log_writer: @log_writer, events: @events, argv: argv)
65
+ end
66
+
67
+ attr_reader :launcher
68
+
69
+ # Parse the options, load the rackup, start the server and wait
70
+ # for it to finish.
71
+ #
72
+ def run
73
+ @launcher.run
74
+ end
75
+
76
+ private
77
+ def unsupported(str)
78
+ @log_writer.error(str)
79
+ raise UnsupportedOption
80
+ end
81
+
82
+ def configure_control_url(command_line_arg)
83
+ if command_line_arg
84
+ @control_url = command_line_arg
85
+ elsif Puma.jruby?
86
+ unsupported "No default url available on JRuby"
87
+ end
88
+ end
89
+
90
+ # Build the OptionParser object to handle the available options.
91
+ #
92
+
93
+ def setup_options(env = ENV)
94
+ @conf = Configuration.new({}, { events: @events }, env) do |user_config, file_config|
95
+ @parser = OptionParser.new do |o|
96
+ o.on "-b", "--bind URI", "URI to bind to (tcp://, unix://, ssl://)" do |arg|
97
+ user_config.bind arg
98
+ end
99
+
100
+ o.on "--bind-to-activated-sockets [only]", "Bind to all activated sockets" do |arg|
101
+ user_config.bind_to_activated_sockets(arg || true)
102
+ end
103
+
104
+ o.on "-C", "--config PATH", "Load PATH as a config file" do |arg|
105
+ file_config.load arg
106
+ end
107
+
108
+ # Identical to supplying --config "-", but more semantic
109
+ o.on "--no-config", "Prevent Puma from searching for a config file" do |arg|
110
+ file_config.load "-"
111
+ end
112
+
113
+ o.on "--control-url URL", "The bind url to use for the control server. Use 'auto' to use temp unix server" do |arg|
114
+ configure_control_url(arg)
115
+ end
116
+
117
+ o.on "--control-token TOKEN",
118
+ "The token to use as authentication for the control server" do |arg|
119
+ @control_options[:auth_token] = arg
120
+ end
121
+
122
+ o.on "--debug", "Log lowlevel debugging information" do
123
+ user_config.debug
124
+ end
125
+
126
+ o.on "--dir DIR", "Change to DIR before starting" do |d|
127
+ user_config.directory d
128
+ end
129
+
130
+ o.on "-e", "--environment ENVIRONMENT",
131
+ "The environment to run the Rack app on (default development)" do |arg|
132
+ user_config.environment arg
133
+ end
134
+
135
+ o.on "-f", "--fork-worker=[REQUESTS]", OptionParser::DecimalInteger,
136
+ "Fork new workers from existing worker. Cluster mode only",
137
+ "Auto-refork after REQUESTS (default 1000)" do |*args|
138
+ user_config.fork_worker(*args.compact)
139
+ end
140
+
141
+ o.on "-I", "--include PATH", "Specify $LOAD_PATH directories" do |arg|
142
+ $LOAD_PATH.unshift(*arg.split(':'))
143
+ end
144
+
145
+ o.on "--idle-timeout SECONDS", "Number of seconds until the next request before automatic shutdown" do |arg|
146
+ user_config.idle_timeout arg
147
+ end
148
+
149
+ o.on "-p", "--port PORT", "Define the TCP port to bind to",
150
+ "Use -b for more advanced options" do |arg|
151
+ user_config.bind "tcp://#{Configuration::DEFAULTS[:tcp_host]}:#{arg}"
152
+ end
153
+
154
+ o.on "--pidfile PATH", "Use PATH as a pidfile" do |arg|
155
+ user_config.pidfile arg
156
+ end
157
+
158
+ o.on "--plugin PLUGIN", "Load the given PLUGIN. Can be used multiple times to load multiple plugins." do |arg|
159
+ user_config.plugin arg
160
+ end
161
+
162
+ o.on "--preload", "Preload the app. Cluster mode only" do
163
+ user_config.preload_app!
164
+ end
165
+
166
+ o.on "--prune-bundler", "Prune out the bundler env if possible" do
167
+ user_config.prune_bundler
168
+ end
169
+
170
+ o.on "--extra-runtime-dependencies GEM1,GEM2", "Defines any extra needed gems when using --prune-bundler" do |arg|
171
+ user_config.extra_runtime_dependencies arg.split(',')
172
+ end
173
+
174
+ o.on "-q", "--quiet", "Do not log requests internally (default true)" do
175
+ user_config.quiet
176
+ end
177
+
178
+ o.on "-v", "--log-requests", "Log requests as they occur" do
179
+ user_config.log_requests
180
+ end
181
+
182
+ o.on "-R", "--restart-cmd CMD",
183
+ "The puma command to run during a hot restart",
184
+ "Default: inferred" do |cmd|
185
+ user_config.restart_command cmd
186
+ end
187
+
188
+ o.on "-s", "--silent", "Do not log prompt messages other than errors" do
189
+ @log_writer = LogWriter.new(NullIO.new, $stderr)
190
+ end
191
+
192
+ o.on "-S", "--state PATH", "Where to store the state details" do |arg|
193
+ user_config.state_path arg
194
+ end
195
+
196
+ o.on '-t', '--threads INT', "min:max threads to use (default 0:16)" do |arg|
197
+ min, max = arg.split(":")
198
+ if max
199
+ user_config.threads min, max
200
+ else
201
+ user_config.threads min, min
202
+ end
203
+ end
204
+
205
+ o.on "--early-hints", "Enable early hints support" do
206
+ user_config.early_hints
207
+ end
208
+
209
+ o.on "-V", "--version", "Print the version information" do
210
+ puts "puma version #{Puma::Const::VERSION}"
211
+ exit 0
212
+ end
213
+
214
+ o.on "-w", "--workers COUNT",
215
+ "Activate cluster mode: How many worker processes to create" do |arg|
216
+ user_config.workers arg
217
+ end
218
+
219
+ o.on "--tag NAME", "Additional text to display in process listing" do |arg|
220
+ user_config.tag arg
221
+ end
222
+
223
+ o.on "--redirect-stdout FILE", "Redirect STDOUT to a specific file" do |arg|
224
+ @stdout = arg.to_s
225
+ end
226
+
227
+ o.on "--redirect-stderr FILE", "Redirect STDERR to a specific file" do |arg|
228
+ @stderr = arg.to_s
229
+ end
230
+
231
+ o.on "--[no-]redirect-append", "Append to redirected files" do |val|
232
+ @append = val
233
+ end
234
+
235
+ o.banner = "puma <options> <rackup file>"
236
+
237
+ o.on_tail "-h", "--help", "Show help" do
238
+ $stdout.puts o
239
+ exit 0
240
+ end
241
+ end.parse! @argv
242
+ end
243
+ end
244
+ end
245
+ end