god 0.9.0 → 0.10.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,9 @@
1
+ ==
2
+ * Minor Enhancements
3
+ * Add stop_timeout and stop_signal options to Watch
4
+ * Bug Fixes
5
+ * Stop command string was being ignored
6
+
1
7
  == 0.9.0 / 2010-04-03
2
8
  * Minor Enhancements
3
9
  * Allow kqueue for OpenBSD and NetBSD
data/Rakefile CHANGED
@@ -2,11 +2,41 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'date'
4
4
 
5
+ #############################################################################
6
+ #
7
+ # The name of the package
8
+ #
9
+ #############################################################################
10
+
11
+ NAME = 'god'
12
+
13
+ #############################################################################
14
+ #
15
+ # Helper functions
16
+ #
17
+ #############################################################################
18
+
5
19
  def source_version
6
- line = File.read('lib/god.rb')[/^\s*VERSION = .*/]
7
- line.match(/.*VERSION = '(.*)'/)[1]
20
+ line = File.read("lib/#{NAME}.rb")[/^\s*VERSION\s*=\s*.*/]
21
+ line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
22
+ end
23
+
24
+ def gemspec_file
25
+ "#{NAME}.gemspec"
8
26
  end
9
27
 
28
+ def gem_file
29
+ "#{NAME}-#{source_version}.gem"
30
+ end
31
+
32
+ #############################################################################
33
+ #
34
+ # Standard tasks
35
+ #
36
+ #############################################################################
37
+
38
+ task :default => :test
39
+
10
40
  require 'rake/testtask'
11
41
  Rake::TestTask.new(:test) do |test|
12
42
  test.libs << 'lib' << 'test'
@@ -14,13 +44,33 @@ Rake::TestTask.new(:test) do |test|
14
44
  test.verbose = true
15
45
  end
16
46
 
17
- task :default => :test
47
+ desc "Generate and open coverage stats via rcov"
48
+ task :coverage do
49
+ require 'rcov'
50
+ sh "rm -fr coverage"
51
+ sh "rcov test/test_*.rb"
52
+ sh "open coverage/index.html"
53
+ end
54
+
55
+ require 'rake/rdoctask'
56
+ Rake::RDocTask.new do |rdoc|
57
+ rdoc.rdoc_dir = 'rdoc'
58
+ rdoc.title = "#{NAME} #{source_version}"
59
+ rdoc.rdoc_files.include('README*')
60
+ rdoc.rdoc_files.include('lib/**/*.rb')
61
+ end
18
62
 
19
63
  desc "Open an irb session preloaded with this library"
20
64
  task :console do
21
- sh "irb -rubygems -r ./lib/god.rb"
65
+ sh "irb -rubygems -r ./lib/#{NAME}.rb"
22
66
  end
23
67
 
68
+ #############################################################################
69
+ #
70
+ # Custom tasks (add your own tasks here)
71
+ #
72
+ #############################################################################
73
+
24
74
  desc "Upload site to Rubyforge"
25
75
  task :site do
26
76
  sh "scp -r site/* mojombo@god.rubyforge.org:/var/www/gforge-projects/god"
@@ -31,54 +81,62 @@ task :site_edge do
31
81
  sh "scp -r site/* mojombo@god.rubyforge.org:/var/www/gforge-projects/god/edge"
32
82
  end
33
83
 
34
- desc "Run rcov"
35
- task :coverage do
36
- `rm -fr coverage`
37
- `rcov test/test_*.rb`
38
- `open coverage/index.html`
84
+ #############################################################################
85
+ #
86
+ # Packaging tasks
87
+ #
88
+ #############################################################################
89
+
90
+ task :release => :build do
91
+ unless `git branch` =~ /^\* master$/
92
+ puts "You must be on the master branch to release!"
93
+ exit!
94
+ end
95
+ sh "git commit --allow-empty -a -m 'up to #{source_version}'"
96
+ sh "git tag v#{source_version}"
97
+ sh "git push origin master --tags"
98
+ sh "gem push pkg/#{NAME}-#{source_version}.gem"
39
99
  end
40
100
 
41
- require 'rake/rdoctask'
42
- Rake::RDocTask.new do |rdoc|
43
- rdoc.rdoc_dir = 'rdoc'
44
- rdoc.title = "god #{source_version}"
45
- rdoc.rdoc_files.include('README*')
46
- rdoc.rdoc_files.include('lib/**/*.rb')
101
+ task :build => :gemspec do
102
+ sh "mkdir -p pkg"
103
+ sh "gem build #{gemspec_file}"
104
+ sh "mv #{gem_file} pkg"
47
105
  end
