ringleader 1.0.2 → 1.0.3
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/README.md +2 -0
- data/lib/ringleader/cli.rb +2 -0
- data/lib/ringleader/config.rb +3 -0
- data/lib/ringleader/process.rb +8 -4
- data/lib/ringleader/version.rb +1 -1
- data/spec/ringleader/config_spec.rb +9 -2
- metadata +2 -5
data/README.md
CHANGED
@@ -95,6 +95,8 @@ main_app:
|
|
95
95
|
env: # Override or set environment variables inherited
|
96
96
|
FOO: hello # from the current environment. Use nil to unset a
|
97
97
|
BAR: nil # var.
|
98
|
+
kill_with: TERM # Signal to use to kill the process tree with. Use
|
99
|
+
# KILL if the default (TERM) is leaving zombies.
|
98
100
|
|
99
101
|
# If you have an application managed by rvm, this setting automatically adds
|
100
102
|
# the rvm-specific shell setup before executing the given command. This
|
data/lib/ringleader/cli.rb
CHANGED
@@ -101,6 +101,8 @@ something like this:
|
|
101
101
|
env: # Override or set environment variables inherited
|
102
102
|
FOO: hello # from the current environment. Use nil to unset a
|
103
103
|
BAR: nil # var.
|
104
|
+
kill_with: TERM # Signal to use to kill the process tree with. Use
|
105
|
+
# KILL if the default (TERM) is leaving zombies.
|
104
106
|
|
105
107
|
# If you have an application managed by rvm, this setting automatically
|
106
108
|
# adds the rvm-specific shell setup before executing the given command.
|
data/lib/ringleader/config.rb
CHANGED
@@ -37,6 +37,7 @@ module Ringleader
|
|
37
37
|
options["host"] ||= DEFAULT_HOST
|
38
38
|
options["idle_timeout"] ||= DEFAULT_IDLE_TIMEOUT
|
39
39
|
options["startup_timeout"] ||= DEFAULT_STARTUP_TIMEOUT
|
40
|
+
options["kill_with"] ||= "TERM"
|
40
41
|
options["env"] ||= {}
|
41
42
|
|
42
43
|
if command = options.delete("rvm")
|
@@ -44,6 +45,8 @@ module Ringleader
|
|
44
45
|
elsif command = options.delete("rbenv")
|
45
46
|
options["command"] = "rbenv exec #{command}"
|
46
47
|
options["env"]["RBENV_VERSION"] = nil
|
48
|
+
options["env"]["RBENV_DIR"] = nil
|
49
|
+
options["env"]["GEM_HOME"] = nil
|
47
50
|
end
|
48
51
|
|
49
52
|
validate name, options
|
data/lib/ringleader/process.rb
CHANGED
@@ -47,16 +47,20 @@ module Ringleader
|
|
47
47
|
# Public: stop the application.
|
48
48
|
#
|
49
49
|
# Sends a SIGTERM to the app's process, and expects it to exit like a sane
|
50
|
-
# and well-behaved application within
|
50
|
+
# and well-behaved application within 7 seconds before sending a SIGKILL.
|
51
|
+
#
|
52
|
+
# Uses config.kill_with for the initial signal, which defaults to "TERM".
|
53
|
+
# If a configured process doesn't respond well to TERM (i.e. leaving
|
54
|
+
# zombies), use KILL instead.
|
51
55
|
def stop
|
52
56
|
return unless @pid
|
53
57
|
|
54
58
|
info "stopping #{@pid}"
|
55
59
|
@master.close unless @master.closed?
|
56
|
-
debug "kill
|
57
|
-
::Process.kill
|
60
|
+
debug "kill -#{config.kill_with} #{@pid}"
|
61
|
+
::Process.kill config.kill_with, -@pid
|
58
62
|
|
59
|
-
kill = after
|
63
|
+
kill = after 7 do
|
60
64
|
if @running
|
61
65
|
warn "process #{@pid} did not shut down cleanly, killing it"
|
62
66
|
debug "kill -KILL #{@pid}"
|
data/lib/ringleader/version.rb
CHANGED
@@ -35,6 +35,10 @@ describe Ringleader::Config do
|
|
35
35
|
expect(subject.apps["main_site"].env).to eq({})
|
36
36
|
expect(subject.apps["admin"].env).to have_key("OVERRIDE")
|
37
37
|
end
|
38
|
+
|
39
|
+
it "sets 'TERM' as the default kill signal" do
|
40
|
+
expect(subject.apps["main_site"].kill_with).to eq("TERM")
|
41
|
+
end
|
38
42
|
end
|
39
43
|
end
|
40
44
|
|
@@ -73,8 +77,11 @@ describe Ringleader::Config do
|
|
73
77
|
it "replaces the 'rbenv' command with an rbenv command and environment" do
|
74
78
|
config = Ringleader::Config.new "spec/fixtures/rbenv.yml"
|
75
79
|
expect(config.apps["rbenv_app"].command).to eq("rbenv exec bundle exec foreman start")
|
76
|
-
|
77
|
-
|
80
|
+
|
81
|
+
%w(RBENV_VERSION RBENV_DIR GEM_HOME).each do |key|
|
82
|
+
expect(config.apps["rbenv_app"].env).to have_key(key)
|
83
|
+
expect(config.apps["rbenv_app"].env[key]).to eq(nil)
|
84
|
+
end
|
78
85
|
end
|
79
86
|
end
|
80
87
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ringleader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: celluloid
|
@@ -240,9 +240,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
240
240
|
- - ! '>='
|
241
241
|
- !ruby/object:Gem::Version
|
242
242
|
version: '0'
|
243
|
-
segments:
|
244
|
-
- 0
|
245
|
-
hash: -834861029563874532
|
246
243
|
requirements: []
|
247
244
|
rubyforge_project:
|
248
245
|
rubygems_version: 1.8.24
|