puma 3.4.0 → 3.12.0

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 (71) hide show
  1. checksums.yaml +5 -5
  2. data/{History.txt → History.md} +356 -74
  3. data/README.md +143 -227
  4. data/docs/architecture.md +36 -0
  5. data/{DEPLOYMENT.md → docs/deployment.md} +1 -1
  6. data/docs/images/puma-connection-flow-no-reactor.png +0 -0
  7. data/docs/images/puma-connection-flow.png +0 -0
  8. data/docs/images/puma-general-arch.png +0 -0
  9. data/docs/plugins.md +28 -0
  10. data/docs/restart.md +39 -0
  11. data/docs/signals.md +56 -3
  12. data/docs/systemd.md +124 -22
  13. data/ext/puma_http11/extconf.rb +2 -0
  14. data/ext/puma_http11/http11_parser.c +291 -447
  15. data/ext/puma_http11/http11_parser.h +1 -0
  16. data/ext/puma_http11/http11_parser.rl +10 -9
  17. data/ext/puma_http11/http11_parser_common.rl +1 -1
  18. data/ext/puma_http11/io_buffer.c +7 -7
  19. data/ext/puma_http11/mini_ssl.c +67 -6
  20. data/ext/puma_http11/org/jruby/puma/Http11Parser.java +76 -94
  21. data/ext/puma_http11/org/jruby/puma/MiniSSL.java +15 -2
  22. data/ext/puma_http11/puma_http11.c +1 -0
  23. data/lib/puma.rb +13 -5
  24. data/lib/puma/app/status.rb +8 -0
  25. data/lib/puma/binder.rb +46 -21
  26. data/lib/puma/cli.rb +49 -33
  27. data/lib/puma/client.rb +149 -4
  28. data/lib/puma/cluster.rb +55 -13
  29. data/lib/puma/commonlogger.rb +19 -20
  30. data/lib/puma/compat.rb +3 -7
  31. data/lib/puma/configuration.rb +136 -131
  32. data/lib/puma/const.rb +19 -37
  33. data/lib/puma/control_cli.rb +38 -35
  34. data/lib/puma/convenient.rb +3 -3
  35. data/lib/puma/detect.rb +3 -1
  36. data/lib/puma/dsl.rb +86 -57
  37. data/lib/puma/events.rb +17 -13
  38. data/lib/puma/io_buffer.rb +1 -1
  39. data/lib/puma/jruby_restart.rb +0 -1
  40. data/lib/puma/launcher.rb +61 -30
  41. data/lib/puma/minissl.rb +85 -4
  42. data/lib/puma/null_io.rb +6 -13
  43. data/lib/puma/plugin.rb +12 -1
  44. data/lib/puma/plugin/tmp_restart.rb +1 -2
  45. data/lib/puma/rack/builder.rb +3 -0
  46. data/lib/puma/rack/urlmap.rb +9 -8
  47. data/lib/puma/reactor.rb +144 -0
  48. data/lib/puma/runner.rb +27 -1
  49. data/lib/puma/server.rb +135 -33
  50. data/lib/puma/single.rb +17 -3
  51. data/lib/puma/tcp_logger.rb +8 -1
  52. data/lib/puma/thread_pool.rb +70 -20
  53. data/lib/puma/util.rb +1 -5
  54. data/lib/rack/handler/puma.rb +58 -17
  55. data/tools/jungle/README.md +12 -2
  56. data/tools/jungle/init.d/README.md +9 -2
  57. data/tools/jungle/init.d/puma +85 -58
  58. data/tools/jungle/init.d/run-puma +16 -1
  59. data/tools/jungle/rc.d/README.md +74 -0
  60. data/tools/jungle/rc.d/puma +61 -0
  61. data/tools/jungle/rc.d/puma.conf +10 -0
  62. data/tools/jungle/upstart/puma.conf +1 -1
  63. data/tools/trickletest.rb +1 -1
  64. metadata +22 -94
  65. data/Gemfile +0 -13
  66. data/Manifest.txt +0 -78
  67. data/Rakefile +0 -158
  68. data/docs/config.md +0 -0
  69. data/lib/puma/rack/backports/uri/common_18.rb +0 -59
  70. data/lib/puma/rack/backports/uri/common_192.rb +0 -55
  71. data/puma.gemspec +0 -52
