puma 3.1.1 → 3.2.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.
- checksums.yaml +4 -4
- data/History.txt +14 -0
- data/Manifest.txt +0 -1
- data/lib/puma/cluster.rb +22 -18
- data/lib/puma/const.rb +2 -2
- data/lib/puma/dsl.rb +3 -4
- data/lib/puma/launcher.rb +11 -10
- metadata +2 -3
- data/lib/puma/capistrano.rb +0 -94
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae407cb3f846ef2c3da83f997e42b4b0da3e6b9e
|
4
|
+
data.tar.gz: 2e74ecbc15ed0a1363ad70d71605c69004b184ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b66e244414a78a68ab0e841f10f531797098a19d054757b9e0d7cb2bceebe1e850a2e50aa73d9b096379a99e73b8a9d242afb5c477ecd2de2dddf7950d630404
|
7
|
+
data.tar.gz: 52c7ac2681b0a73e58e2e1a2cf13d2e448248703dbcd630823c221423a4ae1564a71f28e10a4896ce9be2ab3e1c64a0ee2e0fab735c93bd9619e33dc08ef7f3d
|
data/History.txt
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
=== 3.2.0 / 2016-03-20
|
2
|
+
|
3
|
+
* 1 deprecation removal:
|
4
|
+
* Delete capistrano.rb
|
5
|
+
|
6
|
+
* 3 bug fixes:
|
7
|
+
* Detect gems.rb as well as Gemfile
|
8
|
+
* Simplify and fix logic for directory to use when restarting for all phases
|
9
|
+
* Speed up phased-restart start
|
10
|
+
|
11
|
+
* 2 PRs merged:
|
12
|
+
* Merge pull request #927 from jlecour/gemfile_variants
|
13
|
+
* Merge pull request #931 from joneslee85/patch-10
|
14
|
+
|
1
15
|
=== 3.1.1 / 2016-03-17
|
2
16
|
|
3
17
|
* 4 bug fixes:
|
data/Manifest.txt
CHANGED
data/lib/puma/cluster.rb
CHANGED
@@ -31,10 +31,9 @@ module Puma
|
|
31
31
|
|
32
32
|
# Be sure to change the directory again before loading
|
33
33
|
# the app. This way we can pick up new code.
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
34
|
+
dir = @launcher.restart_dir
|
35
|
+
log "+ Changing to #{dir}"
|
36
|
+
Dir.chdir dir
|
38
37
|
end
|
39
38
|
|
40
39
|
def redirect_io
|
@@ -219,8 +218,12 @@ module Puma
|
|
219
218
|
|
220
219
|
# If we're not running under a Bundler context, then
|
221
220
|
# report the info about the context we will be using
|
222
|
-
if !ENV['BUNDLE_GEMFILE']
|
223
|
-
|
221
|
+
if !ENV['BUNDLE_GEMFILE']
|
222
|
+
if File.exist?("Gemfile")
|
223
|
+
log "+ Gemfile in context: #{File.expand_path("Gemfile")}"
|
224
|
+
elsif File.exist?("gems.rb")
|
225
|
+
log "+ Gemfile in context: #{File.expand_path("gems.rb")}"
|
226
|
+
end
|
224
227
|
end
|
225
228
|
|
226
229
|
# Invoke any worker boot hooks so they can get
|
@@ -298,10 +301,9 @@ module Puma
|
|
298
301
|
end
|
299
302
|
|
300
303
|
def reload_worker_directory
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
end
|
304
|
+
dir = @launcher.restart_dir
|
305
|
+
log "+ Changing to #{dir}"
|
306
|
+
Dir.chdir dir
|
305
307
|
end
|
306
308
|
|
307
309
|
def stats
|
@@ -422,12 +424,21 @@ module Puma
|
|
422
424
|
@launcher.events.fire_on_booted!
|
423
425
|
|
424
426
|
begin
|
427
|
+
force_check = false
|
428
|
+
|
425
429
|
while @status == :run
|
426
430
|
begin
|
427
|
-
|
431
|
+
if @phased_restart
|
432
|
+
start_phased_restart
|
433
|
+
@phased_restart = false
|
434
|
+
end
|
435
|
+
|
436
|
+
check_workers force_check
|
428
437
|
|
429
438
|
force_check = false
|
430
439
|
|
440
|
+
res = IO.select([read], nil, nil, 5)
|
441
|
+
|
431
442
|
if res
|
432
443
|
req = read.read_nonblock(1)
|
433
444
|
|
@@ -453,13 +464,6 @@ module Puma
|
|
453
464
|
end
|
454
465
|
end
|
455
466
|
|
456
|
-
if @phased_restart
|
457
|
-
start_phased_restart
|
458
|
-
@phased_restart = false
|
459
|
-
end
|
460
|
-
|
461
|
-
check_workers force_check
|
462
|
-
|
463
467
|
rescue Interrupt
|
464
468
|
@status = :stop
|
465
469
|
end
|
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.2.0".freeze
|
104
|
+
CODE_NAME = "Spring Is A Heliocentric Viewpoint".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/dsl.rb
CHANGED
@@ -312,13 +312,12 @@ module Puma
|
|
312
312
|
# The directory to operate out of.
|
313
313
|
def directory(dir)
|
314
314
|
@options[:directory] = dir.to_s
|
315
|
-
|
316
|
-
worker_directory dir
|
317
315
|
end
|
318
316
|
|
319
|
-
#
|
317
|
+
# DEPRECATED: The directory to operate out of.
|
320
318
|
def worker_directory(dir)
|
321
|
-
|
319
|
+
$stderr.puts "worker_directory is deprecated. Please use `directory`"
|
320
|
+
directory dir
|
322
321
|
end
|
323
322
|
|
324
323
|
# Run the app as a raw TCP app instead of an HTTP rack app
|
data/lib/puma/launcher.rb
CHANGED
@@ -54,8 +54,6 @@ module Puma
|
|
54
54
|
@binder = Binder.new(@events)
|
55
55
|
@binder.import_from_env
|
56
56
|
|
57
|
-
generate_restart_data
|
58
|
-
|
59
57
|
@environment = conf.environment
|
60
58
|
|
61
59
|
# Advertise the Configuration
|
@@ -65,6 +63,8 @@ module Puma
|
|
65
63
|
|
66
64
|
@options = @config.options
|
67
65
|
|
66
|
+
generate_restart_data
|
67
|
+
|
68
68
|
if clustered? && (Puma.jruby? || Puma.windows?)
|
69
69
|
unsupported 'worker mode not supported on JRuby or Windows'
|
70
70
|
end
|
@@ -73,8 +73,7 @@ module Puma
|
|
73
73
|
unsupported 'daemon mode not supported on Windows'
|
74
74
|
end
|
75
75
|
|
76
|
-
|
77
|
-
Dir.chdir(dir) if dir
|
76
|
+
Dir.chdir(@restart_dir)
|
78
77
|
|
79
78
|
prune_bundler if prune_bundler?
|
80
79
|
|
@@ -93,7 +92,7 @@ module Puma
|
|
93
92
|
@status = :run
|
94
93
|
end
|
95
94
|
|
96
|
-
attr_reader :binder, :events, :config, :options
|
95
|
+
attr_reader :binder, :events, :config, :options, :restart_dir
|
97
96
|
|
98
97
|
# Return stats about the server
|
99
98
|
def stats
|
@@ -314,16 +313,18 @@ module Puma
|
|
314
313
|
|
315
314
|
|
316
315
|
def generate_restart_data
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
316
|
+
if dir = @options[:directory]
|
317
|
+
@restart_dir = dir
|
318
|
+
|
319
|
+
# Use the same trick as unicorn, namely favor PWD because
|
320
|
+
# it will contain an unresolved symlink, useful for when
|
321
|
+
# the pwd is /data/releases/current.
|
322
|
+
elsif dir = ENV['PWD']
|
321
323
|
s_env = File.stat(dir)
|
322
324
|
s_pwd = File.stat(Dir.pwd)
|
323
325
|
|
324
326
|
if s_env.ino == s_pwd.ino and (Puma.jruby? or s_env.dev == s_pwd.dev)
|
325
327
|
@restart_dir = dir
|
326
|
-
@config.configure { |c| c.worker_directory dir }
|
327
328
|
end
|
328
329
|
end
|
329
330
|
|
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.2.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-03-
|
11
|
+
date: 2016-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|
@@ -126,7 +126,6 @@ files:
|
|
126
126
|
- lib/puma/accept_nonblock.rb
|
127
127
|
- lib/puma/app/status.rb
|
128
128
|
- lib/puma/binder.rb
|
129
|
-
- lib/puma/capistrano.rb
|
130
129
|
- lib/puma/cli.rb
|
131
130
|
- lib/puma/client.rb
|
132
131
|
- lib/puma/cluster.rb
|
data/lib/puma/capistrano.rb
DELETED
@@ -1,94 +0,0 @@
|
|
1
|
-
$stderr.puts "DEPRECATED: To manage puma with capistrano, use https://github.com/seuros/capistrano-puma"
|
2
|
-
|
3
|
-
Capistrano::Configuration.instance.load do
|
4
|
-
|
5
|
-
# Ensure the tmp/sockets directory is created by the deploy:setup task and
|
6
|
-
# symlinked in by the deploy:update task. This is not handled by Capistrano
|
7
|
-
# v2 but is fixed in v3.
|
8
|
-
shared_children.push('tmp/sockets')
|
9
|
-
|
10
|
-
_cset(:puma_default_hooks) { true }
|
11
|
-
_cset(:puma_cmd) { "#{fetch(:bundle_cmd, 'bundle')} exec puma" }
|
12
|
-
_cset(:pumactl_cmd) { "#{fetch(:bundle_cmd, 'bundle')} exec pumactl" }
|
13
|
-
_cset(:puma_env) { fetch(:rack_env, fetch(:rails_env, 'production')) }
|
14
|
-
_cset(:puma_state) { "#{shared_path}/sockets/puma.state" }
|
15
|
-
_cset(:puma_socket) { "unix://#{shared_path}/sockets/puma.sock" }
|
16
|
-
_cset(:puma_role) { :app }
|
17
|
-
|
18
|
-
if fetch(:puma_default_hooks)
|
19
|
-
after 'deploy:stop', 'puma:stop'
|
20
|
-
after 'deploy:start', 'puma:start'
|
21
|
-
after 'deploy:restart', 'puma:restart'
|
22
|
-
end
|
23
|
-
|
24
|
-
namespace :puma do
|
25
|
-
desc 'Start puma'
|
26
|
-
task :start, :roles => lambda { puma_role }, :on_no_matching_servers => :continue do
|
27
|
-
run "cd #{current_path} && #{puma_rails_additional_env} #{puma_cmd} #{start_options}", :pty => false
|
28
|
-
end
|
29
|
-
|
30
|
-
desc 'Stop puma'
|
31
|
-
task :stop, :roles => lambda { puma_role }, :on_no_matching_servers => :continue do
|
32
|
-
run "cd #{current_path} && #{pumactl_cmd} -S #{state_path} stop"
|
33
|
-
end
|
34
|
-
|
35
|
-
desc 'Restart puma'
|
36
|
-
task :restart, :roles => lambda { puma_role }, :on_no_matching_servers => :continue do
|
37
|
-
begin
|
38
|
-
run "cd #{current_path} && #{puma_rails_additional_env} #{pumactl_cmd} -S #{state_path} restart"
|
39
|
-
rescue Capistrano::CommandError => ex
|
40
|
-
puts "Failed to restart puma: #{ex}\nAssuming not started."
|
41
|
-
start
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
desc 'Restart puma (phased restart)'
|
46
|
-
task :phased_restart, :roles => lambda { puma_role }, :on_no_matching_servers => :continue do
|
47
|
-
begin
|
48
|
-
run "cd #{current_path} && #{puma_rails_additional_env} #{pumactl_cmd} -S #{state_path} phased-restart"
|
49
|
-
rescue Capistrano::CommandError => ex
|
50
|
-
puts "Failed to restart puma: #{ex}\nAssuming not started."
|
51
|
-
start
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
def start_options
|
58
|
-
if config_file
|
59
|
-
"-q -d -e #{puma_env} -C #{config_file}"
|
60
|
-
else
|
61
|
-
"-q -d -e #{puma_env} -b '#{puma_socket}' -S #{state_path} --control 'unix://#{shared_path}/sockets/pumactl.sock'"
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def config_file
|
66
|
-
@_config_file ||= begin
|
67
|
-
file = fetch(:puma_config_file, nil)
|
68
|
-
file = "./config/puma/#{puma_env}.rb" if !file && File.exists?("./config/puma/#{puma_env}.rb")
|
69
|
-
file
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def puma_env
|
74
|
-
fetch(:rack_env, fetch(:rails_env, 'production'))
|
75
|
-
end
|
76
|
-
|
77
|
-
#add additional env when start rails, such as : secret key, db username, db pwd or other what you want.
|
78
|
-
def puma_rails_additional_env
|
79
|
-
fetch(:puma_rails_additional_env, '')
|
80
|
-
end
|
81
|
-
|
82
|
-
def state_path
|
83
|
-
(config_file ? configuration.options[:state] : nil) || puma_state
|
84
|
-
end
|
85
|
-
|
86
|
-
def configuration
|
87
|
-
require 'puma'
|
88
|
-
require 'puma/configuration'
|
89
|
-
|
90
|
-
config = Puma::Configuration.new(:config_file => config_file)
|
91
|
-
config.load
|
92
|
-
config
|
93
|
-
end
|
94
|
-
end
|