capistrano3-monit 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e786a0cf2bd866f7bed8e4ba7fd17e767ed1b3bb
4
+ data.tar.gz: 5233747b43f9b83d2253ded1eed363925535d359
5
+ SHA512:
6
+ metadata.gz: 42b30090e9267257f4a1a9e582b84aa1fa44ce8f7ca99ab262626bca1f1b31ce11ed07d33f067da3cf47ea3d7ce2ac17e490d3f475aa54a88c865d848497ab3b
7
+ data.tar.gz: 740c36912620e833fe70c523b810aac31d9c099fc793ba8a7541a2037e0f30ab488ae60b081520accfda51a8ac97ed1753613c92afd6b62e1ab22cc39ce1caf0
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ Gemfile.lock
2
+ *.gem
3
+ /vagrant
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License (MIT)
2
+
3
+ Copyright (c) 2013, Miguel Palhas
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,67 @@
1
+ # Capistrano 3 Monit Wrapper
2
+
3
+ ## Usage
4
+
5
+ Add the gem to your Gemfile
6
+
7
+ gem 'capistrano3-monit', github: 'naps62/capistrano3-monit'
8
+
9
+ Run `bundle` to update your `Gemfile.lock`
10
+ Add the following to your `Capfile`:
11
+
12
+ require 'capistrano/monit'
13
+
14
+ The following tasks will be available to you:
15
+
16
+ monit:status # shows the output of running `monit status` on the server
17
+ monit:start # sends a start signal to all monitored processes
18
+ monit:stop # sends a stop signal to all monitored processes
19
+ monit:restart # sends a restart signal to all monitored processes
20
+
21
+ Additionally, `monit:restart` will automatically be called as a dependency of
22
+ the `deploy:restart` task.
23
+
24
+ Currently, the `start|stop|restart` tasks assume you only want to handle
25
+ monitored processes related to the app being deployed. For this, the name of
26
+ each process should contain the name of the application. For example, if you
27
+ have the following configuration for your production stage:
28
+
29
+ # config/deploy/production.rb
30
+ set :application, 'production'
31
+
32
+ And if `monit:status` returns the following output:
33
+
34
+ Process 'production-puma'
35
+ status Does not exist
36
+ monitoring status Monitored
37
+ data collected Wed, 04 Dec 2013 23:24:51
38
+
39
+ Process 'production-redis'
40
+ status Does not exist
41
+ monitoring status Monitored
42
+ data collected Wed, 04 Dec 2013 23:24:51
43
+
44
+ Process 'staging-puma'
45
+ status Does not exist
46
+ monitoring status Monitored
47
+ data collected Wed, 04 Dec 2013 23:24:51
48
+
49
+ Process 'staging-redis'
50
+ status Does not exist
51
+ monitoring status Monitored
52
+ data collected Wed, 04 Dec 2013 23:24:51
53
+
54
+ Then launching the `monit:start` task will only handle the `production-puma`
55
+ and `production-redis` processes.
56
+
57
+ # TODO
58
+
59
+ * Add tasks to manage the monit service itself
60
+ * Allow a customizable list of processes to manage, instead of making
61
+ assumptions based on their names
62
+
63
+ # Contributing
64
+
65
+ This is a very early work, extracted from a specific project i'm working on.
66
+ If you require a new feature, please open an issue, or preferably, a pull request with
67
+ a proposed implementation
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = "capistrano3-monit"
7
+ gem.version = '0.1.0'
8
+ gem.authors = ["Miguel Palhas"]
9
+ gem.email = ["mpalhas@gmail.com"]
10
+ gem.description = %q{Monit integration for Capistrano 3}
11
+ gem.summary = %q{Monit integration for Capistrano 3}
12
+ gem.homepage = "https://github.com/naps62/capistrano3-monit"
13
+ gem.licenses = ['MIT']
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
+ gem.require_paths = ["lib"]
18
+
19
+ gem.add_dependency 'capistrano', '~> 3.0'
20
+ end
@@ -0,0 +1,2 @@
1
+ load File.expand_path('../tasks/monit.rake', __FILE__)
2
+
@@ -0,0 +1,45 @@
1
+ namespace :monit do
2
+
3
+ desc 'Monit status'
4
+ task :status do
5
+ on roles :app do
6
+ puts capture :sudo, :monit, :status
7
+ end
8
+ end
9
+
10
+ desc 'Start all processes'
11
+ task :start do
12
+ all_processes_do :start
13
+ end
14
+
15
+ desc 'Stop all processes'
16
+ task :stop do
17
+ all_processes_do :stop
18
+ end
19
+
20
+ desc 'Restart all processes'
21
+ task :restart do
22
+ all_processes_do :restart
23
+ end
24
+
25
+ def monit_do(*args)
26
+ on roles :app do
27
+ execute :sudo, :monit, *args
28
+ end
29
+ end
30
+
31
+ def all_processes_do(*args)
32
+ on roles :app do
33
+ output = capture :sudo, :monit, :status
34
+ processes = output.lines.grep(/^Process '/).grep(/#{fetch(:application)}/)
35
+ processes.each do |process|
36
+ process_name = process.split(/\s+/).last.delete "'"
37
+ monit_do :restart, process_name
38
+ end
39
+ end
40
+ end
41
+ end
42
+
43
+ namespace :deploy do
44
+ task :restart => 'monit:restart'
45
+ end
File without changes
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano3-monit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Miguel Palhas
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: capistrano
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ description: Monit integration for Capistrano 3
28
+ email:
29
+ - mpalhas@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - .gitignore
35
+ - Gemfile
36
+ - LICENSE
37
+ - README.md
38
+ - Rakefile
39
+ - capistrano3-monit.gemspec
40
+ - lib/capistrano/monit.rb
41
+ - lib/capistrano/tasks/monit.rake
42
+ - lib/capistrano3-monit.rb
43
+ homepage: https://github.com/naps62/capistrano3-monit
44
+ licenses:
45
+ - MIT
46
+ metadata: {}
47
+ post_install_message:
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubyforge_project:
63
+ rubygems_version: 2.1.11
64
+ signing_key:
65
+ specification_version: 4
66
+ summary: Monit integration for Capistrano 3
67
+ test_files: []
68
+ has_rdoc: