bluepill 0.2.9 → 0.3.2
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 +111 -2
- data/README.md +16 -13
- data/bin/bluepill +21 -8
- data/bluepill.gemspec +7 -2
- data/lib/bluepill/application/lifecycle.rb +48 -35
- data/lib/bluepill/application/listener.rb +2 -4
- data/lib/bluepill/application/previous_daemon.rb +12 -14
- data/lib/bluepill/application.rb +36 -30
- data/lib/bluepill/base_directory.rb +18 -20
- data/lib/bluepill/check_registry.rb +104 -0
- data/lib/bluepill/clock.rb +1 -3
- data/lib/bluepill/condition_watch.rb +46 -54
- data/lib/bluepill/controller/directory.rb +1 -3
- data/lib/bluepill/controller.rb +35 -37
- data/lib/bluepill/daemonize.rb +52 -0
- data/lib/bluepill/dsl/app_proxy.rb +68 -64
- data/lib/bluepill/dsl/attributes.rb +135 -0
- data/lib/bluepill/dsl/process_factory/child_factory.rb +83 -0
- data/lib/bluepill/dsl/process_factory/registry.rb +4 -26
- data/lib/bluepill/dsl/process_factory.rb +85 -84
- data/lib/bluepill/dsl/process_proxy.rb +80 -160
- data/lib/bluepill/dsl.rb +16 -15
- data/lib/bluepill/errors.rb +190 -0
- data/lib/bluepill/group.rb +14 -37
- data/lib/bluepill/logger.rb +65 -99
- data/lib/bluepill/process/attributes.rb +66 -32
- data/lib/bluepill/process/children.rb +6 -7
- data/lib/bluepill/process/pid.rb +43 -35
- data/lib/bluepill/process/state_machine.rb +15 -59
- data/lib/bluepill/process/stop_signals.rb +123 -0
- data/lib/bluepill/process/transition.rb +1 -3
- data/lib/bluepill/process/transition_callbacks.rb +2 -16
- data/lib/bluepill/process/triggers.rb +90 -0
- data/lib/bluepill/process/user_commands.rb +1 -1
- data/lib/bluepill/process/watches.rb +9 -23
- data/lib/bluepill/process.rb +55 -52
- data/lib/bluepill/process_commands/execution.rb +16 -24
- data/lib/bluepill/process_commands/hooks.rb +1 -31
- data/lib/bluepill/process_commands/stop_signals.rb +12 -17
- data/lib/bluepill/process_commands.rb +10 -8
- data/lib/bluepill/process_conditions/always_true.rb +2 -6
- data/lib/bluepill/process_conditions/below_threshold.rb +6 -8
- data/lib/bluepill/process_conditions/cpu_usage.rb +1 -4
- data/lib/bluepill/process_conditions/file_time.rb +8 -9
- data/lib/bluepill/process_conditions/http.rb +29 -67
- data/lib/bluepill/process_conditions/mem_usage.rb +7 -45
- data/lib/bluepill/process_conditions/process_condition.rb +29 -47
- data/lib/bluepill/process_conditions/zombie_process.rb +2 -6
- data/lib/bluepill/process_conditions.rb +5 -14
- data/lib/bluepill/process_journal/cleanup.rb +5 -53
- data/lib/bluepill/process_journal/config.rb +73 -0
- data/lib/bluepill/process_journal/entries.rb +128 -0
- data/lib/bluepill/process_journal/journal.rb +69 -0
- data/lib/bluepill/process_journal/kind.rb +60 -0
- data/lib/bluepill/process_journal/lock.rb +9 -4
- data/lib/bluepill/process_journal.rb +13 -324
- data/lib/bluepill/process_statistics.rb +3 -7
- data/lib/bluepill/socket.rb +19 -17
- data/lib/bluepill/system/command_options.rb +136 -0
- data/lib/bluepill/system/command_result.rb +73 -0
- data/lib/bluepill/system/command_setup.rb +3 -4
- data/lib/bluepill/system/command_spawn.rb +244 -0
- data/lib/bluepill/system/commands.rb +27 -40
- data/lib/bluepill/system/daemon.rb +97 -15
- data/lib/bluepill/system/files.rb +35 -0
- data/lib/bluepill/system/ps.rb +20 -17
- data/lib/bluepill/system/ps_table.rb +7 -9
- data/lib/bluepill/system/usage.rb +175 -0
- data/lib/bluepill/system.rb +7 -192
- data/lib/bluepill/trigger.rb +18 -69
- data/lib/bluepill/triggers/flapping.rb +12 -8
- data/lib/bluepill/units.rb +7 -21
- data/lib/bluepill/version.rb +16 -26
- data/lib/bluepill.rb +1 -1
- data/sig/bluepill/application.rbs +11 -12
- data/sig/bluepill/attributes.rbs +48 -0
- data/sig/bluepill/checks.rbs +40 -40
- data/sig/bluepill/dsl.rbs +100 -59
- data/sig/bluepill/errors.rbs +48 -0
- data/sig/bluepill/logger.rbs +15 -31
- data/sig/bluepill/process.rbs +39 -305
- data/sig/bluepill/process_commands.rbs +235 -0
- data/sig/bluepill/stop_signals.rbs +21 -0
- data/sig/bluepill/system.rbs +191 -101
- data/sig/bluepill/version.rbs +17 -0
- data/sig/bluepill.rbs +2 -17
- data/sig/manifest.yaml +1 -0
- metadata +22 -8
- data/lib/bluepill/deprecation/custom_checks.rb +0 -193
- data/lib/bluepill/deprecation/dsl.rb +0 -141
- data/lib/bluepill/deprecation/options.rb +0 -140
- data/lib/bluepill/deprecation.rb +0 -92
- data/lib/bluepill/dsl/process_factory/children.rb +0 -99
- data/sig/bluepill/deprecation.rbs +0 -87
data/sig/bluepill/system.rbs
CHANGED
|
@@ -6,6 +6,10 @@ module Bluepill
|
|
|
6
6
|
|
|
7
7
|
MAX_FD: Integer
|
|
8
8
|
|
|
9
|
+
DAEMON_ENV: String
|
|
10
|
+
|
|
11
|
+
def self.can_fork?: () -> bool
|
|
12
|
+
|
|
9
13
|
def self.safefork: () -> Integer?
|
|
10
14
|
|
|
11
15
|
def self.call_as_daemon: (^() -> void block, ?String? name) -> Integer
|
|
@@ -16,6 +20,10 @@ module Bluepill
|
|
|
16
20
|
|
|
17
21
|
def self.daemonize: () -> Integer
|
|
18
22
|
|
|
23
|
+
def self.daemonize_without_fork: () -> Integer
|
|
24
|
+
|
|
25
|
+
def self.start_daemon_bluepill: () -> bot
|
|
26
|
+
|
|
19
27
|
def self.detach: () -> Integer
|
|
20
28
|
|
|
21
29
|
def self.become_daemon: (?String? name) -> void
|
|
@@ -33,26 +41,58 @@ module Bluepill
|
|
|
33
41
|
# they finish
|
|
34
42
|
module System
|
|
35
43
|
extend Ps
|
|
44
|
+
extend Usage
|
|
45
|
+
extend Files
|
|
36
46
|
extend Commands
|
|
37
47
|
extend Daemon
|
|
38
48
|
|
|
39
|
-
#
|
|
40
|
-
type
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
# What the child that runs a command sends its parent
|
|
50
|
+
type blocking_result = { exit_code: Integer?, stdout: String, stderr: String }
|
|
51
|
+
|
|
52
|
+
# How a command runs, for daemonize and execute_blocking
|
|
53
|
+
class CommandOptions
|
|
54
|
+
attr_reader uid: String?
|
|
55
|
+
attr_reader gid: String?
|
|
56
|
+
attr_reader supplementary_groups: Array[String]?
|
|
57
|
+
attr_reader working_dir: String?
|
|
58
|
+
attr_reader environment: Hash[_ToS, _ToS]
|
|
59
|
+
attr_reader stdin: String?
|
|
60
|
+
attr_reader stdout: String?
|
|
61
|
+
attr_reader stderr: String?
|
|
48
62
|
# Hooks are killed after this many seconds
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
?stderr: String?,
|
|
52
|
-
|
|
53
|
-
|
|
63
|
+
attr_reader timeout: seconds?
|
|
64
|
+
|
|
65
|
+
def initialize: (?uid: String?, ?gid: String?, ?supplementary_groups: Array[String]?, ?working_dir: String?, ?environment: Hash[_ToS, _ToS]?, ?stdin: String?, ?stdout: String?, ?stderr: String?, ?timeout: seconds?) -> void
|
|
66
|
+
|
|
67
|
+
def for_hook: (Hash[String, String] env, seconds timeout) -> CommandOptions
|
|
68
|
+
|
|
69
|
+
def to_h: () -> {
|
|
70
|
+
uid: String?,
|
|
71
|
+
gid: String?,
|
|
72
|
+
supplementary_groups: Array[String]?,
|
|
73
|
+
working_dir: String?,
|
|
74
|
+
environment: Hash[_ToS, _ToS]?,
|
|
75
|
+
stdin: String?,
|
|
76
|
+
stdout: String?,
|
|
77
|
+
stderr: String?,
|
|
78
|
+
timeout: seconds?
|
|
79
|
+
}
|
|
80
|
+
end
|
|
54
81
|
|
|
55
|
-
|
|
82
|
+
# What a command that ran until it finished printed, and how it exited
|
|
83
|
+
class CommandResult
|
|
84
|
+
def self.from_h: (blocking_result result) -> CommandResult
|
|
85
|
+
|
|
86
|
+
attr_reader exit_code: Integer?
|
|
87
|
+
attr_reader stdout: String
|
|
88
|
+
attr_reader stderr: String
|
|
89
|
+
|
|
90
|
+
def initialize: (exit_code: Integer?, ?stdout: String, ?stderr: String) -> void
|
|
91
|
+
|
|
92
|
+
def success?: () -> bool
|
|
93
|
+
|
|
94
|
+
def to_h: () -> blocking_result
|
|
95
|
+
end
|
|
56
96
|
|
|
57
97
|
type grandchild_pipes = { out: [IO, IO], err: [IO, IO], result: IO }
|
|
58
98
|
|
|
@@ -101,45 +141,52 @@ module Bluepill
|
|
|
101
141
|
|
|
102
142
|
# Runs ps once a tick, and reads its table of processes
|
|
103
143
|
module Ps
|
|
104
|
-
# The
|
|
105
|
-
|
|
144
|
+
# The table lives on System, which extends this module, or why ps
|
|
145
|
+
# could not be run this tick
|
|
146
|
+
@ps_table: PsTable | PsError | nil
|
|
106
147
|
# The table get_children read this tick
|
|
107
148
|
@children_table: PsTable?
|
|
108
149
|
|
|
109
|
-
def store: () -> Hash[Symbol, PsTable | String]
|
|
110
|
-
|
|
111
150
|
def reset_data: () -> void
|
|
112
151
|
|
|
113
152
|
def ps_axu: () -> PsTable
|
|
114
153
|
|
|
115
|
-
def read_ps_table: () -> (PsTable |
|
|
154
|
+
def read_ps_table: () -> (PsTable | PsError)
|
|
116
155
|
|
|
117
156
|
def get_children: (Integer? parent_pid) -> Array[Integer]
|
|
118
157
|
end
|
|
119
158
|
|
|
120
|
-
|
|
159
|
+
# Asks the system about a process
|
|
160
|
+
module Usage : Ps
|
|
161
|
+
def pid_alive?: (Integer pid) -> bool
|
|
162
|
+
|
|
163
|
+
def reap: (Integer? pid) -> void
|
|
121
164
|
|
|
122
|
-
|
|
165
|
+
def started_at: (Integer pid) -> Integer?
|
|
123
166
|
|
|
124
|
-
|
|
167
|
+
def boot_time: () -> Integer?
|
|
125
168
|
|
|
126
|
-
|
|
169
|
+
def cpu_usage: (Integer? pid, boolish include_children) -> Float?
|
|
127
170
|
|
|
128
|
-
|
|
171
|
+
def memory_usage: (Integer? pid, boolish include_children) -> Float?
|
|
129
172
|
|
|
130
|
-
|
|
173
|
+
def usage: (Integer? pid, boolish include_children, Integer column) -> Float?
|
|
131
174
|
|
|
132
|
-
|
|
175
|
+
def running_time: (Integer? pid) -> Integer?
|
|
133
176
|
|
|
134
|
-
|
|
177
|
+
def command: (Integer? pid) -> String?
|
|
135
178
|
|
|
136
|
-
|
|
179
|
+
def parse_elapsed_time: (String? str) -> Integer
|
|
180
|
+
end
|
|
137
181
|
|
|
138
|
-
|
|
182
|
+
# Deletes the files that bluepill leaves behind
|
|
183
|
+
module Files
|
|
184
|
+
def delete_if_exists: (String? filename) -> void
|
|
185
|
+
end
|
|
139
186
|
|
|
140
187
|
# Sets up the process that a command runs in
|
|
141
188
|
module CommandSetup
|
|
142
|
-
def setup_command_environment: (
|
|
189
|
+
def setup_command_environment: (CommandOptions options) -> void
|
|
143
190
|
|
|
144
191
|
def drop_privileges: (String? uid, String? gid, Array[String]? supplementary_groups) -> void
|
|
145
192
|
|
|
@@ -150,18 +197,54 @@ module Bluepill
|
|
|
150
197
|
def switch_to_user: (Etc::Passwd user) -> void
|
|
151
198
|
end
|
|
152
199
|
|
|
200
|
+
# Starts commands without forking, in a Ruby that can't fork
|
|
201
|
+
module CommandSpawn
|
|
202
|
+
EXIT_POLL_INTERVAL: Float
|
|
203
|
+
|
|
204
|
+
def spawn_command: (String cmd, CommandOptions options, ?chdir: String?, **untyped redirects) -> Integer
|
|
205
|
+
|
|
206
|
+
def spawn_blocking: (String cmd, CommandOptions options) -> CommandResult
|
|
207
|
+
|
|
208
|
+
def run_spawned: (String cmd, CommandOptions options, Array[IO] readers, [IO, IO] writers) -> CommandResult
|
|
209
|
+
|
|
210
|
+
def spawn_blocking_command: (String cmd, CommandOptions options, IO out, IO err) -> Integer
|
|
211
|
+
|
|
212
|
+
def wait_for_spawned: (String cmd, seconds? timeout, Integer pid, Array[IO] pipes) -> CommandResult
|
|
213
|
+
|
|
214
|
+
def wait_for_exit: (Integer pid, seconds? timeout) -> Process::Status?
|
|
215
|
+
|
|
216
|
+
def kill_spawned_after: (Integer pid, seconds? timeout, String cmd) -> bot
|
|
217
|
+
|
|
218
|
+
def kill_group_after: (Integer child, seconds? timeout, String cmd) -> bot
|
|
219
|
+
|
|
220
|
+
def monotonic_now: () -> Float
|
|
221
|
+
|
|
222
|
+
def read_in_background: (IO reader) -> Thread
|
|
223
|
+
|
|
224
|
+
def spawn_environment: (CommandOptions options) -> Hash[String, String]
|
|
225
|
+
end
|
|
226
|
+
|
|
153
227
|
# Runs commands in the background, as daemons
|
|
154
228
|
module Daemon
|
|
155
229
|
include CommandSetup
|
|
230
|
+
include CommandSpawn
|
|
156
231
|
|
|
157
232
|
# Returns the daemon's pid
|
|
158
|
-
def daemonize: (String cmd, ?
|
|
233
|
+
def daemonize: (String cmd, ?CommandOptions options, pid_file: String, logger: Logger) -> Integer?
|
|
234
|
+
|
|
235
|
+
def fork_daemon: (String cmd, CommandOptions options, pid_file: String, logger: Logger) -> Integer?
|
|
236
|
+
|
|
237
|
+
def spawn_daemon: (String cmd, CommandOptions options, pid_file: String, logger: Logger) -> Integer?
|
|
238
|
+
|
|
239
|
+
def daemon_streams: (CommandOptions options) -> Hash[Symbol, untyped]
|
|
240
|
+
|
|
241
|
+
def daemon_stderr: (String? out, String? err) -> untyped
|
|
159
242
|
|
|
160
243
|
def read_daemon_pid: (IO reader, IO writer) -> Integer?
|
|
161
244
|
|
|
162
|
-
def start_daemon: (String cmd,
|
|
245
|
+
def start_daemon: (String cmd, CommandOptions options, IO pid_pipe, pid_file: String, logger: Logger) -> bot
|
|
163
246
|
|
|
164
|
-
def daemon_command: (String cmd,
|
|
247
|
+
def daemon_command: (String cmd, CommandOptions options) -> ^() -> void
|
|
165
248
|
|
|
166
249
|
def can_write_pid_file: (String pid_file, Logger logger) -> bool
|
|
167
250
|
|
|
@@ -171,22 +254,21 @@ module Bluepill
|
|
|
171
254
|
# Runs commands until they finish
|
|
172
255
|
module Commands
|
|
173
256
|
include CommandSetup
|
|
257
|
+
include CommandSpawn
|
|
174
258
|
|
|
175
|
-
def execute_blocking: (String cmd, ?
|
|
259
|
+
def execute_blocking: (String cmd, ?CommandOptions options) -> CommandResult
|
|
176
260
|
|
|
177
|
-
def start_blocking_child: (String cmd,
|
|
261
|
+
def start_blocking_child: (String cmd, CommandOptions options, IO reader, IO result_pipe) -> bot
|
|
178
262
|
|
|
179
263
|
def read_blocking_status: (String cmd, seconds? timeout, Integer child, IO reader) -> String
|
|
180
264
|
|
|
181
|
-
def
|
|
182
|
-
|
|
183
|
-
def run_blocking_child: (String cmd, command_options options, IO result_pipe) -> bot
|
|
265
|
+
def run_blocking_child: (String cmd, CommandOptions options, IO result_pipe) -> bot
|
|
184
266
|
|
|
185
267
|
def collect_blocking_result: (Integer pid, IO cmd_out_read, IO cmd_err_read) -> blocking_result
|
|
186
268
|
|
|
187
269
|
def report_blocking_result: (IO result_pipe, blocking_result result) -> bot
|
|
188
270
|
|
|
189
|
-
def exec_blocking_grandchild: (String cmd,
|
|
271
|
+
def exec_blocking_grandchild: (String cmd, CommandOptions options, grandchild_pipes pipes) -> bot
|
|
190
272
|
|
|
191
273
|
def reopen_on_pipe: (IO stream, [IO, IO] pipe) -> void
|
|
192
274
|
|
|
@@ -197,23 +279,49 @@ module Bluepill
|
|
|
197
279
|
# Remembers the pids and process groups of the processes bluepill starts,
|
|
198
280
|
# so it can kill any left over from an earlier run
|
|
199
281
|
module ProcessJournal
|
|
282
|
+
extend Config
|
|
283
|
+
extend Entries
|
|
200
284
|
extend Cleanup
|
|
201
285
|
extend Lock
|
|
202
286
|
|
|
203
287
|
# What a journal holds: pids, or process group ids
|
|
204
|
-
class Kind
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
288
|
+
class Kind
|
|
289
|
+
@file_tag: String
|
|
290
|
+
|
|
291
|
+
attr_reader name: String
|
|
292
|
+
attr_reader label: String
|
|
293
|
+
attr_reader sign: Integer
|
|
209
294
|
|
|
210
|
-
def
|
|
295
|
+
def initialize: (String name, String label, String file_tag, Integer sign) -> void
|
|
296
|
+
|
|
297
|
+
def filename: (String dir, _ToS journal_name) -> String
|
|
211
298
|
end
|
|
212
299
|
|
|
213
300
|
PID: Kind
|
|
214
301
|
|
|
215
302
|
PGID: Kind
|
|
216
303
|
|
|
304
|
+
# Raised when another process holds a journal's lock for too long
|
|
305
|
+
class LockTimeoutError < StandardError
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
# A process's pid journal and process group journal
|
|
309
|
+
class Journal
|
|
310
|
+
@name: _ToS
|
|
311
|
+
|
|
312
|
+
attr_reader name: _ToS
|
|
313
|
+
|
|
314
|
+
def initialize: (_ToS name) -> void
|
|
315
|
+
|
|
316
|
+
def append: (Integer? pid) -> void
|
|
317
|
+
|
|
318
|
+
def kill_all: () -> void
|
|
319
|
+
|
|
320
|
+
private
|
|
321
|
+
|
|
322
|
+
def append_process_group: (Integer pid) -> void
|
|
323
|
+
end
|
|
324
|
+
|
|
217
325
|
# What the modules that ProcessJournal extends use from it
|
|
218
326
|
interface _Journal
|
|
219
327
|
def logger: () -> Logger
|
|
@@ -222,24 +330,54 @@ module Bluepill
|
|
|
222
330
|
|
|
223
331
|
def legacy_journal_dir: () -> String
|
|
224
332
|
|
|
225
|
-
def
|
|
333
|
+
def journal_dirs: () -> Array[String]
|
|
226
334
|
|
|
227
335
|
def journal_entries: (String filename) -> Array[[Integer, Integer?]]
|
|
228
336
|
|
|
229
337
|
def journal_ids: (Kind kind, String filename) -> Array[Integer]
|
|
230
338
|
end
|
|
231
339
|
|
|
232
|
-
#
|
|
233
|
-
module
|
|
234
|
-
|
|
340
|
+
# Where the journals are, and the logger they write to
|
|
341
|
+
module Config
|
|
342
|
+
@logger: Logger
|
|
343
|
+
@journal_base_dir: String
|
|
344
|
+
@legacy_journal_dir: String
|
|
345
|
+
|
|
346
|
+
attr_reader logger: Logger
|
|
347
|
+
|
|
348
|
+
attr_reader journal_base_dir: String
|
|
235
349
|
|
|
236
|
-
|
|
350
|
+
attr_reader legacy_journal_dir: String
|
|
237
351
|
|
|
238
|
-
|
|
352
|
+
# Only the first logger is kept
|
|
353
|
+
def logger=: (Logger new_logger) -> Logger
|
|
239
354
|
|
|
240
|
-
def
|
|
355
|
+
def setup: (String base_dir, _ToS app_name) -> void
|
|
241
356
|
|
|
242
357
|
def journal_dirs: () -> Array[String]
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
# Reads and writes the ids in a process's journals
|
|
361
|
+
module Entries : _Journal, Lock
|
|
362
|
+
def for: (_ToS name) -> Journal
|
|
363
|
+
|
|
364
|
+
def skip_id?: (Integer? id) -> bool
|
|
365
|
+
|
|
366
|
+
# Each id, with when its process started (nil before 0.2)
|
|
367
|
+
def journal_entries: (String filename) -> Array[[Integer, Integer?]]
|
|
368
|
+
|
|
369
|
+
def journal_line: (Integer id) -> String
|
|
370
|
+
|
|
371
|
+
def journal_ids: (Kind kind, String filename) -> Array[Integer]
|
|
372
|
+
|
|
373
|
+
def append: (Kind kind, _ToS journal_name, Integer? id) ?{ (Integer id) -> void } -> void
|
|
374
|
+
|
|
375
|
+
def write_to_journal: (String filename, _ToS journal_name, String name, Integer id) { () -> Array[Integer] } -> void
|
|
376
|
+
end
|
|
377
|
+
|
|
378
|
+
# Kills what an earlier run left in a process's journals
|
|
379
|
+
module Cleanup : _Journal, Lock
|
|
380
|
+
def kill_all: (Kind kind, _ToS journal_name) -> void
|
|
243
381
|
|
|
244
382
|
def kill_all_from_journal_file: (String filename, Array[Integer] ids, Kind kind) -> void
|
|
245
383
|
|
|
@@ -264,53 +402,5 @@ module Bluepill
|
|
|
264
402
|
|
|
265
403
|
def wait_for_atomic_fs_lock: (String lock, Integer attempts) -> void
|
|
266
404
|
end
|
|
267
|
-
|
|
268
|
-
self.@logger: Logger
|
|
269
|
-
self.@journal_base_dir: String
|
|
270
|
-
self.@legacy_journal_dir: String
|
|
271
|
-
|
|
272
|
-
def self.logger: () -> Logger
|
|
273
|
-
|
|
274
|
-
def self.journal_base_dir: () -> String
|
|
275
|
-
|
|
276
|
-
def self.legacy_journal_dir: () -> String
|
|
277
|
-
|
|
278
|
-
# Only the first logger is kept
|
|
279
|
-
def self.logger=: (Logger new_logger) -> Logger
|
|
280
|
-
|
|
281
|
-
def self.setup: (String base_dir, _ToS app_name) -> void
|
|
282
|
-
|
|
283
|
-
def self.skip_pid?: (Integer? pid) -> bool
|
|
284
|
-
|
|
285
|
-
def self.skip_pgid?: (Integer? pgid) -> bool
|
|
286
|
-
|
|
287
|
-
def self.skip_id?: (Integer? id) -> bool
|
|
288
|
-
|
|
289
|
-
def self.pid_journal_filename: (String journal_name, ?String dir) -> String
|
|
290
|
-
|
|
291
|
-
def self.pgid_journal_filename: (String journal_name, ?String dir) -> String
|
|
292
|
-
|
|
293
|
-
def self.journal_filename: (Kind kind, String journal_name, ?String dir) -> String
|
|
294
|
-
|
|
295
|
-
# Each id, with when its process started (nil before 0.2)
|
|
296
|
-
def self.journal_entries: (String filename) -> Array[[Integer, Integer?]]
|
|
297
|
-
|
|
298
|
-
def self.journal_line: (Integer id) -> String
|
|
299
|
-
|
|
300
|
-
def self.pid_journal: (String filename) -> Array[Integer]
|
|
301
|
-
|
|
302
|
-
def self.pgid_journal: (String filename) -> Array[Integer]
|
|
303
|
-
|
|
304
|
-
def self.journal_ids: (Kind kind, String filename) -> Array[Integer]
|
|
305
|
-
|
|
306
|
-
def self.append_pgid_to_journal: (String journal_name, Integer? pgid) -> void
|
|
307
|
-
|
|
308
|
-
def self.append_pid_to_journal: (String journal_name, Integer? pid) -> void
|
|
309
|
-
|
|
310
|
-
def self.append_process_group_to_journal: (String journal_name, Integer pid) -> void
|
|
311
|
-
|
|
312
|
-
def self.append_to_journal: (Kind kind, String journal_name, Integer? id) ?{ (Integer id) -> void } -> void
|
|
313
|
-
|
|
314
|
-
def self.write_to_journal: (String filename, String journal_name, String name, Integer id) { () -> Array[Integer] } -> void
|
|
315
405
|
end
|
|
316
406
|
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Bluepill
|
|
2
|
+
module Version
|
|
3
|
+
def self.major: () -> Integer
|
|
4
|
+
|
|
5
|
+
def self.minor: () -> Integer
|
|
6
|
+
|
|
7
|
+
def self.patch: () -> Integer
|
|
8
|
+
|
|
9
|
+
def self.pre: () -> Integer?
|
|
10
|
+
|
|
11
|
+
def self.to_h: () -> { major: Integer, minor: Integer, patch: Integer, pre: Integer? }
|
|
12
|
+
|
|
13
|
+
def self.to_a: () -> Array[Integer]
|
|
14
|
+
|
|
15
|
+
def self.to_s: () -> String
|
|
16
|
+
end
|
|
17
|
+
end
|
data/sig/bluepill.rbs
CHANGED
|
@@ -15,23 +15,7 @@ module Bluepill
|
|
|
15
15
|
|
|
16
16
|
# Loads an application from a config file. The block runs with self set to
|
|
17
17
|
# the AppProxy, and also gets it as an argument.
|
|
18
|
-
def self.application: (_ToS app_name,
|
|
19
|
-
|
|
20
|
-
module Version
|
|
21
|
-
def self.major: () -> Integer
|
|
22
|
-
|
|
23
|
-
def self.minor: () -> Integer
|
|
24
|
-
|
|
25
|
-
def self.patch: () -> Integer
|
|
26
|
-
|
|
27
|
-
def self.pre: () -> Integer?
|
|
28
|
-
|
|
29
|
-
def self.to_h: () -> { major: Integer, minor: Integer, patch: Integer, pre: Integer? }
|
|
30
|
-
|
|
31
|
-
def self.to_a: () -> Array[Integer]
|
|
32
|
-
|
|
33
|
-
def self.to_s: () -> String
|
|
34
|
-
end
|
|
18
|
+
def self.application: (_ToS app_name, **untyped options) { (AppProxy app) [self: AppProxy] -> void } -> void
|
|
35
19
|
|
|
36
20
|
# The monotonic clock that times ticks, checks and grace times
|
|
37
21
|
module Clock
|
|
@@ -115,6 +99,7 @@ class Integer
|
|
|
115
99
|
include Bluepill::Units
|
|
116
100
|
end
|
|
117
101
|
|
|
102
|
+
# So Float multiplies by the units too
|
|
118
103
|
class Float
|
|
119
104
|
include Bluepill::Units
|
|
120
105
|
end
|
data/sig/manifest.yaml
CHANGED
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.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Arya Asemanfar
|
|
@@ -38,21 +38,20 @@ files:
|
|
|
38
38
|
- lib/bluepill/application/listener.rb
|
|
39
39
|
- lib/bluepill/application/previous_daemon.rb
|
|
40
40
|
- lib/bluepill/base_directory.rb
|
|
41
|
+
- lib/bluepill/check_registry.rb
|
|
41
42
|
- lib/bluepill/clock.rb
|
|
42
43
|
- lib/bluepill/condition_watch.rb
|
|
43
44
|
- lib/bluepill/controller.rb
|
|
44
45
|
- lib/bluepill/controller/directory.rb
|
|
45
46
|
- lib/bluepill/daemonize.rb
|
|
46
|
-
- lib/bluepill/deprecation.rb
|
|
47
|
-
- lib/bluepill/deprecation/custom_checks.rb
|
|
48
|
-
- lib/bluepill/deprecation/dsl.rb
|
|
49
|
-
- lib/bluepill/deprecation/options.rb
|
|
50
47
|
- lib/bluepill/dsl.rb
|
|
51
48
|
- lib/bluepill/dsl/app_proxy.rb
|
|
49
|
+
- lib/bluepill/dsl/attributes.rb
|
|
52
50
|
- lib/bluepill/dsl/process_factory.rb
|
|
53
|
-
- lib/bluepill/dsl/process_factory/
|
|
51
|
+
- lib/bluepill/dsl/process_factory/child_factory.rb
|
|
54
52
|
- lib/bluepill/dsl/process_factory/registry.rb
|
|
55
53
|
- lib/bluepill/dsl/process_proxy.rb
|
|
54
|
+
- lib/bluepill/errors.rb
|
|
56
55
|
- lib/bluepill/group.rb
|
|
57
56
|
- lib/bluepill/logger.rb
|
|
58
57
|
- lib/bluepill/pid_file.rb
|
|
@@ -61,8 +60,10 @@ files:
|
|
|
61
60
|
- lib/bluepill/process/children.rb
|
|
62
61
|
- lib/bluepill/process/pid.rb
|
|
63
62
|
- lib/bluepill/process/state_machine.rb
|
|
63
|
+
- lib/bluepill/process/stop_signals.rb
|
|
64
64
|
- lib/bluepill/process/transition.rb
|
|
65
65
|
- lib/bluepill/process/transition_callbacks.rb
|
|
66
|
+
- lib/bluepill/process/triggers.rb
|
|
66
67
|
- lib/bluepill/process/user_commands.rb
|
|
67
68
|
- lib/bluepill/process/watches.rb
|
|
68
69
|
- lib/bluepill/process_commands.rb
|
|
@@ -81,15 +82,24 @@ files:
|
|
|
81
82
|
- lib/bluepill/process_conditions/zombie_process.rb
|
|
82
83
|
- lib/bluepill/process_journal.rb
|
|
83
84
|
- lib/bluepill/process_journal/cleanup.rb
|
|
85
|
+
- lib/bluepill/process_journal/config.rb
|
|
86
|
+
- lib/bluepill/process_journal/entries.rb
|
|
87
|
+
- lib/bluepill/process_journal/journal.rb
|
|
88
|
+
- lib/bluepill/process_journal/kind.rb
|
|
84
89
|
- lib/bluepill/process_journal/lock.rb
|
|
85
90
|
- lib/bluepill/process_statistics.rb
|
|
86
91
|
- lib/bluepill/socket.rb
|
|
87
92
|
- lib/bluepill/system.rb
|
|
93
|
+
- lib/bluepill/system/command_options.rb
|
|
94
|
+
- lib/bluepill/system/command_result.rb
|
|
88
95
|
- lib/bluepill/system/command_setup.rb
|
|
96
|
+
- lib/bluepill/system/command_spawn.rb
|
|
89
97
|
- lib/bluepill/system/commands.rb
|
|
90
98
|
- lib/bluepill/system/daemon.rb
|
|
99
|
+
- lib/bluepill/system/files.rb
|
|
91
100
|
- lib/bluepill/system/ps.rb
|
|
92
101
|
- lib/bluepill/system/ps_table.rb
|
|
102
|
+
- lib/bluepill/system/usage.rb
|
|
93
103
|
- lib/bluepill/trigger.rb
|
|
94
104
|
- lib/bluepill/triggers/flapping.rb
|
|
95
105
|
- lib/bluepill/units.rb
|
|
@@ -99,12 +109,16 @@ files:
|
|
|
99
109
|
- lib/bluepill/version.rb
|
|
100
110
|
- sig/bluepill.rbs
|
|
101
111
|
- sig/bluepill/application.rbs
|
|
112
|
+
- sig/bluepill/attributes.rbs
|
|
102
113
|
- sig/bluepill/checks.rbs
|
|
103
|
-
- sig/bluepill/deprecation.rbs
|
|
104
114
|
- sig/bluepill/dsl.rbs
|
|
115
|
+
- sig/bluepill/errors.rbs
|
|
105
116
|
- sig/bluepill/logger.rbs
|
|
106
117
|
- sig/bluepill/process.rbs
|
|
118
|
+
- sig/bluepill/process_commands.rbs
|
|
119
|
+
- sig/bluepill/stop_signals.rbs
|
|
107
120
|
- sig/bluepill/system.rbs
|
|
121
|
+
- sig/bluepill/version.rbs
|
|
108
122
|
- sig/manifest.yaml
|
|
109
123
|
homepage: https://github.com/bluepill-rb/bluepill
|
|
110
124
|
licenses:
|
|
@@ -121,7 +135,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
121
135
|
requirements:
|
|
122
136
|
- - ">="
|
|
123
137
|
- !ruby/object:Gem::Version
|
|
124
|
-
version: '2
|
|
138
|
+
version: '3.2'
|
|
125
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
140
|
requirements:
|
|
127
141
|
- - ">="
|