ringleader 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -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.
@@ -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
@@ -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 30 seconds before sending a SIGKILL.
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 -TERM #{@pid}"
57
- ::Process.kill "TERM", -@pid
60
+ debug "kill -#{config.kill_with} #{@pid}"
61
+ ::Process.kill config.kill_with, -@pid
58
62
 
59
- kill = after 30 do
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}"
@@ -1,3 +1,3 @@
1
1
  module Ringleader
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
@@ -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
- expect(config.apps["rbenv_app"].env).to have_key("RBENV_VERSION")
77
- expect(config.apps["rbenv_app"].env["RBENV_VERSION"]).to eq(nil)
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.2
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-08-30 00:00:00.000000000 Z
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