bluepill 0.1.3 → 0.1.5

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 +835 -0
  3. data/CONTRIBUTING.md +31 -0
  4. data/LICENSE +1 -1
  5. data/README.md +66 -29
  6. data/bin/bluepill +1 -1
  7. data/bluepill.gemspec +17 -6
  8. data/lib/bluepill/application.rb +321 -46
  9. data/lib/bluepill/condition_watch.rb +103 -8
  10. data/lib/bluepill/controller.rb +124 -13
  11. data/lib/bluepill/dsl/app_proxy.rb +102 -3
  12. data/lib/bluepill/dsl/process_factory.rb +183 -60
  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 -5
  17. data/lib/bluepill/process.rb +575 -201
  18. data/lib/bluepill/process_commands.rb +264 -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 +61 -2
  24. data/lib/bluepill/process_conditions/process_condition.rb +43 -0
  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 +374 -114
  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 +223 -228
  33. data/lib/bluepill/trigger.rb +110 -14
  34. data/lib/bluepill/triggers/flapping.rb +84 -3
  35. data/lib/bluepill/util/rotational_array.rb +24 -1
  36. data/lib/bluepill/version.rb +71 -19
  37. data/lib/bluepill.rb +25 -2
  38. data/sig/bluepill.rbs +941 -0
  39. data/sig/manifest.yaml +7 -0
  40. metadata +16 -34
  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/CHANGELOG.md ADDED