@@ -1,3 +1,18 @@
1
1
  #!/bin/bash
2
+
3
+ # on system boot, and root have no rbenv installed,
4
+ # after start-stop-daemon switched to current user, we have to init rbenv
5
+ if [ -d "$HOME/.rbenv/bin" ]; then
6
+ PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"
7
+ eval "$(rbenv init -)"
8
+ elif [ -d "/usr/local/rbenv/bin" ]; then
9
+ PATH="/usr/local/rbenv/bin:/usr/local/rbenv/shims:$PATH"
10
+ eval "$(rbenv init -)"
11
+ elif [ -f /usr/local/rvm/scripts/rvm ]; then
12
+ source /etc/profile.d/rvm.sh
13
+ elif [ -f "$HOME/.rvm/scripts/rvm" ]; then
14
+ source "$HOME/.rvm/scripts/rvm"
15
+ fi
16
+
2
17
  app=$1; config=$2; log=$3;
3
- cd $app && exec bundle exec puma -C $config 2>&1 >> $log
18
+ cd $app && exec bundle exec puma -C $config >> $log 2>&1
@@ -0,0 +1,74 @@
1
+ # Puma as a service using rc.d
2
+
3
+ Manage multilpe Puma servers as services on one box using FreeBSD's rc.d service.
4
+
5
+ ## Dependencies
6
+
7
+ * `jq` - a command-line json parser is needed to parse the json in the config file
8
+
9
+ ## Installation
10
+
11
+ # Copy the puma script to the rc.d directory (make sure everyone has read/execute perms)
12
+ sudo cp puma /usr/local/etc/rc.d/
13
+
14
+ # Create an empty configuration file
15
+ sudo touch /usr/local/etc/puma.conf
16
+
17
+ # Enable the puma service
18
+ sudo echo 'puma_enable="YES"' >> /etc/rc.conf
19
+
20
+ ## Managing the jungle
21
+
22
+ Puma apps are referenced in /usr/local/etc/puma.conf by default.
23
+
24
+ Start the jungle running:
25
+
26
+ `service puma start`
27
+
28
+ This script will run at boot time.
29
+
30
+
31
+ You can also stop the jungle (stops ALL puma instances) by running:
32
+
33
+ `service puma stop`
34
+
35
+
36
+ To restart the jungle:
37
+
38
+ `service puma restart`
39
+
40
+ ## Conventions
41
+
42
+ * The script expects:
43
+ * a config file to exist under `config/puma.rb` in your app. E.g.: `/home/apps/my-app/config/puma.rb`.
44
+
45
+ You can always change those defaults by editing the scripts.
46
+
47
+ ## Here's what a minimal app's config file should have
48
+
49
+ ```
50
+ {
51
+ "servers" : [
52
+ {
53
+ "dir": "/path/to/rails/project",
54
+ "user": "deploy-user",
55
+ "ruby_version": "ruby.version",
56
+ "ruby_env": "rbenv"
57
+ }
58
+ ]
59
+ }
60
+ ```
61
+
62
+ ## Before starting...
63
+
64
+ You need to customise `puma.conf` to:
65
+
66
+ * Set the right user your app should be running on unless you want root to execute it!
67
+ * Set the directory of the app
68
+ * Set the ruby version to execute
69
+ * Set the ruby environment (currently set to rbenv, since that is the only ruby environment currently supported)
70
+ * Add additional server instances following the scheme in the example
71
+
72
+ ## Notes:
73
+
74
+ Only rbenv is currently supported.
@@ -0,0 +1,61 @@
1
+ #!/bin/sh
2
+ #
3
+
4
+ # PROVIDE: puma
5
+
6
+ . /etc/rc.subr
7
+
8
+ name="puma"
9
+ start_cmd="puma_start"
10
+ stop_cmd="puma_stop"
11
+ restart_cmd="puma_restart"
12
+ rcvar=puma_enable
13
+ required_files=/usr/local/etc/puma.conf
14
+
15
+ puma_start()
16
+ {
17
+ server_count=$(/usr/local/bin/jq ".servers[] .ruby_env" /usr/local/etc/puma.conf | wc -l)
18
+ i=0
19
+ while [ "$i" -lt "$server_count" ]; do
20
+ rb_env=$(/usr/local/bin/jq -r ".servers[$i].ruby_env" /usr/local/etc/puma.conf)
21
+ dir=$(/usr/local/bin/jq -r ".servers[$i].dir" /usr/local/etc/puma.conf)
22
+ user=$(/usr/local/bin/jq -r ".servers[$i].user" /usr/local/etc/puma.conf)
23
+ rb_ver=$(/usr/local/bin/jq -r ".servers[$i].ruby_version" /usr/local/etc/puma.conf)
24
+ case $rb_env in
25
+ "rbenv")
26
+ su - $user -c "cd $dir && rbenv shell $rb_ver && bundle exec puma -C $dir/config/puma.rb -d"
27
+ ;;
28
+ *)
29
+ ;;
30
+ esac
31
+ i=$(( i + 1 ))
32
+ done
33
+ }
34
+
35
+ puma_stop()
36
+ {
37
+ pkill ruby
38
+ }
39
+
40
+ puma_restart()
41
+ {
42
+ server_count=$(/usr/local/bin/jq ".servers[] .ruby_env" /usr/local/etc/puma.conf | wc -l)
43
+ i=0
44
+ while [ "$i" -lt "$server_count" ]; do
45
+ rb_env=$(/usr/local/bin/jq -r ".servers[$i].ruby_env" /usr/local/etc/puma.conf)
46
+ dir=$(/usr/local/bin/jq -r ".servers[$i].dir" /usr/local/etc/puma.conf)
47
+ user=$(/usr/local/bin/jq -r ".servers[$i].user" /usr/local/etc/puma.conf)
48
+ rb_ver=$(/usr/local/bin/jq -r ".servers[$i].ruby_version" /usr/local/etc/puma.conf)
49
+ case $rb_env in
50
+ "rbenv")
51
+ su - $user -c "cd $dir && pkill ruby && rbenv shell $ruby_version && bundle exec puma -C $dir/config/puma.rb -d"
52
+ ;;
53
+ *)
54
+ ;;
55
+ esac
56
+ i=$(( i + 1 ))
57
+ done
58
+ }
59
+
60
+ load_rc_config $name
61
+ run_rc_command "$1"
@@ -0,0 +1,10 @@
1
+ {
2
+ "servers" : [
3
+ {
4
+ "dir": "/path/to/rails/project",
5
+ "user": "deploy-user",
6
+ "ruby_version": "ruby.version",
7
+ "ruby_env": "rbenv"
8
+ }
9
+ ]
10
+ }
@@ -4,7 +4,7 @@
4
4
  # allows you to manage multiple Puma instances with
