bluepill 0.2.3 → 0.2.7
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -1
- data/README.md +2 -2
- data/bin/bluepill +1 -2
- data/bluepill.gemspec +1 -1
- data/lib/bluepill/clock.rb +2 -4
- data/lib/bluepill/daemonize.rb +6 -10
- data/lib/bluepill/dsl/process_factory.rb +1 -1
- data/lib/bluepill/dsl/process_proxy.rb +5 -10
- data/lib/bluepill/process/state_machine.rb +1 -1
- data/lib/bluepill/process/transition_callbacks.rb +4 -6
- data/lib/bluepill/process_conditions/http.rb +4 -2
- data/lib/bluepill/process_conditions/zombie_process.rb +1 -1
- data/lib/bluepill/process_journal/cleanup.rb +4 -6
- data/lib/bluepill/socket.rb +4 -6
- data/lib/bluepill/version.rb +7 -7
- data/sig/bluepill.rbs +0 -7
- metadata +2 -3
- data/lib/bluepill/util/levenshtein.rb +0 -55
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9d664e72f8442b19af1fb89f3fcde512ce4d59c883801117a9d7bc25f5353db8
|
|
4
|
+
data.tar.gz: 77794cc2c1df9fa08ac568b33098333f1adc67802cb943e00c0ee033a7cdf647
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5a16b8fc0f63a6e1aa90eef446e9e7841c3f88442db3cb8e9f7b49518770694ad09992b859229151d63496fc11e2283731af559df8eb2a25e737312382bb8581
|
|
7
|
+
data.tar.gz: 0e417a4c4072c3f9435e185ba1ee2ac7f013f01f10d18041e6ce2eea48f39776cd9ac477644586c85e5a6d7b621ef2fee2510783b13944e706d6886d6f2cd3da
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.2.7] - 2026-11-02
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- The attribute that a config error suggests for a misspelled one now comes from Ruby's `did_you_mean`, as a misspelled method's does, so it also suggests one for a short name, such as `uid` for `ui`.
|
|
15
|
+
|
|
16
|
+
### Removed
|
|
17
|
+
|
|
18
|
+
- **Breaking:** support for Ruby 2.5 and 2.6, and for JRuby 9.2 and 9.3, which run Ruby 2.5 and 2.6 code. Bluepill 0.2.7 needs Ruby 2.7 or newer, or JRuby 9.4 or newer. Bluepill 0.2.5 still runs on them.
|
|
19
|
+
|
|
20
|
+
## [0.2.5] - 2026-11-02
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- The `zombie_process` check tests for `<defunct>` with `match?`, so each check makes one fewer object.
|
|
25
|
+
|
|
26
|
+
### Removed
|
|
27
|
+
|
|
28
|
+
- **Breaking:** support for Ruby 2.3 and 2.4, and for JRuby 9.1, which runs Ruby 2.3 code. Bluepill 0.2.5 needs Ruby 2.5 or newer, or JRuby 9.2 or newer. Bluepill 0.2.3 still runs on them.
|
|
29
|
+
|
|
10
30
|
## [0.2.3] - 2026-11-02
|
|
11
31
|
|
|
12
32
|
### Changed
|
|
@@ -832,7 +852,9 @@ Initial release.
|
|
|
832
852
|
- Added the `bluepill` CLI with the `load`, `status`, `start`, `stop`, `restart`, `unmonitor`, `quit` and `log` commands.
|
|
833
853
|
- Added syslog logging.
|
|
834
854
|
|
|
835
|
-
[unreleased]: https://github.com/bluepill-rb/bluepill/compare/v0.2.
|
|
855
|
+
[unreleased]: https://github.com/bluepill-rb/bluepill/compare/v0.2.7...HEAD
|
|
856
|
+
[0.2.7]: https://github.com/bluepill-rb/bluepill/compare/v0.2.5...v0.2.7
|
|
857
|
+
[0.2.5]: https://github.com/bluepill-rb/bluepill/compare/v0.2.3...v0.2.5
|
|
836
858
|
[0.2.3]: https://github.com/bluepill-rb/bluepill/compare/v0.2.1...v0.2.3
|
|
837
859
|
[0.2.1]: https://github.com/bluepill-rb/bluepill/compare/v0.2.0...v0.2.1
|
|
838
860
|
[0.2.0]: https://github.com/bluepill-rb/bluepill/compare/v0.1.6...v0.2.0
|
data/README.md
CHANGED
|
@@ -504,10 +504,10 @@ JRuby allows you to run bluepill only in the foreground.
|
|
|
504
504
|
This library aims to support and is [tested against][ci] the following Ruby
|
|
505
505
|
implementations:
|
|
506
506
|
|
|
507
|
-
* Ruby 2.
|
|
507
|
+
* Ruby 2.7
|
|
508
508
|
* Ruby 3.0 through 3.4
|
|
509
509
|
* Ruby 4.0
|
|
510
|
-
* JRuby 9.
|
|
510
|
+
* JRuby 9.4 (only in the foreground)
|
|
511
511
|
* JRuby 10.0 and 10.1 (only in the foreground)
|
|
512
512
|
|
|
513
513
|
If something doesn't work on one of these interpreters, please open an issue.
|
data/bin/bluepill
CHANGED
|
@@ -69,8 +69,7 @@ end
|
|
|
69
69
|
|
|
70
70
|
APPLICATION_COMMANDS = %w[status start stop restart unmonitor quit log].freeze
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
controller = Bluepill::Controller.new(options.select { |key, _| %i[base_dir log_file].include?(key) })
|
|
72
|
+
controller = Bluepill::Controller.new(options.slice(:base_dir, :log_file))
|
|
74
73
|
|
|
75
74
|
if controller.running_applications.include?(File.basename($PROGRAM_NAME)) && File.symlink?($PROGRAM_NAME)
|
|
76
75
|
# bluepill was called as a symlink with the name of the target application
|
data/bluepill.gemspec
CHANGED
|
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
|
22
22
|
"rubygems_mfa_required" => "true"
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
spec.required_ruby_version = ">= 2.
|
|
25
|
+
spec.required_ruby_version = ">= 2.7"
|
|
26
26
|
|
|
27
27
|
# sig has the RBS signatures, and the standard libraries they use in manifest.yaml
|
|
28
28
|
spec.executables = %w[bluepill bpsv]
|
data/lib/bluepill/clock.rb
CHANGED
|
@@ -13,15 +13,13 @@ module Bluepill
|
|
|
13
13
|
# Return the monotonic clock's time, in whole seconds
|
|
14
14
|
#
|
|
15
15
|
# It counts from an arbitrary point, such as when the machine booted, so
|
|
16
|
-
# a reading only means something next to another one.
|
|
17
|
-
# :second unit, so it reads the clock in seconds, as a Float, and drops
|
|
18
|
-
# the fraction.
|
|
16
|
+
# a reading only means something next to another one.
|
|
19
17
|
#
|
|
20
18
|
# @return [Integer]
|
|
21
19
|
#
|
|
22
20
|
# @api private
|
|
23
21
|
def self.now
|
|
24
|
-
|
|
22
|
+
::Process.clock_gettime(::Process::CLOCK_MONOTONIC, :second)
|
|
25
23
|
end
|
|
26
24
|
end
|
|
27
25
|
end
|
data/lib/bluepill/daemonize.rb
CHANGED
|
@@ -52,11 +52,9 @@ module Bluepill
|
|
|
52
52
|
# @api private
|
|
53
53
|
def self.safefork
|
|
54
54
|
loop do
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
sleep 5
|
|
59
|
-
end
|
|
55
|
+
return fork
|
|
56
|
+
rescue Errno::EWOULDBLOCK
|
|
57
|
+
sleep 5
|
|
60
58
|
end
|
|
61
59
|
end
|
|
62
60
|
|
|
@@ -201,11 +199,9 @@ module Bluepill
|
|
|
201
199
|
# @api private
|
|
202
200
|
def self.close_fds
|
|
203
201
|
(3..MAX_FD).each do |fd|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
nil
|
|
208
|
-
end
|
|
202
|
+
IO.for_fd(fd).close
|
|
203
|
+
rescue
|
|
204
|
+
nil
|
|
209
205
|
end
|
|
210
206
|
end
|
|
211
207
|
|
|
@@ -190,7 +190,7 @@ module Bluepill
|
|
|
190
190
|
# @api private
|
|
191
191
|
def validate_stop_grace_time!(stop_signals, stop_grace_time)
|
|
192
192
|
delays = stop_signals.select.with_index { |_, i| i.odd? }
|
|
193
|
-
return unless stop_grace_time.nil? || stop_grace_time <= delays.
|
|
193
|
+
return unless stop_grace_time.nil? || stop_grace_time <= delays.sum
|
|
194
194
|
|
|
195
195
|
config_error!("Config Error: Stop_grace_time should be greater than the sum of stop_signals delays!")
|
|
196
196
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "
|
|
3
|
+
require "did_you_mean"
|
|
4
4
|
|
|
5
5
|
module Bluepill
|
|
6
6
|
# The self of a process block in a config file
|
|
@@ -230,10 +230,8 @@ module Bluepill
|
|
|
230
230
|
|
|
231
231
|
# Return the attribute a process has that's closest to a misspelled one
|
|
232
232
|
#
|
|
233
|
-
#
|
|
234
|
-
#
|
|
235
|
-
# but Bundler leaves it out on Rubies before 2.7, so bluepill compares
|
|
236
|
-
# the names itself and suggests the same attribute on every Ruby.
|
|
233
|
+
# Ruby's did_you_mean picks it, as it picks a method for a misspelled
|
|
234
|
+
# one.
|
|
237
235
|
#
|
|
238
236
|
# @param [Symbol] key the misspelled attribute
|
|
239
237
|
#
|
|
@@ -241,11 +239,8 @@ module Bluepill
|
|
|
241
239
|
#
|
|
242
240
|
# @api private
|
|
243
241
|
def suggest(key)
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
closest = distances.min #: [Integer, String]
|
|
247
|
-
distance, name = closest
|
|
248
|
-
name if distance <= word.length / 3
|
|
242
|
+
names = self.class.attribute_names.collect(&:to_s)
|
|
243
|
+
DidYouMean::SpellChecker.new(dictionary: names).correct(key).first
|
|
249
244
|
end
|
|
250
245
|
end
|
|
251
246
|
end
|
|
@@ -41,7 +41,7 @@ module Bluepill
|
|
|
41
41
|
|
|
42
42
|
# The transition from each state to itself, made once, so a tick that
|
|
43
43
|
# leaves the state alone makes no new object
|
|
44
|
-
LOOPBACKS = STATES.
|
|
44
|
+
LOOPBACKS = STATES.to_h { |state| [state, Transition.new(state, state).freeze] }.freeze
|
|
45
45
|
|
|
46
46
|
# Return the process's state, such as :up
|
|
47
47
|
#
|
|
@@ -64,12 +64,10 @@ module Bluepill
|
|
|
64
64
|
# @api private
|
|
65
65
|
def notify_triggers(transition)
|
|
66
66
|
triggers.each do |trigger|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
raise
|
|
72
|
-
end
|
|
67
|
+
trigger.notify(transition)
|
|
68
|
+
rescue => e
|
|
69
|
+
logger.err e.backtrace
|
|
70
|
+
raise
|
|
73
71
|
end
|
|
74
72
|
end
|
|
75
73
|
|
|
@@ -71,10 +71,12 @@ module Bluepill
|
|
|
71
71
|
# @api private
|
|
72
72
|
def check?(value)
|
|
73
73
|
return false unless value.is_a?(@kind)
|
|
74
|
-
|
|
74
|
+
|
|
75
|
+
pattern = @pattern
|
|
76
|
+
return true unless pattern
|
|
75
77
|
|
|
76
78
|
response = value #: Net::HTTPResponse
|
|
77
|
-
|
|
79
|
+
pattern.match?(response.body)
|
|
78
80
|
end
|
|
79
81
|
|
|
80
82
|
private
|
|
@@ -189,12 +189,10 @@ module Bluepill
|
|
|
189
189
|
def signal_journaled(signal, ids, kind)
|
|
190
190
|
past, verb = signal.eql?("TERM") ? %w[Termed term] : %w[Killed kill]
|
|
191
191
|
ids.each do |id|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
logger.debug("Unable to #{verb} missing #{kind.label} #{id}")
|
|
197
|
-
end
|
|
192
|
+
::Process.kill(signal, kind.sign * id)
|
|
193
|
+
logger.info("#{past} old #{kind.label} #{id}")
|
|
194
|
+
rescue Errno::ESRCH
|
|
195
|
+
logger.debug("Unable to #{verb} missing #{kind.label} #{id}")
|
|
198
196
|
end
|
|
199
197
|
end
|
|
200
198
|
end
|
data/lib/bluepill/socket.rb
CHANGED
|
@@ -46,12 +46,10 @@ module Bluepill
|
|
|
46
46
|
def self.client_command(base_dir, name, command)
|
|
47
47
|
res = nil
|
|
48
48
|
MAX_ATTEMPTS.times do |current_attempt|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
retry_or_abort(current_attempt)
|
|
54
|
-
end
|
|
49
|
+
res = send_command(base_dir, name, command)
|
|
50
|
+
break
|
|
51
|
+
rescue EOFError, Timeout::Error
|
|
52
|
+
retry_or_abort(current_attempt)
|
|
55
53
|
end
|
|
56
54
|
res
|
|
57
55
|
end
|
data/lib/bluepill/version.rb
CHANGED
|
@@ -4,7 +4,7 @@ module Bluepill
|
|
|
4
4
|
# The version of bluepill
|
|
5
5
|
#
|
|
6
6
|
# @example
|
|
7
|
-
# Bluepill::Version.to_s # => "0.2.
|
|
7
|
+
# Bluepill::Version.to_s # => "0.2.7"
|
|
8
8
|
#
|
|
9
9
|
# @api public
|
|
10
10
|
module Version
|
|
@@ -35,13 +35,13 @@ module Bluepill
|
|
|
35
35
|
# Return the patch version
|
|
36
36
|
#
|
|
37
37
|
# @example
|
|
38
|
-
# Bluepill::Version.patch # =>
|
|
38
|
+
# Bluepill::Version.patch # => 7
|
|
39
39
|
#
|
|
40
40
|
# @return [Integer] the patch version
|
|
41
41
|
#
|
|
42
42
|
# @api public
|
|
43
43
|
def self.patch
|
|
44
|
-
|
|
44
|
+
7
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
# Return the pre-release version
|
|
@@ -58,7 +58,7 @@ module Bluepill
|
|
|
58
58
|
# Return the version's parts by name
|
|
59
59
|
#
|
|
60
60
|
# @example
|
|
61
|
-
# Bluepill::Version.to_h # => {major: 0, minor: 2, patch:
|
|
61
|
+
# Bluepill::Version.to_h # => {major: 0, minor: 2, patch: 7, pre: nil}
|
|
62
62
|
#
|
|
63
63
|
# @return [Hash{Symbol => Integer, nil}] the major, minor, patch and
|
|
64
64
|
# pre-release versions
|
|
@@ -76,7 +76,7 @@ module Bluepill
|
|
|
76
76
|
# Return the version's parts, without a missing pre-release version
|
|
77
77
|
#
|
|
78
78
|
# @example
|
|
79
|
-
# Bluepill::Version.to_a # => [0, 2,
|
|
79
|
+
# Bluepill::Version.to_a # => [0, 2, 7]
|
|
80
80
|
#
|
|
81
81
|
# @return [Array<Integer>] the parts of the version
|
|
82
82
|
#
|
|
@@ -88,9 +88,9 @@ module Bluepill
|
|
|
88
88
|
# Return the version as a string
|
|
89
89
|
#
|
|
90
90
|
# @example
|
|
91
|
-
# Bluepill::Version.to_s # => "0.2.
|
|
91
|
+
# Bluepill::Version.to_s # => "0.2.7"
|
|
92
92
|
#
|
|
93
|
-
# @return [String] the version, such as "0.2.
|
|
93
|
+
# @return [String] the version, such as "0.2.7"
|
|
94
94
|
#
|
|
95
95
|
# @api public
|
|
96
96
|
def self.to_s
|
data/sig/bluepill.rbs
CHANGED
|
@@ -93,13 +93,6 @@ module Bluepill
|
|
|
93
93
|
# does
|
|
94
94
|
def self.underscore: (String name) -> String
|
|
95
95
|
|
|
96
|
-
# The Levenshtein distance between two strings
|
|
97
|
-
def self.levenshtein_distance: (String from, String to) -> Integer
|
|
98
|
-
|
|
99
|
-
private
|
|
100
|
-
|
|
101
|
-
def self.next_levenshtein_row!: (Array[Integer] row, Integer from_length, String from_char, String to) -> void
|
|
102
|
-
|
|
103
96
|
# An array that drops its oldest element when it grows past its capacity
|
|
104
97
|
class RotationalArray[Elem] < Array[Elem]
|
|
105
98
|
@capacity: Integer
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bluepill
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Arya Asemanfar
|
|
@@ -90,7 +90,6 @@ files:
|
|
|
90
90
|
- lib/bluepill/triggers/flapping.rb
|
|
91
91
|
- lib/bluepill/units.rb
|
|
92
92
|
- lib/bluepill/util/inflections.rb
|
|
93
|
-
- lib/bluepill/util/levenshtein.rb
|
|
94
93
|
- lib/bluepill/util/rotational_array.rb
|
|
95
94
|
- lib/bluepill/version.rb
|
|
96
95
|
- sig/bluepill.rbs
|
|
@@ -116,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
116
115
|
requirements:
|
|
117
116
|
- - ">="
|
|
118
117
|
- !ruby/object:Gem::Version
|
|
119
|
-
version: '2.
|
|
118
|
+
version: '2.7'
|
|
120
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
120
|
requirements:
|
|
122
121
|
- - ">="
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Bluepill
|
|
4
|
-
module Util
|
|
5
|
-
# Return how many edits turn one string into another
|
|
6
|
-
#
|
|
7
|
-
# Counts the characters to insert, delete or replace (the Levenshtein
|
|
8
|
-
# distance), a row of the table at a time. ProcessProxy uses it to
|
|
9
|
-
# suggest the attribute closest to a misspelled one.
|
|
10
|
-
#
|
|
11
|
-
# @example
|
|
12
|
-
# Bluepill::Util.levenshtein_distance("start_comand", "start_command") # => 1
|
|
13
|
-
#
|
|
14
|
-
# @param [String] from the string to start from
|
|
15
|
-
# @param [String] to the string to end at
|
|
16
|
-
#
|
|
17
|
-
# @return [Integer] the number of edits
|
|
18
|
-
#
|
|
19
|
-
# @api private
|
|
20
|
-
def self.levenshtein_distance(from, to)
|
|
21
|
-
row = (0..to.length).to_a
|
|
22
|
-
from.each_char.with_index(1) do |from_char, i|
|
|
23
|
-
next_levenshtein_row!(row, i, from_char, to)
|
|
24
|
-
end
|
|
25
|
-
row.fetch(-1)
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
# Turn a row of the distance table into the next one, in place
|
|
29
|
-
#
|
|
30
|
-
# Cell j becomes the fewest edits that turn the first from_length
|
|
31
|
-
# characters of the from string into the first j characters of the to
|
|
32
|
-
# string.
|
|
33
|
-
#
|
|
34
|
-
# @param [Array<Integer>] row the row for the characters before from_char
|
|
35
|
-
# @param [Integer] from_length the number of from's characters, through
|
|
36
|
-
# from_char
|
|
37
|
-
# @param [String] from_char the from string's next character
|
|
38
|
-
# @param [String] to the string to end at
|
|
39
|
-
#
|
|
40
|
-
# @return [void]
|
|
41
|
-
#
|
|
42
|
-
# @api private
|
|
43
|
-
def self.next_levenshtein_row!(row, from_length, from_char, to)
|
|
44
|
-
diagonal = row.fetch(0)
|
|
45
|
-
row[0] = from_length
|
|
46
|
-
to.each_char.with_index(1) do |to_char, j|
|
|
47
|
-
above = row.fetch(j)
|
|
48
|
-
substitution = diagonal + (from_char.eql?(to_char) ? 0 : 1)
|
|
49
|
-
row[j] = [above + 1, row.fetch(j - 1) + 1, substitution].min
|
|
50
|
-
diagonal = above
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
private_class_method :next_levenshtein_row!
|
|
54
|
-
end
|
|
55
|
-
end
|