puma 3.2.0-java → 3.3.0-java
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.
- checksums.yaml +4 -4
- data/History.txt +15 -0
- data/Manifest.txt +1 -0
- data/README.md +15 -0
- data/docs/systemd.md +78 -0
- data/lib/puma/binder.rb +35 -16
- data/lib/puma/configuration.rb +5 -8
- data/lib/puma/const.rb +2 -2
- data/lib/puma/puma_http11.jar +0 -0
- data/lib/rack/handler/puma.rb +1 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db88941163e2684d462f325b8925101502e52854
|
4
|
+
data.tar.gz: f7b1c9db56a8266f91be1a2663345f7a31290bac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e23f516cda511172581e743ac65ab8db24cbd89e43bf1e5d55218379ea0bc56265e4e363d217d80311c799d9b068e54189cecc37c423d80831cb25559c083e04
|
7
|
+
data.tar.gz: 7058a5382117a2f917219c3478a0fd0f4660c1f9eca12dc993f781d18b255952068c4d52f90d0eb42093b76bfedc26470a05d6dc7d9a97f64d95d2b787c05c93
|
data/History.txt
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
=== 3.3.0 / 2016-04-05
|
2
|
+
|
3
|
+
* 2 minor features:
|
4
|
+
* Allow overriding options of Configuration object
|
5
|
+
* Rename to inherit_ssl_listener like inherit_tcp|unix
|
6
|
+
|
7
|
+
* 2 doc fixes:
|
8
|
+
* Add docs/systemd.md (with socket activation sub-section)
|
9
|
+
* Document UNIX signals with cluster on README.md
|
10
|
+
|
11
|
+
* 3 PRs merged:
|
12
|
+
* Merge pull request #936 from prathamesh-sonpatki/allow-overriding-config-options
|
13
|
+
* Merge pull request #940 from kyledrake/signalsdoc
|
14
|
+
* Merge pull request #942 from dekellum/socket-activate-improve
|
15
|
+
|
1
16
|
=== 3.2.0 / 2016-03-20
|
2
17
|
|
3
18
|
* 1 deprecation removal:
|
data/Manifest.txt
CHANGED
data/README.md
CHANGED
@@ -252,6 +252,21 @@ But again beware, upgrading an application sometimes involves upgrading the data
|
|
252
252
|
|
253
253
|
If you perform a lot of database migrations, you probably should not use phased restart and use a normal/hot restart instead (pumactl restart). That way, no code is shared while deploying (in that case, preload_app might help for quicker deployment, see below).
|
254
254
|
|
255
|
+
### Puma Signals
|
256
|
+
|
257
|
+
Puma cluster responds to these signals:
|
258
|
+
|
259
|
+
- `TTIN` increment the worker count by 1
|
260
|
+
- `TTOU` decrement the worker count by 1
|
261
|
+
- `TERM` send `TERM` to worker. Worker will attempt to finish then exit.
|
262
|
+
- `USR2` restart workers
|
263
|
+
- `USR1` restart workers in phases, a rolling restart.
|
264
|
+
- `HUP` reopen log files defined in stdout_redirect configuration parameter
|
265
|
+
- `INT` equivalent of sending Ctrl-C to cluster. Will attempt to finish then exit.
|
266
|
+
- `CHLD`
|
267
|
+
|
268
|
+
A detailed guide to using UNIX signals with Puma can be found in the [signals documentation](https://github.com/puma/puma/blob/master/docs/signals.md).
|
269
|
+
|
255
270
|
### Release Directory
|
256
271
|
|
257
272
|
If you symlink releases into a common working directory (i.e., `/current` from Capistrano), Puma won't pick up your new changes when running phased restarts without additional configuration. You should set your working directory within Puma's config to specify the directory it should use. This is a change from earlier versions of Puma (< 2.15) that would infer the directory for you.
|
data/docs/systemd.md
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
# systemd
|
2
|
+
|
3
|
+
[systemd](https://www.freedesktop.org/wiki/Software/systemd/) is a
|
4
|
+
commonly available init system (PID 1) on many Linux distributions. It
|
5
|
+
offers process monitoring (including automatic restarts) and other
|
6
|
+
useful features for running Puma in production. Below is a sample
|
7
|
+
puma.service configuration file for systemd:
|
8
|
+
|
9
|
+
~~~~
|
10
|
+
[Unit]
|
11
|
+
Description=Puma HTTP Server
|
12
|
+
After=network.target
|
13
|
+
|
14
|
+
[Service]
|
15
|
+
# Foreground process (do not use --daemon in ExecStart or config.rb)
|
16
|
+
Type=simple
|
17
|
+
|
18
|
+
# Preferably configure a non-privileged user
|
19
|
+
# User=
|
20
|
+
|
21
|
+
# Specify the path to your puma application root
|
22
|
+
# WorkingDirectory=
|
23
|
+
|
24
|
+
# Helpful for debugging socket activation, etc.
|
25
|
+
# Environment=PUMA_DEBUG=1
|
26
|
+
|
27
|
+
# The command to start Puma
|
28
|
+
# Here we are using a binstub generated via:
|
29
|
+
# `bundle binstubs puma --path ./sbin`
|
30
|
+
# in the WorkingDirectory (replace <WD> below)
|
31
|
+
# You can alternatively use `bundle exec --keep-file-descriptors puma`
|
32
|
+
# ExecStart=<WD>/sbin/puma -b tcp://0.0.0.0:9292 -b ssl://0.0.0.0:9293?key=key.pem&cert=cert.pem
|
33
|
+
|
34
|
+
# Alternatively with a config file (in WorkingDirectory) and
|
35
|
+
# comparable `bind` directives
|
36
|
+
# ExecStart=<WorkingDirectory>/sbin/puma -C config.rb
|
37
|
+
|
38
|
+
Restart=always
|
39
|
+
|
40
|
+
[Install]
|
41
|
+
WantedBy=multi-user.target
|
42
|
+
~~~~
|
43
|
+
|
44
|
+
See [systemd.exec](https://www.freedesktop.org/software/systemd/man/systemd.exec.html)
|
45
|
+
for additional details.
|
46
|
+
|
47
|
+
## Socket Activation
|
48
|
+
|
49
|
+
systemd and puma also support socket activation, where systemd opens
|
50
|
+
the listening socket(s) in advance and provides them to the puma master
|
51
|
+
process on startup. Among other advantages, this keeps listening
|
52
|
+
sockets open across puma restarts and achieves graceful restarts. To
|
53
|
+
use socket activation, configure one or more `ListenStream`
|
54
|
+
sockets in a companion `*.socket` systemd config file. Here is a sample
|
55
|
+
puma.socket, matching the ports used in the above puma.service:
|
56
|
+
|
57
|
+
~~~~
|
58
|
+
[Unit]
|
59
|
+
Description=Puma HTTP Server Accept Sockets
|
60
|
+
|
61
|
+
[Socket]
|
62
|
+
ListenStream=0.0.0.0:9292
|
63
|
+
ListenStream=0.0.0.0:9293
|
64
|
+
|
65
|
+
# AF_UNIX domain socket
|
66
|
+
# SocketUser, SocketGroup, etc. may be needed for Unix domain sockets
|
67
|
+
# ListenStream=/run/puma.sock
|
68
|
+
|
69
|
+
# Socket options matching what Puma wants
|
70
|
+
NoDelay=true
|
71
|
+
ReusePort=true
|
72
|
+
|
73
|
+
[Install]
|
74
|
+
WantedBy=sockets.target
|
75
|
+
~~~~
|
76
|
+
|
77
|
+
See [systemd.socket](https://www.freedesktop.org/software/systemd/man/systemd.socket.html)
|
78
|
+
for additional details.
|
data/lib/puma/binder.rb
CHANGED
@@ -11,6 +11,7 @@ module Puma
|
|
11
11
|
@events = events
|
12
12
|
@listeners = []
|
13
13
|
@inherited_fds = {}
|
14
|
+
@activated_sockets = {}
|
14
15
|
@unix_paths = []
|
15
16
|
|
16
17
|
@proto_env = {
|
@@ -55,24 +56,23 @@ module Puma
|
|
55
56
|
fd, url = v.split(":", 2)
|
56
57
|
@inherited_fds[url] = fd.to_i
|
57
58
|
remove << k
|
58
|
-
|
59
|
-
if k =~ /LISTEN_FDS/ && ENV['LISTEN_PID'].to_i == $$
|
59
|
+
elsif k == 'LISTEN_FDS' && ENV['LISTEN_PID'].to_i == $$
|
60
60
|
v.to_i.times do |num|
|
61
61
|
fd = num + 3
|
62
62
|
sock = TCPServer.for_fd(fd)
|
63
63
|
begin
|
64
|
-
|
64
|
+
key = [ :unix, Socket.unpack_sockaddr_un(sock.getsockname) ]
|
65
65
|
rescue ArgumentError
|
66
66
|
port, addr = Socket.unpack_sockaddr_in(sock.getsockname)
|
67
67
|
if addr =~ /\:/
|
68
68
|
addr = "[#{addr}]"
|
69
69
|
end
|
70
|
-
|
70
|
+
key = [ :tcp, addr, port ]
|
71
71
|
end
|
72
|
-
@
|
72
|
+
@activated_sockets[key] = sock
|
73
|
+
@events.debug "Registered #{key.join ':'} for activation from LISTEN_FDS"
|
73
74
|
end
|
74
|
-
|
75
|
-
ENV.delete 'LISTEN_PID'
|
75
|
+
remove << k << 'LISTEN_PID'
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
@@ -89,6 +89,9 @@ module Puma
|
|
89
89
|
if fd = @inherited_fds.delete(str)
|
90
90
|
logger.log "* Inherited #{str}"
|
91
91
|
io = inherit_tcp_listener uri.host, uri.port, fd
|
92
|
+
elsif sock = @activated_sockets.delete([ :tcp, uri.host, uri.port ])
|
93
|
+
logger.log "* Activated #{str}"
|
94
|
+
io = inherit_tcp_listener uri.host, uri.port, sock
|
92
95
|
else
|
93
96
|
params = Util.parse_query uri.query
|
94
97
|
|
@@ -106,6 +109,9 @@ module Puma
|
|
106
109
|
if fd = @inherited_fds.delete(str)
|
107
110
|
logger.log "* Inherited #{str}"
|
108
111
|
io = inherit_unix_listener path, fd
|
112
|
+
elsif sock = @activated_sockets.delete([ :unix, path ])
|
113
|
+
logger.log "* Activated #{str}"
|
114
|
+
io = inherit_unix_listener path, sock
|
109
115
|
else
|
110
116
|
logger.log "* Listening on #{str}"
|
111
117
|
|
@@ -191,7 +197,10 @@ module Puma
|
|
191
197
|
|
192
198
|
if fd = @inherited_fds.delete(str)
|
193
199
|
logger.log "* Inherited #{str}"
|
194
|
-
io =
|
200
|
+
io = inherit_ssl_listener fd, ctx
|
201
|
+
elsif sock = @activated_sockets.delete([ :tcp, uri.host, uri.port ])
|
202
|
+
logger.log "* Activated #{str}"
|
203
|
+
io = inherit_ssl_listener sock, ctx
|
195
204
|
else
|
196
205
|
logger.log "* Listening on #{str}"
|
197
206
|
io = add_ssl_listener uri.host, uri.port, ctx
|
@@ -209,12 +218,7 @@ module Puma
|
|
209
218
|
logger.log "* Closing unused inherited connection: #{str}"
|
210
219
|
|
211
220
|
begin
|
212
|
-
|
213
|
-
fd.close
|
214
|
-
else
|
215
|
-
IO.for_fd(fd).close
|
216
|
-
end
|
217
|
-
|
221
|
+
IO.for_fd(fd).close
|
218
222
|
rescue SystemCallError
|
219
223
|
end
|
220
224
|
|
@@ -226,6 +230,17 @@ module Puma
|
|
226
230
|
end
|
227
231
|
end
|
228
232
|
|
233
|
+
# Also close any unsued activated sockets
|
234
|
+
@activated_sockets.each do |key, sock|
|
235
|
+
logger.log "* Closing unused activated socket: #{key.join ':'}"
|
236
|
+
begin
|
237
|
+
sock.close
|
238
|
+
rescue SystemCallError
|
239
|
+
end
|
240
|
+
# We have to unlink a unix socket path that's not being used
|
241
|
+
File.unlink key[1] if key[0] == :unix
|
242
|
+
end
|
243
|
+
|
229
244
|
end
|
230
245
|
|
231
246
|
# Tell the server to listen on host +host+, port +port+.
|
@@ -285,11 +300,15 @@ module Puma
|
|
285
300
|
s
|
286
301
|
end
|
287
302
|
|
288
|
-
def
|
303
|
+
def inherit_ssl_listener(fd, ctx)
|
289
304
|
require 'puma/minissl'
|
290
305
|
MiniSSL.check
|
291
306
|
|
292
|
-
|
307
|
+
if fd.kind_of? TCPServer
|
308
|
+
s = fd
|
309
|
+
else
|
310
|
+
s = TCPServer.for_fd(fd)
|
311
|
+
end
|
293
312
|
ssl = MiniSSL::Server.new(s, ctx)
|
294
313
|
|
295
314
|
env = @proto_env.dup
|
data/lib/puma/configuration.rb
CHANGED
@@ -13,10 +13,10 @@ module Puma
|
|
13
13
|
end
|
14
14
|
|
15
15
|
class LeveledOptions
|
16
|
-
def initialize(
|
17
|
-
@cur =
|
16
|
+
def initialize(default_options, user_options)
|
17
|
+
@cur = user_options
|
18
18
|
@set = [@cur]
|
19
|
-
@defaults =
|
19
|
+
@defaults = default_options.dup
|
20
20
|
end
|
21
21
|
|
22
22
|
def initialize_copy(other)
|
@@ -133,12 +133,9 @@ module Puma
|
|
133
133
|
end
|
134
134
|
|
135
135
|
def initialize(options={}, &blk)
|
136
|
-
@options = LeveledOptions.new(default_options)
|
137
|
-
@plugins = PluginLoader.new
|
136
|
+
@options = LeveledOptions.new(default_options, options)
|
138
137
|
|
139
|
-
|
140
|
-
# @options[k] = v
|
141
|
-
# end
|
138
|
+
@plugins = PluginLoader.new
|
142
139
|
|
143
140
|
if blk
|
144
141
|
configure(&blk)
|
data/lib/puma/const.rb
CHANGED
@@ -100,8 +100,8 @@ module Puma
|
|
100
100
|
# too taxing on performance.
|
101
101
|
module Const
|
102
102
|
|
103
|
-
PUMA_VERSION = VERSION = "3.
|
104
|
-
CODE_NAME = "
|
103
|
+
PUMA_VERSION = VERSION = "3.3.0".freeze
|
104
|
+
CODE_NAME = "Jovial Platypus".freeze
|
105
105
|
PUMA_SERVER_STRING = ['puma', PUMA_VERSION, CODE_NAME].join(' ').freeze
|
106
106
|
|
107
107
|
FAST_TRACK_KA_TIMEOUT = 0.2
|
data/lib/puma/puma_http11.jar
CHANGED
Binary file
|
data/lib/rack/handler/puma.rb
CHANGED
@@ -12,7 +12,7 @@ module Rack
|
|
12
12
|
def self.run(app, options = {})
|
13
13
|
options = DEFAULT_OPTIONS.merge(options)
|
14
14
|
|
15
|
-
conf = ::Puma::Configuration.new do |c|
|
15
|
+
conf = ::Puma::Configuration.new(options) do |c|
|
16
16
|
c.quiet
|
17
17
|
|
18
18
|
if options.delete(:Verbose)
|
@@ -69,4 +69,3 @@ module Rack
|
|
69
69
|
register :puma, Puma
|
70
70
|
end
|
71
71
|
end
|
72
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Evan Phoenix
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -87,6 +87,7 @@ extra_rdoc_files:
|
|
87
87
|
- docs/config.md
|
88
88
|
- docs/nginx.md
|
89
89
|
- docs/signals.md
|
90
|
+
- docs/systemd.md
|
90
91
|
- tools/jungle/README.md
|
91
92
|
- tools/jungle/init.d/README.md
|
92
93
|
- tools/jungle/upstart/README.md
|
@@ -104,6 +105,7 @@ files:
|
|
104
105
|
- docs/config.md
|
105
106
|
- docs/nginx.md
|
106
107
|
- docs/signals.md
|
108
|
+
- docs/systemd.md
|
107
109
|
- ext/puma_http11/PumaHttp11Service.java
|
108
110
|
- ext/puma_http11/ext_help.h
|
109
111
|
- ext/puma_http11/extconf.rb
|