5
5
  # Upstart, Ubuntu's native service management tool.
6
6
  #
7
- # See workers.conf for how to manage all Puma instances at once.
7
+ # See puma-manager.conf for how to manage all Puma instances at once.
8
8
  #
9
9
  # Save this config as /etc/init/puma.conf then manage puma with:
10
10
  # sudo start puma app=PATH_TO_APP
@@ -31,7 +31,7 @@ st = "GET / HTTP/1.1\r\nHost: www.zedshaw.com\r\nContent-Type: text/plain\r\nCon
31
31
  puts "length: #{content.length}"
32
32
 
33
33
  threads = []
34
- ARGV[1].to_i.times do
34
+ ARGV[1].to_i.times do
35
35
  t = Thread.new do
36
36
  size = 100
37
37
  puts ">>>> #{size} sized chunks"
metadata CHANGED
@@ -1,81 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Phoenix
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-07 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rdoc
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '4.0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '4.0'
27
- - !ruby/object:Gem::Dependency
28
- name: rack
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '1.1'
34
- - - "<"
35
- - !ruby/object:Gem::Version
36
- version: '2.0'
37
- type: :development
38
- prerelease: false
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: '1.1'
44
- - - "<"
45
- - !ruby/object:Gem::Version
46
- version: '2.0'
47
- - !ruby/object:Gem::Dependency
48
- name: rake-compiler
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '0.8'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '0.8'
61
- - !ruby/object:Gem::Dependency
62
- name: hoe
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: '3.15'
68
- type: :development
69
- prerelease: false
70
- version_requirements: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - "~>"
73
- - !ruby/object:Gem::Version
74
- version: '3.15'
11
+ date: 2018-07-13 00:00:00.000000000 Z
12
+ dependencies: []
75
13
  description: Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server