48
106
 
49
- if defined?(Gem)
50
- task :release => :build do
51
- sh "git commit --allow-empty -a -m 'up to #{source_version}'"
52
- sh "git tag v#{source_version}"
53
- sh "git push origin master"
54
- sh "gem push pkg/god-#{source_version}.gem"
55
- end
107
+ task :gemspec => :validate do
108
+ # read spec file and split out manifest section
109
+ spec = File.read(gemspec_file)
110
+ head, manifest, tail = spec.split(" # = MANIFEST =\n")
56
111
 
57
- task :build => :gemspec do
58
- sh 'mkdir -p pkg'
59
- sh 'gem build god.gemspec'
60
- sh 'mv *.gem pkg'
61
- end
112
+ # replace version and date
113
+ head.sub!(/\.version = '.*'/, ".version = '#{source_version}'")
114
+ head.sub!(/\.date = '.*'/, ".date = '#{Date.today.to_s}'")
115
+
116
+ # determine file list from git ls-files
117
+ files = `git ls-files`.
118
+ split("\n").
119
+ sort.
120
+ reject { |file| file =~ /^\./ }.
121
+ reject { |file| file =~ /^(examples|ideas|init|site)/ }.
122
+ map { |file| " #{file}" }.
123
+ join("\n")
62
124
 
63
- task :gemspec do
64
- # read spec file and split out manifest section
65
- spec = File.read('god.gemspec')
66
- head, manifest, tail = spec.split(" # = MANIFEST =\n")
67
- # replace version and date
68
- head.sub!(/\.version = '.*'/, ".version = '#{source_version}'")
69
- head.sub!(/\.date = '.*'/, ".date = '#{Date.today.to_s}'")
70
- # determine file list from git ls-files
71
- files = `git ls-files`.
72
- split("\n").
73
- sort.
74
- reject { |file| file =~ /^\./ }.
75
- reject { |file| file =~ /^(ideas|init|site)/ }.
76
- map { |file| " #{file}" }.
77
- join("\n")
78
- # piece file back together and write...
79
- manifest = " s.files = %w[\n#{files}\n ]\n"
80
- spec = [head, manifest, tail].join(" # = MANIFEST =\n")
81
- File.open('god.gemspec', 'w') { |io| io.write(spec) }
82
- puts "updated god.gemspec"
125
+ # piece file back together and write
126
+ manifest = " s.files = %w[\n#{files}\n ]\n"
127
+ spec = [head, manifest, tail].join(" # = MANIFEST =\n")
128
+ File.open(gemspec_file, 'w') { |io| io.write(spec) }
129
+ puts "Updated #{gemspec_file}"
130
+ end
131
+
132
+ task :validate do
133
+ libfiles = Dir['lib/*'] - ["lib/#{NAME}.rb", "lib/#{NAME}"]
134
+ unless libfiles.empty?
135
+ puts "Directory `lib` should only contain a `#{NAME}.rb` file and `#{NAME}` dir."
136
+ exit!
83
137
  end
84
- end
138
+ unless Dir['VERSION*'].empty?
139
+ puts "A `VERSION` file at root level violates Gem best practices."
140
+ exit!
141
+ end
142
+ end
@@ -1,18 +1,39 @@
1
1
  Gem::Specification.new do |s|
2
- s.name = %q{god}
3
- s.version = '0.9.0'
4
-
2
+ s.specification_version = 2 if s.respond_to? :specification_version=
5
3
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
- s.authors = ["Tom Preston-Werner"]
7
- s.date = %q{2009-11-30}
8
- s.default_executable = %q{god}
9
- s.description = %q{God is an easy to configure, easy to extend monitoring framework written in Ruby.}
10
- s.email = %q{tom@mojombo.com}
4
+
5
+ s.name = 'god'
6
+ s.version = '0.10.1'
7
+ s.date = '2010-05-17'
8
+
9
+ s.summary = "Process monitoring framework."
10
+ s.description = "An easy to configure, easy to extend monitoring framework written in Ruby."
11
+
12
+ s.authors = ["Tom Preston-Werner", "Kevin Clark", "Eric Lindvall"]
13
+ s.email = 'god-rb@googlegroups.com'
14
+ s.homepage = 'http://god.rubyforge.org/'
15
+
16
+ s.rubyforge_project = 'god'
17
+ s.rubygems_version = '1.3.5'
18
+ s.require_paths = %w[lib ext]
19
+
11
20
  s.executables = ["god"]
