puma 8.1.4 → 8.2.0.pre1
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.
- checksums.yaml +4 -4
- data/History.md +114 -19
- data/README.md +4 -3
- data/docs/GLOSSARY.md +160 -0
- data/docs/architecture.md +41 -42
- data/docs/binding.md +3 -0
- data/docs/cluster_mode.md +21 -21
- data/docs/control_server.md +4 -4
- data/docs/deployment/nginx.md +2 -0
- data/docs/deployment/systemd.md +15 -0
- data/docs/puma_support.md +12 -0
- data/docs/restart.md +2 -2
- data/docs/signals.md +3 -3
- data/docs/ssl.md +65 -0
- data/docs/upgrading/5.0-Upgrade.md +1 -1
- data/docs/upgrading/6.0-Upgrade.md +1 -1
- data/docs/upgrading/7.0-Upgrade.md +1 -1
- data/docs/upgrading/8.0-Upgrade.md +1 -1
- data/ext/puma_http11/extconf.rb +7 -5
- data/ext/puma_http11/http11_parser.c +66 -84
- data/ext/puma_http11/http11_parser.h +0 -5
- data/ext/puma_http11/mini_ssl.c +17 -61
- data/ext/puma_http11/puma_http11.c +125 -7
- data/lib/puma/app/status.rb +22 -7
- data/lib/puma/binder.rb +0 -1
- data/lib/puma/cli.rb +1 -3
- data/lib/puma/client.rb +114 -56
- data/lib/puma/client_env.rb +9 -11
- data/lib/puma/cluster/worker.rb +0 -6
- data/lib/puma/cluster.rb +3 -14
- data/lib/puma/cluster_accept_loop_delay.rb +18 -7
- data/lib/puma/commonlogger.rb +3 -4
- data/lib/puma/configuration.rb +4 -1
- data/lib/puma/const.rb +5 -5
- data/lib/puma/control_cli.rb +5 -7
- data/lib/puma/detect.rb +1 -1
- data/lib/puma/dsl.rb +70 -14
- data/lib/puma/http_parser_error.rb +8 -0
- data/lib/puma/launcher/bundle_pruner.rb +3 -21
- data/lib/puma/launcher.rb +13 -5
- data/lib/puma/minissl/context_builder.rb +3 -2
- data/lib/puma/minissl.rb +3 -12
- data/lib/puma/plugin/systemd.rb +69 -3
- data/lib/puma/rack/urlmap.rb +2 -2
- data/lib/puma/reactor.rb +138 -25
- data/lib/puma/response.rb +52 -33
- data/lib/puma/runner.rb +4 -1
- data/lib/puma/sd_notify.rb +21 -0
- data/lib/puma/server.rb +14 -14
- data/lib/puma/single.rb +0 -1
- data/lib/puma/thread_pool.rb +87 -14
- data/lib/puma/util.rb +5 -16
- data/lib/puma.rb +22 -5
- data/lib/rack/handler/puma.rb +1 -5
- metadata +4 -1
data/docs/deployment/nginx.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
This is a very common setup using an upstream. It was adapted from some Capistrano recipe I found on the Internet a while ago.
|
|
4
4
|
|
|
5
|
+
For HTTPS terminated at nginx, see [HTTPS with Puma](../ssl.md).
|
|
6
|
+
|
|
5
7
|
```nginx
|
|
6
8
|
upstream myapp {
|
|
7
9
|
server unix:///myapp/tmp/puma.sock;
|
data/docs/deployment/systemd.md
CHANGED
|
@@ -68,6 +68,21 @@ See
|
|
|
68
68
|
[systemd.exec](https://www.freedesktop.org/software/systemd/man/systemd.exec.html)
|
|
69
69
|
for additional details.
|
|
70
70
|
|
|
71
|
+
### Startup timeout extension
|
|
72
|
+
|
|
73
|
+
If boot time varies too much for a fixed `TimeoutStartSec`, set
|
|
74
|
+
`PUMA_EXTEND_TIMEOUT_SEC`. Until `READY=1`, Puma keeps asking systemd for that
|
|
75
|
+
many more seconds. `PUMA_EXTEND_TIMEOUT_MAX_SEC` optionally caps the total,
|
|
76
|
+
counted from when Puma loads its systemd plugin.
|
|
77
|
+
|
|
78
|
+
~~~~ ini
|
|
79
|
+
Environment=PUMA_EXTEND_TIMEOUT_SEC=30
|
|
80
|
+
Environment=PUMA_EXTEND_TIMEOUT_MAX_SEC=600
|
|
81
|
+
~~~~
|
|
82
|
+
|
|
83
|
+
Extensions start after Puma reads its config, so `ExecStartPre=` and config
|
|
84
|
+
loading must still fit in `TimeoutStartSec`.
|
|
85
|
+
|
|
71
86
|
## Socket Activation
|
|
72
87
|
|
|
73
88
|
systemd and Puma also support socket activation, where systemd opens the
|
data/docs/puma_support.md
CHANGED
|
@@ -20,6 +20,8 @@ CI aims for the most coverage with the fewest jobs.
|
|
|
20
20
|
|
|
21
21
|
Every OS and architecture runs the oldest supported Ruby on its oldest runner image, and the newest Ruby on its newest image.
|
|
22
22
|
|
|
23
|
+
"Runner images" means every standard GitHub-hosted runner image currently listed in [GitHub's runner docs](https://docs.github.com/en/actions/reference/runners/github-hosted-runners#supported-runners-and-hardware-resources), not only the images CI already uses.
|
|
24
|
+
|
|
23
25
|
On x64, a few more jobs fill in the gaps:
|
|
24
26
|
|
|
25
27
|
- The newest Ubuntu image that can build every supported Ruby runs all of them.
|
|
@@ -28,6 +30,14 @@ On x64, a few more jobs fill in the gaps:
|
|
|
28
30
|
- The oldest Ubuntu and Windows images also run the oldest Ruby without SSL.
|
|
29
31
|
- The oldest Ubuntu image also runs the oldest Ruby with the oldest supported Rack.
|
|
30
32
|
|
|
33
|
+
## Versioning
|
|
34
|
+
|
|
35
|
+
Puma follows [SemVer 2.0](https://semver.org/). Puma's public API is its HTTP serving behavior over the socket and its configuration. All of Puma's other Ruby APIs are private and may change in any release.
|
|
36
|
+
|
|
37
|
+
Puma is an HTTP/1.1 server, so any deviation from the relevant RFCs is a bug, which we may fix in a patch release.
|
|
38
|
+
|
|
39
|
+
PRs labeled `breaking change` are strong evidence that a major release is needed.
|
|
40
|
+
|
|
31
41
|
## Puma release support policy
|
|
32
42
|
|
|
33
43
|
By default, Puma supports one release version, the latest release. That means if there is a bug in 3.2.1 (made-up numbers for example only), but the latest release is 4.3.2, the bug must be reproduced in 4.3.2 to qualify for support.
|
|
@@ -36,6 +46,8 @@ When a new major (and sometimes minor) version is released, Puma maintainers wil
|
|
|
36
46
|
|
|
37
47
|
If a bug report cannot be reproduced with the latest Puma version, it may be closed.
|
|
38
48
|
|
|
49
|
+
Security fixes follow a separate policy; see [SECURITY.md](../governance/SECURITY.md#supported-versions).
|
|
50
|
+
|
|
39
51
|
## Ruby version support policy
|
|
40
52
|
|
|
41
53
|
"Ruby version" refers to the https://github.com/ruby/ruby implementation. Puma also supports other Ruby implementations (the origin of Puma involves an alternate Ruby implementation, Rubinius); see below.
|
data/docs/restart.md
CHANGED
|
@@ -15,7 +15,7 @@ If the new process is unable to load, it will simply exit. You should therefore
|
|
|
15
15
|
Any of the following will cause a Puma server to perform a hot restart:
|
|
16
16
|
|
|
17
17
|
* Send the `puma` process the `SIGUSR2` signal
|
|
18
|
-
* Issue a `GET` request to the Puma
|
|
18
|
+
* Issue a `GET` request to the Puma control server with the path `/restart`
|
|
19
19
|
* Issue `pumactl restart` (this uses the control server method if available, otherwise sends the `SIGUSR2` signal to the process)
|
|
20
20
|
|
|
21
21
|
### Supported configurations
|
|
@@ -45,7 +45,7 @@ Phased restarts replace all running workers in a Puma cluster. This is a useful
|
|
|
45
45
|
Any of the following will cause a Puma server to perform a phased restart:
|
|
46
46
|
|
|
47
47
|
* Send the `puma` process the `SIGUSR1` signal
|
|
48
|
-
* Issue a `GET` request to the Puma
|
|
48
|
+
* Issue a `GET` request to the Puma control server with the path `/phased-restart`
|
|
49
49
|
* Issue `pumactl phased-restart` (this uses the control server method if available, otherwise sends the `SIGUSR1` signal to the process)
|
|
50
50
|
|
|
51
51
|
### Supported configurations
|
data/docs/signals.md
CHANGED
|
@@ -38,11 +38,11 @@ Puma cluster responds to these signals:
|
|
|
38
38
|
- `TTIN`: Increment the worker count by 1.
|
|
39
39
|
- `TTOU`: Decrement the worker count by 1.
|
|
40
40
|
- `TERM`: Send `TERM` to worker. The worker will attempt to finish then exit.
|
|
41
|
-
- `USR2`:
|
|
42
|
-
- `USR1`: Restart workers
|
|
41
|
+
- `USR2`: Perform a [hot restart](restart.md#hot-restart). This also reloads the Puma configuration file, if there is one.
|
|
42
|
+
- `USR1`: Restart workers one at a time, a [phased restart](restart.md#phased-restart). This will not reload the configuration file.
|
|
43
43
|
- `HUP`: Reopen log files defined in `stdout_redirect` configuration parameter. If there is no `stdout_redirect` option provided, it will behave like `INT`.
|
|
44
44
|
- `INT`: Equivalent of sending Ctrl-C to cluster. Puma will attempt to finish then exit.
|
|
45
|
-
- `CHLD`: Reap zombie child processes and wake
|
|
45
|
+
- `CHLD`: Reap zombie child processes and wake the master in `fork_worker` and `mold_worker` modes.
|
|
46
46
|
- `URG`: Refork workers in phases from worker 0 if `fork_worker` option is enabled, or from a newly promoted mold if `mold_worker` option is enabled.
|
|
47
47
|
- `INFO` (or `PWR` for systems without `INFO`) print backtraces of all puma threads (if supported on your platform).
|
|
48
48
|
|
data/docs/ssl.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# HTTPS with Puma
|
|
2
|
+
|
|
3
|
+
There are two common setups:
|
|
4
|
+
|
|
5
|
+
1. **TLS terminates at a reverse proxy** (nginx, a load balancer, a CDN). The proxy holds the certificate and talks plain HTTP to Puma over TCP or a Unix socket. Puma needs no SSL configuration.
|
|
6
|
+
2. **TLS terminates in Puma** with an `ssl://` bind or `ssl_bind`. Useful for local HTTPS, or when nothing sits in front of Puma.
|
|
7
|
+
|
|
8
|
+
## TLS at a reverse proxy
|
|
9
|
+
|
|
10
|
+
Bind Puma to a plain socket:
|
|
11
|
+
|
|
12
|
+
```ruby
|
|
13
|
+
# config/puma.rb
|
|
14
|
+
bind 'unix:///myapp/tmp/puma.sock'
|
|
15
|
+
# Or, when the proxy cannot share a filesystem with Puma (for example, separate containers):
|
|
16
|
+
# bind 'tcp://0.0.0.0:9292'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Terminate TLS in nginx and tell the app the original request was HTTPS:
|
|
20
|
+
|
|
21
|
+
```nginx
|
|
22
|
+
upstream myapp {
|
|
23
|
+
server unix:///myapp/tmp/puma.sock;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
server {
|
|
27
|
+
listen 443 ssl;
|
|
28
|
+
server_name myapp.com;
|
|
29
|
+
|
|
30
|
+
ssl_certificate /etc/nginx/certs/cert.pem;
|
|
31
|
+
ssl_certificate_key /etc/nginx/certs/key.pem;
|
|
32
|
+
|
|
33
|
+
location / {
|
|
34
|
+
proxy_pass http://myapp;
|
|
35
|
+
proxy_set_header Host $host;
|
|
36
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
37
|
+
proxy_set_header X-Forwarded-Proto https;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Puma passes `X-Forwarded-Proto` through to the Rack env, and frameworks such as Rails use it to treat the request as HTTPS. If your proxy cannot set the header, `rack_url_scheme 'https'` in the Puma config sets `env['rack.url_scheme']` instead.
|
|
43
|
+
|
|
44
|
+
## TLS in Puma
|
|
45
|
+
|
|
46
|
+
From the command line:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
$ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert'
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Or in `config/puma.rb`:
|
|
53
|
+
|
|
54
|
+
```ruby
|
|
55
|
+
ssl_bind '127.0.0.1', '9292', {
|
|
56
|
+
key: 'path_to_key',
|
|
57
|
+
cert: 'path_to_cert'
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Bind URLs name a socket type, not an HTTP scheme, so use `ssl://`. Puma accepts `tcp://`, `unix://`, and `ssl://`; `https://` is not a valid bind.
|
|
62
|
+
|
|
63
|
+
`verify_mode` controls client certificates, not whether HTTPS is on. The default, `none`, is right for an ordinary HTTPS server. `peer` and `force_peer` are for mutual TLS, usually together with `ca`.
|
|
64
|
+
|
|
65
|
+
See [`Puma::DSL#ssl_bind`](../lib/puma/dsl.rb) for every option, and [Binding TCP / Sockets and SSL](binding.md) for self-signed development certificates, cipher suites, and encrypted keys.
|
|
@@ -10,7 +10,7 @@ Puma 5 brings new experimental performance features, a few quality-of-life featu
|
|
|
10
10
|
2. Upgrade to version 5.0 in your Gemfile and deploy.
|
|
11
11
|
3. Try the new performance experiments outlined below and report your results back to the Puma issue tracker.
|
|
12
12
|
|
|
13
|
-
Puma 5 was named Spoony Bard by our newest supercontributor, [@wjordan](https://github.com/puma/puma/commits?author=wjordan). Will brought you one of our new perf features for this release, as well as [many other fixes and refactors.](https://github.com/puma/puma/commits?author=wjordan) If you'd like to name a Puma release in the future, take a look at [CONTRIBUTING.md](../../CONTRIBUTING.md) and get started helping us out :)
|
|
13
|
+
Puma 5 was named Spoony Bard by our newest supercontributor, [@wjordan](https://github.com/puma/puma/commits?author=wjordan). Will brought you one of our new perf features for this release, as well as [many other fixes and refactors.](https://github.com/puma/puma/commits?author=wjordan) If you'd like to name a Puma release in the future, take a look at [CONTRIBUTING.md](../../governance/CONTRIBUTING.md) and get started helping us out :)
|
|
14
14
|
|
|
15
15
|
Puma 5 also welcomes [@MSP-Greg](https://github.com/puma/puma/commits?author=MSP-Greg) as our newest committer. Greg has been instrumental in improving our CI setup and SSL features. Greg also [named our 4.3.0 release](https://github.com/puma/puma/releases/tag/v4.3.0): Mysterious Traveller.
|
|
16
16
|
|
|
@@ -9,7 +9,7 @@ Here's what you should do:
|
|
|
9
9
|
1. Review the Upgrade section below to look for breaking changes that could affect you.
|
|
10
10
|
2. Upgrade to version 6.0 in your Gemfile and deploy.
|
|
11
11
|
3. Open up a new bug issue if you find any problems.
|
|
12
|
-
4. Join us in building Puma! We welcome first-timers. See [CONTRIBUTING.md](../../CONTRIBUTING.md).
|
|
12
|
+
4. Join us in building Puma! We welcome first-timers. See [CONTRIBUTING.md](../../governance/CONTRIBUTING.md).
|
|
13
13
|
|
|
14
14
|
For a complete list of changes, see [History.md](../../History.md).
|
|
15
15
|
|
|
@@ -7,7 +7,7 @@ Here's what you should do:
|
|
|
7
7
|
1. Review the Upgrade section below to look for breaking changes that could affect you.
|
|
8
8
|
2. Upgrade to version 7.0 in your Gemfile and deploy.
|
|
9
9
|
3. Open up a new bug issue if you find any problems.
|
|
10
|
-
4. Join us in building Puma! We welcome first-timers. See [CONTRIBUTING.md](../../CONTRIBUTING.md).
|
|
10
|
+
4. Join us in building Puma! We welcome first-timers. See [CONTRIBUTING.md](../../governance/CONTRIBUTING.md).
|
|
11
11
|
|
|
12
12
|
For a complete list of changes, see [History.md](../../History.md).
|
|
13
13
|
|
|
@@ -7,7 +7,7 @@ Here's what you should do:
|
|
|
7
7
|
1. Review the Upgrade section below to look for breaking changes that could affect you.
|
|
8
8
|
2. Upgrade to version 8.0 in your Gemfile and deploy.
|
|
9
9
|
3. Open up a new bug issue if you find any problems.
|
|
10
|
-
4. Join us in building Puma! We welcome first-timers. See [CONTRIBUTING.md](../../CONTRIBUTING.md).
|
|
10
|
+
4. Join us in building Puma! We welcome first-timers. See [CONTRIBUTING.md](../../governance/CONTRIBUTING.md).
|
|
11
11
|
|
|
12
12
|
For a complete list of changes, see [History.md](../../History.md).
|
|
13
13
|
|
data/ext/puma_http11/extconf.rb
CHANGED
|
@@ -10,6 +10,8 @@ end
|
|
|
10
10
|
|
|
11
11
|
have_func "prctl(PR_SET_CHILD_SUBREAPER, 1)", "sys/prctl.h"
|
|
12
12
|
|
|
13
|
+
has_ssl = false
|
|
14
|
+
|
|
13
15
|
unless ENV["PUMA_DISABLE_SSL"]
|
|
14
16
|
# don't use pkg_config('openssl') if '--with-openssl-dir' is used
|
|
15
17
|
has_openssl_dir = dir_config('openssl').any? ||
|
|
@@ -30,9 +32,8 @@ unless ENV["PUMA_DISABLE_SSL"]
|
|
|
30
32
|
false
|
|
31
33
|
end
|
|
32
34
|
|
|
33
|
-
if found_ssl
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
if found_ssl && have_header("openssl/bio.h")
|
|
36
|
+
has_ssl = true
|
|
36
37
|
ssl_h = "openssl/ssl.h".freeze
|
|
37
38
|
|
|
38
39
|
puts "\n──── Below are yes for 1.0.2 & later ────"
|
|
@@ -57,11 +58,12 @@ unless ENV["PUMA_DISABLE_SSL"]
|
|
|
57
58
|
end
|
|
58
59
|
end
|
|
59
60
|
|
|
61
|
+
$srcs = %w[http11_parser.c puma_http11.c] unless has_ssl
|
|
62
|
+
|
|
60
63
|
if ENV["PUMA_MAKE_WARNINGS_INTO_ERRORS"]
|
|
61
|
-
# Make all warnings into errors
|
|
62
|
-
# Except `implicit-fallthrough` since most failures comes from ragel state machine generated code
|
|
63
64
|
append_cflags(config_string('WERRORFLAG') || '-Werror')
|
|
64
65
|
append_cflags '-Wno-implicit-fallthrough'
|
|
66
|
+
append_cflags '-Wno-error=type-limits'
|
|
65
67
|
end
|
|
66
68
|
|
|
67
69
|
create_makefile("puma/puma_http11")
|