capistrano-monstart 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: 6d92fc0079c5c0bc4af425f44c4ff57f7452d225
4
+ data.tar.gz: 634866428fcf9e1959689fec6b90b255c04548b4
5
+ SHA512:
6
+ metadata.gz: fe85b3e09b5f7794039ef488a220536cbb8ffbd214a590f1fcec727c6c8081b044dde783d3c6f0628be11176302a0bff82a89829104d89932b851b41ccfee31f
7
+ data.tar.gz: 371f04a9259a13c150afcc1f9f70a24098a82a691b6828d05d312bf1fa50d3197a6196ca776a6de47bc9a36eb54d02cc6d658677a31ef3661113d9461d5d55e3
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-monstart.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 m4rCsi
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 all
13
+ 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 THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # Capistrano::Monstart
2
+
3
+ ## Installation
4
+
5
+ Add this line to your application's Gemfile:
6
+
7
+ ```ruby
8
+ gem 'capistrano-monstart'
9
+ ```
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install capistrano-monstart
18
+
19
+ ## Usage
20
+
21
+ tba
22
+
23
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,24 @@
1
+ lib = File.expand_path('../lib',__FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'capistrano/monstart/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'capistrano-monstart'
7
+ s.version = Capistrano::Monstart::VERSION
8
+ s.summary = "capistrano plugin which converts foreman procfile to monit and upstart"
9
+ s.description = "capistrano plugin which converts foreman procfile to monit and upstart"
10
+ s.authors = ["Marc Siegenthaler"]
11
+ s.email = 'shin@marcsi.ch'
12
+ s.files = `git ls-files`.split($/)
13
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
14
+ s.require_paths = ["lib"]
15
+ s.homepage =
16
+ 'https://github.com/m4rCsi/capistrano-monstart'
17
+ s.license = 'MIT'
18
+
19
+ s.required_ruby_version = '>= 1.9.3'
20
+ s.add_dependency 'capistrano', '~> 3.4'
21
+ s.add_dependency 'capistrano-templ', '~> 0.1.0'
22
+ s.add_dependency 'foreman', '~> 0.78'
23
+ end
24
+
File without changes
@@ -0,0 +1,12 @@
1
+ require 'capistrano/templ'
2
+
3
+ module Capistrano
4
+ module Monstart
5
+ end
6
+ end
7
+
8
+ require 'capistrano/monstart/foreman'
9
+
10
+ # Load Tasks
11
+ load File.expand_path('../monstart/tasks/monstart.cap', __FILE__)
12
+ load File.expand_path('../monstart/tasks/monit.cap', __FILE__)
@@ -0,0 +1,17 @@
1
+ require 'foreman/engine'
2
+
3
+ module Capistrano
4
+ module Monstart
5
+ class Procs
6
+ def initialize(procfile)
7
+ @foreman = Foreman::Engine.new()
8
+ @foreman.load_procfile(procfile)
9
+ end
10
+
11
+ def procs
12
+ return @foreman
13
+ end
14
+ end
15
+ end
16
+ end
17
+
@@ -0,0 +1,17 @@
1
+ namespace :monit do
2
+ desc "Install Monit"
3
+ task :installl do
4
+ on roles :all do
5
+ execute :sudo, "yum -y install monit"
6
+ end
7
+ end
8
+
9
+ %w[start stop restart reload status].each do |command|
10
+ desc "Run Monit #{command} script"
11
+ task command do
12
+ on roles :all do
13
+ execute :sudo, "service monit #{command}"
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,52 @@
1
+ namespace :load do
2
+ task :defaults do
3
+ set :monstart_procfile, -> { Dir.pwd + "/Procfile" }
4
+ end
5
+ end
6
+
7
+ namespace :monstart do
8
+ desc "sets up monstart files"
9
+ task :setup do
10
+ on roles :all do
11
+ procs = Capistrano::Monstart::Procs.new(fetch(:monstart_procfile))
12
+ procs.procs.each_process do |n, process|
13
+ name = fetch(:application) + "-#{n}"
14
+ exe = process.command
15
+
16
+ d = {
17
+ current_path: current_path,
18
+ pidfile: "/var/run/#{name}.pid",
19
+ name: name,
20
+ wrapper: fetch(:rvm1_alias_name),
21
+ exe: exe
22
+ }
23
+
24
+ template File.expand_path("../templates/upstart.conf.erb", File.dirname(__FILE__)), "/etc/init/#{name}.conf", d
25
+ template File.expand_path("../templates/monit.erb", File.dirname(__FILE__)), "/etc/monit.d/#{name}", d
26
+ end
27
+ end
28
+ end
29
+
30
+ task :restart do
31
+ on roles :all do
32
+ procs = Capistrano::Monstart::Procs.new(fetch(:monstart_procfile))
33
+ procs.procs.each_process do |n, process|
34
+ name = fetch(:application) + "-#{n}"
35
+
36
+ execute :sudo, :monit, :restart, name
37
+ end
38
+ end
39
+ end
40
+
41
+ task :summary do
42
+ on roles :all do
43
+ puts capture :sudo, :monit, :summary
44
+ end
45
+ end
46
+
47
+ task :status do
48
+ on roles :all do
49
+ puts capture :sudo, :monit, :status
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,4 @@
1
+ check process <%= name %> with pidfile "<%= pidfile %>"
2
+ start program = "/sbin/start <%= name %>"
3
+ stop program = "/sbin/stop <%= name %>"
4
+ if 5 restarts within 5 cycles then timeout
@@ -0,0 +1,14 @@
1
+ description "<%= name %>"
2
+
3
+ start on runlevel [2345]
4
+ stop on runlevel[!2345]
5
+
6
+ script
7
+ cd <%= current_path %>
8
+ echo $$ > <%= pidfile %>
9
+ exec su -s /bin/sh -c "/home/<%= user %>/.rvm/wrappers/<%= wrapper %>/bundle exec <%= exe %>" <%= user %>
10
+ end script
11
+
12
+ pre-stop script
13
+ rm <%= pidfile %>
14
+ end script
@@ -0,0 +1,5 @@
1
+ module Capistrano
2
+ module Monstart
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-monstart
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Marc Siegenthaler
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-08 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.4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: capistrano-templ
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.1.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.1.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: foreman
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.78'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.78'
55
+ description: capistrano plugin which converts foreman procfile to monit and upstart
56
+ email: shin@marcsi.ch
57
+ executables: []
58
+ extensions: []
59
+ extra_rdoc_files: []
60
+ files:
61
+ - ".gitignore"
62
+ - Gemfile
63
+ - LICENSE
64
+ - README.md
65
+ - Rakefile
66
+ - capistrano-monstart.gemspec
67
+ - lib/capistrano-monstart.rb
68
+ - lib/capistrano/monstart.rb
69
+ - lib/capistrano/monstart/foreman.rb
70
+ - lib/capistrano/monstart/tasks/monit.cap
71
+ - lib/capistrano/monstart/tasks/monstart.cap
72
+ - lib/capistrano/monstart/templates/monit.erb
73
+ - lib/capistrano/monstart/templates/upstart.conf.erb
74
+ - lib/capistrano/monstart/version.rb
75
+ homepage: https://github.com/m4rCsi/capistrano-monstart
76
+ licenses:
77
+ - MIT
78
+ metadata: {}
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: 1.9.3
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ requirements: []
94
+ rubyforge_project:
95
+ rubygems_version: 2.4.5
96
+ signing_key:
97
+ specification_version: 4
98
+ summary: capistrano plugin which converts foreman procfile to monit and upstart
99
+ test_files: []