12
- s.extensions = ["ext/god/extconf.rb", "ext/god/extconf.rb"]
13
- s.extra_rdoc_files = [
14
- "README.txt"
15
- ]
21
+ s.default_executable = 'god'
22
+ s.extensions = %w[ext/god/extconf.rb]
23
+
24
+ s.rdoc_options = ["--charset=UTF-8"]
25
+ s.extra_rdoc_files = %w[README.txt]
26
+
27
+ s.add_development_dependency('twitter', [">= 0.3.7"])
28
+ s.add_development_dependency('prowly', [">= 0.2.1"])
29
+ s.add_development_dependency('tinder', [">= 1.3.1", "< 2.0.0"])
30
+ s.add_development_dependency('xmpp4r', [">= 0.4.0"])
31
+ s.add_development_dependency('dike', [">= 0.0.3"])
32
+ s.add_development_dependency('snapshot', [">= 1.0.0", "< 2.0.0"])
33
+ s.add_development_dependency('rcov', [">= 0.9.8"])
34
+ s.add_development_dependency('daemons', [">= 1.0.10", "< 2.0.0"])
35
+ s.add_development_dependency('mocha', [">= 0.9.1"])
36
+
16
37
  # = MANIFEST =
17
38
  s.files = %w[
18
39
  Announce.txt
@@ -20,9 +41,6 @@ Gem::Specification.new do |s|
20
41
  README.txt
21
42
  Rakefile
22
43
  bin/god
23
- examples/events.god
24
- examples/gravatar.god
25
- examples/single.god
26
44
  ext/god/.gitignore
27
45
  ext/god/extconf.rb
28
46
  ext/god/kqueue_handler.c
@@ -102,6 +120,8 @@ Gem::Specification.new do |s|
102
120
  test/configs/matias/matias.god
103
121
  test/configs/real.rb
104
122
  test/configs/running_load/running_load.god
123
+ test/configs/stop_options/simple_server.rb
124
+ test/configs/stop_options/stop_options.god
105
125
  test/configs/stress/simple_server.rb
106
126
  test/configs/stress/stress.god
107
127
  test/configs/task/logs/.placeholder
@@ -140,64 +160,6 @@ Gem::Specification.new do |s|
140
160
  test/test_webhook.rb
141
161
  ]
142
162
  # = MANIFEST =
