eye-patch 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +108 -3
- data/bin/eye-patch-loader +1 -1
- data/lib/eye/patch/capistrano.rb +4 -2
- data/lib/eye/patch/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ae126b1cd5336f830562e4756fb68111736ed76
|
4
|
+
data.tar.gz: 955a4abc5019da4ae7c6b23dcb026b015cecf2ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51f2bf68434eda7600d629de9d5a8a03e3f125aeb94d3dd88a1797bb1d1d69db2adc10760caacd5b362e5a5c338a32d319a05e11248a3b0d7b3608e5b22268d0
|
7
|
+
data.tar.gz: c92bcd94ef883581a97107430d54ece4aa39e584250ba3c47d4a9526665a0518bd59b7f27518e1f87d02620cb32956337aecfe553ef3103ac72edea2fdd73de3
|
data/README.md
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
# Eye::Patch
|
2
2
|
|
3
|
-
|
3
|
+
`Eye::Patch` is a wrapper for the fantastic [`eye`](https://github.com/kostya/eye) process monitoring gem, with support for parsing yaml configuration files and capistrano deploys.
|
4
|
+
|
5
|
+
The goal of this gem is to make eye process monitoring easier to set up, manage, and deploy for large applications.
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
Add this line to your application's Gemfile:
|
8
10
|
|
9
|
-
gem
|
11
|
+
gem "eye-patch"
|
10
12
|
|
11
13
|
And then execute:
|
12
14
|
|
@@ -18,7 +20,105 @@ Or install it yourself as:
|
|
18
20
|
|
19
21
|
## Usage
|
20
22
|
|
21
|
-
|
23
|
+
### Configuration
|
24
|
+
|
25
|
+
`Eye::Patch` overrides `eye`'s built-in DSL to allow your eye application to be configured in a structured YAML file.
|
26
|
+
|
27
|
+
#### Notifications
|
28
|
+
|
29
|
+
`Eye::Patch` forgoes granular process-level notification in favor of setting up application-wide notifications for different reporting levels. The following configuration will send all error notifications to the described contact via Amazon's SES service.
|
30
|
+
|
31
|
+
notifications:
|
32
|
+
- name: admin
|
33
|
+
type: ses
|
34
|
+
level: error
|
35
|
+
contact: test+admin@example.com
|
36
|
+
config:
|
37
|
+
from: eye+notifications@example.com
|
38
|
+
access_key_id: Your+AWS+Access+Key+ID
|
39
|
+
secret_access_key: Your+AWS+Secret+Access+Key
|
40
|
+
|
41
|
+
Note that SES support will only be provided if the [`aws-ses`](https://github.com/drewblas/aws-ses) gem is available on the system.
|
42
|
+
|
43
|
+
#### Triggers/Checks
|
44
|
+
|
45
|
+
Triggers and checks are set up much like `eye`'s basic DSL. All trigger and check types available in `eye` are supported.
|
46
|
+
|
47
|
+
triggers:
|
48
|
+
- name: flapping
|
49
|
+
config:
|
50
|
+
times: 10
|
51
|
+
within: 1 minute
|
52
|
+
|
53
|
+
checks:
|
54
|
+
- name: memory
|
55
|
+
config:
|
56
|
+
times: 3
|
57
|
+
every: 20 seconds
|
58
|
+
below: 1.5 gigabytes
|
59
|
+
|
60
|
+
Note that memory and duration values are written in plain english. See `lib/eye/patch/value_parser.rb` for the regular expressions used to parse these values into usable numbers.
|
61
|
+
|
62
|
+
#### Processes
|
63
|
+
|
64
|
+
`Eye::Patch` uses the same conventions as `eye` for basic process configuration.
|
65
|
+
|
66
|
+
processes:
|
67
|
+
- name: my-process
|
68
|
+
config:
|
69
|
+
start_command: bundle exec my-process
|
70
|
+
pid_file: tmp/pids/my-process.pid
|
71
|
+
|
72
|
+
Processes will inherit all configurations from the main application. All process options supported by `eye` are available by using the appropriate key in the `config` block.
|
73
|
+
|
74
|
+
##### Grouping
|
75
|
+
|
76
|
+
Rather than using the `eye` DSL's nesting approaching to setting up processes within groups, `Eye::Patch` simply needs a `group` attribute to be added to the process definition.
|
77
|
+
|
78
|
+
processes:
|
79
|
+
- name: my-grouped-process
|
80
|
+
group: my-group
|
81
|
+
config:
|
82
|
+
...
|
83
|
+
|
84
|
+
All processes sharing a group name will be grouped together when the configuration is loaded.
|
85
|
+
|
86
|
+
##### Copying
|
87
|
+
|
88
|
+
On occasion, it's desirable to spin up multiple copies of a process with the same configuration. `Eye::Patch` offers a shorthand for this setup with the `count` attribute.
|
89
|
+
|
90
|
+
processes:
|
91
|
+
- name: my-copied-process
|
92
|
+
count: 3
|
93
|
+
config:
|
94
|
+
start_command: bundle exec my-copied-process
|
95
|
+
pid_file: "copied-process-{ID}.pid"
|
96
|
+
|
97
|
+
The above configuration will spin up a number of processes equal to `count`, resulting in the following monitored processes:
|
98
|
+
|
99
|
+
my-copied-process-0 <copied-process-0.pid>
|
100
|
+
my-copied-process-1 <copied-process-1.pid>
|
101
|
+
my-copied-process-2 <copied-process-2.pid>
|
102
|
+
|
103
|
+
This approach pairs well with the `daemonize: true` option, as `eye` will have control over the creation and management of the enumerated PID files.
|
104
|
+
|
105
|
+
### Running Locally
|
106
|
+
|
107
|
+
You can test your configurations locally by running the `eye-patch` binary like so:
|
108
|
+
|
109
|
+
bundle exec eye-patch l config/eye.yml
|
110
|
+
|
111
|
+
The `eye-patch` binary wraps the `eye` CLI, with some tweaks to insert `Eye::Patch` as the config file parser.
|
112
|
+
|
113
|
+
### Deploying
|
114
|
+
|
115
|
+
`Eye::Patch` has built-in support for capistrano deploys. Include the following in your `deploy.rb` file:
|
116
|
+
|
117
|
+
require "eye/patch/capistrano"
|
118
|
+
|
119
|
+
For standard capistrano deployments with bundler, this should be enough. If you aren't using bundler, or your deploy process is more complicated, you may need to tweak the default binary locations or callback ordering.
|
120
|
+
|
121
|
+
See `lib/eye/patch/capistrano.rb` for a list of available configuration options.
|
22
122
|
|
23
123
|
## Contributing
|
24
124
|
|
@@ -27,3 +127,8 @@ TODO: Write usage instructions here
|
|
27
127
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
128
|
4. Push to the branch (`git push origin my-new-feature`)
|
29
129
|
5. Create new Pull Request
|
130
|
+
|
131
|
+
## Coming Soon
|
132
|
+
|
133
|
+
- Proper support for per-process triggers and checks.
|
134
|
+
- Process templates for commonly-used libraries (unicorn, sidekiq, delayed_jobs).
|
data/bin/eye-patch-loader
CHANGED
data/lib/eye/patch/capistrano.rb
CHANGED
@@ -7,14 +7,14 @@ Capistrano::Configuration.instance.load do
|
|
7
7
|
|
8
8
|
if fetch(:eye_default_hooks)
|
9
9
|
after "deploy:stop", "eye:stop"
|
10
|
-
after "deploy:start", "eye:
|
10
|
+
after "deploy:start", "eye:load"
|
11
11
|
before "deploy:restart", "eye:restart"
|
12
12
|
end
|
13
13
|
|
14
14
|
namespace :eye do
|
15
15
|
|
16
16
|
desc "Start eye with the desired configuration file"
|
17
|
-
task :
|
17
|
+
task :load, roles: -> { fetch(:eye_roles) } do
|
18
18
|
run "cd #{current_path} && #{fetch(:eye_bin)} l #{fetch(:eye_config)}"
|
19
19
|
end
|
20
20
|
|
@@ -28,4 +28,6 @@ Capistrano::Configuration.instance.load do
|
|
28
28
|
run "cd #{current_path} && #{fetch(:eye_bin)} r all"
|
29
29
|
end
|
30
30
|
end
|
31
|
+
|
32
|
+
before "eye:restart", "eye:load"
|
31
33
|
end
|
data/lib/eye/patch/version.rb
CHANGED