76
14
  for Ruby/Rack applications. Puma is intended for use in both development and production
77
- environments. In order to get the best throughput, it is highly recommended that
78
- you use a Ruby implementation with real threads like Rubinius or JRuby.
15
+ environments. It's great for highly concurrent Ruby implementations such as Rubinius
16
+ and JRuby as well as as providing process worker support to support CRuby well.
79
17
  email:
80
18
  - evan@phx.io
81
19
  executables:
@@ -83,31 +21,22 @@ executables:
83
21
  - pumactl
84
22
  extensions:
85
23
  - ext/puma_http11/extconf.rb
86
- extra_rdoc_files:
87
- - DEPLOYMENT.md
88
- - History.txt
89
- - Manifest.txt
90
- - README.md
91
- - docs/config.md
92
- - docs/nginx.md
93
- - docs/signals.md
94
- - docs/systemd.md
95
- - tools/jungle/README.md
96
- - tools/jungle/init.d/README.md
97
- - tools/jungle/upstart/README.md
24
+ extra_rdoc_files: []
98
25
  files:
99
- - DEPLOYMENT.md
100
- - Gemfile
101
- - History.txt
26
+ - History.md
102
27
  - LICENSE
103
- - Manifest.txt
104
28
  - README.md
105
- - Rakefile
106
29
  - bin/puma
107
30
  - bin/puma-wild
108
31
  - bin/pumactl
109
- - docs/config.md
32
+ - docs/architecture.md
33
+ - docs/deployment.md
34
+ - docs/images/puma-connection-flow-no-reactor.png
35
+ - docs/images/puma-connection-flow.png
36
+ - docs/images/puma-general-arch.png
110
37
  - docs/nginx.md
38
+ - docs/plugins.md
39
+ - docs/restart.md
111
40
  - docs/signals.md
112
41
  - docs/systemd.md
113
42
  - ext/puma_http11/PumaHttp11Service.java
@@ -150,8 +79,6 @@ files:
150
79
  - lib/puma/null_io.rb
151
80
  - lib/puma/plugin.rb
152
81
  - lib/puma/plugin/tmp_restart.rb
153
- - lib/puma/rack/backports/uri/common_18.rb
154
- - lib/puma/rack/backports/uri/common_192.rb
155
82
  - lib/puma/rack/backports/uri/common_193.rb
156
83
  - lib/puma/rack/builder.rb
157
84
  - lib/puma/rack/urlmap.rb
@@ -165,11 +92,13 @@ files:
165
92
  - lib/puma/thread_pool.rb
166
93
  - lib/puma/util.rb
167
94
  - lib/rack/handler/puma.rb
168
- - puma.gemspec
169
95
  - tools/jungle/README.md
170
96
  - tools/jungle/init.d/README.md
171
97
  - tools/jungle/init.d/puma
172
98
  - tools/jungle/init.d/run-puma
99
+ - tools/jungle/rc.d/README.md
100
+ - tools/jungle/rc.d/puma
101
+ - tools/jungle/rc.d/puma.conf
173
102
  - tools/jungle/upstart/README.md
174
103
  - tools/jungle/upstart/puma-manager.conf
175
104
  - tools/jungle/upstart/puma.conf
@@ -177,18 +106,17 @@ files:
177
106
  homepage: http://puma.io
178
107
  licenses:
179
108
  - BSD-3-Clause
180
- metadata: {}
109
+ metadata:
110
+ msys2_mingw_dependencies: openssl
181
111
  post_install_message:
182
- rdoc_options:
183
- - "--main"
184
- - README.md
112
+ rdoc_options: []
185
113
  require_paths:
186
114
  - lib
187
115
  required_ruby_version: !ruby/object:Gem::Requirement
188
116
  requirements:
189
117
  - - ">="
190
118
  - !ruby/object:Gem::Version