143
- s.homepage = %q{http://god.rubyforge.org/}
144
- s.rdoc_options = ["--charset=UTF-8"]
145
- s.require_paths = ["lib", "ext"]
146
- s.rubyforge_project = %q{god}
147
- s.rubygems_version = %q{1.3.5}
148
- s.summary = %q{Like monit, only awesome}
149
- s.test_files = [
150
- "test/configs/child_events/simple_server.rb",
151
- "test/configs/child_polls/simple_server.rb",
152
- "test/configs/complex/simple_server.rb",
153
- "test/configs/contact/simple_server.rb",
154
- "test/configs/daemon_events/simple_server.rb",
155
- "test/configs/daemon_events/simple_server_stop.rb",
156
- "test/configs/daemon_polls/simple_server.rb",
157
- "test/configs/degrading_lambda/tcp_server.rb",
158
- "test/configs/real.rb",
159
- "test/configs/stress/simple_server.rb",
160
- "test/configs/test.rb",
161
- "test/helper.rb",
162
- "test/suite.rb",
163
- "test/test_behavior.rb",
164
- "test/test_campfire.rb",
165
- "test/test_condition.rb",
166
- "test/test_conditions_disk_usage.rb",
167
- "test/test_conditions_http_response_code.rb",
168
- "test/test_conditions_process_running.rb",
169
- "test/test_conditions_tries.rb",
170
- "test/test_contact.rb",
171
- "test/test_dependency_graph.rb",
172
- "test/test_driver.rb",
173
- "test/test_email.rb",
174
- "test/test_event_handler.rb",
175
- "test/test_god.rb",
176
- "test/test_handlers_kqueue_handler.rb",
177
- "test/test_jabber.rb",
178
- "test/test_logger.rb",
179
- "test/test_metric.rb",
180
- "test/test_process.rb",
181
- "test/test_registry.rb",
182
- "test/test_socket.rb",
183
- "test/test_sugar.rb",
184
- "test/test_system_portable_poller.rb",
185
- "test/test_system_process.rb",
186
- "test/test_task.rb",
187
- "test/test_timeline.rb",
188
- "test/test_trigger.rb",
189
- "test/test_watch.rb",
190
- "test/test_webhook.rb"
191
- ]
192
-
193
- if s.respond_to? :specification_version then
194
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
195
- s.specification_version = 3
196
163
 
197
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
198
- else
199
- end
200
- else
201
- end
164
+ s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
202
165
  end
203
-
data/lib/god.rb CHANGED
@@ -150,13 +150,15 @@ class Module
150
150
  end
151
151
 
152
152
  module God
153
- VERSION = '0.9.0'
153
+ VERSION = '0.10.1'
154
154
  LOG_BUFFER_SIZE_DEFAULT = 100
155
155
  PID_FILE_DIRECTORY_DEFAULTS = ['/var/run/god', '~/.god/pids']
156
156
  DRB_PORT_DEFAULT = 17165
157
157
  DRB_ALLOW_DEFAULT = ['127.0.0.1']
158
158
  LOG_LEVEL_DEFAULT = :info
159
159
  TERMINATE_TIMEOUT_DEFAULT = 10
160
+ STOP_TIMEOUT_DEFAULT = 10
161
+ STOP_SIGNAL_DEFAULT = 'TERM'
160
162
 
161
163
  class << self
162
164
  # user configurable
@@ -2,8 +2,9 @@ module God
2
2
  class Process
3
3
  WRITES_PID = [:start, :restart]
4
4
 
5
- attr_accessor :name, :uid, :gid, :log, :log_cmd, :err_log, :err_log_cmd, :start, :stop, :restart,
6
- :unix_socket, :chroot, :env, :dir
5
+ attr_accessor :name, :uid, :gid, :log, :log_cmd, :err_log, :err_log_cmd,
6
+ :start, :stop, :restart, :unix_socket, :chroot, :env, :dir,
7
+ :stop_timeout, :stop_signal
7
8
 
8
9
  def initialize
9
10
  self.log = '/dev/null'
@@ -14,6 +15,8 @@ module God
14
15
  @pid = nil
15
16
  @unix_socket = nil
16
17
  @log_cmd = nil
18
+ @stop_timeout = God::STOP_TIMEOUT_DEFAULT
19
+ @stop_signal = God::STOP_SIGNAL_DEFAULT
17
20
  end
18
21
 
19
22
  def alive?
@@ -203,11 +206,11 @@ module God
203
206
  command = lambda do
204
207
  applog(self, :info, "#{self.name} stop: default lambda killer")
205
208
 
206
- ::Process.kill('TERM', pid) rescue nil
207
- applog(self, :info, "#{self.name} sent SIGTERM")
209
+ ::Process.kill(@stop_signal, pid) rescue nil
210
+ applog(self, :info, "#{self.name} sent SIG#{@stop_signal}")
208
211
 
209
212
  # Poll to see if it's dead
210
- 5.times do
213
+ @stop_timeout.times do
211
214
  begin
212
215
  ::Process.kill(0, pid)
213
216
  rescue Errno::ESRCH
@@ -220,14 +223,14 @@ module God
220
223
  end
221
224
 
222
225
  ::Process.kill('KILL', pid) rescue nil
223
- applog(self, :info, "#{self.name} still alive; sent SIGKILL")
226
+ applog(self, :warn, "#{self.name} still alive after #{@stop_timeout}s; sent SIGKILL")
224
227
  end
225
228
  end
226
229
 
227
230
  if command.kind_of?(String)
228
231
  pid = nil
229
232
 
230
- if @tracking_pid
233
+ if [:start, :restart].include?(action) && @tracking_pid
231
234
  # double fork god-daemonized processes
232
235
  # we don't want to wait for them to finish
233
236
  r, w = IO.pipe
@@ -326,13 +329,15 @@ module God
326
329
  #
327
330
  # Returns nothing
328
331
  def ensure_stop
332
+ applog(self, :warn, "#{self.name} ensuring stop...")
333
+
329
334
  unless self.pid
330
335
  applog(self, :warn, "#{self.name} stop called but pid is uknown")
331
336
  return
332
337
  end
333
338
 
334
339
  # Poll to see if it's dead
335
- 10.times do
340
+ @stop_timeout.times do
336
341
  begin
337
342
  ::Process.kill(0, self.pid)
338
343
  rescue Errno::ESRCH
@@ -345,7 +350,7 @@ module God
345
350
 
346
351
  # last resort
347
352
  ::Process.kill('KILL', self.pid) rescue nil
348
- applog(self, :warn, "#{self.name} process still running 10 seconds after stop command returned. Force killing.")
353
+ applog(self, :warn, "#{self.name} still alive after #{@stop_timeout}s; sent SIGKILL")
349
354
  end
350
355
 
351
356
  private
@@ -12,10 +12,13 @@ module God
12
12
 
13
13
  extend Forwardable
14
14
  def_delegators :@process, :name, :uid, :gid, :start, :stop, :restart, :dir,
15
- :name=, :uid=, :gid=, :start=, :stop=, :restart=, :dir=,
16
- :pid_file, :pid_file=, :log, :log=, :log_cmd, :log_cmd=,
17
- :err_log, :err_log=, :err_log_cmd, :err_log_cmd=, :alive?, :pid,
18
- :unix_socket, :unix_socket=, :chroot, :chroot=, :env, :env=, :signal
15
+ :name=, :uid=, :gid=, :start=, :stop=, :restart=,
16
+ :dir=, :pid_file, :pid_file=, :log, :log=,
17
+ :log_cmd, :log_cmd=, :err_log, :err_log=,
18
+ :err_log_cmd, :err_log_cmd=, :alive?, :pid,
19
+ :unix_socket, :unix_socket=, :chroot, :chroot=,
20
+ :env, :env=, :signal, :stop_timeout=,
21
+ :stop_signal=
19
22
  #
20
23
  def initialize
21
24
  super
@@ -0,0 +1,12 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ trap :USR1 do
4
+
5
+ end
6
+
7
+ loop do
8
+ STDOUT.puts('server');
9
+ STDOUT.flush;
10
+
11
+ sleep 10
12
+ end
@@ -0,0 +1,39 @@
1
+ God.watch do |w|
2
+ w.name = 'stop-options'
3
+ w.start = File.join(GOD_ROOT, *%w[test configs stop_options simple_server.rb])
4
+ w.stop_signal = 'USR1'
5
+ w.stop_timeout = 5
6
+ w.interval = 5
7
+ w.grace = 2
8
+
9
+ w.start_if do |start|
10
+ start.condition(:process_running) do |c|
11
+ c.running = false
12
+ end
13
+ end
14
+
15
+ w.restart_if do |restart|
16
+ restart.condition(:cpu_usage) do |c|
17
+ c.above = 30.percent
18
+ c.times = [3, 5]
19
+ end
20
+
21
+ restart.condition(:memory_usage) do |c|
22
+ c.above = 10.megabytes
23
+ c.times = [3, 5]
24
+ end
25
+ end
26
+
27
+ # lifecycle
28
+ w.lifecycle do |on|
29
+ on.condition(:flapping) do |c|
30
+ c.to_state = [:start, :restart]
31
+ c.times = 3
32
+ c.within = 60.seconds
33
+ c.transition = :unmonitored
34
+ c.retry_in = 10.seconds
35
+ c.retry_times = 2
36
+ c.retry_within = 5.minutes
37
+ end
38
+ end
39
+ end
metadata CHANGED
@@ -1,25 +1,177 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: god
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 10
8
+ - 1
9
+ version: 0.10.1
5
10
  platform: ruby
6
11
  authors:
7
12
  - Tom Preston-Werner
13
+ - Kevin Clark
14
+ - Eric Lindvall
8
15
  autorequire:
9
16
  bindir: bin
10
17
  cert_chain: []
11
18
 
12
- date: 2009-11-30 00:00:00 -08:00
19
+ date: 2010-05-17 00:00:00 -07:00
13
20
  default_executable: god
14
- dependencies: []
15
-
16
- description: God is an easy to configure, easy to extend monitoring framework written in Ruby.
17
- email: tom@mojombo.com
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ name: twitter
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ segments:
30
+ - 0
31
+ - 3
32
+ - 7
33
+ version: 0.3.7
34
+ type: :development
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: prowly
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ segments:
44
+ - 0
45
+ - 2
46
+ - 1
47
+ version: 0.2.1
48
+ type: :development
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: tinder
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ segments:
58
+ - 1
59
+ - 3
60
+ - 1
61
+ version: 1.3.1
62
+ - - <
63
+ - !ruby/object:Gem::Version
64
+ segments:
65
+ - 2
66
+ - 0
67
+ - 0
68
+ version: 2.0.0
69
+ type: :development
70
+ version_requirements: *id003
71
+ - !ruby/object:Gem::Dependency
72
+ name: xmpp4r
73
+ prerelease: false
74
+ requirement: &id004 !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ segments:
79
+ - 0
80
+ - 4
81
+ - 0
82
+ version: 0.4.0
83
+ type: :development
84
+ version_requirements: *id004
85
+ - !ruby/object:Gem::Dependency
86
+ name: dike
87
+ prerelease: false
88
+ requirement: &id005 !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ segments:
93
+ - 0
94
+ - 0
95
+ - 3
96
+ version: 0.0.3
97
+ type: :development
98
+ version_requirements: *id005
99
+ - !ruby/object:Gem::Dependency
100
+ name: snapshot
101
+ prerelease: false
102
+ requirement: &id006 !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ segments:
107
+ - 1
108
+ - 0
109
+ - 0
110
+ version: 1.0.0
111
+ - - <
112
+ - !ruby/object:Gem::Version
113
+ segments:
114
+ - 2
115
+ - 0
116
+ - 0
117
+ version: 2.0.0
118
+ type: :development
119
+ version_requirements: *id006
120
+ - !ruby/object:Gem::Dependency
121
+ name: rcov
122
+ prerelease: false
123
+ requirement: &id007 !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ segments:
128
+ - 0
129
+ - 9
130
+ - 8
131
+ version: 0.9.8
132
+ type: :development
133
+ version_requirements: *id007
134
+ - !ruby/object:Gem::Dependency
135
+ name: daemons
136
+ prerelease: false
137
+ requirement: &id008 !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ segments:
142
+ - 1
143
+ - 0
144
+ - 10
145
+ version: 1.0.10
146
+ - - <
147
+ - !ruby/object:Gem::Version
148
+ segments:
149
+ - 2
150
+ - 0
151
+ - 0
152
+ version: 2.0.0
153
+ type: :development
154
+ version_requirements: *id008
155
+ - !ruby/object:Gem::Dependency
156
+ name: mocha
157
+ prerelease: false
158
+ requirement: &id009 !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ segments:
163
+ - 0
164
+ - 9
165
+ - 1
166
+ version: 0.9.1
167
+ type: :development
168
+ version_requirements: *id009
169
+ description: An easy to configure, easy to extend monitoring framework written in Ruby.
170
+ email: god-rb@googlegroups.com
18
171
  executables:
19
172
  - god
20
173
  extensions:
21
174
  - ext/god/extconf.rb
22
- - ext/god/extconf.rb
23
175
  extra_rdoc_files:
24
176
  - README.txt
25
177
  files:
@@ -28,9 +180,6 @@ files:
28
180
  - README.txt
29
181
  - Rakefile
30
182
  - bin/god
31
- - examples/events.god
32
- - examples/gravatar.god
33
- - examples/single.god
34
183
  - ext/god/.gitignore
35
184
  - ext/god/extconf.rb
36
185
  - ext/god/kqueue_handler.c
@@ -110,6 +259,8 @@ files:
110
259
  - test/configs/matias/matias.god
111
260
  - test/configs/real.rb
112
261
  - test/configs/running_load/running_load.god
262
+ - test/configs/stop_options/simple_server.rb
263
+ - test/configs/stop_options/stop_options.god
113
264
  - test/configs/stress/simple_server.rb
114
265
  - test/configs/stress/stress.god
115
266
  - test/configs/task/logs/.placeholder
@@ -160,35 +311,24 @@ required_ruby_version: !ruby/object:Gem::Requirement
160
311
  requirements:
161
312
  - - ">="
162
313
  - !ruby/object:Gem::Version
314
+ segments:
315
+ - 0
163
316
  version: "0"
164
- version:
165
317
  required_rubygems_version: !ruby/object:Gem::Requirement
166
318
  requirements:
167
319
  - - ">="
168
320
  - !ruby/object:Gem::Version
321
+ segments:
322
+ - 0
169
323
  version: "0"
170
- version:
171
324
  requirements: []
172
325
 
173
326
  rubyforge_project: god
174
- rubygems_version: 1.3.5
327
+ rubygems_version: 1.3.6
175
328
  signing_key:
176
- specification_version: 3
177
- summary: Like monit, only awesome
329
+ specification_version: 2
330
+ summary: Process monitoring framework.
178
331
  test_files:
179
- - test/configs/child_events/simple_server.rb
180
- - test/configs/child_polls/simple_server.rb
181
- - test/configs/complex/simple_server.rb
182
- - test/configs/contact/simple_server.rb
183
- - test/configs/daemon_events/simple_server.rb
184
- - test/configs/daemon_events/simple_server_stop.rb
185
- - test/configs/daemon_polls/simple_server.rb
186
- - test/configs/degrading_lambda/tcp_server.rb
187
- - test/configs/real.rb
188
- - test/configs/stress/simple_server.rb
189
- - test/configs/test.rb
190
- - test/helper.rb
191
- - test/suite.rb
192
332
  - test/test_behavior.rb
193
333
  - test/test_campfire.rb
194
334
  - test/test_condition.rb
@@ -207,6 +347,7 @@ test_files:
207
347
  - test/test_logger.rb
208
348
  - test/test_metric.rb
209
349
  - test/test_process.rb
350
+ - test/test_prowl.rb
210
351
  - test/test_registry.rb
211
352
  - test/test_socket.rb
212
353
  - test/test_sugar.rb
@@ -1,84 +0,0 @@
1
- # This example shows how you might keep a local development Rails server up
2
- # and running on your Mac.
3
-
4
- # Run with:
5
- # god -c /path/to/events.god
6
-
7
- RAILS_ROOT = ENV['GOD_TEST_RAILS_ROOT']
8
-
9
- %w{3002}.each do |port|
10
- God.watch do |w|
11
- w.name = "local-#{port}"
12
- w.interval = 5.seconds
13
- w.start = "mongrel_rails start -p #{port} -P #{RAILS_ROOT}/log/mongrel.#{port}.pid -c #{RAILS_ROOT} -d"
14
- w.stop = "mongrel_rails stop -P #{RAILS_ROOT}/log/mongrel.#{port}.pid -c #{RAILS_ROOT}"
15
- w.pid_file = File.join(RAILS_ROOT, "log/mongrel.#{port}.pid")
16
- w.log = File.join(RAILS_ROOT, "log/commands.#{port}.log")
17
-
18
- # clean pid files before start if necessary
19
- w.behavior(:clean_pid_file)
20
-
21
- # determine the state on startup
22
- w.transition(:init, { true => :up, false => :start }) do |on|
23
- on.condition(:process_running) do |c|
24
- c.running = true
25
- end
26
- end
27
-
28
- # determine when process has finished starting
29
- w.transition([:start, :restart], :up) do |on|
30
- on.condition(:process_running) do |c|
31
- c.running = true
32
- end
33
-
34
- # failsafe
35
- on.condition(:tries) do |c|
36
- c.times = 8
37
- c.within = 2.minutes
38
- c.transition = :start
39
- end
40
- end
41
-
42
- # start if process is not running
43
- w.transition(:up, :start) do |on|
44
- on.condition(:process_exits)
45
- end
46
-
47
- # restart if memory or cpu is too high
48
- w.transition(:up, :restart) do |on|
49
- on.condition(:memory_usage) do |c|
50
- c.interval = 20
51
- c.above = 50.megabytes
52
- c.times = [3, 5]
53
- end
54
-
55
- on.condition(:cpu_usage) do |c|
56
- c.interval = 10
57
- c.above = 10.percent
58
- c.times = 5
59
- end
60
-
61
- on.condition(:http_response_code) do |c|
62
- c.host = 'localhost'
63
- c.port = port
64
- c.path = '/'
65
- c.code_is = 500
66
- c.timeout = 10.seconds
67
- c.times = [3, 5]
68
- end
69
- end
70
-
71
- # lifecycle
72
- w.lifecycle do |on|
73
- on.condition(:flapping) do |c|
74
- c.to_state = [:start, :restart]
75
- c.times = 5
76
- c.within = 1.minute
77
- c.transition = :unmonitored
78
- c.retry_in = 10.minutes
79
- c.retry_times = 5
80
- c.retry_within = 2.hours
81
- end
82
- end
83
- end
84
- end
@@ -1,54 +0,0 @@
1
- # run with: god -c /path/to/gravatar.god
2
- #
3
- # This is the actual config file used to keep the mongrels of
4
- # gravatar.com running.
5
-
6
- RAILS_ROOT = "/Users/tom/dev/gravatar2"
7
-
8
- %w{8200 8201 8202}.each do |port|
9
- God.watch do |w|
10
- w.name = "gravatar2-mongrel-#{port}"
11
- w.interval = 30.seconds # default
12
- w.start = "mongrel_rails start -c #{RAILS_ROOT} -p #{port} \
13
- -P #{RAILS_ROOT}/log/mongrel.#{port}.pid -d"
14
- w.stop = "mongrel_rails stop -P #{RAILS_ROOT}/log/mongrel.#{port}.pid"
15
- w.restart = "mongrel_rails restart -P #{RAILS_ROOT}/log/mongrel.#{port}.pid"
16
- w.start_grace = 10.seconds
17
- w.restart_grace = 10.seconds
18
- w.pid_file = File.join(RAILS_ROOT, "log/mongrel.#{port}.pid")
19
-
20
- w.behavior(:clean_pid_file)
21
-
22
- w.start_if do |start|
23
- start.condition(:process_running) do |c|
24
- c.interval = 5.seconds
25
- c.running = false
26
- end
27
- end
28
-
29
- w.restart_if do |restart|
30
- restart.condition(:memory_usage) do |c|
31
- c.above = 150.megabytes
32
- c.times = [3, 5] # 3 out of 5 intervals
33
- end
34
-
35
- restart.condition(:cpu_usage) do |c|
36
- c.above = 50.percent
37
- c.times = 5
38
- end
39
- end
40
-
41
- # lifecycle
42
- w.lifecycle do |on|
43
- on.condition(:flapping) do |c|
44
- c.to_state = [:start, :restart]
45
- c.times = 5
46
- c.within = 5.minute
47
- c.transition = :unmonitored
48
- c.retry_in = 10.minutes
49
- c.retry_times = 5
50
- c.retry_within = 2.hours
51
- end
52
- end
53
- end
54
- end
@@ -1,66 +0,0 @@
1
- RAILS_ROOT = "/Users/tom/dev/gravatar2"
2
-
3
- God.watch do |w|
4
- w.name = "local-3000"
5
- w.interval = 5.seconds # default
6
- w.start = "mongrel_rails start -c #{RAILS_ROOT} -P #{RAILS_ROOT}/log/mongrel.pid -p 3000 -d"
7
- w.stop = "mongrel_rails stop -P #{RAILS_ROOT}/log/mongrel.pid"
8
- w.restart = "mongrel_rails restart -P #{RAILS_ROOT}/log/mongrel.pid"
9
- w.pid_file = File.join(RAILS_ROOT, "log/mongrel.pid")
10
-
11
- # clean pid files before start if necessary
12
- w.behavior(:clean_pid_file)
13
-
14
- # determine the state on startup
15
- w.transition(:init, { true => :up, false => :start }) do |on|
16
- on.condition(:process_running) do |c|
17
- c.running = true
18
- end
19
- end
20
-
21
- # determine when process has finished starting
22
- w.transition([:start, :restart], :up) do |on|
23
- on.condition(:process_running) do |c|
24
- c.running = true
25
- end
26
-
27
- # failsafe
28
- on.condition(:tries) do |c|
29
- c.times = 5
30
- c.transition = :start
31
- end
32
- end
33
-
34
- # start if process is not running
35
- w.transition(:up, :start) do |on|
36
- on.condition(:process_exits)
37
- end
38
-
39
- # restart if memory or cpu is too high
40
- w.transition(:up, :restart) do |on|
41
- on.condition(:memory_usage) do |c|
42
- c.interval = 20
43
- c.above = 50.megabytes
44
- c.times = [3, 5]
45
- end
46
-
47
- on.condition(:cpu_usage) do |c|
48
- c.interval = 10
49
- c.above = 10.percent
50
- c.times = [3, 5]
51
- end
52
- end
53
-
54
- # lifecycle
55
- w.lifecycle do |on|
56
- on.condition(:flapping) do |c|
57
- c.to_state = [:start, :restart]
58
- c.times = 5
59
- c.within = 5.minute
60
- c.transition = :unmonitored
61
- c.retry_in = 10.minutes
62
- c.retry_times = 5
63
- c.retry_within = 2.hours
64
- end
65
- end
66
- end