capistrano-base_helper 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -2
- data/VERSION +1 -1
- data/capistrano-base_helper.gemspec +2 -2
- data/lib/capistrano/base_helper/monit_base.rb +13 -13
- metadata +3 -3
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Capistrano - Base helpers
|
2
2
|
|
3
|
-
This libary is a helper library for capistrano tasks that setup
|
3
|
+
This libary is a helper library for capistrano tasks that setup [runit](smarden.org/runit/) and [monit](http://mmonit.com/monit) for various services.
|
4
4
|
|
5
5
|
## Services for Monit and Runit
|
6
6
|
|
@@ -83,7 +83,7 @@ See each gem if you want to start/stop each service separate instead of together
|
|
83
83
|
## Assumptions
|
84
84
|
|
85
85
|
There are some assumptions when using this with capistrano.
|
86
|
-
The following variables must be set
|
86
|
+
The following variables must be set
|
87
87
|
|
88
88
|
* _:application_ - The application name
|
89
89
|
* _:user_ - The username which is running the deployed application (usually deploy..)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.9
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "capistrano-base_helper"
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.9"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Leif Ringstad"]
|
12
|
-
s.date = "2013-
|
12
|
+
s.date = "2013-08-01"
|
13
13
|
s.description = "Helpers for capistrano recipes using runit/monit. Currently: capistrano-puma and capistrano-delayed_job"
|
14
14
|
s.email = "leifcr@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# Available services: shared_path/monit/available
|
6
6
|
# Enabled services: shared_path/monit/enabled
|
7
7
|
# Application "global" config: shared_path/monit/application.conf <-- in this: include shared_path/monit/enabled
|
8
|
-
#
|
8
|
+
#
|
9
9
|
# For control of monit, sudo is required, as it always runs as root. (Unfortunately.)
|
10
10
|
#
|
11
11
|
|
@@ -13,7 +13,7 @@ Capistrano::Configuration.instance(true).load do
|
|
13
13
|
_cset :monit_dir, defer { File.join(shared_path, "monit") }
|
14
14
|
_cset :monit_available_path, defer { File.join(monit_dir, "available") }
|
15
15
|
_cset :monit_enabled_path, defer { File.join(monit_dir, "enabled") }
|
16
|
-
_cset :monit_etc_path, File.join("/etc", "monit")
|
16
|
+
_cset :monit_etc_path, File.join("/etc", "monit")
|
17
17
|
_cset :monit_etc_conf_d_path, defer { File.join(monit_etc_path, "conf.d") }
|
18
18
|
_cset :monit_application_group_name, defer { "#{fetch(:user)}_#{fetch(:application)}_#{Capistrano::BaseHelper.environment}" }
|
19
19
|
|
@@ -33,7 +33,7 @@ Capistrano::Configuration.instance(true).load do
|
|
33
33
|
_cset :monit_local_application_conf, File.join(File.expand_path(File.join(File.dirname(__FILE__),"../../../templates", "monit")), "app_include.conf.erb")
|
34
34
|
|
35
35
|
_cset :monit_remote_monitrc, File.join("/etc","monit","monitrc")
|
36
|
-
_cset :monit_remote_application_conf, File.join(fetch(:monit_dir), "monit.conf")
|
36
|
+
_cset :monit_remote_application_conf, defer { File.join(fetch(:monit_dir), "monit.conf") }
|
37
37
|
|
38
38
|
#after "deploy:update", "monit:enable"
|
39
39
|
after "deploy:setup", "monit:setup"
|
@@ -50,7 +50,7 @@ Capistrano::Configuration.instance(true).load do
|
|
50
50
|
|
51
51
|
before "monit:disable", "monit:unmonitor"
|
52
52
|
after "monit:disable", "monit:reload"
|
53
|
-
|
53
|
+
|
54
54
|
before "monit:purge", "monit:unmonitor"
|
55
55
|
|
56
56
|
namespace :monit do
|
@@ -95,7 +95,7 @@ Capistrano::Configuration.instance(true).load do
|
|
95
95
|
# symlink to include file
|
96
96
|
run("[ -h #{symlink} ] || #{sudo} ln -sf #{real_conf} #{symlink}")
|
97
97
|
end
|
98
|
-
|
98
|
+
|
99
99
|
desc "Disable monit services for application"
|
100
100
|
task :disable, :roles => [:app, :db, :web] do
|
101
101
|
symlink = File.join(fetch(:monit_etc_conf_d_path), "#{Capistrano::BaseHelper.user_app_env_underscore}.conf")
|
@@ -104,7 +104,7 @@ Capistrano::Configuration.instance(true).load do
|
|
104
104
|
|
105
105
|
desc "Purge/remove all monit configurations for the application"
|
106
106
|
task :purge, :roles => [:app, :db, :web] do
|
107
|
-
|
107
|
+
symlink = File.join(fetch(:monit_etc_conf_d_path), "#{Capistrano::BaseHelper.user_app_env_underscore}.conf")
|
108
108
|
run("[ ! -h #{symlink} ] || #{sudo} rm -f #{symlink}")
|
109
109
|
run("[ ! -d #{fetch(:monit_dir)} ] || #{sudo} rm -f #{fetch(:monit_dir)}")
|
110
110
|
end
|
@@ -112,17 +112,17 @@ Capistrano::Configuration.instance(true).load do
|
|
112
112
|
desc "Monitor the application"
|
113
113
|
task :monitor, :roles => [:app, :db, :web] do
|
114
114
|
Capistrano::MonitBase::Application::command_monit_group(fetch(:monit_application_group_name), "monitor")
|
115
|
-
end
|
115
|
+
end
|
116
116
|
|
117
117
|
desc "Unmonitor the application"
|
118
118
|
task :unmonitor, :roles => [:app, :db, :web] do
|
119
119
|
Capistrano::MonitBase::Application::command_monit_group(fetch(:monit_application_group_name), "unmonitor")
|
120
|
-
end
|
120
|
+
end
|
121
121
|
|
122
122
|
desc "Stop monitoring the application permanent (Monit saves state)"
|
123
123
|
task :stop, :roles => [:app, :db, :web] do
|
124
124
|
Capistrano::MonitBase::Application::command_monit_group(fetch(:monit_application_group_name), "stop")
|
125
|
-
end
|
125
|
+
end
|
126
126
|
|
127
127
|
desc "Start monitoring the application permanent (Monit saves state)"
|
128
128
|
task :start, :roles => [:app, :db, :web] do
|
@@ -185,8 +185,8 @@ module Capistrano
|
|
185
185
|
##
|
186
186
|
# Command a single monit service
|
187
187
|
#
|
188
|
-
# The service name scheme is recommended to be
|
189
|
-
# "#{user}_#{application}_#{environment}_#{service}"
|
188
|
+
# The service name scheme is recommended to be
|
189
|
+
# "#{user}_#{application}_#{environment}_#{service}"
|
190
190
|
#
|
191
191
|
def command_monit(command, service_name="", arguments="")
|
192
192
|
c = Capistrano::BaseHelper.get_capistrano_instance
|
@@ -198,7 +198,7 @@ module Capistrano
|
|
198
198
|
# The service name is the same as the conf file name for the service.
|
199
199
|
# E.g. puma.conf
|
200
200
|
#
|
201
|
-
# This will symlink the service to enabled service, but not start or reload monit configuration
|
201
|
+
# This will symlink the service to enabled service, but not start or reload monit configuration
|
202
202
|
#
|
203
203
|
def enable(service_conf_filename)
|
204
204
|
c = Capistrano::BaseHelper.get_capistrano_instance
|
@@ -209,7 +209,7 @@ module Capistrano
|
|
209
209
|
c = Capistrano::BaseHelper.get_capistrano_instance
|
210
210
|
c.run("rm -f #{File.join(c.fetch(:monit_enabled_path), service_conf_filename)}")
|
211
211
|
end
|
212
|
-
end
|
212
|
+
end
|
213
213
|
end
|
214
214
|
end
|
215
215
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-base_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-08-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|
@@ -99,7 +99,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
99
99
|
version: '0'
|
100
100
|
segments:
|
101
101
|
- 0
|
102
|
-
hash:
|
102
|
+
hash: 1324722637583950222
|
103
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
104
|
none: false
|
105
105
|
requirements:
|