red_unicorn 1.0.0 → 1.1.0
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.
- data/CHANGELOG.rdoc +3 -0
- data/README.rdoc +1 -0
- data/bin/red_unicorn +4 -0
- data/lib/red_unicorn/unicorn.rb +2 -1
- data/lib/red_unicorn/version.rb +1 -1
- metadata +4 -4
data/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -14,6 +14,7 @@ provide zero downtime restarts.
|
|
14
14
|
-x, --unicorn-exec /path/to/unicorn Specify path to unicorn executable (default: /var/www/shared/bundle/bin/unicorn_rails)
|
15
15
|
-c, --unicorn-config /path/to/config Specify path to unicorn configuration file (default: /etc/unicorn/app.rb)
|
16
16
|
-t, --timeout 30 Specify timeout for running actions
|
17
|
+
-g, --restart-grace 8 Specify grace time to start replacement children (default: 8 seconds)
|
17
18
|
-e, --env production Specify environment (default: production)
|
18
19
|
Commands:
|
19
20
|
prolicide: Kill single worker process
|
data/bin/red_unicorn
CHANGED
@@ -11,6 +11,7 @@ opts = GetoptLong.new(
|
|
11
11
|
['--unicorn-exec', '-x', GetoptLong::REQUIRED_ARGUMENT],
|
12
12
|
['--unicorn-config', '-c', GetoptLong::REQUIRED_ARGUMENT],
|
13
13
|
['--timeout', '-t', GetoptLong::REQUIRED_ARGUMENT],
|
14
|
+
['--restart-grace', '-g', GetoptLong::REQUIRED_ARGUMENT],
|
14
15
|
['--help', '-h', GetoptLong::NO_ARGUMENT],
|
15
16
|
['--env', '-e', GetoptLong::REQUIRED_ARGUMENT]
|
16
17
|
)
|
@@ -50,6 +51,7 @@ def print_help
|
|
50
51
|
puts ' -x, --unicorn-exec /path/to/unicorn Specify path to unicorn executable (default: /var/www/shared/bundle/bin/unicorn_rails)'
|
51
52
|
puts ' -c, --unicorn-config /path/to/config Specify path to unicorn configuration file (default: /etc/unicorn/app.rb)'
|
52
53
|
puts ' -t, --timeout 30 Specify timeout for running actions'
|
54
|
+
puts ' -g, --restart-grace 8 Specify grace time to start replacement children (default: 8 seconds)'
|
53
55
|
puts ' -e, --env production Specify environment (default: production)'
|
54
56
|
puts 'Commands:'
|
55
57
|
max_width = ALLOWED_ACTIONS.keys.map(&:to_s).map(&:length).max + 8
|
@@ -63,6 +65,8 @@ opts.each do |opt,arg|
|
|
63
65
|
case opt
|
64
66
|
when '--timeout'
|
65
67
|
unicorn_hash[:action_timeout] = arg.to_i
|
68
|
+
when '--restart-grace'
|
69
|
+
unicorn_hash[:restart_grace] = arg.to_i
|
66
70
|
when '--unicorn-config'
|
67
71
|
unicorn_hash[:unicorn_config] = arg.to_s
|
68
72
|
when '--unicorn-exec'
|
data/lib/red_unicorn/unicorn.rb
CHANGED
@@ -24,6 +24,7 @@ module RedUnicorn
|
|
24
24
|
:exec_path => '/var/www/shared/bundle/bin/unicorn_rails',
|
25
25
|
:config_path => '/etc/unicorn/app.rb',
|
26
26
|
:action_timeout => 30,
|
27
|
+
:restart_grace => 8,
|
27
28
|
:env => 'production'
|
28
29
|
}.merge(opts)
|
29
30
|
check_exec_path
|
@@ -55,7 +56,7 @@ module RedUnicorn
|
|
55
56
|
process_is :running do
|
56
57
|
original_pid = pid
|
57
58
|
Process.kill('USR2', pid)
|
58
|
-
sleep(
|
59
|
+
sleep(@opts[:restart_grace]) # give unicorn some breathing room
|
59
60
|
waited = 0
|
60
61
|
until((File.exists?(@opts[:pid]) && is_running? && !child_pids(pid).empty?) || waited > @opts[:action_timeout])
|
61
62
|
sleep_start = Time.now.to_f
|
data/lib/red_unicorn/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: red_unicorn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 1.0.0
|
10
|
+
version: 1.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Chris Roberts
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-06-
|
18
|
+
date: 2011-06-15 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|