bluepill 0.1.2 → 0.1.4

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.
Files changed (43) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +820 -0
  3. data/CONTRIBUTING.md +31 -0
  4. data/LICENSE +1 -1
  5. data/README.md +69 -30
  6. data/bin/bluepill +2 -2
  7. data/bluepill.gemspec +17 -6
  8. data/lib/bluepill/application.rb +311 -43
  9. data/lib/bluepill/condition_watch.rb +105 -10
  10. data/lib/bluepill/controller.rb +125 -14
  11. data/lib/bluepill/dsl/app_proxy.rb +103 -4
  12. data/lib/bluepill/dsl/process_factory.rb +185 -62
  13. data/lib/bluepill/dsl/process_proxy.rb +132 -14
  14. data/lib/bluepill/dsl.rb +27 -5
  15. data/lib/bluepill/group.rb +142 -9
  16. data/lib/bluepill/logger.rb +122 -7
  17. data/lib/bluepill/process.rb +582 -211
  18. data/lib/bluepill/process_commands.rb +262 -0
  19. data/lib/bluepill/process_conditions/always_true.rb +18 -4
  20. data/lib/bluepill/process_conditions/cpu_usage.rb +34 -0
  21. data/lib/bluepill/process_conditions/file_time.rb +40 -4
  22. data/lib/bluepill/process_conditions/http.rb +81 -23
  23. data/lib/bluepill/process_conditions/mem_usage.rb +64 -5
  24. data/lib/bluepill/process_conditions/process_condition.rb +45 -2
  25. data/lib/bluepill/process_conditions/running_time.rb +36 -1
  26. data/lib/bluepill/process_conditions/zombie_process.rb +26 -5
  27. data/lib/bluepill/process_conditions.rb +15 -1
  28. data/lib/bluepill/process_journal.rb +256 -104
  29. data/lib/bluepill/process_statistics.rb +33 -3
  30. data/lib/bluepill/socket.rb +63 -16
  31. data/lib/bluepill/system/commands.rb +286 -0
  32. data/lib/bluepill/system.rb +193 -229
  33. data/lib/bluepill/trigger.rb +111 -15
  34. data/lib/bluepill/triggers/flapping.rb +86 -5
  35. data/lib/bluepill/util/rotational_array.rb +25 -2
  36. data/lib/bluepill/version.rb +71 -19
  37. data/lib/bluepill.rb +25 -2
  38. data/sig/bluepill.rbs +926 -0
  39. data/sig/manifest.yaml +7 -0
  40. metadata +16 -35
  41. data/bin/sample_forking_server +0 -66
  42. data/lib/bluepill/application/client.rb +0 -6
  43. data/lib/bluepill/application/server.rb +0 -21
data/sig/manifest.yaml ADDED
@@ -0,0 +1,7 @@
1
+ # Standard libraries that bluepill's signatures use
2
+ dependencies:
3
+ - name: logger
4
+ - name: monitor
5
+ - name: net-http
6
+ - name: socket
7
+ - name: uri
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bluepill
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arya Asemanfar
8
- - Gary Tsang
8
+ - Erik Berlin
9
9
  - Rohith Ravi
10
- autorequire:
10
+ - Gary Tsang
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-06-19 00:00:00.000000000 Z
13
+ date: 1980-01-02 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -19,9 +19,6 @@ dependencies:
19
19
  - - ">="
20
20
  - !ruby/object:Gem::Version
21
21
  version: '3.2'
22
- - - "<"
23
- - !ruby/object:Gem::Version
24
- version: '5'
25
22
  type: :runtime
26
23
  prerelease: false
27
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,9 +26,6 @@ dependencies:
29
26
  - - ">="
30
27
  - !ruby/object:Gem::Version
31
28
  version: '3.2'
32
- - - "<"
33
- - !ruby/object:Gem::Version
34
- version: '5'
35
29
  - !ruby/object:Gem::Dependency
36
30
  name: blue-daemons
37
31
  requirement: !ruby/object:Gem::Requirement
@@ -60,20 +54,6 @@ dependencies:
60
54
  - - "~>"
61
55
  - !ruby/object:Gem::Version
62
56
  version: '1.1'
63
- - !ruby/object:Gem::Dependency
64
- name: bundler
65
- requirement: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - "~>"
68
- - !ruby/object:Gem::Version
69
- version: '1.3'
70
- type: :development
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - "~>"
75
- - !ruby/object:Gem::Version
76
- version: '1.3'
77
57
  description: Bluepill keeps your daemons up while taking up as little resources as
78
58
  possible. After all you probably want the resources of your server to be used by
79
59
  whatever daemons you are running rather than the thing that's supposed to make sure
@@ -83,22 +63,19 @@ email:
83
63
  executables:
84
64
  - bluepill
85
65
  - bpsv
86
- - sample_forking_server
87
66
  extensions: []
88
67
  extra_rdoc_files: []
89
68
  files:
69
+ - CHANGELOG.md
90
70
  - CONTRIBUTING.md
91
71
  - DESIGN.md
92
72
  - LICENSE
93
73
  - README.md
94
74
  - bin/bluepill
95
75
  - bin/bpsv
96
- - bin/sample_forking_server
97
76
  - bluepill.gemspec
98
77
  - lib/bluepill.rb
99
78
  - lib/bluepill/application.rb
100
- - lib/bluepill/application/client.rb
101
- - lib/bluepill/application/server.rb
102
79
  - lib/bluepill/condition_watch.rb
