puma 8.1.0-java → 8.1.1-java

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 (48) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +10 -0
  3. data/README.md +16 -381
  4. data/docs/binding.md +135 -0
  5. data/docs/cluster_mode.md +241 -0
  6. data/docs/configuration.md +78 -0
  7. data/docs/{stats.md → control_server.md} +23 -3
  8. data/docs/{deployment.md → deployment/README.md} +20 -4
  9. data/docs/{kubernetes.md → deployment/kubernetes.md} +1 -1
  10. data/docs/plugins.md +61 -2
  11. data/docs/puma_support.md +15 -1
  12. data/docs/restart.md +5 -1
  13. data/docs/signals.md +2 -0
  14. data/docs/{5.0-Upgrade.md → upgrading/5.0-Upgrade.md} +3 -3
  15. data/docs/{6.0-Upgrade.md → upgrading/6.0-Upgrade.md} +2 -2
  16. data/docs/{7.0-Upgrade.md → upgrading/7.0-Upgrade.md} +2 -2
  17. data/docs/{8.0-Upgrade.md → upgrading/8.0-Upgrade.md} +2 -2
  18. data/lib/puma/cluster.rb +0 -1
  19. data/lib/puma/const.rb +1 -1
  20. data/lib/puma/minissl.rb +1 -4
  21. data/lib/puma/puma_http11.jar +0 -0
  22. metadata +17 -35
  23. data/docs/fork_worker.md +0 -71
  24. data/docs/grpc.md +0 -62
  25. data/docs/jungle/README.md +0 -9
  26. data/docs/testing_benchmarks_local_files.md +0 -150
  27. data/docs/testing_test_rackup_ci_files.md +0 -36
  28. data/ext/puma_http11/PumaHttp11Service.java +0 -17
  29. data/ext/puma_http11/extconf.rb +0 -67
  30. data/ext/puma_http11/http11_parser.c +0 -1061
  31. data/ext/puma_http11/http11_parser.h +0 -65
  32. data/ext/puma_http11/http11_parser.java.rl +0 -131
  33. data/ext/puma_http11/http11_parser.rl +0 -149
  34. data/ext/puma_http11/http11_parser_common.rl +0 -57
  35. data/ext/puma_http11/mini_ssl.c +0 -863
  36. data/ext/puma_http11/no_ssl/PumaHttp11Service.java +0 -15
  37. data/ext/puma_http11/org/jruby/puma/EnvKey.java +0 -241
  38. data/ext/puma_http11/org/jruby/puma/Http11.java +0 -321
  39. data/ext/puma_http11/org/jruby/puma/Http11Parser.java +0 -441
  40. data/ext/puma_http11/org/jruby/puma/MiniSSL.java +0 -519
  41. data/ext/puma_http11/puma_http11.c +0 -524
  42. data/tools/Dockerfile +0 -26
  43. data/tools/trickletest.rb +0 -44
  44. /data/docs/{nginx.md → deployment/nginx.md} +0 -0
  45. /data/docs/{jungle → deployment}/rc.d/README.md +0 -0
  46. /data/docs/{jungle → deployment}/rc.d/puma +0 -0
  47. /data/docs/{jungle → deployment}/rc.d/puma.conf +0 -0
  48. /data/docs/{systemd.md → deployment/systemd.md} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e02c432552f5eaaac8c58b225f9f0dd3c22989934edd82cd1fb1bd29b5ba363
4
- data.tar.gz: 64bc20c3349c3de9518aa40131410effa3d4bf7f7c6e5e761be5a1e9b13e0af9
3
+ metadata.gz: 0fba79f28dc2923378fa1d5d91982a60fa0f5fa040d372252413c6298b3ff14e
4
+ data.tar.gz: 536c3b67d879dd8df682ebb2d119649dbda647311a8e536d7c7acf1b68ab14db
5
5
  SHA512:
6
- metadata.gz: 1ac59882efd8822b4f068fd0705cd30ca35cfff1a3d1a653c6c208793f60642ec5d0206ca002cb21253ebffc0fca01cda74dbc42be0c996d27ec131ab41fdb27
7
- data.tar.gz: e52b5670782329d492c1a3c8a2811ef183f7c4f46bb66fb8e2b109cf190a23202efd246e9a4eafdc8a886aeca4587d6c02cfbc6c95bae1edfc3e00ec94bb0521
6
+ metadata.gz: ab93e52be84c22692b15f07eb777ed28b76b59d8d2bb7a356469748bedeb24830d62ca3d1722a1d5cdd73126f416dc7584ab08a69b83f5625026f2f0ce9bcc94
7
+ data.tar.gz: 9fe0219f02e03173abcc075296b40058468bbace111c37533f864d1ffda37a97ae8366e8765786e9ac20b6850a789c71eb4cbb7cd7a98b9306218f97a7fb7752
data/History.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 8.1.1 / 2026-11-15
2
+
3
+ * Bugfixes
4
+ * Fix `pumactl stop` and SIGINT hanging in cluster mode when an `after_stopped` hook owns child processes ([#4135])
5
+ * Fix TLS stream corruption on TruffleRuby when flushing to a full socket ([#4108])
6
+ * Stop shipping development-only files in the gem ([#4124])
7
+
1
8
  ## 8.1.0 / 2026-11-15
2
9
 
3
10
  * Features
@@ -2431,6 +2438,9 @@ be added back in a future date when a java Puma::MiniSSL is added.
2431
2438
  * Bugfixes
2432
2439
  * Your bugfix goes here <Most recent on the top, like GitHub> (#Github Number)
2433
2440
 
2441
+ [#4135]:https://github.com/puma/puma/pull/4135 "PR by Nate Berkopec, merged 2026-11-15"
2442
+ [#4108]:https://github.com/puma/puma/pull/4108 "PR by Nate Berkopec, merged 2026-11-15"
2443
+ [#4124]:https://github.com/puma/puma/pull/4124 "PR by Nate Berkopec, merged 2026-11-15"
2434
2444
  [#4059]:https://github.com/puma/puma/pull/4059 "PR by William T. Nelson, merged 2026-11-09"
2435
2445
  [#3976]:https://github.com/puma/puma/pull/3976 "PR by Maksim Romanov, merged 2026-10-02"
2436
2446
  [#4021]:https://github.com/puma/puma/pull/4021 "PR by Ted Ford, merged 2026-09-27"
data/README.md CHANGED
@@ -95,355 +95,21 @@ You can also find several configuration examples as part of the
95
95
  For debugging purposes, you can set the environment variable `PUMA_LOG_CONFIG` with a value
96
96
  and the loaded configuration will be printed as part of the boot process.
97
97
 
98
- ### Thread Pool
99
-
100
- Puma uses a thread pool. You can set the minimum and maximum number of threads that are available in the pool with the `-t` (or `--threads`) flag:
101
-
102
- ```
103
- $ puma -t 8:32
104
- ```
105
-
106
- Puma will automatically scale the number of threads, from the minimum until it caps out at the maximum, based on how much traffic is present. The current default is `0:16` and on MRI is `0:5`. Feel free to experiment, but be careful not to set the number of maximum threads to a large number, as you may exhaust resources on the system (or cause contention for the Global VM Lock, when using MRI).
107
-
108
- Be aware that additionally Puma creates threads on its own for internal purposes (e.g. handling slow clients). So, even if you specify -t 1:1, expect around 7 threads created in your application.
109
-
110
- ### Cluster mode
111
-
112
- Puma also offers "cluster mode". Cluster mode `fork`s workers from a master process. Each child process still has its own thread pool. You can tune the number of workers with the `-w` (or `--workers`) flag:
113
-
114
- ```
115
- $ puma -t 8:32 -w 3
116
- ```
117
-
118
- Or with the `WEB_CONCURRENCY` environment variable:
119
-
120
- ```
121
- $ WEB_CONCURRENCY=3 puma -t 8:32
122
- ```
123
-
124
- When using a config file, most applications can simply set `workers :auto` (requires the `concurrent-ruby` gem) to match the number of worker processes to the available processors:
125
-
126
- ```ruby
127
- # config/puma.rb
128
- workers :auto
129
- ```
130
-
131
- See [`workers :auto` gotchas](lib/puma/dsl.rb).
132
-
133
- Note that threads are still used in cluster mode, and the `-t` thread flag setting is per worker, so `-w 2 -t 16:16` will spawn 32 threads in total, with 16 in each worker process.
134
-
135
- If `workers` is set to `:auto`, or the `WEB_CONCURRENCY` environment variable is set to `"auto"`, and the `concurrent-ruby` gem is available in your application, Puma will set the worker process count to the result of [available processors](https://msp-greg.github.io/concurrent-ruby/Concurrent.html#available_processor_count-class_method).
136
-
137
- For an in-depth discussion of the tradeoffs of thread and process count settings, [see our docs](docs/deployment.md).
138
-
139
- In cluster mode, Puma can "preload" your application. This loads all the application code *prior* to forking. Preloading reduces total memory usage of your application via an operating system feature called [copy-on-write](https://en.wikipedia.org/wiki/Copy-on-write).
140
-
141
- If the number of workers is greater than 1 (and `--prune-bundler` has not been specified), preloading will be enabled by default. Otherwise, you can use the `--preload` flag from the command line:
142
-
143
- ```
144
- $ puma -w 3 --preload
145
- ```
146
-
147
- Or, if you're using a configuration file, you can use the `preload_app!` method:
148
-
149
- ```ruby
150
- # config/puma.rb
151
- workers 3
152
- preload_app!
153
- ```
154
-
155
- Preloading can’t be used with phased restart, since phased restart kills and restarts workers one-by-one, and preloading copies the code of master into the workers.
156
-
157
- #### Cluster mode hooks
158
-
159
- When using clustered mode, Puma's configuration DSL provides `before_fork`, `before_worker_boot`, and `after_worker_shutdown`
160
- hooks to run code when the master process forks, the child workers are booted, and after each child worker exits respectively.
161
-
162
- It is recommended to use these hooks with `preload_app!`, otherwise constants loaded by your
163
- application (such as `Rails`) will not be available inside the hooks.
164
-
165
- ```ruby
166
- # config/puma.rb
167
- before_fork do
168
- # Add code to run inside the Puma master process before it forks a worker child.
169
- end
170
-
171
- before_worker_boot do
172
- # Add code to run inside the Puma worker process after forking.
173
- end
174
-
175
- after_worker_shutdown do |worker_handle|
176
- # Add code to run inside the Puma master process after a worker exits. `worker.process_status` can be used to get the
177
- # `Process::Status` of the exited worker.
178
- end
179
- ```
180
-
181
- In addition, there are `before_refork` and `after_refork` hooks which are used only in [`fork_worker` mode](docs/fork_worker.md),
182
- when the worker 0 child process forks a grandchild worker:
183
-
184
- ```ruby
185
- before_refork do
186
- # Used only when fork_worker mode is enabled. Add code to run inside the Puma worker 0
187
- # child process before it forks a grandchild worker.
188
- end
189
- ```
190
-
191
- ```ruby
192
- after_refork do
193
- # Used only when fork_worker mode is enabled. Add code to run inside the Puma worker 0
194
- # child process after it forks a grandchild worker.
195
- end
196
- ```
197
-
198
- Importantly, note the following considerations when Ruby forks a child process:
199
-
200
- 1. File descriptors such as network sockets **are** copied from the parent to the forked
201
- child process. Dual-use of the same sockets by parent and child will result in I/O conflicts
202
- such as `SocketError`, `Errno::EPIPE`, and `EOFError`.
203
- 2. Background Ruby threads, including threads used by various third-party gems for connection
204
- monitoring, etc., are **not** copied to the child process. Often this does not cause
205
- immediate problems until a third-party connection goes down, at which point there will
206
- be no supervisor to reconnect it.
207
-
208
- Therefore, we recommend the following:
209
-
210
- 1. If possible, do not establish any socket connections (HTTP, database connections, etc.)
211
- inside Puma's master process when booting.
212
- 2. If (1) is not possible, use `before_fork` and `before_refork` to disconnect the parent's socket
213
- connections when forking, so that they are not accidentally copied to the child process.
214
- 3. Use `before_worker_boot` to restart any background threads on the forked child.
215
- 4. Use `after_refork` to restart any background threads on the parent.
216
-
217
- #### Master process lifecycle hooks
218
-
219
- Puma's configuration DSL provides master process lifecycle hooks `after_booted`, `before_restart`, and `after_stopped`
220
- which may be used to specify code blocks to run on each event:
221
-
222
- ```ruby
223
- # config/puma.rb
224
- after_booted do
225
- # Add code to run in the Puma master process after it boots,
226
- # and also after a phased restart completes.
227
- end
228
-
229
- before_restart do
230
- # Add code to run in the Puma master process when it receives
231
- # a restart command but before it restarts.
232
- end
233
-
234
- after_stopped do
235
- # Add code to run in the Puma master process after outstanding
236
- # requests have finished and Puma has stopped.
237
- end
238
- ```
239
-
240
- ### Error handling
241
-
242
- If Puma encounters an error outside of the context of your application, it will respond with a 400/500 and a simple
243
- textual error message (see `Puma::Server#lowlevel_error` or [server.rb](https://github.com/puma/puma/blob/main/lib/puma/server.rb)).
244
- You can specify custom behavior for this scenario. For example, you can report the error to your third-party
245
- error-tracking service (in this example, [rollbar](https://rollbar.com)):
246
-
247
- ```ruby
248
- lowlevel_error_handler do |e, env, status|
249
- if status == 400
250
- message = "The server could not process the request due to an error, such as an incorrectly typed URL, malformed syntax, or a URL that contains illegal characters.\n"
251
- else
252
- message = "An error has occurred, and engineers have been informed. Please reload the page. If you continue to have problems, contact support@example.com\n"
253
- Rollbar.critical(e)
254
- end
255
-
256
- [status, {}, [message]]
257
- end
258
- ```
259
-
260
- ### Binding TCP / Sockets
261
-
262
- Bind Puma to a socket with the `-b` (or `--bind`) flag:
263
-
264
- ```
265
- $ puma -b tcp://127.0.0.1:9292
266
- ```
267
-
268
- When using a TCP socket on Linux, Puma will automatically skip requests whose connection has closed by the time it's taken from the queue. If you'd like to avoid wasting time on connections that are closing after your app starts handling them, you can call `env["puma.connection_closed?"]` at any time during the lifecycle of a request. A `false` result does not guarantee that the connection will remain open. Puma cannot check this for you during a request: it is waiting for your app to return a response.
269
-
270
- To use a UNIX Socket instead of TCP:
271
-
272
- ```
273
- $ puma -b unix:///var/run/puma.sock
274
- ```
275
-
276
- If you need to change the permissions of the UNIX socket, just add a umask parameter:
277
-
278
- ```
279
- $ puma -b 'unix:///var/run/puma.sock?umask=0111'
280
- ```
281
-
282
- Need a bit of security? Use SSL sockets:
283
-
284
- ```
285
- $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert'
286
- ```
287
- #### Self-signed SSL certificates (via the [`localhost`] gem, for development use):
288
-
289
- Puma supports the [`localhost`] gem for self-signed certificates. This is particularly useful if you want to use Puma with SSL locally, and self-signed certificates will work for your use-case. Currently, the integration can only be used in MRI.
290
-
291
- Puma automatically configures SSL when the [`localhost`] gem is loaded in a `development` environment:
292
-
293
- Add the gem to your Gemfile:
294
- ```ruby
295
- group(:development) do
296
- gem 'localhost'
297
- end
298
- ```
299
-
300
- And require it implicitly using bundler:
301
- ```ruby
302
- require "bundler"
303
- Bundler.require(:default, ENV["RACK_ENV"].to_sym)
304
- ```
305
-
306
- Alternatively, you can require the gem in your configuration file, either `config/puma/development.rb`, `config/puma.rb`, or set via the `-C` cli option:
307
- ```ruby
308
- require 'localhost'
309
- # configuration methods (from Puma::DSL) as needed
310
- ```
311
-
312
- Additionally, Puma must be listening to an SSL socket:
313
-
314
- ```shell
315
- $ puma -b 'ssl://localhost:9292' -C config/use_local_host.rb
316
-
317
- # The following options allow you to reach Puma over HTTP as well:
318
- $ puma -b ssl://localhost:9292 -b tcp://localhost:9393 -C config/use_local_host.rb
319
- ```
320
-
321
- [`localhost`]: https://github.com/socketry/localhost
322
-
323
- #### Controlling SSL Cipher Suites
324
-
325
- To use or avoid specific SSL ciphers for TLSv1.2 and below, use `ssl_cipher_filter` or `ssl_cipher_list` options.
326
-
327
- ##### Ruby:
328
-
329
- ```
330
- $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&ssl_cipher_filter=!aNULL:AES+SHA'
331
- ```
332
-
333
- ##### JRuby:
334
-
335
- ```
336
- $ puma -b 'ssl://127.0.0.1:9292?keystore=path_to_keystore&keystore-pass=keystore_password&ssl_cipher_list=TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA'
337
- ```
338
-
339
- To configure the available TLSv1.3 ciphersuites, use `ssl_ciphersuites` option (not available for JRuby).
340
-
341
- ##### Ruby:
342
-
343
- ```
344
- $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&ssl_ciphersuites=TLS_AES_256_GCM_SHA384:TLS_AES_128_GCM_SHA256'
345
- ```
346
-
347
- See https://www.openssl.org/docs/man1.1.1/man1/ciphers.html for cipher filter format and full list of cipher suites.
348
-
349
- Disable TLS v1 with the `no_tlsv1` option:
350
-
351
- ```
352
- $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&no_tlsv1=true'
353
- ```
354
-
355
- #### Controlling OpenSSL Verification Flags
356
-
357
- To enable verification flags offered by OpenSSL, use `verification_flags` (not available for JRuby):
358
-
359
- ```
360
- $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&verification_flags=PARTIAL_CHAIN'
361
- ```
362
-
363
- You can also set multiple verification flags (by separating them with a comma):
364
-
365
- ```
366
- $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&verification_flags=PARTIAL_CHAIN,CRL_CHECK'
367
- ```
368
-
369
- List of available flags: `USE_CHECK_TIME`, `CRL_CHECK`, `CRL_CHECK_ALL`, `IGNORE_CRITICAL`, `X509_STRICT`, `ALLOW_PROXY_CERTS`, `POLICY_CHECK`, `EXPLICIT_POLICY`, `INHIBIT_ANY`, `INHIBIT_MAP`, `NOTIFY_POLICY`, `EXTENDED_CRL_SUPPORT`, `USE_DELTAS`, `CHECK_SS_SIGNATURE`, `TRUSTED_FIRST`, `SUITEB_128_LOS_ONLY`, `SUITEB_192_LOS`, `SUITEB_128_LOS`, `PARTIAL_CHAIN`, `NO_ALT_CHAINS`, `NO_CHECK_TIME`
370
- (see https://www.openssl.org/docs/manmaster/man3/X509_VERIFY_PARAM_set_hostflags.html#VERIFICATION-FLAGS).
371
-
372
- #### Controlling OpenSSL Password Decryption
373
-
374
- To enable runtime decryption of an encrypted SSL key (not available for JRuby), use `key_password_command`:
375
-
376
- ```
377
- $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&key_password_command=/path/to/command.sh'
378
- ```
379
-
380
- `key_password_command` must:
381
-
382
- 1. Be executable by Puma.
383
- 2. Print the decryption password to stdout.
384
-
385
- For example:
386
-
387
- ```shell
388
- #!/bin/sh
389
-
390
- echo "this is my password"
391
- ```
392
-
393
- `key_password_command` can be used with `key` or `key_pem`. If the key
394
- is not encrypted, the executable will not be called.
395
-
396
- ### Control/Status Server
397
-
398
- Puma has a built-in status and control app that can be used to query and control Puma.
399
-
400
- ```
401
- $ puma --control-url tcp://127.0.0.1:9293 --control-token foo
402
- ```
403
-
404
- Puma will start the control server on localhost port 9293. All requests to the control server will need to include a control token (in this case, `token=foo`) as a query parameter. This allows for simple authentication. Check out `Puma::App::Status` or [status.rb](https://github.com/puma/puma/blob/main/lib/puma/app/status.rb) to see what the status app has available.
405
-
406
- You can also interact with the control server via `pumactl`. This command will restart Puma:
407
-
408
- ```
409
- $ pumactl --control-url 'tcp://127.0.0.1:9293' --control-token foo restart
410
- ```
411
-
412
- To see a list of `pumactl` options, use `pumactl --help`.
413
-
414
- ### Configuration File
415
-
416
- You can also provide a configuration file with the `-C` (or `--config`) flag:
417
-
418
- ```
419
- $ puma -C /path/to/config
420
- ```
421
-
422
- If no configuration file is specified, Puma will look for a configuration file at `config/puma.rb`. If an environment is specified (via the `--environment` flag or through the `APP_ENV`, `RACK_ENV`, or `RAILS_ENV` environment variables) Puma looks for a configuration file at `config/puma/<environment_name>.rb` and then falls back to `config/puma.rb`.
423
-
424
- If you want to prevent Puma from looking for a configuration file in those locations, include the `--no-config` flag:
425
-
426
- ```
427
- $ puma --no-config
428
-
429
- # or
430
-
431
- $ puma -C "-"
432
- ```
433
-
434
- The other side-effects of setting the environment are whether to show stack traces (in `development` or `test`), and setting RACK_ENV may potentially affect middleware looking for this value to change their behavior. The default puma RACK_ENV value is `development`. You can see all config default values in `Puma::Configuration#puma_default_options` or [configuration.rb](https://github.com/puma/puma/blob/61c6213fbab/lib/puma/configuration.rb#L182-L204).
435
-
436
- Check out `Puma::DSL` or [dsl.rb](https://github.com/puma/puma/blob/main/lib/puma/dsl.rb) to see all available options.
437
-
438
- ## Restart
439
-
440
- Puma includes the ability to restart itself. When available (MRI, Rubinius, JRuby), Puma performs a "hot restart". This is the same functionality available in *Unicorn* and *NGINX* which keep the server sockets open between restarts. This makes sure that no pending requests are dropped while the restart is taking place.
441
-
442
- For more, see the [Restart documentation](docs/restart.md).
443
-
444
- ## Signals
445
-
446
- Puma responds to several signals. A detailed guide to using UNIX signals with Puma can be found in the [Signals documentation](docs/signals.md).
98
+ ## Documentation
99
+
100
+ * [Configuration](docs/configuration.md)
101
+ * [Cluster mode](docs/cluster_mode.md)
102
+ * [Binding TCP / Sockets and SSL](docs/binding.md)
103
+ * [Control/Status Server and stats](docs/control_server.md)
104
+ * [Restart](docs/restart.md)
105
+ * [Signals](docs/signals.md)
106
+ * [Plugins](docs/plugins.md)
107
+ * [Deployment](docs/deployment/README.md)
108
+ * [Running Puma in Rails development mode](docs/rails_dev_mode.md)
109
+ * [Compile options](docs/compile_options.md) and [Java options](docs/java_options.md)
110
+ * [Architecture](docs/architecture.md)
111
+ * [Support policy](docs/puma_support.md)
112
+ * [Upgrade guides](docs/upgrading)
447
113
 
448
114
  ## Platform Constraints
449
115
 
@@ -451,38 +117,7 @@ Some platforms do not support all Puma features.
451
117
 
452
118
  * **JRuby**, **Windows**: server sockets are not seamless on restart, they must be closed and reopened. These platforms have no way to pass descriptors into a new process that is exposed to Ruby. Also, cluster mode is not supported due to a lack of fork(2).
453
119
  * **Windows**: Cluster mode is not supported due to a lack of fork(2).
454
- * **Kubernetes**: The way Kubernetes handles pod shutdowns interacts poorly with server processes implementing graceful shutdown, like Puma. See the [kubernetes section of the documentation](docs/kubernetes.md) for more details.
455
-
456
- ## Deployment
457
-
458
- * Puma has support for Capistrano with an [external gem](https://github.com/seuros/capistrano-puma).
459
-
460
- * Additionally, Puma has support for built-in daemonization via the [puma-daemon](https://github.com/kigster/puma-daemon) ruby gem. The gem restores the `daemonize` option that was removed from Puma starting version 5, but only for MRI Ruby.
461
-
462
-
463
- It is common to use process monitors with Puma. Modern process monitors like systemd or rc.d
464
- provide continuous monitoring and restarts for increased reliability in production environments:
465
-
466
- * [rc.d](docs/jungle/rc.d/README.md)
467
- * [systemd](docs/systemd.md)
468
-
469
- Community guides:
470
-
471
- * [Deploying Puma on OpenBSD using relayd and httpd](https://gist.github.com/anon987654321/4532cf8d6c59c1f43ec8973faa031103)
472
-
473
- ## Community Extensions
474
-
475
- ### Plugins
476
-
477
- * [puma-metrics](https://github.com/harmjanblok/puma-metrics) — export Puma metrics to Prometheus
478
- * [puma-plugin-statsd](https://github.com/yob/puma-plugin-statsd) — send Puma metrics to statsd
479
- * [puma-plugin-systemd](https://github.com/sj26/puma-plugin-systemd) — deeper integration with systemd for notify, status and watchdog. Puma 5.1.0 integrated notify and watchdog, which probably conflicts with this plugin. Puma 6.1.0 added status support which obsoletes the plugin entirely.
480
- * [puma-plugin-telemetry](https://github.com/babbel/puma-plugin-telemetry) - telemetry plugin for Puma offering various targets to publish
481
- * [puma-acme](https://github.com/anchordotdev/puma-acme) - automatic SSL/HTTPS certificate provisioning and setup
482
-
483
- ### Monitoring
484
-
485
- * [puma-status](https://github.com/ylecuyer/puma-status) — Monitor CPU/Mem/Load of running puma instances from the CLI
120
+ * **Kubernetes**: The way Kubernetes handles pod shutdowns interacts poorly with server processes implementing graceful shutdown, like Puma. See the [kubernetes section of the documentation](docs/deployment/kubernetes.md) for more details.
486
121
 
487
122
  ## Merchandise
488
123
 
data/docs/binding.md ADDED
@@ -0,0 +1,135 @@
1
+ # Binding TCP / Sockets
2
+
3
+ Bind Puma to a socket with the `-b` (or `--bind`) flag:
4
+
5
+ ```
6
+ $ puma -b tcp://127.0.0.1:9292
7
+ ```
8
+
9
+ When using a TCP socket on Linux, Puma will automatically skip requests whose connection has closed by the time it's taken from the queue. If you'd like to avoid wasting time on connections that are closing after your app starts handling them, you can call `env["puma.connection_closed?"]` at any time during the lifecycle of a request. A `false` result does not guarantee that the connection will remain open. Puma cannot check this for you during a request: it is waiting for your app to return a response.
10
+
11
+ To use a UNIX Socket instead of TCP:
12
+
13
+ ```
14
+ $ puma -b unix:///var/run/puma.sock
15
+ ```
16
+
17
+ If you need to change the permissions of the UNIX socket, just add a umask parameter:
18
+
19
+ ```
20
+ $ puma -b 'unix:///var/run/puma.sock?umask=0111'
21
+ ```
22
+
23
+ Need a bit of security? Use SSL sockets:
24
+
25
+ ```
26
+ $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert'
27
+ ```
28
+ ## Self-signed SSL certificates (via the [`localhost`] gem, for development use):
29
+
30
+ Puma supports the [`localhost`] gem for self-signed certificates. This is particularly useful if you want to use Puma with SSL locally, and self-signed certificates will work for your use-case. Currently, the integration can only be used in MRI.
31
+
32
+ Puma automatically configures SSL when the [`localhost`] gem is loaded in a `development` environment:
33
+
34
+ Add the gem to your Gemfile:
35
+ ```ruby
36
+ group(:development) do
37
+ gem 'localhost'
38
+ end
39
+ ```
40
+
41
+ And require it implicitly using bundler:
42
+ ```ruby
43
+ require "bundler"
44
+ Bundler.require(:default, ENV["RACK_ENV"].to_sym)
45
+ ```
46
+
47
+ Alternatively, you can require the gem in your configuration file, either `config/puma/development.rb`, `config/puma.rb`, or set via the `-C` cli option:
48
+ ```ruby
49
+ require 'localhost'
50
+ # configuration methods (from Puma::DSL) as needed
51
+ ```
52
+
53
+ Additionally, Puma must be listening to an SSL socket:
54
+
55
+ ```shell
56
+ $ puma -b 'ssl://localhost:9292' -C config/use_local_host.rb
57
+
58
+ # The following options allow you to reach Puma over HTTP as well:
59
+ $ puma -b ssl://localhost:9292 -b tcp://localhost:9393 -C config/use_local_host.rb
60
+ ```
61
+
62
+ [`localhost`]: https://github.com/socketry/localhost
63
+
64
+ ## Controlling SSL Cipher Suites
65
+
66
+ To use or avoid specific SSL ciphers for TLSv1.2 and below, use `ssl_cipher_filter` or `ssl_cipher_list` options.
67
+
68
+ ### Ruby:
69
+
70
+ ```
71
+ $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&ssl_cipher_filter=!aNULL:AES+SHA'
72
+ ```
73
+
74
+ ### JRuby:
75
+
76
+ ```
77
+ $ puma -b 'ssl://127.0.0.1:9292?keystore=path_to_keystore&keystore-pass=keystore_password&ssl_cipher_list=TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA'
78
+ ```
79
+
80
+ To configure the available TLSv1.3 ciphersuites, use `ssl_ciphersuites` option (not available for JRuby).
81
+
82
+ ### Ruby:
83
+
84
+ ```
85
+ $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&ssl_ciphersuites=TLS_AES_256_GCM_SHA384:TLS_AES_128_GCM_SHA256'
86
+ ```
87
+
88
+ See https://www.openssl.org/docs/man1.1.1/man1/ciphers.html for cipher filter format and full list of cipher suites.
89
+
90
+ Disable TLS v1 with the `no_tlsv1` option:
91
+
92
+ ```
93
+ $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&no_tlsv1=true'
94
+ ```
95
+
96
+ ## Controlling OpenSSL Verification Flags
97
+
98
+ To enable verification flags offered by OpenSSL, use `verification_flags` (not available for JRuby):
99
+
100
+ ```
101
+ $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&verification_flags=PARTIAL_CHAIN'
102
+ ```
103
+
104
+ You can also set multiple verification flags (by separating them with a comma):
105
+
106
+ ```
107
+ $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&verification_flags=PARTIAL_CHAIN,CRL_CHECK'
108
+ ```
109
+
110
+ List of available flags: `USE_CHECK_TIME`, `CRL_CHECK`, `CRL_CHECK_ALL`, `IGNORE_CRITICAL`, `X509_STRICT`, `ALLOW_PROXY_CERTS`, `POLICY_CHECK`, `EXPLICIT_POLICY`, `INHIBIT_ANY`, `INHIBIT_MAP`, `NOTIFY_POLICY`, `EXTENDED_CRL_SUPPORT`, `USE_DELTAS`, `CHECK_SS_SIGNATURE`, `TRUSTED_FIRST`, `SUITEB_128_LOS_ONLY`, `SUITEB_192_LOS`, `SUITEB_128_LOS`, `PARTIAL_CHAIN`, `NO_ALT_CHAINS`, `NO_CHECK_TIME`
111
+ (see https://www.openssl.org/docs/manmaster/man3/X509_VERIFY_PARAM_set_hostflags.html#VERIFICATION-FLAGS).
112
+
113
+ ## Controlling OpenSSL Password Decryption
114
+
115
+ To enable runtime decryption of an encrypted SSL key (not available for JRuby), use `key_password_command`:
116
+
117
+ ```
118
+ $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&key_password_command=/path/to/command.sh'
119
+ ```
120
+
121
+ `key_password_command` must:
122
+
123
+ 1. Be executable by Puma.
124
+ 2. Print the decryption password to stdout.
125
+
126
+ For example:
127
+
128
+ ```shell
129
+ #!/bin/sh
130
+
131
+ echo "this is my password"
132
+ ```
133
+
134
+ `key_password_command` can be used with `key` or `key_pem`. If the key
135
+ is not encrypted, the executable will not be called.