puma 5.6.8 → 6.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +332 -16
  3. data/README.md +79 -29
  4. data/bin/puma-wild +1 -1
  5. data/docs/compile_options.md +34 -0
  6. data/docs/fork_worker.md +1 -3
  7. data/docs/kubernetes.md +12 -0
  8. data/docs/nginx.md +1 -1
  9. data/docs/restart.md +1 -0
  10. data/docs/systemd.md +3 -6
  11. data/docs/testing_benchmarks_local_files.md +150 -0
  12. data/docs/testing_test_rackup_ci_files.md +36 -0
  13. data/ext/puma_http11/extconf.rb +16 -9
  14. data/ext/puma_http11/http11_parser.c +1 -1
  15. data/ext/puma_http11/http11_parser.h +1 -1
  16. data/ext/puma_http11/http11_parser.java.rl +2 -2
  17. data/ext/puma_http11/http11_parser.rl +2 -2
  18. data/ext/puma_http11/http11_parser_common.rl +2 -2
  19. data/ext/puma_http11/mini_ssl.c +127 -19
  20. data/ext/puma_http11/org/jruby/puma/Http11.java +5 -3
  21. data/ext/puma_http11/org/jruby/puma/Http11Parser.java +1 -1
  22. data/ext/puma_http11/org/jruby/puma/MiniSSL.java +157 -53
  23. data/ext/puma_http11/puma_http11.c +17 -9
  24. data/lib/puma/app/status.rb +4 -4
  25. data/lib/puma/binder.rb +50 -53
  26. data/lib/puma/cli.rb +16 -18
  27. data/lib/puma/client.rb +59 -19
  28. data/lib/puma/cluster/worker.rb +18 -11
  29. data/lib/puma/cluster/worker_handle.rb +4 -1
  30. data/lib/puma/cluster.rb +102 -40
  31. data/lib/puma/commonlogger.rb +21 -14
  32. data/lib/puma/configuration.rb +77 -59
  33. data/lib/puma/const.rb +137 -92
  34. data/lib/puma/control_cli.rb +15 -11
  35. data/lib/puma/detect.rb +7 -4
  36. data/lib/puma/dsl.rb +250 -56
  37. data/lib/puma/error_logger.rb +18 -9
  38. data/lib/puma/events.rb +6 -126
  39. data/lib/puma/io_buffer.rb +39 -4
  40. data/lib/puma/jruby_restart.rb +2 -1
  41. data/lib/puma/launcher/bundle_pruner.rb +104 -0
  42. data/lib/puma/launcher.rb +102 -175
  43. data/lib/puma/log_writer.rb +147 -0
  44. data/lib/puma/minissl/context_builder.rb +26 -12
  45. data/lib/puma/minissl.rb +104 -11
  46. data/lib/puma/null_io.rb +16 -2
  47. data/lib/puma/plugin/systemd.rb +90 -0
  48. data/lib/puma/plugin/tmp_restart.rb +1 -1
  49. data/lib/puma/rack/builder.rb +6 -6
  50. data/lib/puma/rack/urlmap.rb +1 -1
  51. data/lib/puma/rack_default.rb +19 -4
  52. data/lib/puma/reactor.rb +19 -10
  53. data/lib/puma/request.rb +380 -172
  54. data/lib/puma/runner.rb +56 -20
  55. data/lib/puma/sd_notify.rb +149 -0
  56. data/lib/puma/server.rb +137 -89
  57. data/lib/puma/single.rb +13 -11
  58. data/lib/puma/state_file.rb +3 -6
  59. data/lib/puma/thread_pool.rb +57 -19
  60. data/lib/puma/util.rb +0 -11
  61. data/lib/puma.rb +9 -10
  62. data/lib/rack/handler/puma.rb +113 -86
  63. data/tools/Dockerfile +2 -2
  64. metadata +11 -7
  65. data/lib/puma/queue_close.rb +0 -26
  66. data/lib/puma/systemd.rb +0 -46
  67. data/lib/rack/version_restriction.rb +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc34dc2b7094b86d3eec5100455de02cdcfb14a2e382059565e06e512d5c40ac
4
- data.tar.gz: 10080424606d3a4613f1b27b33199a048711da57e4b45a55f7e997346c64c419
3
+ metadata.gz: e3cedcd91a2366db019124505992d71ff47717760e4c3f37d9e7ae681c45bbdb
4
+ data.tar.gz: 6ad4999caa3542103c8bb2d3a1bd49202e1c8cf71d409ee96e13d23c169f0d32
5
5
  SHA512:
6
- metadata.gz: 18da16eff3311151ff29f868f07762d509541b1302dd6ff80bf323bb6fdd73da9d8bc32983a37b71e439faf4753e8110bdafb8f444df205b62f742376c980147
7
- data.tar.gz: 89968813be0e066fc4de68dc439827d621d2d1803c58c64ee2df78f4d9baa4785fc7865d655990564ff52d9cd64ebc8d9dbc4be048334e0f8db954d83efaeef1
6
+ metadata.gz: a69d8cec268d2e35444609f2e69e737e47eb1dc30dd2b3a387e5f3e84bc4905d8241ae3b158f39259a9930ca093fff17db927039aaef54583e6c1a30d8b12a61
7
+ data.tar.gz: f03e924b53e70ac876c786031b23775e4b91aa5d009d5f40fb9a0c241093a238c4b78a99fc062c8495e634b2cfc8561626e9aaf0888c203d40cf84f9d14c539b
data/History.md CHANGED
@@ -1,4 +1,189 @@
1
- ## 5.6.8 / 2023-01-08
1
+ ## 6.4.3 / 2024-09-19
2
+
3
+ * Security
4
+ * Discards any headers using underscores if the non-underscore version also exists. Without this, an attacker could overwrite values set by intermediate proxies (e.g. X-Forwarded-For). ([CVE-2024-45614](https://github.com/puma/puma/security/advisories/GHSA-9hf4-67fc-4vf4)/GHSA-9hf4-67fc-4vf4)
5
+
6
+ ## 6.4.2 / 2024-01-08
7
+
8
+ * Security
9
+ * Limit the size of chunk extensions. Without this limit, an attacker could cause unbounded resource (CPU, network bandwidth) consumption. ([GHSA-c2f4-cvqm-65w2](https://github.com/puma/puma/security/advisories/GHSA-c2f4-cvqm-65w2))
10
+
11
+ ## 6.4.1 / 2024-01-03
12
+
13
+ * Bugfixes
14
+ * DSL#warn_if_in_single_mode - fixup when workers set via CLI ([#3256])
15
+ * Fix `idle-timeout` not working in cluster mode ([#3235], [#3228], [#3282], [#3283])
16
+ * Fix worker 0 timing out during phased restart ([#3225], [#2786])
17
+ * context_builder.rb - require openssl if verify_mode != 'none' ([#3179])
18
+ * Make puma cluster process suitable as PID 1 ([#3255])
19
+ * Improve Puma::NullIO consistency with real IO ([#3276])
20
+ * extconf.rb - fixup to detect openssl info in Ruby build ([#3271], [#3266])
21
+ * MiniSSL.java - set serialVersionUID, fix RaiseException deprecation ([#3270])
22
+ * dsl.rb - fix warn_if_in_single_mode when WEB_CONCURRENCY is set ([#3265], [#3264])
23
+
24
+ * Maintenance
25
+ * LOTS of test refactoring to make tests more stable and easier to write - thanks to @MSP-Greg!
26
+ * Fix bug in tests re: TestPuma::HOST4 ([#3254])
27
+ * Dockerfile for minimal repros: use Ruby 3.2, expect bundler installed ([#3245])
28
+ * fix define_method calls, use Symbol parameter instead of String ([#3293])
29
+
30
+ * Docs
31
+ * README.md - add the puma-acme plugin ([#3301])
32
+ * Remove `--keep-file-descriptors` flag from systemd docs ([#3248])
33
+ * Note symlink mechanism in restart documentation for hot restart ([#3298])
34
+
35
+ ## 6.4.0 / 2023-09-21
36
+
37
+ * Features
38
+ * on_thread_exit hook ([#2920])
39
+ * on_thread_start_hook ([#3195])
40
+ * Shutdown on idle ([#3209], [#2580])
41
+ * New error message when control server port taken ([#3204])
42
+
43
+ * Refactor
44
+ * Remove `Forwardable` dependency ([#3191], #3190)
45
+ * Update URLMap Regexp usage for Ruby v3.3 ([#3165])
46
+
47
+ * Bugfixes
48
+ * Bring the cert_pem: parameter into parity with the cert: parameter to ssl_bind. ([#3174])
49
+ * Fix using control server with IPv6 host ([#3181])
50
+ * control_cli.rb - add require_relative 'log_writer' ([#3187])
51
+ * Fix cases where fallback Rack response wasn't sent to the client ([#3094])
52
+
53
+ ## 6.3.1 / 2023-08-18
54
+
55
+ * Security
56
+ * Address HTTP request smuggling vulnerabilities with zero-length Content Length header and trailer fields ([GHSA-68xg-gqqm-vgj8](https://github.com/puma/puma/security/advisories/GHSA-68xg-gqqm-vgj8))
57
+
58
+ ## 6.3.0 / 2023-05-31
59
+
60
+ * Features
61
+ * Add dsl method `supported_http_methods` ([#3106], [#3014])
62
+ * Puma error responses no longer have any fingerprints to indicate Puma ([#3161], [#3037])
63
+ * Support decryption of SSL key ([#3133], [#3132])
64
+
65
+ * Bugfixes
66
+ * Don't send 103 early hints response when only invalid headers are used ([#3163])
67
+ * Handle malformed request path ([#3155], [#3148])
68
+ * Misc lib file fixes - trapping additional errors, CI helper ([#3129])
69
+ * Fixup req form data file upload with "r\n" line endings ([#3137])
70
+ * Restore rack 1.6 compatibility ([#3156])
71
+
72
+ * Refactor
73
+ * const.rb - Update Puma::HTTP_STATUS_CODES ([#3162])
74
+ * Clarify Reactor#initialize ([#3151])
75
+
76
+ ## 6.2.2 / 2023-04-17
77
+
78
+ * Bugfixes
79
+ * Fix Rack-related NameError by adding :: operator ([#3118], [#3117])
80
+
81
+ ## 6.2.1 / 2023-03-31
82
+
83
+ * Bugfixes
84
+ * Fix java 8 compatibility ([#3109], [#3108])
85
+ * Always write io_buffer when in "enum bodies" branch. ([#3113], [#3112])
86
+ * Fix warn_if_in_single_mode incorrect message ([#3111])
87
+
88
+ ## 6.2.0 / 2023-03-29
89
+
90
+ * Features
91
+ * Ability to supply a custom logger ([#2770], [#2511])
92
+ * Warn when clustered-only hooks are defined in single mode ([#3089])
93
+ * Adds the on_booted event ([#2709])
94
+
95
+ * Bugfixes
96
+ * Loggers - internal_write - catch Errno::EINVAL ([#3091])
97
+ * commonlogger.rb - fix HIJACK time format, use constants, not strings ([#3074])
98
+ * Fixed some edge cases regarding request hijacking ([#3072])
99
+
100
+ ## 6.1.1 / 2023-02-28
101
+
102
+ * Bugfixes
103
+ * We no longer try to use the systemd plugin for JRuby ([#3079])
104
+ * Allow ::Rack::Handler::Puma.run to work regardless of whether Rack/Rackup are loaded ([#3080])
105
+
106
+ ## 6.1.0 / 2023-02-12
107
+
108
+ * Features
109
+ * WebSocket support via partial hijack ([#3058], [#3007])
110
+ * Add built-in systemd notify support ([#3011])
111
+ * Periodically send status to systemd ([#3006], [#2604])
112
+ * Introduce the ability to return 413: payload too large for requests ([#3040])
113
+ * Log loaded extensions when `PUMA_DEBUG` is set ([#3036], [#3020])
114
+
115
+ * Bugfixes
116
+ * Fix issue with rack 3 compatibility re: rackup ([#3061], [#3057])
117
+ * Allow setting TCP low_latency with SSL listener ([#3065])
118
+
119
+ * Performance
120
+ * Reduce memory usage for large file uploads ([#3062])
121
+
122
+ ## 6.0.2 / 2023-01-01
123
+
124
+ * Refactor
125
+ * Remove use of etc and time gems in Puma ([#3035], [#3033])
126
+ * Refactor const.rb - freeze ([#3016])
127
+
128
+ ## 6.0.1 / 2022-12-20
129
+
130
+ * Bugfixes
131
+ * Handle waking up a closed selector in Reactor#add ([#3005])
132
+ * Fixup response processing, enumerable bodies ([#3004], [#3000])
133
+ * Correctly close app body for all code paths ([#3002], [#2999])
134
+ * Refactor
135
+ * Add IOBuffer to Client, remove from ThreadPool thread instances ([#3013])
136
+
137
+ ## 6.0.0 / 2022-10-14
138
+
139
+ * Breaking Changes
140
+ * Dropping Ruby 2.2 and 2.3 support (now 2.4+) ([#2919])
141
+ * Remote_addr functionality has changed ([#2652], [#2653])
142
+ * No longer supporting Java 1.7 or below (JRuby 9.1 was the last release to support this) ([#2849])
143
+ * Remove nakayoshi GC ([#2933], [#2925])
144
+ * wait_for_less_busy_worker is now default on ([#2940])
145
+ * Prefix all environment variables with `PUMA_` ([#2924], [#2853])
146
+ * Removed some constants ([#2957], [#2958], [#2959], [#2960])
147
+ * The following classes are now part of Puma's private API: `Client`, `Cluster::Worker`, `Cluster::Worker`, `HandleRequest`. ([#2988])
148
+ * Configuration constants like `DefaultRackup` removed ([#2928])
149
+ * Extracted `LogWriter` from `Events` ([#2798])
150
+ * Only accept the standard 8 HTTP methods, others rejected with 501. ([#2932])
151
+
152
+ * Features
153
+ * Increase throughput on large (100kb+) response bodies by 3-10x ([#2896], [#2892])
154
+ * Increase throughput on file responses ([#2923])
155
+ * Add support for streaming bodies in Rack. ([#2740])
156
+ * Allow OpenSSL session reuse via a 'reuse' ssl_bind method or bind string query parameter ([#2845])
157
+ * Allow `run_hooks` to pass a hash to blocks for use later ([#2917], [#2915])
158
+ * Allow using `preload_app!` with `fork_worker` ([#2907])
159
+ * Support request_body_wait metric with higher precision ([#2953])
160
+ * Allow header values to be arrays (Rack 3) ([#2936], [#2931])
161
+ * Export Puma/Ruby versions in /stats ([#2875])
162
+ * Allow configuring request uri max length & request path max length ([#2840])
163
+ * Add a couple of public accessors ([#2774])
164
+ * Log entire backtrace when worker start fails ([#2891])
165
+ * [jruby] Enable TLSv1.3 support ([#2886])
166
+ * [jruby] support setting TLS protocols + rename ssl_cipher_list ([#2899])
167
+ * [jruby] Support a truststore option ([#2849], [#2904], [#2884])
168
+
169
+ * Bugfixes
170
+ * Load the configuration before passing it to the binder ([#2897])
171
+ * Do not raise error raised on HTTP methods we don't recognize or support, like CONNECT ([#2932], [#1441])
172
+ * Fixed a memory leak when creating a new SSL listener ([#2956])
173
+
174
+ * Refactor
175
+ * log_writer.rb - add internal_write method ([#2888])
176
+ * Extract prune_bundler code into it's own class. ([#2797])
177
+ * Refactor Launcher#run to increase readability (no logic change) ([#2795])
178
+ * Ruby 3.2 will have native IO#wait_* methods, don't require io/wait ([#2903])
179
+ * Various internal API refactorings ([#2942], [#2921], [#2922], [#2955])
180
+
181
+ ## 5.6.9 / 2024-09-19
182
+
183
+ * Security
184
+ * Discards any headers using underscores if the non-underscore version also exists. Without this, an attacker could overwrite values set by intermediate proxies (e.g. X-Forwarded-For). ([CVE-2024-45614](https://github.com/puma/puma/security/advisories/GHSA-9hf4-67fc-4vf4)/GHSA-9hf4-67fc-4vf4)
185
+
186
+ ## 5.6.8 / 2024-01-08
2
187
 
3
188
  * Security
4
189
  * Limit the size of chunk extensions. Without this limit, an attacker could cause unbounded resource (CPU, network bandwidth) consumption. ([GHSA-c2f4-cvqm-65w2](https://github.com/puma/puma/security/advisories/GHSA-c2f4-cvqm-65w2))
@@ -11,7 +196,7 @@
11
196
  ## 5.6.6 / 2023-06-21
12
197
 
13
198
  * Bugfix
14
- * Allow Puma to be loaded with Rack 3 ([#3166])
199
+ * Prevent loading with rack 3 ([#3166])
15
200
 
16
201
  ## 5.6.5 / 2022-08-23
17
202
 
@@ -335,6 +520,16 @@
335
520
  * Support parallel tests in verbose progress reporting ([#2223])
336
521
  * Refactor error handling in server accept loop ([#2239])
337
522
 
523
+ ## 4.3.12 / 2022-03-30
524
+
525
+ * Security
526
+ * Close several HTTP Request Smuggling exploits (CVE-2022-24790)
527
+
528
+ ## 4.3.11 / 2022-02-11
529
+
530
+ * Security
531
+ * Always close the response body (GHSA-rmj8-8hhh-gv5h)
532
+
338
533
  ## 4.3.10 / 2021-10-12
339
534
 
340
535
  * Bugfixes
@@ -1878,16 +2073,144 @@ be added back in a future date when a java Puma::MiniSSL is added.
1878
2073
  * Bugfixes
1879
2074
  * Your bugfix goes here <Most recent on the top, like GitHub> (#Github Number)
1880
2075
 
1881
- [#3166]:https://github.com/puma/puma/issues/3166 "Issue by @JoeDupuis, merged 2023-06-08"
1882
- [#2883]:https://github.com/puma/puma/pull/2883 "PR by @MSP-Greg, merged 2022-06-02"
2076
+ [#3256]:https://github.com/puma/puma/pull/3256 "PR by @MSP-Greg, merged 2023-10-16"
2077
+ [#3235]:https://github.com/puma/puma/pull/3235 "PR by @joshuay03, merged 2023-10-03"
2078
+ [#3228]:https://github.com/puma/puma/issues/3228 "Issue by @davidalejandroaguilar, closed 2023-10-03"
2079
+ [#3282]:https://github.com/puma/puma/issues/3282 "Issue by @bensheldon, closed 2024-01-02"
2080
+ [#3283]:https://github.com/puma/puma/pull/3283 "PR by @joshuay03, merged 2024-01-02"
2081
+ [#3225]:https://github.com/puma/puma/pull/3225 "PR by @joshuay03, merged 2023-09-27"
2082
+ [#2786]:https://github.com/puma/puma/issues/2786 "Issue by @vitiokss, closed 2023-09-27"
2083
+ [#3179]:https://github.com/puma/puma/pull/3179 "PR by @MSP-Greg, merged 2023-09-26"
2084
+ [#3255]:https://github.com/puma/puma/pull/3255 "PR by @casperisfine, merged 2023-10-19"
2085
+ [#3276]:https://github.com/puma/puma/pull/3276 "PR by @casperisfine, merged 2023-11-16"
2086
+ [#3271]:https://github.com/puma/puma/pull/3271 "PR by @MSP-Greg, merged 2023-10-30"
2087
+ [#3266]:https://github.com/puma/puma/issues/3266 "Issue by @Dragonicity, closed 2023-10-30"
2088
+ [#3270]:https://github.com/puma/puma/pull/3270 "PR by @MSP-Greg, merged 2023-10-30"
2089
+ [#3265]:https://github.com/puma/puma/pull/3265 "PR by @MSP-Greg, merged 2023-10-25"
2090
+ [#3264]:https://github.com/puma/puma/issues/3264 "Issue by @dentarg, closed 2023-10-25"
2091
+ [#3254]:https://github.com/puma/puma/pull/3254 "PR by @casperisfine, merged 2023-10-11"
2092
+ [#3245]:https://github.com/puma/puma/pull/3245 "PR by @olleolleolle, merged 2023-10-02"
2093
+ [#3293]:https://github.com/puma/puma/pull/3293 "PR by @MSP-Greg, merged 2023-12-21"
2094
+ [#3301]:https://github.com/puma/puma/pull/3301 "PR by @benburkert, merged 2023-12-29"
2095
+ [#3248]:https://github.com/puma/puma/pull/3248 "PR by @dentarg, merged 2023-10-04"
2096
+ [#3298]:https://github.com/puma/puma/pull/3298 "PR by @til, merged 2023-12-26"
2097
+ [#2920]:https://github.com/puma/puma/pull/2920 "PR by @biinari, merged 2023-07-11"
2098
+ [#3195]:https://github.com/puma/puma/pull/3195 "PR by @binarygit, merged 2023-08-15"
2099
+ [#3209]:https://github.com/puma/puma/pull/3209 "PR by @joshuay03, merged 2023-09-04"
2100
+ [#2580]:https://github.com/puma/puma/issues/2580 "Issue by @schuetzm, closed 2023-09-04"
2101
+ [#3204]:https://github.com/puma/puma/pull/3204 "PR by @dhavalsingh, merged 2023-08-25"
2102
+ [#3191]:https://github.com/puma/puma/pull/3191 "PR by @MSP-Greg, merged 2023-08-31"
2103
+ [#3165]:https://github.com/puma/puma/pull/3165 "PR by @fallwith, merged 2023-06-06"
2104
+ [#3174]:https://github.com/puma/puma/pull/3174 "PR by @copiousfreetime, merged 2023-06-11"
2105
+ [#3181]:https://github.com/puma/puma/pull/3181 "PR by @MSP-Greg, merged 2023-06-23"
2106
+ [#3187]:https://github.com/puma/puma/pull/3187 "PR by @MSP-Greg, merged 2023-06-30"
2107
+ [#3094]:https://github.com/puma/puma/pull/3094 "PR by @Vuta, merged 2023-07-23"
2108
+ [#3106]:https://github.com/puma/puma/pull/3106 "PR by @MSP-Greg, merged 2023-05-29"
2109
+ [#3014]:https://github.com/puma/puma/issues/3014 "Issue by @kyledrake, closed 2023-05-29"
2110
+ [#3161]:https://github.com/puma/puma/pull/3161 "PR by @MSP-Greg, merged 2023-05-27"
2111
+ [#3037]:https://github.com/puma/puma/issues/3037 "Issue by @daisy1754, closed 2023-05-27"
2112
+ [#3133]:https://github.com/puma/puma/pull/3133 "PR by @stanhu, merged 2023-04-30"
2113
+ [#3132]:https://github.com/puma/puma/issues/3132 "Issue by @stanhu, closed 2023-04-30"
2114
+ [#3163]:https://github.com/puma/puma/pull/3163 "PR by @MSP-Greg, merged 2023-05-27"
2115
+ [#3155]:https://github.com/puma/puma/pull/3155 "PR by @dentarg, merged 2023-05-14"
2116
+ [#3148]:https://github.com/puma/puma/issues/3148 "Issue by @dentarg, closed 2023-05-14"
2117
+ [#3129]:https://github.com/puma/puma/pull/3129 "PR by @MSP-Greg, merged 2023-05-02"
2118
+ [#3137]:https://github.com/puma/puma/pull/3137 "PR by @MSP-Greg, merged 2023-04-30"
2119
+ [#3156]:https://github.com/puma/puma/pull/3156 "PR by @severin, merged 2023-05-16"
2120
+ [#3162]:https://github.com/puma/puma/pull/3162 "PR by @MSP-Greg, merged 2023-05-23"
2121
+ [#3151]:https://github.com/puma/puma/pull/3151 "PR by @nateberkopec, merged 2023-05-12"
2122
+ [#3118]:https://github.com/puma/puma/pull/3118 "PR by @ninoseki, merged 2023-04-01"
2123
+ [#3117]:https://github.com/puma/puma/issues/3117 "Issue by @ninoseki, closed 2023-04-01"
2124
+ [#3109]:https://github.com/puma/puma/pull/3109 "PR by @ahorek, merged 2023-03-31"
2125
+ [#3108]:https://github.com/puma/puma/issues/3108 "Issue by @treviateo, closed 2023-03-31"
2126
+ [#3113]:https://github.com/puma/puma/pull/3113 "PR by @collinsauve, merged 2023-03-31"
2127
+ [#3112]:https://github.com/puma/puma/issues/3112 "Issue by @dmke, closed 2023-03-31"
2128
+ [#3111]:https://github.com/puma/puma/pull/3111 "PR by @adzap, merged 2023-03-30"
2129
+ [#2770]:https://github.com/puma/puma/pull/2770 "PR by @vzajkov, merged 2023-03-29"
2130
+ [#2511]:https://github.com/puma/puma/issues/2511 "Issue by @jchristie55332, closed 2021-12-12"
2131
+ [#3089]:https://github.com/puma/puma/pull/3089 "PR by @Vuta, merged 2023-03-06"
2132
+ [#2709]:https://github.com/puma/puma/pull/2709 "PR by @rodzyn, merged 2023-02-20"
2133
+ [#3091]:https://github.com/puma/puma/pull/3091 "PR by @MSP-Greg, merged 2023-03-28"
2134
+ [#3074]:https://github.com/puma/puma/pull/3074 "PR by @MSP-Greg, merged 2023-03-14"
2135
+ [#3072]:https://github.com/puma/puma/pull/3072 "PR by @MSP-Greg, merged 2023-02-17"
2136
+ [#3079]:https://github.com/puma/puma/pull/3079 "PR by @mohamedhafez, merged 2023-02-24"
2137
+ [#3080]:https://github.com/puma/puma/pull/3080 "PR by @MSP-Greg, merged 2023-02-16"
2138
+ [#3058]:https://github.com/puma/puma/pull/3058 "PR by @dentarg, merged 2023-01-29"
2139
+ [#3007]:https://github.com/puma/puma/issues/3007 "Issue by @MSP-Greg, closed 2023-01-29"
2140
+ [#3011]:https://github.com/puma/puma/pull/3011 "PR by @joaomarcos96, merged 2023-01-03"
2141
+ [#3006]:https://github.com/puma/puma/pull/3006 "PR by @QWYNG, merged 2023-02-09"
2142
+ [#2604]:https://github.com/puma/puma/issues/2604 "Issue by @dgoetz, closed 2023-02-09"
2143
+ [#3040]:https://github.com/puma/puma/pull/3040 "PR by @shayonj, merged 2023-01-02"
2144
+ [#3036]:https://github.com/puma/puma/pull/3036 "PR by @MSP-Greg, merged 2023-01-13"
2145
+ [#3020]:https://github.com/puma/puma/issues/3020 "Issue by @dentarg, closed 2023-01-13"
2146
+ [#3061]:https://github.com/puma/puma/pull/3061 "PR by @MSP-Greg, merged 2023-02-12"
2147
+ [#3057]:https://github.com/puma/puma/issues/3057 "Issue by @mmarvb8h, closed 2023-02-12"
2148
+ [#3065]:https://github.com/puma/puma/pull/3065 "PR by @MSP-Greg, merged 2023-02-11"
2149
+ [#3062]:https://github.com/puma/puma/pull/3062 "PR by @willkoehler, merged 2023-01-29"
2150
+ [#3035]:https://github.com/puma/puma/pull/3035 "PR by @MSP-Greg, merged 2022-12-24"
2151
+ [#3033]:https://github.com/puma/puma/issues/3033 "Issue by @jules-w2, closed 2022-12-24"
2152
+ [#3016]:https://github.com/puma/puma/pull/3016 "PR by @MSP-Greg, merged 2022-12-24"
2153
+ [#3005]:https://github.com/puma/puma/pull/3005 "PR by @JuanitoFatas, merged 2022-11-04"
2154
+ [#3004]:https://github.com/puma/puma/pull/3004 "PR by @MSP-Greg, merged 2022-11-24"
2155
+ [#3000]:https://github.com/puma/puma/issues/3000 "Issue by @dentarg, closed 2022-11-24"
2156
+ [#3002]:https://github.com/puma/puma/pull/3002 "PR by @MSP-Greg, merged 2022-11-03"
2157
+ [#2999]:https://github.com/puma/puma/issues/2999 "Issue by @aymeric-ledorze, closed 2022-11-03"
2158
+ [#3013]:https://github.com/puma/puma/pull/3013 "PR by @MSP-Greg, merged 2022-11-13"
2159
+ [#2919]:https://github.com/puma/puma/pull/2919 "PR by @MSP-Greg, merged 2022-08-30"
2160
+ [#2652]:https://github.com/puma/puma/issues/2652 "Issue by @Roguelazer, closed 2022-09-04"
2161
+ [#2653]:https://github.com/puma/puma/pull/2653 "PR by @Roguelazer, closed 2022-03-07"
2162
+ [#2849]:https://github.com/puma/puma/pull/2849 "PR by @kares, merged 2022-04-09"
2163
+ [#2933]:https://github.com/puma/puma/pull/2933 "PR by @cafedomancer, merged 2022-09-09"
2164
+ [#2925]:https://github.com/puma/puma/issues/2925 "Issue by @nateberkopec, closed 2022-09-09"
2165
+ [#2940]:https://github.com/puma/puma/pull/2940 "PR by @cafedomancer, merged 2022-09-10"
2166
+ [#2924]:https://github.com/puma/puma/pull/2924 "PR by @cafedomancer, merged 2022-09-07"
2167
+ [#2853]:https://github.com/puma/puma/issues/2853 "Issue by @nateberkopec, closed 2022-09-07"
2168
+ [#2957]:https://github.com/puma/puma/pull/2957 "PR by @JuanitoFatas, merged 2022-09-16"
2169
+ [#2958]:https://github.com/puma/puma/pull/2958 "PR by @JuanitoFatas, merged 2022-09-16"
2170
+ [#2959]:https://github.com/puma/puma/pull/2959 "PR by @JuanitoFatas, merged 2022-09-16"
2171
+ [#2960]:https://github.com/puma/puma/pull/2960 "PR by @JuanitoFatas, merged 2022-09-16"
2172
+ [#2988]:https://github.com/puma/puma/pull/2988 "PR by @MSP-Greg, merged 2022-10-12"
2173
+ [#2928]:https://github.com/puma/puma/pull/2928 "PR by @nateberkopec, merged 2022-09-10"
2174
+ [#2798]:https://github.com/puma/puma/pull/2798 "PR by @johnnyshields, merged 2022-02-05"
2175
+ [#2932]:https://github.com/puma/puma/pull/2932 "PR by @mrzasa, merged 2022-09-12"
2176
+ [#2896]:https://github.com/puma/puma/pull/2896 "PR by @MSP-Greg, merged 2022-09-13"
2177
+ [#2892]:https://github.com/puma/puma/pull/2892 "PR by @guilleiguaran, closed 2022-09-13"
2178
+ [#2923]:https://github.com/puma/puma/pull/2923 "PR by @nateberkopec, merged 2022-09-09"
2179
+ [#2740]:https://github.com/puma/puma/pull/2740 "PR by @ioquatix, merged 2022-01-29"
2180
+ [#2845]:https://github.com/puma/puma/issues/2845 "Issue by @donv, closed 2022-03-22"
2181
+ [#2917]:https://github.com/puma/puma/pull/2917 "PR by @MSP-Greg, merged 2022-09-19"
2182
+ [#2915]:https://github.com/puma/puma/issues/2915 "Issue by @mperham, closed 2022-09-19"
2183
+ [#2907]:https://github.com/puma/puma/pull/2907 "PR by @casperisfine, merged 2022-09-15"
2184
+ [#2953]:https://github.com/puma/puma/pull/2953 "PR by @JuanitoFatas, merged 2022-09-14"
2185
+ [#2936]:https://github.com/puma/puma/pull/2936 "PR by @MSP-Greg, merged 2022-09-09"
2186
+ [#2931]:https://github.com/puma/puma/issues/2931 "Issue by @dentarg, closed 2022-09-09"
2187
+ [#2875]:https://github.com/puma/puma/pull/2875 "PR by @ylecuyer, merged 2022-05-19"
2188
+ [#2840]:https://github.com/puma/puma/pull/2840 "PR by @LukaszMaslej, merged 2022-04-13"
2189
+ [#2774]:https://github.com/puma/puma/pull/2774 "PR by @ob-stripe, merged 2022-01-31"
2190
+ [#2891]:https://github.com/puma/puma/pull/2891 "PR by @gingerlime, merged 2022-06-02"
2191
+ [#2886]:https://github.com/puma/puma/pull/2886 "PR by @kares, merged 2022-05-30"
2192
+ [#2899]:https://github.com/puma/puma/pull/2899 "PR by @kares, merged 2022-07-04"
2193
+ [#2904]:https://github.com/puma/puma/pull/2904 "PR by @kares, merged 2022-08-27"
2194
+ [#2884]:https://github.com/puma/puma/pull/2884 "PR by @kares, merged 2022-05-30"
2195
+ [#2897]:https://github.com/puma/puma/pull/2897 "PR by @Edouard-chin, merged 2022-08-27"
2196
+ [#1441]:https://github.com/puma/puma/issues/1441 "Issue by @nirvdrum, closed 2022-09-12"
2197
+ [#2956]:https://github.com/puma/puma/pull/2956 "PR by @MSP-Greg, merged 2022-09-15"
2198
+ [#2888]:https://github.com/puma/puma/pull/2888 "PR by @MSP-Greg, merged 2022-06-01"
2199
+ [#2797]:https://github.com/puma/puma/pull/2797 "PR by @johnnyshields, merged 2022-02-01"
2200
+ [#2795]:https://github.com/puma/puma/pull/2795 "PR by @johnnyshields, merged 2022-01-31"
2201
+ [#2903]:https://github.com/puma/puma/pull/2903 "PR by @MSP-Greg, merged 2022-08-27"
2202
+ [#2942]:https://github.com/puma/puma/pull/2942 "PR by @nateberkopec, merged 2022-09-15"
2203
+ [#2921]:https://github.com/puma/puma/issues/2921 "Issue by @MSP-Greg, closed 2022-09-15"
2204
+ [#2922]:https://github.com/puma/puma/issues/2922 "Issue by @MSP-Greg, closed 2022-09-10"
2205
+ [#2955]:https://github.com/puma/puma/pull/2955 "PR by @cafedomancer, merged 2022-09-15"
2206
+ [#3166]:https://github.com/puma/puma/pull/3166 "PR by @JoeDupuis, merged 2023-06-08"
1883
2207
  [#2868]:https://github.com/puma/puma/pull/2868 "PR by @MSP-Greg, merged 2022-06-02"
1884
2208
  [#2866]:https://github.com/puma/puma/issues/2866 "Issue by @slondr, closed 2022-06-02"
1885
- [#2888]:https://github.com/puma/puma/pull/2888 "PR by @MSP-Greg, merged 2022-06-01"
2209
+ [#2883]:https://github.com/puma/puma/pull/2883 "PR by @MSP-Greg, merged 2022-06-02"
1886
2210
  [#2890]:https://github.com/puma/puma/pull/2890 "PR by @kares, merged 2022-06-01"
1887
2211
  [#2729]:https://github.com/puma/puma/issues/2729 "Issue by @kares, closed 2022-06-01"
1888
2212
  [#2885]:https://github.com/puma/puma/pull/2885 "PR by @MSP-Greg, merged 2022-05-30"
1889
2213
  [#2839]:https://github.com/puma/puma/issues/2839 "Issue by @wlipa, closed 2022-05-30"
1890
- [#2882]:https://github.com/puma/puma/pull/2882 "PR by @MSP-Greg, merged 2022-05-19"
1891
2214
  [#2864]:https://github.com/puma/puma/pull/2864 "PR by @MSP-Greg, merged 2022-04-26"
1892
2215
  [#2863]:https://github.com/puma/puma/issues/2863 "Issue by @eradman, closed 2022-04-26"
1893
2216
  [#2861]:https://github.com/puma/puma/pull/2861 "PR by @BlakeWilliams, merged 2022-04-17"
@@ -1898,13 +2221,6 @@ be added back in a future date when a java Puma::MiniSSL is added.
1898
2221
  [#2838]:https://github.com/puma/puma/pull/2838 "PR by @epsilon-0, merged 2022-03-03"
1899
2222
  [#2817]:https://github.com/puma/puma/pull/2817 "PR by @khustochka, merged 2022-02-20"
1900
2223
  [#2810]:https://github.com/puma/puma/pull/2810 "PR by @kzkn, merged 2022-01-27"
1901
- [#2899]:https://github.com/puma/puma/pull/2899 "PR by @kares, merged 2022-07-04"
1902
- [#2891]:https://github.com/puma/puma/pull/2891 "PR by @gingerlime, merged 2022-06-02"
1903
- [#2886]:https://github.com/puma/puma/pull/2886 "PR by @kares, merged 2022-05-30"
1904
- [#2884]:https://github.com/puma/puma/pull/2884 "PR by @kares, merged 2022-05-30"
1905
- [#2875]:https://github.com/puma/puma/pull/2875 "PR by @ylecuyer, merged 2022-05-19"
1906
- [#2840]:https://github.com/puma/puma/pull/2840 "PR by @LukaszMaslej, merged 2022-04-13"
1907
- [#2849]:https://github.com/puma/puma/pull/2849 "PR by @kares, merged 2022-04-09"
1908
2224
  [#2809]:https://github.com/puma/puma/pull/2809 "PR by @dentarg, merged 2022-01-26"
1909
2225
  [#2764]:https://github.com/puma/puma/pull/2764 "PR by @dentarg, merged 2022-01-18"
1910
2226
  [#2708]:https://github.com/puma/puma/issues/2708 "Issue by @erikaxel, closed 2022-01-18"
@@ -1914,7 +2230,7 @@ be added back in a future date when a java Puma::MiniSSL is added.
1914
2230
  [#2794]:https://github.com/puma/puma/pull/2794 "PR by @johnnyshields, merged 2022-01-10"
1915
2231
  [#2759]:https://github.com/puma/puma/pull/2759 "PR by @ob-stripe, merged 2021-12-11"
1916
2232
  [#2731]:https://github.com/puma/puma/pull/2731 "PR by @baelter, merged 2021-11-02"
1917
- [#2341]:https://github.com/puma/puma/issues/2341 "Issue by @cjlarose, closed 2021-11-02"
2233
+ [#2341]:https://github.com/puma/puma/issues/2341 "Issue by @cjlarose, closed 2023-07-23"
1918
2234
  [#2728]:https://github.com/puma/puma/pull/2728 "PR by @dalibor, merged 2021-10-31"
1919
2235
  [#2733]:https://github.com/puma/puma/pull/2733 "PR by @ob-stripe, merged 2021-12-12"
1920
2236
  [#2807]:https://github.com/puma/puma/pull/2807 "PR by @MSP-Greg, merged 2022-01-25"
@@ -1962,7 +2278,7 @@ be added back in a future date when a java Puma::MiniSSL is added.
1962
2278
  [#2563]:https://github.com/puma/puma/pull/2563 "PR by @MSP-Greg, merged 2021-03-06"
1963
2279
  [#2504]:https://github.com/puma/puma/issues/2504 "Issue by @fsateler, closed 2021-03-06"
1964
2280
  [#2591]:https://github.com/puma/puma/pull/2591 "PR by @MSP-Greg, merged 2021-05-05"
1965
- [#2572]:https://github.com/puma/puma/issues/2572 "Issue by @josefbilendo, closed 2021-05-05"
2281
+ [#2572]:https://github.com/puma/puma/issues/2572 "Issue by @josef-krabath, closed 2021-05-05"
1966
2282
  [#2613]:https://github.com/puma/puma/pull/2613 "PR by @smcgivern, merged 2021-04-27"
1967
2283
  [#2605]:https://github.com/puma/puma/pull/2605 "PR by @pascalbetz, merged 2021-04-26"
1968
2284
  [#2584]:https://github.com/puma/puma/issues/2584 "Issue by @kaorihinata, closed 2021-04-26"
@@ -2278,7 +2594,7 @@ be added back in a future date when a java Puma::MiniSSL is added.
2278
2594
  [#1110]:https://github.com/puma/puma/pull/1110 "PR by @montdidier, merged 2016-12-12"
2279
2595
  [#1135]:https://github.com/puma/puma/pull/1135 "PR by @jkraemer, merged 2016-11-19"
2280
2596
  [#1081]:https://github.com/puma/puma/pull/1081 "PR by @frodsan, merged 2016-09-08"
2281
- [#1138]:https://github.com/puma/puma/pull/1138 "PR by @steakknife, merged 2016-12-13"
2597
+ [#1138]:https://github.com/puma/puma/pull/1138 "PR by @skull-squadron, merged 2016-12-13"
2282
2598
  [#1118]:https://github.com/puma/puma/pull/1118 "PR by @hiroara, merged 2016-11-20"
2283
2599
  [#1075]:https://github.com/puma/puma/issues/1075 "Issue by @pvalena, closed 2016-09-06"
2284
2600
  [#932]:https://github.com/puma/puma/issues/932 "Issue by @everplays, closed 2016-07-24"
data/README.md CHANGED
@@ -4,21 +4,23 @@
4
4
 
5
5
  # Puma: A Ruby Web Server Built For Parallelism
6
6
 
7
- [![Actions MRI](https://github.com/puma/puma/workflows/MRI/badge.svg?branch=master)](https://github.com/puma/puma/actions?query=workflow%3AMRI)
8
- [![Actions non MRI](https://github.com/puma/puma/workflows/non_MRI/badge.svg?branch=master)](https://github.com/puma/puma/actions?query=workflow%3Anon_MRI)
7
+ [![Actions](https://github.com/puma/puma/workflows/Tests/badge.svg?branch=master)](https://github.com/puma/puma/actions?query=workflow%3ATests)
9
8
  [![Code Climate](https://codeclimate.com/github/puma/puma.svg)](https://codeclimate.com/github/puma/puma)
10
- [![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=puma&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=puma&package-manager=bundler&version-scheme=semver)
11
9
  [![StackOverflow](https://img.shields.io/badge/stackoverflow-Puma-blue.svg)]( https://stackoverflow.com/questions/tagged/puma )
12
10
 
13
11
  Puma is a **simple, fast, multi-threaded, and highly parallel HTTP 1.1 server for Ruby/Rack applications**.
14
12
 
15
13
  ## Built For Speed &amp; Parallelism
16
14
 
17
- Puma processes requests using a C-optimized Ragel extension (inherited from Mongrel) that provides fast, accurate HTTP 1.1 protocol parsing in a portable way. Puma then serves the request using a thread pool. Each request is served in a separate thread, so truly parallel Ruby implementations (JRuby, Rubinius) will use all available CPU cores.
15
+ Puma is a server for [Rack](https://github.com/rack/rack)-powered HTTP applications written in Ruby. It is:
16
+ * **Multi-threaded**. Each request is served in a separate thread. This helps you serve more requests per second with less memory use.
17
+ * **Multi-process**. "Pre-forks" in cluster mode, using less memory per-process thanks to copy-on-write memory.
18
+ * **Standalone**. With SSL support, zero-downtime rolling restarts and a built-in request bufferer, you can deploy Puma without any reverse proxy.
19
+ * **Battle-tested**. Our HTTP parser is inherited from Mongrel and has over 15 years of production use. Puma is currently the most popular Ruby webserver, and is the default server for Ruby on Rails.
18
20
 
19
21
  Originally designed as a server for [Rubinius](https://github.com/rubinius/rubinius), Puma also works well with Ruby (MRI) and JRuby.
20
22
 
21
- On MRI, there is a Global VM Lock (GVL) that ensures only one thread can run Ruby code at a time. But if you're doing a lot of blocking IO (such as HTTP calls to external APIs like Twitter), Puma still improves MRI's throughput by allowing IO waiting to be done in parallel.
23
+ On MRI, there is a Global VM Lock (GVL) that ensures only one thread can run Ruby code at a time. But if you're doing a lot of blocking IO (such as HTTP calls to external APIs like Twitter), Puma still improves MRI's throughput by allowing IO waiting to be done in parallel. Truly parallel Ruby implementations (TruffleRuby, JRuby) don't have this limitation.
22
24
 
23
25
  ## Quick Start
24
26
 
@@ -108,15 +110,25 @@ Puma also offers "clustered mode". Clustered mode `fork`s workers from a master
108
110
  $ puma -t 8:32 -w 3
109
111
  ```
110
112
 
113
+ Or with the `WEB_CONCURRENCY` environment variable:
114
+
115
+ ```
116
+ $ WEB_CONCURRENCY=3 puma -t 8:32
117
+ ```
118
+
111
119
  Note that threads are still used in clustered 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.
112
120
 
113
- In clustered 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) (Ruby 2.0+ only). Use the `--preload` flag from the command line:
121
+ For an in-depth discussion of the tradeoffs of thread and process count settings, [see our docs](https://github.com/puma/puma/blob/9282a8efa5a0c48e39c60d22ca70051a25df9f55/docs/kubernetes.md#workers-per-pod-and-other-config-issues).
122
+
123
+ In clustered 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).
124
+
125
+ If the `WEB_CONCURRENCY` environment variable is set to a value > 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:
114
126
 
115
127
  ```
116
128
  $ puma -w 3 --preload
117
129
  ```
118
130
 
119
- If you're using a configuration file, use the `preload_app!` method:
131
+ Or, if you're using a configuration file, you can use the `preload_app!` method:
120
132
 
121
133
  ```ruby
122
134
  # config/puma.rb
@@ -124,7 +136,9 @@ workers 3
124
136
  preload_app!
125
137
  ```
126
138
 
127
- Additionally, you can specify a block in your configuration file that will be run on boot of each worker:
139
+ 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.
140
+
141
+ When using clustered mode, you can specify a block in your configuration file that will be run on boot of each worker:
128
142
 
129
143
  ```ruby
130
144
  # config/puma.rb
@@ -137,12 +151,10 @@ This code can be used to setup the process before booting the application, allow
137
151
  you to do some Puma-specific things that you don't want to embed in your application.
138
152
  For instance, you could fire a log notification that a worker booted or send something to statsd. This can be called multiple times.
139
153
 
140
- Constants loaded by your application (such as `Rails`) will not be available in `on_worker_boot`.
141
- However, these constants _will_ be available if `preload_app!` is enabled, either explicitly in your `puma` config or automatically if
142
- using 2 or more workers in cluster mode.
143
- If `preload_app!` is not enabled and 1 worker is used, then `on_worker_boot` will fire, but your app will not be preloaded and constants will not be available.
154
+ Constants loaded by your application (such as `Rails`) will not be available in `on_worker_boot`
155
+ unless preloading is enabled.
144
156
 
145
- `before_fork` specifies a block to be run before workers are forked:
157
+ You can also specify a block to be run before workers are forked, using `before_fork`:
146
158
 
147
159
  ```ruby
148
160
  # config/puma.rb
@@ -151,7 +163,14 @@ before_fork do
151
163
  end
152
164
  ```
153
165
 
154
- Preloading can’t be used with phased restart, since phased restart kills and restarts workers one-by-one, and `preload_app!` copies the code of master into the workers.
166
+ You can also specify a block to be run after puma is booted using `on_booted`:
167
+
168
+ ```ruby
169
+ # config/puma.rb
170
+ on_booted do
171
+ # configuration here
172
+ end
173
+ ```
155
174
 
156
175
  ### Error handling
157
176
 
@@ -192,35 +211,38 @@ Need a bit of security? Use SSL sockets:
192
211
  ```
193
212
  $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert'
194
213
  ```
195
- #### Self-signed SSL certificates (via the [`localhost`] gem, for development use):
214
+ #### Self-signed SSL certificates (via the [`localhost`] gem, for development use):
196
215
 
197
- 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.
216
+ 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.
198
217
 
199
218
  Puma automatically configures SSL when the [`localhost`] gem is loaded in a `development` environment:
200
219
 
220
+ Add the gem to your Gemfile:
201
221
  ```ruby
202
- # Add the gem to your Gemfile
203
- group(:development) do
222
+ group(:development) do
204
223
  gem 'localhost'
205
224
  end
225
+ ```
206
226
 
207
- # And require it implicitly using bundler
227
+ And require it implicitly using bundler:
228
+ ```ruby
208
229
  require "bundler"
209
230
  Bundler.require(:default, ENV["RACK_ENV"].to_sym)
231
+ ```
210
232
 
211
- # Alternatively, you can require the gem in config.ru:
212
- require './app'
233
+ 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:
234
+ ```ruby
213
235
  require 'localhost'
214
- run Sinatra::Application
236
+ # configuration methods (from Puma::DSL) as needed
215
237
  ```
216
238
 
217
239
  Additionally, Puma must be listening to an SSL socket:
218
240
 
219
241
  ```shell
220
- $ puma -b 'ssl://localhost:9292' config.ru
242
+ $ puma -b 'ssl://localhost:9292' -C config/use_local_host.rb
221
243
 
222
244
  # The following options allow you to reach Puma over HTTP as well:
223
- $ puma -b ssl://localhost:9292 -b tcp://localhost:9393 config.ru
245
+ $ puma -b ssl://localhost:9292 -b tcp://localhost:9393 -C config/use_local_host.rb
224
246
  ```
225
247
 
226
248
  [`localhost`]: https://github.com/socketry/localhost
@@ -266,6 +288,30 @@ $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&verification_f
266
288
  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`
267
289
  (see https://www.openssl.org/docs/manmaster/man3/X509_VERIFY_PARAM_set_hostflags.html#VERIFICATION-FLAGS).
268
290
 
291
+ #### Controlling OpenSSL Password Decryption
292
+
293
+ To enable runtime decryption of an encrypted SSL key (not available for JRuby), use `key_password_command`:
294
+
295
+ ```
296
+ $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&key_password_command=/path/to/command.sh'
297
+ ```
298
+
299
+ `key_password_command` must:
300
+
301
+ 1. Be executable by Puma.
302
+ 2. Print the decryption password to stdout.
303
+
304
+ For example:
305
+
306
+ ```shell
307
+ #!/bin/sh
308
+
309
+ echo "this is my password"
310
+ ```
311
+
312
+ `key_password_command` can be used with `key` or `key_pem`. If the key
313
+ is not encrypted, the executable will not be called.
314
+
269
315
  ### Control/Status Server
270
316
 
271
317
  Puma has a built-in status and control app that can be used to query and control Puma.
@@ -341,16 +387,18 @@ end
341
387
 
342
388
  ## Deployment
343
389
 
344
- Puma has support for Capistrano with an [external gem](https://github.com/seuros/capistrano-puma).
390
+ * Puma has support for Capistrano with an [external gem](https://github.com/seuros/capistrano-puma).
391
+
392
+ * 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.
393
+
345
394
 
346
395
  It is common to use process monitors with Puma. Modern process monitors like systemd or rc.d
347
- provide continuous monitoring and restarts for increased
348
- reliability in production environments:
396
+ provide continuous monitoring and restarts for increased reliability in production environments:
349
397
 
350
398
  * [rc.d](docs/jungle/rc.d/README.md)
351
399
  * [systemd](docs/systemd.md)
352
400
 
353
- Community guides:
401
+ Community guides:
354
402
 
355
403
  * [Deploying Puma on OpenBSD using relayd and httpd](https://gist.github.com/anon987654321/4532cf8d6c59c1f43ec8973faa031103)
356
404
 
@@ -360,7 +408,9 @@ Community guides:
360
408
 
361
409
  * [puma-metrics](https://github.com/harmjanblok/puma-metrics) — export Puma metrics to Prometheus
362
410
  * [puma-plugin-statsd](https://github.com/yob/puma-plugin-statsd) — send Puma metrics to statsd
363
- * [puma-plugin-systemd](https://github.com/sj26/puma-plugin-systemd) — deeper integration with systemd for notify, status and watchdog
411
+ * [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.
412
+ * [puma-plugin-telemetry](https://github.com/babbel/puma-plugin-telemetry) - telemetry plugin for Puma offering various targets to publish
413
+ * [puma-acme](https://github.com/anchordotdev/puma-acme) - automatic SSL/HTTPS certificate provisioning and setup
364
414
 
365
415
  ### Monitoring
366
416