puma 3.12.0 → 4.3.8

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puma might be problematic. Click here for more details.

Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +164 -0
  3. data/README.md +76 -48
  4. data/docs/architecture.md +1 -0
  5. data/docs/deployment.md +24 -4
  6. data/docs/plugins.md +20 -10
  7. data/docs/restart.md +4 -2
  8. data/docs/systemd.md +27 -9
  9. data/docs/tcp_mode.md +96 -0
  10. data/ext/puma_http11/PumaHttp11Service.java +2 -0
  11. data/ext/puma_http11/extconf.rb +13 -0
  12. data/ext/puma_http11/http11_parser.c +40 -63
  13. data/ext/puma_http11/http11_parser.java.rl +21 -37
  14. data/ext/puma_http11/http11_parser.rl +3 -1
  15. data/ext/puma_http11/http11_parser_common.rl +3 -3
  16. data/ext/puma_http11/mini_ssl.c +86 -4
  17. data/ext/puma_http11/org/jruby/puma/Http11.java +106 -114
  18. data/ext/puma_http11/org/jruby/puma/Http11Parser.java +91 -106
  19. data/ext/puma_http11/org/jruby/puma/IOBuffer.java +72 -0
  20. data/ext/puma_http11/org/jruby/puma/MiniSSL.java +15 -4
  21. data/ext/puma_http11/puma_http11.c +3 -0
  22. data/lib/puma.rb +8 -0
  23. data/lib/puma/accept_nonblock.rb +7 -1
  24. data/lib/puma/app/status.rb +37 -29
  25. data/lib/puma/binder.rb +47 -68
  26. data/lib/puma/cli.rb +6 -0
  27. data/lib/puma/client.rb +244 -199
  28. data/lib/puma/cluster.rb +55 -30
  29. data/lib/puma/commonlogger.rb +2 -0
  30. data/lib/puma/configuration.rb +6 -3
  31. data/lib/puma/const.rb +32 -18
  32. data/lib/puma/control_cli.rb +41 -14
  33. data/lib/puma/detect.rb +2 -0
  34. data/lib/puma/dsl.rb +311 -77
  35. data/lib/puma/events.rb +6 -1
  36. data/lib/puma/io_buffer.rb +3 -6
  37. data/lib/puma/jruby_restart.rb +2 -0
  38. data/lib/puma/launcher.rb +99 -55
  39. data/lib/puma/minissl.rb +37 -17
  40. data/lib/puma/minissl/context_builder.rb +76 -0
  41. data/lib/puma/null_io.rb +2 -0
  42. data/lib/puma/plugin.rb +7 -2
  43. data/lib/puma/plugin/tmp_restart.rb +2 -0
  44. data/lib/puma/rack/builder.rb +4 -1
  45. data/lib/puma/rack/urlmap.rb +2 -0
  46. data/lib/puma/rack_default.rb +2 -0
  47. data/lib/puma/reactor.rb +112 -57
  48. data/lib/puma/runner.rb +13 -3
  49. data/lib/puma/server.rb +119 -48
  50. data/lib/puma/single.rb +5 -3
  51. data/lib/puma/state_file.rb +2 -0
  52. data/lib/puma/tcp_logger.rb +2 -0
  53. data/lib/puma/thread_pool.rb +17 -33
  54. data/lib/puma/util.rb +2 -6
  55. data/lib/rack/handler/puma.rb +6 -3
  56. data/tools/docker/Dockerfile +16 -0
  57. data/tools/jungle/init.d/puma +6 -6
  58. data/tools/trickletest.rb +0 -1
  59. metadata +26 -14
  60. data/lib/puma/compat.rb +0 -14
  61. data/lib/puma/convenient.rb +0 -23
  62. data/lib/puma/daemon_ext.rb +0 -31
  63. data/lib/puma/delegation.rb +0 -11
  64. data/lib/puma/java_io_buffer.rb +0 -45
  65. data/lib/puma/rack/backports/uri/common_193.rb +0 -33
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bff4687b24c136075e00b45d5314fd6326b6240733fff22c706096d10d8ec965
4
- data.tar.gz: db2020f983ba02f7403e50f9f9391bd2f20e811fa42121147d4cbaf619e1d8d3
3
+ metadata.gz: 0133cf43153c495af4daa489fd6db234a14fb0d7b72201b71260d4d57dfb1211
4
+ data.tar.gz: a1a369772eaf8e3e0efa2931c4cdfdc1880314540c260d6c01226f4b0fd2a863
5
5
  SHA512:
6
- metadata.gz: d6d7efcb9aeb437c07f49cb5a589ed016d888acab08f130bb382f2d470b301ec40ce3df90fbe4cf989bc84468633b180894c60daca377346d283210e6fedba98
7
- data.tar.gz: 2d45380434e8d88d534a27db1a1f843d70b925a64065d55ee637153669b3c78f1539bf4c84ee166ec90636ba3ee948a97540c0bdbac5cc3d68809c86874038f8
6
+ metadata.gz: 6dfe3a8aa4e40676eb2c70822dac050c75f9bf9ec5270626e2b282a5971f323b2661d5792a4d24982e236f378a13ddf8408080e18bf7f4957cfd5971a7d8d034
7
+ data.tar.gz: 95706c08d6b746d82af99474001664b282bf760fbbef14860b5e6897dd4eaedc3f4b49a5da2a1809dcfcf0a23fe5f62baabe5da88c631c8228889c615248fe03
data/History.md CHANGED
@@ -1,3 +1,158 @@
1
+ ## 4.3.8 / 2021-05-11
2
+
3
+ * Security
4
+ * Close keepalive connections after the maximum number of fast inlined requests (#2625)
5
+
6
+ ## 4.3.7 / 2020-11-30
7
+
8
+ * Bugfixes
9
+ * Backport set CONTENT_LENGTH for chunked requests (Originally: #2287, backport: #2496)
10
+
11
+ ## 4.3.6 / 2020-09-05
12
+
13
+ * Bugfixes
14
+ * Explicitly include ctype.h to fix compilation warning and build error on macOS with Xcode 12 (#2304)
15
+ * Don't require json at boot (#2269)
16
+ * Set `CONTENT_LENGTH` for chunked requests (#2287)
17
+
18
+ ## 4.3.4/4.3.5 and 3.12.5/3.12.6 / 2020-05-22
19
+
20
+ Each patchlevel release contains a separate security fix. We recommend simply upgrading to 4.3.5/3.12.6.
21
+
22
+ ## 4.3.3 and 3.12.4 / 2020-02-28
23
+ * Bugfixes
24
+ * Fix: Fixes a problem where we weren't splitting headers correctly on newlines (#2132)
25
+ * Security
26
+ * Fix: Prevent HTTP Response splitting via CR in early hints.
27
+
28
+ ## 4.3.2 and 3.12.3 / 2020-02-27
29
+
30
+ * Security
31
+ * Fix: Prevent HTTP Response splitting via CR/LF in header values. CVE-2020-5247.
32
+
33
+ ## 4.3.1 and 3.12.2 / 2019-12-05
34
+
35
+ * Security
36
+ * Fix: a poorly-behaved client could use keepalive requests to monopolize Puma's reactor and create a denial of service attack. CVE-2019-16770.
37
+
38
+ ## 4.3.0 / 2019-11-07
39
+
40
+ * Features
41
+ * Strip whitespace at end of HTTP headers (#2010)
42
+ * Optimize HTTP parser for JRuby (#2012)
43
+ * Add SSL support for the control app and cli (#2046, #2052)
44
+
45
+ * Bugfixes
46
+ * Fix Errno::EINVAL when SSL is enabled and browser rejects cert (#1564)
47
+ * Fix pumactl defaulting puma to development if an environment was not specified (#2035)
48
+ * Fix closing file stream when reading pid from pidfile (#2048)
49
+ * Fix a typo in configuration option `--extra_runtime_dependencies` (#2050)
50
+
51
+ ## 4.2.1 / 2019-10-07
52
+
53
+ * 3 bugfixes
54
+ * Fix socket activation of systemd (pre-existing) unix binder files (#1842, #1988)
55
+ * Deal with multiple calls to bind correctly (#1986, #1994, #2006)
56
+ * Accepts symbols for `verify_mode` (#1222)
57
+
58
+ ## 4.2.0 / 2019-09-23
59
+
60
+ * 6 features
61
+ * Pumactl has a new -e environment option and reads `config/puma/<environment>.rb` config files (#1885)
62
+ * Semicolons are now allowed in URL paths (MRI only), useful for Angular or Redmine (#1934)
63
+ * Allow extra dependencies to be defined when using prune_bundler (#1105)
64
+ * Puma now reports the correct port when binding to port 0, also reports other listeners when binding to localhost (#1786)
65
+ * Sending SIGINFO to any Puma worker now prints currently active threads and their backtraces (#1320)
66
+ * Puma threads all now have their name set on Ruby 2.3+ (#1968)
67
+ * 4 bugfixes
68
+ * Fix some misbehavior with phased restart and externally SIGTERMed workers (#1908, #1952)
69
+ * Fix socket closing on error (#1941)
70
+ * Removed unnecessary SIGINT trap for JRuby that caused some race conditions (#1961)
71
+ * Fix socket files being left around after process stopped (#1970)
72
+ * Absolutely thousands of lines of test improvements and fixes thanks to @MSP-Greg
73
+
74
+ ## 4.1.1 / 2019-09-05
75
+
76
+ * 3 bugfixes
77
+ * Revert our attempt to not dup STDOUT/STDERR (#1946)
78
+ * Fix socket close on error (#1941)
79
+ * Fix workers not shutting down correctly (#1908)
80
+
81
+ ## 4.1.0 / 2019-08-08
82
+
83
+ * 4 features
84
+ * Add REQUEST_PATH on parse error message (#1831)
85
+ * You can now easily add custom log formatters with the `log_formatter` config option (#1816)
86
+ * Puma.stats now provides process start times (#1844)
87
+ * Add support for disabling TLSv1.1 (#1836)
88
+
89
+ * 7 bugfixes
90
+ * Fix issue where Puma was creating zombie process entries (#1887)
91
+ * Fix bugs with line-endings and chunked encoding (#1812)
92
+ * RACK_URL_SCHEME is now set correctly in all conditions (#1491)
93
+ * We no longer mutate global STDOUT/STDERR, particularly the sync setting (#1837)
94
+ * SSL read_nonblock no longer blocks (#1857)
95
+ * Swallow connection errors when sending early hints (#1822)
96
+ * Backtrace no longer dumped when invalid pumactl commands are run (#1863)
97
+
98
+ * 5 other
99
+ * Avoid casting worker_timeout twice (#1838)
100
+ * Removed a call to private that wasn't doing anything (#1882)
101
+ * README, Rakefile, docs and test cleanups (#1848, #1847, #1846, #1853, #1859, #1850, #1866, #1870, #1872, #1833, #1888)
102
+ * Puma.io has proper documentation now (https://puma.io/puma/)
103
+ * Added the Contributor Covenant CoC
104
+
105
+ * 1 known issue
106
+ * Some users are still experiencing issues surrounding socket activation and Unix sockets (#1842)
107
+
108
+ ## 4.0.1 / 2019-07-11
109
+
110
+ * 2 bugfixes
111
+ * Fix socket removed after reload - should fix problems with systemd socket activation. (#1829)
112
+ * Add extconf tests for DTLS_method & TLS_server_method, use in minissl.rb. Should fix "undefined symbol: DTLS_method" when compiling against old OpenSSL versions. (#1832)
113
+ * 1 other
114
+ * Removed unnecessary RUBY_VERSION checks. (#1827)
115
+
116
+ ## 4.0.0 / 2019-06-25
117
+
118
+ * 9 features
119
+ * Add support for disabling TLSv1.0 (#1562)
120
+ * Request body read time metric (#1569)
121
+ * Add out_of_band hook (#1648)
122
+ * Re-implement (native) IOBuffer for JRuby (#1691)
123
+ * Min worker timeout (#1716)
124
+ * Add option to suppress SignalException on SIGTERM (#1690)
125
+ * Allow mutual TLS CA to be set using `ssl_bind` DSL (#1689)
126
+ * Reactor now uses nio4r instead of `select` (#1728)
127
+ * Add status to pumactl with pidfile (#1824)
128
+
129
+ * 10 bugfixes
130
+ * Do not accept new requests on shutdown (#1685, #1808)
131
+ * Fix 3 corner cases when request body is chunked (#1508)
132
+ * Change pid existence check's condition branches (#1650)
133
+ * Don't call .stop on a server that doesn't exist (#1655)
134
+ * Implemented NID_X9_62_prime256v1 (P-256) curve over P-521 (#1671)
135
+ * Fix @notify.close can't modify frozen IOError (RuntimeError) (#1583)
136
+ * Fix Java 8 support (#1773)
137
+ * Fix error `uninitialized constant Puma::Cluster` (#1731)
138
+ * Fix `not_token` being able to be set to true (#1803)
139
+ * Fix "Hang on SIGTERM with ruby 2.6 in clustered mode" ([PR #1741], [#1674], [#1720], [#1730], [#1755])
140
+
141
+ [PR #1741]: https://github.com/puma/puma/pull/1741
142
+ [#1674]: https://github.com/puma/puma/issues/1674
143
+ [#1720]: https://github.com/puma/puma/issues/1720
144
+ [#1730]: https://github.com/puma/puma/issues/1730
145
+ [#1755]: https://github.com/puma/puma/issues/1755
146
+
147
+ ## 3.12.1 / 2019-03-19
148
+
149
+ * 1 features
150
+ * Internal strings are frozen (#1649)
151
+ * 3 bugfixes
152
+ * Fix chunked ending check (#1607)
153
+ * Rack handler should use provided default host (#1700)
154
+ * Better support for detecting runtimes that support `fork` (#1630)
155
+
1
156
  ## 3.12.0 / 2018-07-13
2
157
 
3
158
  * 5 features:
@@ -1395,3 +1550,12 @@ be added back in a future date when a java Puma::MiniSSL is added.
1395
1550
  ## 1.0.0 / 2012-03-29
1396
1551
 
1397
1552
  * Released!
1553
+
1554
+ ## Ignore - this is for maintainers to copy-paste during release
1555
+ ## Master
1556
+
1557
+ * Features
1558
+ * Your feature goes here (#Github Number)
1559
+
1560
+ * Bugfixes
1561
+ * Your bugfix goes here (#Github Number)
data/README.md CHANGED
@@ -1,45 +1,48 @@
1
1
  <p align="center">
2
- <img src="http://puma.io/images/logos/puma-logo-large.png">
2
+ <img src="https://puma.io/images/logos/puma-logo-large.png">
3
3
  </p>
4
4
 
5
5
  # Puma: A Ruby Web Server Built For Concurrency
6
6
 
7
7
  [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/puma/puma?utm\_source=badge&utm\_medium=badge&utm\_campaign=pr-badge)
8
- [![Build Status](https://secure.travis-ci.org/puma/puma.svg)](http://travis-ci.org/puma/puma)
9
- [![AppVeyor](https://img.shields.io/appveyor/ci/nateberkopec/puma.svg)](https://ci.appveyor.com/project/nateberkopec/puma)
10
- [![Dependency Status](https://gemnasium.com/puma/puma.svg)](https://gemnasium.com/puma/puma)
8
+ [![Actions Build Status](https://github.com/puma/puma/workflows/Puma/badge.svg)](https://github.com/puma/puma/actions)
9
+ [![Travis Build Status](https://travis-ci.org/puma/puma.svg?branch=master)](https://travis-ci.org/puma/puma)
10
+
11
11
  [![Code Climate](https://codeclimate.com/github/puma/puma.svg)](https://codeclimate.com/github/puma/puma)
12
+ [![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)
12
13
 
13
- Puma is a **simple, fast, threaded, and highly concurrent HTTP 1.1 server for Ruby/Rack applications** in development and production.
14
+ Puma is a **simple, fast, multi-threaded, and highly concurrent HTTP 1.1 server for Ruby/Rack applications**.
14
15
 
15
16
  ## Built For Speed &amp; Concurrency
16
17
 
17
- Under the hood, 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 in a thread from an internal thread pool. Since each request is served in a separate thread, truly concurrent Ruby implementations (JRuby, Rubinius) will use all available CPU cores.
18
+ 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 concurrent Ruby implementations (JRuby, Rubinius) will use all available CPU cores.
18
19
 
19
- Puma was designed to be the go-to server for [Rubinius](http://rubini.us), but also works well with JRuby and MRI.
20
+ Puma was designed to be the go-to server for [Rubinius](https://rubinius.com), but also works well with JRuby and MRI.
20
21
 
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 blocking IO to be run concurrently.
22
+ 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.
22
23
 
23
24
  ## Quick Start
24
25
 
25
26
  ```
26
27
  $ gem install puma
27
- $ puma <any rackup (*.ru) file>
28
- ```
28
+ $ puma
29
+ ```
30
+
31
+ Without arguments, puma will look for a rackup (.ru) file in the current working directory called `config.ru`.
29
32
 
30
33
  ## Frameworks
31
34
 
32
35
  ### Rails
33
36
 
34
- Puma is the default server for Rails, and should already be included in your Gemfile.
37
+ Puma is the default server for Rails, included in the generated Gemfile.
35
38
 
36
- Then start your server with the `rails` command:
39
+ Start your server with the `rails` command:
37
40
 
38
41
  ```
39
- $ rails s
42
+ $ rails server
40
43
  ```
41
44
 
42
- Many configuration options are not available when using `rails s`. It is recommended that you use Puma's executable instead:
45
+ Many configuration options and Puma features are not available when using `rails server`. It is recommended that you use Puma's executable instead:
43
46
 
44
47
  ```
45
48
  $ bundle exec puma
@@ -53,7 +56,7 @@ You can run your Sinatra application with Puma from the command line like this:
53
56
  $ ruby app.rb -s Puma
54
57
  ```
55
58
 
56
- Or you can configure your application to always use Puma:
59
+ Or you can configure your Sinatra application to always use Puma:
57
60
 
58
61
  ```ruby
59
62
  require 'sinatra'
@@ -64,6 +67,9 @@ configure { set :server, :puma }
64
67
 
65
68
  Puma provides numerous options. Consult `puma -h` (or `puma --help`) for a full list of CLI options, or see [dsl.rb](https://github.com/puma/puma/blob/master/lib/puma/dsl.rb).
66
69
 
70
+ You can also find several configuration examples as part of the
71
+ [test](test/config) suite.
72
+
67
73
  ### Thread Pool
68
74
 
69
75
  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:
@@ -72,9 +78,9 @@ Puma uses a thread pool. You can set the minimum and maximum number of threads t
72
78
  $ puma -t 8:32
73
79
  ```
74
80
 
75
- 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`. 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 hit resource limits).
81
+ 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`. 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).
76
82
 
77
- 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.
83
+ 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.
78
84
 
79
85
  ### Clustered mode
80
86
 
@@ -84,9 +90,9 @@ Puma also offers "clustered mode". Clustered mode `fork`s workers from a master
84
90
  $ puma -t 8:32 -w 3
85
91
  ```
86
92
 
87
- 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.
93
+ 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.
88
94
 
89
- In clustered mode, Puma may "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:
95
+ 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:
90
96
 
91
97
  ```
92
98
  $ puma -w 3 --preload
@@ -111,40 +117,42 @@ end
111
117
 
112
118
  This code can be used to setup the process before booting the application, allowing
113
119
  you to do some Puma-specific things that you don't want to embed in your application.
114
- For instance, you could fire a log notification that a worker booted or send something to statsd.
115
- This can be called multiple times.
120
+ For instance, you could fire a log notification that a worker booted or send something to statsd. This can be called multiple times.
116
121
 
117
- If you're preloading your application and using ActiveRecord, it's recommended that you setup your connection pool here:
122
+ `before_fork` specifies a block to be run before workers are forked:
118
123
 
119
124
  ```ruby
120
125
  # config/puma.rb
121
- on_worker_boot do
122
- ActiveSupport.on_load(:active_record) do
123
- ActiveRecord::Base.establish_connection
124
- end
126
+ before_fork do
127
+ # configuration here
125
128
  end
126
129
  ```
127
130
 
128
- On top of that, you can specify a block in your configuration file that will be run before workers are forked:
131
+ 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.
132
+
133
+ ### Error handling
134
+
135
+ If puma encounters an error outside of the context of your application, it will respond with a 500 and a simple
136
+ textual error message (see `lowlevel_error` in [this file](https://github.com/puma/puma/blob/master/lib/puma/server.rb)).
137
+ You can specify custom behavior for this scenario. For example, you can report the error to your third-party
138
+ error-tracking service (in this example, [rollbar](http://rollbar.com)):
129
139
 
130
140
  ```ruby
131
- # config/puma.rb
132
- before_fork do
133
- # configuration here
141
+ lowlevel_error_handler do |e|
142
+ Rollbar.critical(e)
143
+ [500, {}, ["An error has occurred, and engineers have been informed. Please reload the page. If you continue to have problems, contact support@example.com\n"]]
134
144
  end
135
145
  ```
136
146
 
137
- 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.
138
-
139
147
  ### Binding TCP / Sockets
140
148
 
141
- In contrast to many other server configs which require multiple flags, Puma simply uses one URI parameter with the `-b` (or `--bind`) flag:
149
+ Bind Puma to a socket with the `-b` (or `--bind`) flag:
142
150
 
143
151
  ```
144
152
  $ puma -b tcp://127.0.0.1:9292
145
153
  ```
146
154
 
147
- Want to use UNIX Sockets instead of TCP (which can provide a 5-10% performance boost)?
155
+ To use a UNIX Socket instead of TCP:
148
156
 
149
157
  ```
150
158
  $ puma -b unix:///var/run/puma.sock
@@ -157,30 +165,44 @@ $ puma -b 'unix:///var/run/puma.sock?umask=0111'
157
165
  ```
158
166
 
159
167
  Need a bit of security? Use SSL sockets:
168
+
160
169
  ```
161
170
  $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert'
162
171
  ```
172
+
163
173
  #### Controlling SSL Cipher Suites
164
- Need to use or avoid specific SSL cipher suites? Use ssl_cipher_filter or ssl_cipher_list options.
165
- #####Ruby:
174
+
175
+ To use or avoid specific SSL cipher suites, use `ssl_cipher_filter` or `ssl_cipher_list` options.
176
+
177
+ ##### Ruby:
178
+
166
179
  ```
167
180
  $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&ssl_cipher_filter=!aNULL:AES+SHA'
168
181
  ```
169
- #####JRuby:
182
+
183
+ ##### JRuby:
184
+
170
185
  ```
171
186
  $ 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'
172
187
  ```
188
+
173
189
  See https://www.openssl.org/docs/man1.0.2/apps/ciphers.html for cipher filter format and full list of cipher suites.
174
190
 
191
+ Disable TLS v1 with the `no_tlsv1` option:
192
+
193
+ ```
194
+ $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&no_tlsv1=true'
195
+ ```
196
+
175
197
  ### Control/Status Server
176
198
 
177
- Puma has a built-in status/control app that can be used to query and control Puma itself.
199
+ Puma has a built-in status and control app that can be used to query and control Puma.
178
200
 
179
201
  ```
180
202
  $ puma --control-url tcp://127.0.0.1:9293 --control-token foo
181
203
  ```
182
204
 
183
- Puma will start the control server on localhost port 9293. All requests to the control server will need to include `token=foo` as a query parameter. This allows for simple authentication. Check out [status.rb](https://github.com/puma/puma/blob/master/lib/puma/app/status.rb) to see what the app has available.
205
+ Puma will start the control server on localhost port 9293. All requests to the control server will need to include control token (in this case, `token=foo`) as a query parameter. This allows for simple authentication. Check out [status.rb](https://github.com/puma/puma/blob/master/lib/puma/app/status.rb) to see what the status app has available.
184
206
 
185
207
  You can also interact with the control server via `pumactl`. This command will restart Puma:
186
208
 
@@ -192,13 +214,13 @@ To see a list of `pumactl` options, use `pumactl --help`.
192
214
 
193
215
  ### Configuration File
194
216
 
195
- You can also provide a configuration file which Puma will use with the `-C` (or `--config`) flag:
217
+ You can also provide a configuration file with the `-C` (or `--config`) flag:
196
218
 
197
219
  ```
198
220
  $ puma -C /path/to/config
199
221
  ```
200
222
 
201
- If no configuration file is specified, Puma will look for a configuration file at `config/puma.rb`. If an environment is specified, either via the `-e` and `--environment` flags, or through the `RACK_ENV` environment variable, the default file location will be `config/puma/environment_name.rb`.
223
+ If no configuration file is specified, Puma will look for a configuration file at `config/puma.rb`. If an environment is specified, either via the `-e` and `--environment` flags, or through the `RACK_ENV` environment variable, Puma looks for configuration at `config/puma/<environment_name>.rb`.
202
224
 
203
225
  If you want to prevent Puma from looking for a configuration file in those locations, provide a dash as the argument to the `-C` (or `--config`) flag:
204
226
 
@@ -206,7 +228,9 @@ If you want to prevent Puma from looking for a configuration file in those locat
206
228
  $ puma -C "-"
207
229
  ```
208
230
 
209
- Take the following [sample configuration](https://github.com/puma/puma/blob/master/examples/config.rb) as inspiration or check out [dsl.rb](https://github.com/puma/puma/blob/master/lib/puma/dsl.rb) to see all available options.
231
+ 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 [here](https://github.com/puma/puma/blob/12d1706ddc71b89ed2ee26275e31c788e94ff541/lib/puma/configuration.rb#L170).
232
+
233
+ Check out [dsl.rb](https://github.com/puma/puma/blob/master/lib/puma/dsl.rb) to see all available options.
210
234
 
211
235
  ## Restart
212
236
 
@@ -223,7 +247,7 @@ Puma responds to several signals. A detailed guide to using UNIX signals with Pu
223
247
  Some platforms do not support all Puma features.
224
248
 
225
249
  * **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).
226
- * **Windows**: daemon mode is not supported due to a lack of fork(2).
250
+ * **Windows**: Cluster mode is not supported due to a lack of fork(2).
227
251
 
228
252
  ## Known Bugs
229
253
 
@@ -249,14 +273,18 @@ reliability in production environments:
249
273
  * [tools/jungle](https://github.com/puma/puma/tree/master/tools/jungle) for sysvinit (init.d) and upstart
250
274
  * [docs/systemd](https://github.com/puma/puma/blob/master/docs/systemd.md)
251
275
 
276
+ ## Community Plugins
277
+
278
+ * [puma-heroku](https://github.com/evanphx/puma-heroku) — default Puma configuration for running on Heroku
279
+ * [puma-metrics](https://github.com/harmjanblok/puma-metrics) — export Puma metrics to Prometheus
280
+ * [puma-plugin-statsd](https://github.com/yob/puma-plugin-statsd) — send Puma metrics to statsd
281
+ * [puma-plugin-systemd](https://github.com/sj26/puma-plugin-systemd) — deeper integration with systemd for notify, status and watchdog
282
+
252
283
  ## Contributing
253
284
 
254
- To run the test suite:
285
+ Find details for contributing in the [contribution guide].
255
286
 
256
- ```bash
257
- $ bundle install
258
- $ bundle exec rake
259
- ```
287
+ [contribution guide]: https://github.com/puma/puma/blob/master/CONTRIBUTING.md
260
288
 
261
289
  ## License
262
290