191
- version: 1.8.7
119
+ version: '2.2'
192
120
  required_rubygems_version: !ruby/object:Gem::Requirement
193
121
  requirements:
194
122
  - - ">="
@@ -196,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
124
  version: '0'
197
125
  requirements: []
198
126
  rubyforge_project:
199
- rubygems_version: 2.5.1
127
+ rubygems_version: 2.7.6
200
128
  signing_key:
201
129
  specification_version: 4
202
130
  summary: Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for
data/Gemfile DELETED
@@ -1,13 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- gem "hoe"
4
- gem "hoe-git"
5
- gem "hoe-ignore"
6
- gem "rdoc"
7
- gem "rake-compiler"
8
- gem "test-unit", "~> 3.0"
9
-
10
- gem "rack"
11
- gem 'minitest', '~> 5.8'
12
-
13
- gem "jruby-openssl", :platform => "jruby"
@@ -1,78 +0,0 @@
1
- DEPLOYMENT.md
2
- Gemfile
3
- History.txt
4
- LICENSE
5
- Manifest.txt
6
- README.md
7
- Rakefile
8
- bin/puma
9
- bin/puma-wild
10
- bin/pumactl
11
- docs/config.md
12
- docs/nginx.md
13
- docs/signals.md
14
- docs/systemd.md
15
- ext/puma_http11/PumaHttp11Service.java
16
- ext/puma_http11/ext_help.h
17
- ext/puma_http11/extconf.rb
18
- ext/puma_http11/http11_parser.c
19
- ext/puma_http11/http11_parser.h
20
- ext/puma_http11/http11_parser.java.rl
21
- ext/puma_http11/http11_parser.rl
22
- ext/puma_http11/http11_parser_common.rl
23
- ext/puma_http11/io_buffer.c
24
- ext/puma_http11/mini_ssl.c
25
- ext/puma_http11/org/jruby/puma/Http11.java
26
- ext/puma_http11/org/jruby/puma/Http11Parser.java
27
- ext/puma_http11/org/jruby/puma/MiniSSL.java
28
- ext/puma_http11/puma_http11.c
29
- lib/puma.rb
30
- lib/puma/accept_nonblock.rb
31
- lib/puma/app/status.rb
32
- lib/puma/binder.rb
33
- lib/puma/cli.rb
34
- lib/puma/client.rb
35
- lib/puma/cluster.rb
36
- lib/puma/commonlogger.rb
37
- lib/puma/compat.rb
38
- lib/puma/configuration.rb
39
- lib/puma/const.rb
40
- lib/puma/control_cli.rb
41
- lib/puma/convenient.rb
42
- lib/puma/daemon_ext.rb
43
- lib/puma/delegation.rb
44
- lib/puma/detect.rb
45
- lib/puma/dsl.rb
46
- lib/puma/events.rb
47
- lib/puma/io_buffer.rb
48
- lib/puma/java_io_buffer.rb
49
- lib/puma/jruby_restart.rb
50
- lib/puma/launcher.rb
51
- lib/puma/minissl.rb
52
- lib/puma/null_io.rb
53
- lib/puma/plugin.rb
54
- lib/puma/plugin/tmp_restart.rb
55
- lib/puma/rack/backports/uri/common_18.rb
56
- lib/puma/rack/backports/uri/common_192.rb
57
- lib/puma/rack/backports/uri/common_193.rb
58
- lib/puma/rack/builder.rb
59
- lib/puma/rack/urlmap.rb
60
- lib/puma/rack_default.rb
61
- lib/puma/reactor.rb
62
- lib/puma/runner.rb
63
- lib/puma/server.rb
64
- lib/puma/single.rb
65
- lib/puma/state_file.rb
66
- lib/puma/tcp_logger.rb
67
- lib/puma/thread_pool.rb
68
- lib/puma/util.rb
69
- lib/rack/handler/puma.rb
70
- puma.gemspec
71
- tools/jungle/README.md
72
- tools/jungle/init.d/README.md
73
- tools/jungle/init.d/puma
74
- tools/jungle/init.d/run-puma
75
- tools/jungle/upstart/README.md
76
- tools/jungle/upstart/puma-manager.conf
77
- tools/jungle/upstart/puma.conf
78
- tools/trickletest.rb