@@ -0,0 +1,835 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/2.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.5] - 2026-11-01
11
+
12
+ ### Removed
13
+
14
+ - `ProcessJournal.kill_all_from_all_journals`, which was meant to kill every journaled process when bluepill started or quit, but looked in the wrong directory and never found any ([#59](https://github.com/bluepill-rb/bluepill/issues/59)). Bluepill still kills what a process's journal lists before it starts that process, and `bluepill load` keeps monitoring the processes that are already running instead of restarting them.
15
+
16
+ ### Fixed
17
+
18
+ - A restart that stops and starts the process, because a check asked for one or from `bluepill restart`, left bluepill watching the old pid. So the process went from `restarting` to `down` and back to `up`, and bluepill logged an error about signaling the old pid. `bluepill restart` now also goes through `restarting`, like a check's restart, instead of leaving the process `up` with its old pid while it restarts.
19
+ - `SIGHUP` never reopened bluepill's log, because daemonizing ignored it after bluepill trapped it. So after log rotation, bluepill kept writing to the rotated file. Bluepill now traps `SIGHUP` again once it has daemonized. Reopening syslog on `SIGHUP` also no longer crashes bluepill, which 0.1.4 did in foreground mode, since it loads syslog only when it logs there.
20
+ - Stale journal locks, which a daemon that died leaves behind, were never cleared, since bluepill looked for them in the current directory instead of the journal directory, and removed them as if they were files ([#59](https://github.com/bluepill-rb/bluepill/issues/59)). A stale lock made the next write to its journal wait 10 seconds and fail. Bluepill now clears the app's own locks when it starts and quits.
21
+ - After a reboot, or once pids wrapped around, bluepill could kill an unrelated process whose pid it had journaled ([#3](https://github.com/bluepill-rb/bluepill/issues/3)). The journal now records when each process started, and bluepill only kills a pid whose process started then. A process group whose leader has exited, and a journal line from bluepill 0.1 and earlier, are only trusted if they were journaled since the machine booted.
22
+ - Two apps with a process of the same name shared its journal, so starting the process in one app killed the other app's ([#34](https://github.com/bluepill-rb/bluepill/issues/34)). Each app now keeps its journals in a directory of its own, `journals/<app>`. Journals that bluepill 0.1 and earlier wrote are still read and cleared, so upgrading doesn't leave their processes running.
23
+
24
+ ## [0.1.4] - 2026-11-01
25
+
26
+ ### Added
27
+
28
+ - `bluepill load` warns about a process that sets none of `daemonize`, `pid_file` or `pid_command`, since bluepill can't find its pid ([#54](https://github.com/bluepill-rb/bluepill/issues/54)).
29
+ - Documented `pre_start_command`, and that commands don't run in a shell.
30
+ - Gem metadata links to the source code, changelog and issue tracker ([#56](https://github.com/bluepill-rb/bluepill/issues/56)).
31
+ - RBS type signatures in `sig/bluepill.rbs`, checked with Steep in strict mode.
32
+
33
+ ### Changed
34
+
35
+ - Allowed Active Support 6 and newer.
36
+ - When cleaning up a process journal, bluepill now sends `KILL` to every process still alive a second after `TERM`, including a single survivor. Before, it only sent `KILL` when more than one process survived, and then to every journaled pid.
37
+ - Process groups in the journal are now checked as whole groups, so a group whose leader exited but whose other members are still running gets killed too.
38
+ - With `stop_signals`, bluepill now waits for the process to exit, up to about `stop_grace_time`, after the last signal before force-killing it from the journal ([#31](https://github.com/bluepill-rb/bluepill/issues/31)).
39
+ - A restart without `restart_command` now waits for the whole `stop_signals` sequence to finish before starting the process again ([#31](https://github.com/bluepill-rb/bluepill/issues/31)).
40
+ - `start` now ends a stop sequence that is still running, so it can't signal or kill the newly started process ([#31](https://github.com/bluepill-rb/bluepill/issues/31)).
41
+ - `ps` now runs with the POSIX options `-Ao pid,ppid,pcpu,rss,etime,args` ([#13](https://github.com/bluepill-rb/bluepill/issues/13)).
42
+ - When `ps` can't run, the daemon logs a warning and skips that check until the next interval instead of exiting ([#37](https://github.com/bluepill-rb/bluepill/issues/37)).
43
+ - When bluepill can't open its log file or create its pids directory, it explains which user needs access and exits with status 5 instead of printing a backtrace ([#33](https://github.com/bluepill-rb/bluepill/issues/33)).
44
+ - An HTTP check with an unknown numeric `kind` now fails when the pill loads, like an unknown String or Symbol `kind` already did. Before, it raised on every tick and kept the process's other checks from running.
45
+
46
+ ### Removed
47
+
48
+ - `Bluepill::Application::Client` and `Bluepill::Application::Server`, which raised `TypeError` when loaded and weren't used.
49
+ - The `sample_forking_server` executable. It was a test server for the examples, so it moved to `examples/` and is no longer installed with the gem.
50
+
51
+ ### Fixed
52
+
53
+ - On Ruby 3.4 and newer, loading bluepill under Bundler raised `LoadError` unless the app's Gemfile included `syslog`, even when logging to a file. Bluepill now loads `syslog` only when it logs to syslog, and explains how to fix a missing `syslog` gem.
54
+ - The HTTP condition with a numeric `kind`, and `stop_signals` with delays, crashed on Ruby 3.2 and newer, where `Fixnum` no longer exists.
55
+ - Two processes could hold the journal lock at the same time, the lock never timed out, and a waiting process could remove a lock held by another.
56
+ - A `nil` pid crashed the process journal, and a pid of 0 made bluepill journal its own process group.
57
+ - A pid file that was empty or held 0 made the process show as `up` forever, since signaling pid 0 reaches bluepill's own process group ([#53](https://github.com/bluepill-rb/bluepill/issues/53)).
58
+ - Checking a process that had no pid yet, such as before its first start, logged a "Failed to signal process" error.
59
+ - Commands sent to a process whose name contains a colon raised `ArgumentError` ([#24](https://github.com/bluepill-rb/bluepill/issues/24)).
60
+ - `stop` or `restart` on a starting process with `monitor_children` raised `SystemStackError` ([#8](https://github.com/bluepill-rb/bluepill/issues/8)).
61
+ - A start, stop or restart command that outlived its grace time left a zombie process behind ([#23](https://github.com/bluepill-rb/bluepill/issues/23)).
62
+ - `ps` failed on SmartOS and Solaris ([#13](https://github.com/bluepill-rb/bluepill/issues/13)).
63
+ - Starting a second daemon for an app that was already running raised `NameError` instead of printing an error and exiting.
64
+ - Event timestamps in `bluepill status` showed the hour where they meant the minutes.
65
+ - The `file_time` check crashed when the file couldn't be read.
66
+ - The command listener stopped answering after `accept` failed once.
67
+ - Several watches could run `ps` at the same time on the same tick.
68
+ - Each reset of a trigger left its canceled events in memory.
69
+ - A start, stop or restart command killed by a signal could crash the daemon, since the command has no exit code.
70
+ - The `running_time` check could crash the daemon when `ps` didn't list the process.
71
+ - The HTTP check's workaround for a Net::HTTP connection error never matched on Ruby 3.4 and newer, which changed the error message.
72
+ - An empty or garbled application pid file made bluepill send `SIGINT` to its own process group on startup.
73
+ - `bluepill quit` with an empty or garbled daemon pid file sent `TERM` to the process group of the `bluepill` command itself.
74
+ - Loading a config rejected two different processes as duplicates when joining group and process name with `:` gave the same string, such as process `b:c` in group `a` and process `c` in group `a:b`.
75
+ - Child processes of a process that didn't set its grace times got no start, stop or restart grace time, instead of the default of 3 seconds.
76
+
77
+ ## [0.1.3] - 2017-04-06
78
+
79
+ ### Changed
80
+
81
+ - Allowed `activesupport` 5, so bluepill can be used with Rails 5 ([#46](https://github.com/bluepill-rb/bluepill/pull/46)).
82
+ - Documented that bluepill can only run in the foreground on JRuby.
83
+
84
+ ## [0.1.2] - 2016-06-19
85
+
86
+ ### Fixed
87
+
88
+ - Killed journaled pids and remove the pid file only after a long-running `stop_command` or `stop_signals` sequence has finished, instead of right away ([#32](https://github.com/bluepill-rb/bluepill/pull/32)).
89
+ - Fixed cleanup of stale pid and socket files for applications that are no longer running.
90
+ - Read command exit codes from `$?` instead of `$CHILD_STATUS`, which is only set when the `English` library is loaded ([#43](https://github.com/bluepill-rb/bluepill/pull/43)).
91
+ - Treated an invalid pid (such as `false`) as a process that is not running instead of raising an error.
92
+
93
+ ## [0.1.1] - 2015-08-14
94
+
95
+ ### Changed
96
+
97
+ - **Breaking:** Required Ruby 1.9.3 or later in the gemspec, so RubyGems no longer installs this release on Ruby 1.8.
98
+ - Updated the README and examples to use Ruby 1.9 hash syntax.
99
+
100
+ ## [0.1.0] - 2015-08-14 [YANKED]
101
+
102
+ ### Removed
103
+
104
+ - **Breaking:** Dropped Ruby 1.8 support. The code now uses Ruby 1.9 hash syntax, but the gemspec did not yet declare a minimum Ruby version.
105
+
106
+ ## [0.0.70] - 2015-08-14
107
+
108
+ ### Changed
109
+
110
+ - Raised the minimum `activesupport` version to 3.2.
111
+ - Relaxed the `blue-daemons` dependency to `~> 1.1`.
112
+ - `bluepill status` now lists every process, not just processes that monitor their children.
113
+
114
+ ### Removed
115
+
116
+ - Removed the unused `i18n` runtime dependency.
117
+
118
+ ### Fixed
119
+
120
+ - Only write child pids to the process journal for processes that bluepill daemonizes ([#26](https://github.com/bluepill-rb/bluepill/pull/26)).
121
+ - Fixed a `NoMethodError` (`undefined method 'actual_id'`) when restarting a process whose children are monitored ([#35](https://github.com/bluepill-rb/bluepill/pull/35)).
122
+
123
+ ## [0.0.69] - 2014-11-02
124
+
125
+ ### Changed
126
+
127
+ - Logged a backtrace when a trigger or process condition raises an exception ([#18](https://github.com/bluepill-rb/bluepill/pull/18)).
128
+
129
+ ### Fixed
130
+
131
+ - Required `active_support` before its core extensions to work around a Rails loading bug ([#19](https://github.com/bluepill-rb/bluepill/pull/19)).
132
+
133
+ ## [0.0.68] - 2014-07-20
134
+
135
+ ### Changed
136
+
137
+ - Allowed `activesupport` 4.1 and later 4.x releases, so bluepill can be used with Rails 4.1 ([#17](https://github.com/bluepill-rb/bluepill/pull/17)).
138
+
139
+ ### Fixed
140
+
141
+ - The `mem_usage` check no longer raises an error when a process has no memory reading.
142
+
143
+ ## [0.0.67] - 2014-05-01
144
+
145
+ ### Added
146
+
147
+ - Added a `zombie_process` check that restarts defunct processes. It requires `cache_actual_pid` to be set to `false`.
148
+
149
+ ### Changed
150
+
151
+ - Allowed `activesupport` 4.0, so bluepill can be used with Rails 4.0.
152
+ - Switched to the `blue-daemons` fork instead of the `daemons` gem.
153
+
154
+ ### Fixed
155
+
156
+ - Reported exceptions raised in the grandchild process of a blocking command instead of losing them silently.
157
+ - Prevented the grandchild process from crashing while reporting an exception after its error pipe is closed ([#10](https://github.com/bluepill-rb/bluepill/pull/10)).
158
+ - Exited the intermediate daemonizing process with `Process.exit!` so it does not run exit handlers.
159
+
160
+ ## [0.0.66] - 2013-07-19
161
+
162
+ ### Fixed
163
+
164
+ - Fixed starting the bluepill daemon without privileges, which still failed in 0.0.62 because `Errno::EPERM` was not rescued correctly.
165
+
166
+ ## [0.0.65] - 2013-07-12
167
+
168
+ ### Changed
169
+
170
+ - Limited `activesupport` to 3.x, since `activesupport` 4 requires Ruby 1.9.3.
171
+
172
+ ### Fixed
173
+
174
+ - `bluepill restart` now starts a process right after stopping it when no `restart_command` is set, instead of waiting for the next tick.
175
+
176
+ ## [0.0.64] - 2013-05-29
177
+
178
+ ### Added
179
+
180
+ - Added a `running_time` check that fires when a process has been running longer than a given time.
181
+ - Added the `BLUEPILL_BASE_DIR` environment variable to set the default base directory.
182
+
183
+ ### Changed
184
+
185
+ - **Breaking:** The default base directory for unprivileged users is now `~/.bluepill` instead of `/var/run/bluepill`.
186
+ - Loosened the `state_machine` dependency to `~> 1.1`.
187
+
188
+ ### Fixed
189
+
190
+ - Fixed an error when daemonizing a process fails.
191
+ - Fixed the load path of the `local-bluepill` script.
192
+ - Exited the child process of a blocking command with `Process.exit!` so it does not leave zombie processes behind.
193
+
194
+ ## [0.0.63] - 2013-04-21
195
+
196
+ ### Added
197
+
198
+ - Added a `file_time` check that fires when a file, such as a log file, has not been modified recently.
199
+ - Added the `group_start_noblock`, `group_stop_noblock`, `group_restart_noblock` and `group_unmonitor_noblock` process options. Set them to `false` to run group commands one process at a time instead of in parallel.
200
+ - Added the `on_start_timeout` process option to choose what happens when a start command takes longer than `start_grace_time`.
201
+
202
+ ### Changed
203
+
204
+ - A process whose start command times out is now started again by default instead of being unmonitored.
205
+
206
+ ### Fixed
207
+
208
+ - The `http` check now sends the query string along with the path.
209
+ - Stopped retrying forever when deleting a file fails.
210
+ - Process journals are now stored in the base directory instead of the current working directory.
211
+
212
+ ## [0.0.62] - 2013-03-19
213
+
214
+ ### Fixed
215
+
216
+ - Fixed a crash when starting the bluepill daemon without privileges.
217
+
218
+ ## [0.0.61] - 2013-03-18
219
+
220
+ ### Added
221
+
222
+ - Added the `kill_timeout` application option to set how long bluepill waits for a previous bluepill daemon to exit. It defaults to 10.
223
+ - Added `pre_start_command`, a command that runs before each start of a process.
224
+ - Added the `include_children` option to `cpu_usage` and `mem_usage` checks to count the resources of child processes.
225
+ - Kept a journal of the pids and process groups that bluepill starts, and kill leftover processes from it when starting and stopping.
226
+
227
+ ### Changed
228
+
229
+ - Allowed `daemons` 1.1.7 and later again.
230
+ - Documented the application name argument of the `bluepill` command.
231
+
232
+ ### Fixed
233
+
234
+ - Accepted a `working_dir` that is not a string, such as a `Pathname`.
235
+
236
+ ## [0.0.60] - 2012-03-05
237
+
238
+ ### Fixed
239
+
240
+ - Fixed sending `stop_signals`, which are given as symbols and broke in 0.0.59.
241
+
242
+ ## [0.0.59] - 2012-02-27
243
+
244
+ ### Fixed
245
+
246
+ - Fixed sending numeric signals to a process, and log an error when sending a signal fails instead of failing silently.
247
+
248
+ ## [0.0.58] - 2012-02-20
249
+
250
+ ### Removed
251
+
252
+ - Removed the workaround for `daemons` 1.1.7 and later, which are still excluded by the gemspec.
253
+
254
+ ## [0.0.57] - 2012-02-20
255
+
256
+ ### Fixed
257
+
258
+ - Only set `close_on_exec` on socket connections when the Ruby version supports it.
259
+
260
+ ## [0.0.56] - 2012-02-18
261
+
262
+ ### Changed
263
+
264
+ - Restricted the `daemons` dependency to 1.1.6 or earlier again.
265
+
266
+ ### Fixed
267
+
268
+ - Fixed sending signals on Ruby 1.8.7, where symbols do not respond to `upcase`.
269
+
270
+ ## [0.0.55] - 2012-02-07
271
+
272
+ ### Changed
273
+
274
+ - Supported `daemons` 1.1.7 and later.
275
+
276
+ ## [0.0.54] - 2012-02-07
277
+
278
+ ### Changed
279
+
280
+ - Restricted the `daemons` dependency to versions 1.1.4 through 1.1.6.
281
+
282
+ ## [0.0.53] - 2012-02-03
283
+
284
+ ### Fixed
285
+
286
+ - Set up Bundler when bluepill runs under `bundle exec`, to avoid gem conflicts.
287
+ - Closed socket connections when a command execs, so a long-running command no longer makes the client time out.
288
+
289
+ ## [0.0.52] - 2011-12-13
290
+
291
+ ### Added
292
+
293
+ - Added the `supplementary_groups` process option.
294
+ - Added the `stop_signals` process option to send a sequence of signals with delays when stopping a process.
295
+ - The client now retries up to 5 times when the server does not respond.
296
+
297
+ ### Changed
298
+
299
+ - **Breaking:** The default base directory is now `/var/run/bluepill` instead of `/var/bluepill`.
300
+ - Set the `HOME` environment variable to the home directory of the configured `uid`.
301
+ - Required `state_machine` 1.1 instead of 0.9.
302
+
303
+ ### Fixed
304
+
305
+ - Fixed a `Config` deprecation warning on Ruby 1.9.3.
306
+ - Fixed `bluepill status` not returning output.
307
+ - Fixed an error when `supplementary_groups` is not set.
308
+
309
+ ## [0.0.51] - 2011-06-01
310
+
311
+ ### Fixed
312
+
313
+ - Fixed `bluepill status <process>`, which failed while printing the process's event history since 0.0.47.
314
+
315
+ ## [0.0.50] - 2011-06-01
316
+
317
+ ### Added
318
+
319
+ - Added the `pid_command` process option to get a process's pid from the output of a command instead of a pid file.
320
+ - Added the `auto_start` option. Set it to `false` so that processes which aren't running when bluepill loads start out unmonitored instead of being started.
321
+ - Added a simpler DSL: `Bluepill.application` and `app.process` blocks that take no argument are evaluated in the proxy's context, and attributes can be set with `working_dir "/path"` or `daemonize!` instead of `process.working_dir = "/path"`. The block-argument style still works.
322
+
323
+ ## [0.0.49] - 2011-05-14
324
+
325
+ ### Added
326
+
327
+ - Added the `cache_actual_pid` process option (default `true`). Set it to `false` to reread the pid file on every check.
328
+
329
+ ### Fixed
330
+
331
+ - Fixed loading the `state_machine` gem on systems that also have the `rubyist-aasm` gem installed.
332
+
333
+ ## [0.0.48] - 2011-04-07
334
+
335
+ ### Changed
336
+
337
+ - **Breaking:** Bluepill now requires ActiveSupport 3.0 or later and `state_machine` 0.9.4 or later in the 0.9 series.
338
+
339
+ ### Removed
340
+
341
+ - Removed the dependency on `blankslate`.
342
+
343
+ ### Fixed
344
+
345
+ - Fixed a crash when a command run by bluepill (such as a stop or restart command) returned no status output.
346
+
347
+ ## [0.0.47] - 2011-04-05
348
+
349
+ ### Changed
350
+
351
+ - Raised the timeout for commands sent to the bluepill daemon from 10 to 60 seconds, so busy daemons have time to respond.
352
+ - **Breaking:** Tightened the gem dependencies to `daemons ~> 1.1.0`, `activesupport ~> 2.3.4`, `blankslate ~> 2.1.2.3` and `i18n ~> 0.5.0`, which rules out ActiveSupport 3.
353
+
354
+ ## [0.0.46] - 2011-03-25
355
+
356
+ ### Added
357
+
358
+ - Added `i18n` as a dependency, since newer ActiveSupport versions need it but don't declare it.
359
+
360
+ ## [0.0.45] - 2011-03-24
361
+
362
+ ### Added
363
+
364
+ - Added HTTPS support to the `:http` check. Certificates are not verified.
365
+ - Added the ability to turn off restarting after flapping by setting the flapping trigger's `retry_in` to `0`.
366
+ - Added a `-t`/`--timeout` option to the `bluepill` command, although it doesn't affect the command timeout yet.
367
+
368
+ ### Fixed
369
+
370
+ - Fixed a race condition that made the flapping trigger unreliable, and removed its misleading "Retrying from flapping" log message.
371
+ - Fixed orphaned processes caused by start commands being run through `sh -c`. Commands are now split into words and executed directly.
372
+ - Fixed an `ArgumentError` from the signal handlers on Ruby 1.9.2.
373
+ - Fixed triggers on monitored child processes on Ruby 1.9.
374
+ - Fixed a race condition when deleting a process's pid file that another process had already removed.
375
+ - Fixed process monitoring on FreeBSD by changing the `ps` invocation.
376
+
377
+ ## [0.0.44] - 2010-10-19
378
+
379
+ ### Changed
380
+
381
+ - `bluepill` now exits with status 1 when given an unknown command.
382
+
383
+ ### Fixed
384
+
385
+ - Fixed monitoring child processes on Ruby 1.9, which failed because a mutex could not be marshaled.
386
+
387
+ ## [0.0.43] - 2010-09-19
388
+
389
+ ### Fixed
390
+
391
+ - Restored Ruby 1.8.6 compatibility, which 0.0.39 had broken by using `Object#tap`.
392
+ - Fixed monitoring child processes on Ruby 1.9, which lacks `Array#nitems`.
393
+
394
+ ## [0.0.42] - 2010-08-24
395
+
396
+ ### Added
397
+
398
+ - Environment variable names and values set with `environment` can now be symbols or other non-string objects.
399
+
400
+ ### Fixed
401
+
402
+ - Fixed loading configuration files on Ruby 1.9.2.
403
+ - Fixed the `bluepill` command's help output on Ruby 1.9.
404
+
405
+ ## [0.0.40] - 2010-08-21
406
+
407
+ ### Added
408
+
409
+ - Added the `--no-privileged` option so `bluepill` can run as a non-root user. Bluepill then skips switching `uid` and `gid` for its processes.
410
+
411
+ ### Fixed
412
+
413
+ - Fixed a spurious error at startup when the pid file of a previous bluepill daemon pointed to a process that was no longer running.
414
+
415
+ ## [0.0.39] - 2010-08-02
416
+
417
+ ### Added
418
+
419
+ - Added the `environment` option, at the application or process level, to set environment variables for monitored processes.
420
+ - Added the `:http` check, which requests a URL and checks the response status and, optionally, its body against a pattern.
421
+
422
+ ### Fixed
423
+
424
+ - Fixed compatibility with Rails 3 and ActiveSupport 3.0.
425
+
426
+ ## [0.0.38] - 2010-05-31
427
+
428
+ ### Fixed
429
+
430
+ - Fixed child processes still not inheriting their parent's grace times after the 0.0.37 change.
431
+
432
+ ## [0.0.37] - 2010-03-15
433
+
434
+ ### Added
435
+
436
+ - Added the `:foreground => true` option to `Bluepill.application` to run bluepill in the foreground without daemonizing and log to stdout, for use under runit or similar supervisors.
437
+
438
+ ### Fixed
439
+
440
+ - Fixed child processes not inheriting the parent's grace times when they were set after `monitor_children`.
441
+
442
+ ## [0.0.36] - 2010-02-28
443
+
444
+ ### Fixed
445
+
446
+ - Fixed an error when closing a client connection that had already been closed.
447
+
448
+ ## [0.0.35] - 2010-02-28
449
+
450
+ ### Fixed
451
+
452
+ - Fixed a second bluepill daemon starting for an application whose daemon was already running. It now exits with an error.
453
+
454
+ ## [0.0.34] - 2010-02-28
455
+
456
+ ### Fixed
457
+
458
+ - Fixed an error in the daemon when a client disconnected before its connection was closed.
459
+
460
+ ## [0.0.33] - 2010-02-11
461
+
462
+ ### Added
463
+
464
+ - Added support for calling `bluepill` through a symlink named after an application, like runit and daemontools.
465
+
466
+ ### Fixed
467
+
468
+ - Fixed race conditions between commands sent to the daemon and the monitoring loop by handling commands one at a time under a lock.
469
+
470
+ ## [0.0.32] - 2010-01-31
471
+
472
+ No user-facing changes.
473
+
474
+ ## [0.0.31] - 2010-01-15
475
+
476
+ ### Changed
477
+
478
+ - Errors raised while the daemon runs a command are now sent back and printed by the client, which exits with status 8.
479
+
480
+ ## [0.0.30] - 2009-12-28
481
+
482
+ ### Added
483
+
484
+ - Added `Bluepill.define_process_condition` to define a custom process condition from a block.
485
+ - Added process statistics, so `bluepill status` with a target shows more detail such as the process's recent event history.
486
+
487
+ ## [0.0.28] - 2009-12-27
488
+
489
+ ### Added
490
+
491
+ - Added the `bpsv` service control script, which runs `bluepill <command> <name>` using the name it is invoked under (for example through a symlink).
492
+
493
+ ## [0.0.27] - 2009-12-06
494
+
495
+ ### Changed
496
+
497
+ - `start`, `stop`, `restart` and `unmonitor` no longer require a target and apply to all processes when none is given.
498
+ - The CLI now checks that the running daemon is the same bluepill version and aborts with an error if it is out of date.
499
+
500
+ ## [0.0.26] - 2009-12-03
501
+
502
+ ### Changed
503
+
504
+ - The CLI now prints an error when `start`, `stop`, `restart` or `unmonitor` is run without a target.
505
+
506
+ ## [0.0.25] - 2009-11-30
507
+
508
+ ### Added
509
+
510
+ - Commands can now target a process by `group:process`, by process name alone, or by group name.
511
+ - The CLI now reports which processes were affected by a command.
512
+ - The config now fails with an error when two processes share a pid file or when a process name is repeated within a group.
513
+
514
+ ### Changed
515
+
516
+ - `pid_file` is no longer required for a monitored process and defaults to a file in a per-application subdirectory of the bluepill pids directory.
517
+ - `bluepill load` now runs the config file in a fresh Ruby interpreter so that whatever the config loads does not stay in the daemon's memory.
518
+ - `bluepill log` now tails the application's configured log file instead of always using the CLI default.
519
+ - Redirected `stdout` and `stderr` files are now opened in append mode instead of being truncated.
520
+
521
+ ### Fixed
522
+
523
+ - Fixed a crash when `bluepill load` was given a file that does not exist.
524
+ - Fixed processes in groups whose names were given as symbols not being handled correctly.
525
+ - Fixed the `times` option of a condition watch being passed through to the process condition.
526
+
527
+ ## [0.0.24] - 2009-11-24
528
+
529
+ ### Added
530
+
531
+ - Watch values can now be formatted for display, and the memory usage watch shows values in KB or MB.
532
+
533
+ ### Changed
534
+
535
+ - Running `bluepill` with no arguments now prints the help.
536
+
537
+ ### Fixed
538
+
539
+ - An empty pid file is now treated as having no pid.
540
+ - Fixed an exception raised when a state transition was halted by a `before_transition` callback.
541
+
542
+ ## [0.0.23] - 2009-11-23
543
+
544
+ ### Added
545
+
546
+ - Added the `-v`/`--version` option to print the bluepill version.
547
+
548
+ ## [0.0.22] - 2009-11-23
549
+
550
+ ### Added
551
+
552
+ - Added the `:log_file` application option to log to a file instead of syslog.
553
+ - Added the `-h`/`--help` option with usage information.
554
+ - Added app-wide `working_dir`, `uid` and `gid` settings that apply to every process that doesn't set its own.
555
+ - Added config validation that rejects duplicate process names and child process monitors without a `stop_command`.
556
+ - Documented the config options, logging, and working directory in the README and added a license file.
557
+
558
+ ### Changed
559
+
560
+ - `bluepill` now prints an error and exits when the daemon fails to start instead of only logging the exception.
561
+
562
+ ### Fixed
563
+
564
+ - The daemon's pid file and socket file are now removed when bluepill quits.
565
+
566
+ ## [0.0.21] - 2009-11-16
567
+
568
+ ### Added
569
+
570
+ - Added the `stdin`, `stdout` and `stderr` process options to redirect a daemonized process's streams.
571
+
572
+ ### Removed
573
+
574
+ - **Breaking:** Removed support for shell output redirection in `start_command` because it was racy. Use the new `stdout` and `stderr` options instead.
575
+
576
+ ## [0.0.20] - 2009-11-16
577
+
578
+ ### Changed
579
+
580
+ - Running `start_command`, `stop_command` and `restart_command` now times out after the matching grace time so a hanging command can't block bluepill.
581
+ - Pid files for daemonized processes are now written by the spawned child so they are no longer always owned by the superuser.
582
+
583
+ ### Fixed
584
+
585
+ - Bluepill now monitors the correct process when a daemonized `start_command` uses output redirection or environment variable assignments.
586
+ - Fixed bluepill refusing to start even when run as the superuser.
587
+
588
+ ## [0.0.19] - 2009-11-13
589
+
590
+ ### Changed
591
+
592
+ - The CLI now exits with distinct non-zero exit codes on errors.
593
+ - The base directory now defaults to `/var/bluepill`, and bluepill exits with an error if it can't write to it.
594
+ - When loading a config, bluepill now waits for a previous daemon to die and exits with an error if it doesn't.
595
+
596
+ ## [0.0.18] - 2009-11-07
597
+
598
+ ### Changed
599
+
600
+ - When several applications are running, the CLI now lists the running applications to choose from.
601
+
602
+ ### Fixed
603
+
604
+ - Fixed the `log` command not picking the application automatically when only one is running.
605
+ - `bluepill load` now prints an error instead of crashing when the config file doesn't exist.
606
+
607
+ ## [0.0.17] - 2009-11-07
608
+
609
+ ### Fixed
610
+
611
+ - Fixed a variable scope error that broke commands sent to the daemon.
612
+
613
+ ## [0.0.16] - 2009-11-07
614
+
615
+ ### Fixed
616
+
617
+ - Fixed `bluepill load` failing because it was treated as a command for an already running daemon.
618
+
619
+ ## [0.0.15] - 2009-11-06
620
+
621
+ ### Added
622
+
623
+ - Added a timeout to the CLI's socket connection to the daemon.
624
+
625
+ ### Changed
626
+
627
+ - Clarified some CLI error messages.
628
+
629
+ ## [0.0.14] - 2009-11-06
630
+
631
+ ### Added
632
+
633
+ - The CLI now prints an error listing the running applications when an application name is needed, and an error when no bluepill daemons are running.
634
+
635
+ ### Fixed
636
+
637
+ - Stale socket files from daemons that are no longer running are now cleaned up.
638
+
639
+ ## [0.0.13] - 2009-11-06
640
+
641
+ ### Fixed
642
+
643
+ - Set the `PWD` environment variable when changing to a process's `working_dir`, to match shell behavior with symlinks.
644
+
645
+ ## [0.0.12] - 2009-11-05
646
+
647
+ ### Added
648
+
649
+ - Added the `working_dir` process option to set the directory a process starts in.
650
+
651
+ ## [0.0.11] - 2009-11-04
652
+
653
+ ### Changed
654
+
655
+ - Depended on the `state_machine` gem instead of `pluginaweek-state_machine` and added the missing `blankslate` dependency.
656
+ - Replaced the README with a basic usage guide and moved the bug list to GitHub issues.
657
+
658
+ ## [0.0.10] - 2009-10-27
659
+
660
+ ### Fixed
661
+
662
+ - The log message for `restart_command` now shows the command after `{{PID}}` substitution.
663
+
664
+ ## [0.0.9] - 2009-10-27
665
+
666
+ No user-facing changes.
667
+
668
+ ## [0.0.8] - 2009-10-27
669
+
670
+ ### Added
671
+
672
+ - Added `{{PID}}` substitution to `restart_command`.
673
+
674
+ ## [0.0.7] - 2009-10-24
675
+
676
+ ### Added
677
+
678
+ - Self-daemonizing `start_command`s now run as the configured `uid` and `gid`.
679
+
680
+ ## [0.0.6] - 2009-10-23
681
+
682
+ ### Added
683
+
684
+ - Added monitoring of child processes with `monitor_children`.
685
+
686
+ ### Changed
687
+
688
+ - Reworked the process state machine, adding the `starting`, `stopping` and `restarting` states.
689
+
690
+ ### Fixed
691
+
692
+ - Fixed `start_grace_time`, `stop_grace_time` and `restart_grace_time` being ignored in favor of a hardcoded 3 seconds.
693
+ - Fixed global error handling catching `SystemExit`, which broke forking.
694
+ - Fixed a logger error in triggers.
695
+
696
+ ## [0.0.5] - 2009-10-15
697
+
698
+ ### Changed
699
+
700
+ - CPU and memory usage are now read from a single `ps axu` call per tick, which is more portable than reading `/proc`.
701
+ - Reduced log noise from `bluepill status`.
702
+
703
+ ### Fixed
704
+
705
+ - Fixed deadlocks in triggers so flap detection and scheduled dispatches work.
706
+
707
+ ## [0.0.4] - 2009-10-14
708
+
709
+ ### Added
710
+
711
+ - Added ActiveSupport numeric and duration extensions so configs can use values like `5.minutes` and `3.megabytes`.
712
+ - `bluepill log` now prints a message when it starts tailing.
713
+
714
+ ### Changed
715
+
716
+ - Required `activesupport` 2.3.4 or later.
717
+
718
+ ## [0.0.3] - 2009-10-13
719
+
720
+ ### Added
721
+
722
+ - Added the ability to run daemons as a different user.
723
+ - Added flap detection.
724
+ - Config attributes can now be read back in the DSL after they are set.
725
+
726
+ ### Changed
727
+
728
+ - Loading a config now only waits for a previous bluepill daemon to die when one was actually running.
729
+
730
+ ### Fixed
731
+
732
+ - Fixed bluepill forgetting a process's pid before the process had been started or killed.
733
+
734
+ ## [0.0.2] - 2009-10-05
735
+
736
+ ### Added
737
+
738
+ - Added the `quit` command.
739
+
740
+ ### Changed
741
+
742
+ - Improved logging of watches and state transitions.
743
+ - Bluepill now creates its base directory structure on startup.
744
+
745
+ ### Fixed
746
+
747
+ - Bluepill no longer claims to kill a process that is already dead.
748
+
749
+ ## [0.0.1] - 2009-10-05
750
+
751
+ Initial release.
752
+
753
+ ### Added
754
+
755
+ - Added a Ruby config DSL for defining an application with processes and groups.
756
+ - Added process monitoring with `start_command`, `stop_command`, `restart_command`, `pid_file`, daemonizing, and configurable grace times.
757
+ - Added CPU and memory usage conditions that trigger actions such as restarts.
758
+ - Added the `bluepill` CLI with the `load`, `status`, `start`, `stop`, `restart`, `unmonitor`, `quit` and `log` commands.
759
+ - Added syslog logging.
760
+
761
+ [unreleased]: https://github.com/bluepill-rb/bluepill/compare/v0.1.5...HEAD
762
+ [0.1.5]: https://github.com/bluepill-rb/bluepill/compare/v0.1.4...v0.1.5
763
+ [0.1.4]: https://github.com/bluepill-rb/bluepill/compare/v0.1.3...v0.1.4
764
+ [0.1.3]: https://github.com/bluepill-rb/bluepill/compare/v0.1.2...v0.1.3
765
+ [0.1.2]: https://github.com/bluepill-rb/bluepill/compare/v0.1.1...v0.1.2
766
+ [0.1.1]: https://github.com/bluepill-rb/bluepill/compare/v0.1.0...v0.1.1
767
+ [0.1.0]: https://github.com/bluepill-rb/bluepill/compare/v0.0.70...v0.1.0
768
+ [0.0.70]: https://github.com/bluepill-rb/bluepill/compare/v0.0.69...v0.0.70
769
+ [0.0.69]: https://github.com/bluepill-rb/bluepill/compare/v0.0.68...v0.0.69
770
+ [0.0.68]: https://github.com/bluepill-rb/bluepill/compare/v0.0.67...v0.0.68
771
+ [0.0.67]: https://github.com/bluepill-rb/bluepill/compare/v0.0.66...v0.0.67
772
+ [0.0.66]: https://github.com/bluepill-rb/bluepill/compare/v0.0.65...v0.0.66
773
+ [0.0.65]: https://github.com/bluepill-rb/bluepill/compare/v0.0.64...v0.0.65
774
+ [0.0.64]: https://github.com/bluepill-rb/bluepill/compare/v0.0.63...v0.0.64
775
+ [0.0.63]: https://github.com/bluepill-rb/bluepill/compare/v0.0.62...v0.0.63
776
+ [0.0.62]: https://github.com/bluepill-rb/bluepill/compare/v0.0.61...v0.0.62
777
+ [0.0.61]: https://github.com/bluepill-rb/bluepill/compare/v0.0.60...v0.0.61
778
+ [0.0.60]: https://github.com/bluepill-rb/bluepill/compare/v0.0.59...v0.0.60
779
+ [0.0.59]: https://github.com/bluepill-rb/bluepill/compare/v0.0.58...v0.0.59
780
+ [0.0.58]: https://github.com/bluepill-rb/bluepill/compare/v0.0.57...v0.0.58
781
+ [0.0.57]: https://github.com/bluepill-rb/bluepill/compare/v0.0.56...v0.0.57
782
+ [0.0.56]: https://github.com/bluepill-rb/bluepill/compare/v0.0.55...v0.0.56
783
+ [0.0.55]: https://github.com/bluepill-rb/bluepill/compare/v0.0.54...v0.0.55
784
+ [0.0.54]: https://github.com/bluepill-rb/bluepill/compare/v0.0.53...v0.0.54
785
+ [0.0.53]: https://github.com/bluepill-rb/bluepill/compare/v0.0.52...v0.0.53
786
+ [0.0.52]: https://github.com/bluepill-rb/bluepill/compare/v0.0.51...v0.0.52
787
+ [0.0.51]: https://github.com/bluepill-rb/bluepill/compare/v0.0.50...v0.0.51
788
+ [0.0.50]: https://github.com/bluepill-rb/bluepill/compare/v0.0.49...v0.0.50
789
+ [0.0.49]: https://github.com/bluepill-rb/bluepill/compare/v0.0.48...v0.0.49
790
+ [0.0.48]: https://github.com/bluepill-rb/bluepill/compare/v0.0.47...v0.0.48
791
+ [0.0.47]: https://github.com/bluepill-rb/bluepill/compare/v0.0.46...v0.0.47
792
+ [0.0.46]: https://github.com/bluepill-rb/bluepill/compare/v0.0.45...v0.0.46
793
+ [0.0.45]: https://github.com/bluepill-rb/bluepill/compare/v0.0.44...v0.0.45
794
+ [0.0.44]: https://github.com/bluepill-rb/bluepill/compare/v0.0.43...v0.0.44
795
+ [0.0.43]: https://github.com/bluepill-rb/bluepill/compare/v0.0.42...v0.0.43
796
+ [0.0.42]: https://github.com/bluepill-rb/bluepill/compare/v0.0.40...v0.0.42
797
+ [0.0.40]: https://github.com/bluepill-rb/bluepill/compare/v0.0.39...v0.0.40
798
+ [0.0.39]: https://github.com/bluepill-rb/bluepill/compare/v0.0.38...v0.0.39
799
+ [0.0.38]: https://github.com/bluepill-rb/bluepill/compare/v0.0.37...v0.0.38
800
+ [0.0.37]: https://github.com/bluepill-rb/bluepill/compare/v0.0.36...v0.0.37
801
+ [0.0.36]: https://github.com/bluepill-rb/bluepill/compare/v0.0.35...v0.0.36
802
+ [0.0.35]: https://github.com/bluepill-rb/bluepill/compare/v0.0.34...v0.0.35
803
+ [0.0.34]: https://github.com/bluepill-rb/bluepill/compare/v0.0.33...v0.0.34
804
+ [0.0.33]: https://github.com/bluepill-rb/bluepill/compare/v0.0.32...v0.0.33
805
+ [0.0.32]: https://github.com/bluepill-rb/bluepill/compare/v0.0.31...v0.0.32
806
+ [0.0.31]: https://github.com/bluepill-rb/bluepill/compare/v0.0.30...v0.0.31
807
+ [0.0.30]: https://github.com/bluepill-rb/bluepill/compare/v0.0.28...v0.0.30
808
+ [0.0.28]: https://github.com/bluepill-rb/bluepill/compare/v0.0.27...v0.0.28
809
+ [0.0.27]: https://github.com/bluepill-rb/bluepill/compare/v0.0.26...v0.0.27
810
+ [0.0.26]: https://github.com/bluepill-rb/bluepill/compare/v0.0.25...v0.0.26
811
+ [0.0.25]: https://github.com/bluepill-rb/bluepill/compare/v0.0.24...v0.0.25
812
+ [0.0.24]: https://github.com/bluepill-rb/bluepill/compare/v0.0.23...v0.0.24
813
+ [0.0.23]: https://github.com/bluepill-rb/bluepill/compare/v0.0.22...v0.0.23
814
+ [0.0.22]: https://github.com/bluepill-rb/bluepill/compare/v0.0.21...v0.0.22
815
+ [0.0.21]: https://github.com/bluepill-rb/bluepill/compare/v0.0.20...v0.0.21
816
+ [0.0.20]: https://github.com/bluepill-rb/bluepill/compare/v0.0.19...v0.0.20
817
+ [0.0.19]: https://github.com/bluepill-rb/bluepill/compare/v0.0.18...v0.0.19
818
+ [0.0.18]: https://github.com/bluepill-rb/bluepill/compare/v0.0.17...v0.0.18
819
+ [0.0.17]: https://github.com/bluepill-rb/bluepill/compare/v0.0.16...v0.0.17
820
+ [0.0.16]: https://github.com/bluepill-rb/bluepill/compare/v0.0.15...v0.0.16
821
+ [0.0.15]: https://github.com/bluepill-rb/bluepill/compare/v0.0.14...v0.0.15
822
+ [0.0.14]: https://github.com/bluepill-rb/bluepill/compare/v0.0.13...v0.0.14
823
+ [0.0.13]: https://github.com/bluepill-rb/bluepill/compare/v0.0.12...v0.0.13
824
+ [0.0.12]: https://github.com/bluepill-rb/bluepill/compare/v0.0.11...v0.0.12
825
+ [0.0.11]: https://github.com/bluepill-rb/bluepill/compare/v0.0.10...v0.0.11
826
+ [0.0.10]: https://github.com/bluepill-rb/bluepill/compare/v0.0.9...v0.0.10
827
+ [0.0.9]: https://github.com/bluepill-rb/bluepill/compare/v0.0.8...v0.0.9
828
+ [0.0.8]: https://github.com/bluepill-rb/bluepill/compare/v0.0.7...v0.0.8
829
+ [0.0.7]: https://github.com/bluepill-rb/bluepill/compare/v0.0.6...v0.0.7
830
+ [0.0.6]: https://github.com/bluepill-rb/bluepill/compare/v0.0.5...v0.0.6
831
+ [0.0.5]: https://github.com/bluepill-rb/bluepill/compare/v0.0.4...v0.0.5
832
+ [0.0.4]: https://github.com/bluepill-rb/bluepill/compare/v0.0.3...v0.0.4
833
+ [0.0.3]: https://github.com/bluepill-rb/bluepill/compare/v0.0.2...v0.0.3
834
+ [0.0.2]: https://github.com/bluepill-rb/bluepill/compare/v0.0.1...v0.0.2
835
+ [0.0.1]: https://github.com/bluepill-rb/bluepill/releases/tag/v0.0.1