103
80
  - lib/bluepill/controller.rb
104
81
  - lib/bluepill/dsl.rb
@@ -108,6 +85,7 @@ files:
108
85
  - lib/bluepill/group.rb
109
86
  - lib/bluepill/logger.rb
110
87
  - lib/bluepill/process.rb
88
+ - lib/bluepill/process_commands.rb
111
89
  - lib/bluepill/process_conditions.rb
112
90
  - lib/bluepill/process_conditions/always_true.rb
113
91
  - lib/bluepill/process_conditions/cpu_usage.rb
@@ -121,15 +99,21 @@ files:
121
99
  - lib/bluepill/process_statistics.rb
122
100
  - lib/bluepill/socket.rb
123
101
  - lib/bluepill/system.rb
102
+ - lib/bluepill/system/commands.rb
124
103
  - lib/bluepill/trigger.rb
125
104
  - lib/bluepill/triggers/flapping.rb
126
105
  - lib/bluepill/util/rotational_array.rb
127
106
  - lib/bluepill/version.rb
128
- homepage: http://github.com/bluepill-rb/bluepill
107
+ - sig/bluepill.rbs
108
+ - sig/manifest.yaml
109
+ homepage: https://github.com/bluepill-rb/bluepill
129
110
  licenses:
130
111
  - MIT
131
- metadata: {}
132
- post_install_message:
112
+ metadata:
113
+ source_code_uri: https://github.com/bluepill-rb/bluepill
114
+ changelog_uri: https://github.com/bluepill-rb/bluepill/blob/master/CHANGELOG.md
115
+ bug_tracker_uri: https://github.com/bluepill-rb/bluepill/issues
116
+ rubygems_mfa_required: 'true'
133
117
  rdoc_options: []
134
118
  require_paths:
135
119
  - lib
@@ -144,10 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
128
  - !ruby/object:Gem::Version
145
129
  version: '0'
146
130
  requirements: []
147
- rubyforge_project:
148
- rubygems_version: 2.5.1
149
- signing_key:
131
+ rubygems_version: 4.0.23
150
132
  specification_version: 4
151
133
  summary: A process monitor written in Ruby with stability and minimalism in mind.
152
134
  test_files: []
153
- has_rdoc:
@@ -1,66 +0,0 @@
1
- #! /usr/bin/env ruby
2
-
3
- # This is a modified version found at http://tomayko.com/writings/unicorn-is-unix
4
- # It is modified to trigger various states like increase memory consumption so that
5
- # I could write watches for them.
6
-
7
- # Instructions for running the test
8
- #
9
- # (1) Edit the example config and fix the path to this file. Around line 16.
10
- # (2) Load up the config and run the bluepill daemon
11
- # (3) Run watch -n0.2 'sudo ruby bin/bluepill status 2>/dev/null; echo; ps ajxu | egrep "(CPU|forking|bluepill|sleep|ruby)" | grep -v grep | sort'
12
- # (4) After verifying that the "sleep" workers are properly being restarted, telnet to localhost 4242 and say something. You should get it echoed back and the worker which answered your request should now be over the allowed memory limit
13
- # (5) Observe the worker being killed in the watch you started in step 3.
14
-
15
- require 'socket'
16
-
17
- port = ARGV[0].to_i
18
- port = 4242 if port.zero?
19
-
20
- acceptor = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)
21
- address = Socket.pack_sockaddr_in(port, '127.0.0.1')
22
- acceptor.bind(address)
23
- acceptor.listen(10)
24
-
25
- children = []
26
- trap('EXIT') do
27
- acceptor.close
28
- children.each { |c| Process.kill('QUIT', c) }
29
- end
30
-
31
- 3.times do
32
- children << fork do
33
- trap('QUIT') do
34
- $0 = 'forking_server| QUIT received shutting down gracefully...'
35
- sleep 5
36
- exit
37
- end
38
- trap('INT') do
39
- $0 = 'forking_server| INT received shutting down UN-gracefully...'
40
- sleep 3
41
- exit
42
- end
43
-
44
- puts "child #{$PROCESS_ID} accepting on shared socket (localhost:#{port})"
45
- loop do
46
- socket, = acceptor.accept
47
- socket.write "child #{$PROCESS_ID} echo> "
48
- socket.flush
49
- message = socket.gets
50
- socket.write message
51
- socket.close
52
- puts "child #{$PROCESS_ID} echo'd: '#{message.strip}'"
53
-
54
- # cause a spike in mem usage
55
- '*' * 2**20
56
- end
57
- exit
58
- end
59
- end
60
-
61
- trap('INT') do
62
- puts "\nbailing"
63
- exit
64
- end
65
-
66
- Process.waitall
@@ -1,6 +0,0 @@
1
- module Bluepill
2
- module Application
3
- module Client
4
- end
5
- end
6
- end
@@ -1,21 +0,0 @@
1
- module Bluepill
2
- module Application
3
- module ServerMethods
4
- def status
5
- processes.collect do |process|
6
- "#{process.name} #{process.state}"
7
- end.join("\n")
8
- end
9
-
10
- def restart
11
- self.socket = Bluepill::Socket.new(name, base_dir).client
12
- socket.send("restart\n", 0)
13
- end
14
-
15
- def stop
16
- self.socket = Bluepill::Socket.new(name, base_dir).client
17
- socket.send("stop\n", 0)
18
- end
19
- end
20
- end
21
- end