capistrano-base_helper 0.0.5 → 0.0.6
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.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
@@ -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.6"
|
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-07-
|
12
|
+
s.date = "2013-07-08"
|
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 = [
|
@@ -25,7 +25,11 @@ module Capistrano
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def user_app_env_underscore
|
28
|
-
"#{
|
28
|
+
"#{@@capistrano_instance.fetch(:user)}_#{@@capistrano_instance.fetch(:application)}_#{environment}"
|
29
|
+
end
|
30
|
+
|
31
|
+
def user_app_env_underscore_short
|
32
|
+
"#{@@capistrano_instance.fetch(:user)[0...1]}_#{environment[0...1]}_#{@@capistrano_instance.fetch(:application)}"
|
29
33
|
end
|
30
34
|
|
31
35
|
def user_app_env_path
|
@@ -93,7 +97,7 @@ module Capistrano
|
|
93
97
|
@@capistrano_instance.upload temp_file, temp_file, :via => :scp
|
94
98
|
# create any folders required,
|
95
99
|
# move temporary file to remote file
|
96
|
-
@@capistrano_instance.run "#{use_sudo ?
|
100
|
+
@@capistrano_instance.run "#{use_sudo ? @@capistrano_instance.sudo : ""} mkdir -p #{Pathname.new(remote_file).dirname}; #{use_sudo ? "sudo" : ""} mv #{temp_file} #{remote_file}"
|
97
101
|
# remove temp file
|
98
102
|
`rm #{temp_file}`
|
99
103
|
end
|
@@ -115,9 +119,9 @@ module Capistrano
|
|
115
119
|
|
116
120
|
def prepare_path(path, user, group, use_sudo = false)
|
117
121
|
commands = []
|
118
|
-
commands << "#{use_sudo ?
|
119
|
-
commands << "#{use_sudo ?
|
120
|
-
commands << "#{use_sudo ?
|
122
|
+
commands << "#{use_sudo ? @@capistrano_instance.sudo : ""} mkdir -p #{path}"
|
123
|
+
commands << "#{use_sudo ? @@capistrano_instance.sudo : ""} chown #{user}:#{group} #{path} -R"
|
124
|
+
commands << "#{use_sudo ? @@capistrano_instance.sudo : ""} chmod +rw #{path}"
|
121
125
|
@@capistrano_instance.run commands.join(" &&")
|
122
126
|
end
|
123
127
|
|
@@ -1,8 +1,13 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
1
|
+
# Monit Base config
|
2
|
+
# Shared config for all apps that use monit
|
3
|
+
#
|
4
|
+
# Monit service config locations:
|
5
|
+
# Available services: shared_path/monit/available
|
6
|
+
# Enabled services: shared_path/monit/enabled
|
7
|
+
# Application "global" config: shared_path/monit/application.conf <-- in this: include shared_path/monit/enabled
|
8
|
+
#
|
9
|
+
# For control of monit, sudo is required, as it always runs as root. (Unfortunately.)
|
10
|
+
#
|
6
11
|
|
7
12
|
Capistrano::Configuration.instance(true).load do
|
8
13
|
_cset :monit_dir, defer { File.join(shared_path, "monit") }
|
@@ -70,15 +75,15 @@ Capistrano::Configuration.instance(true).load do
|
|
70
75
|
Capistrano::BaseHelper::generate_and_upload_config(fetch(:monit_local_monitrc), fetch(:monit_remote_monitrc), true)
|
71
76
|
|
72
77
|
commands = []
|
73
|
-
commands << "sudo chmod 700 /etc/monit/monitrc"
|
74
|
-
commands << "sudo chown root:root /etc/monit/monitrc"
|
78
|
+
commands << "#{sudo} chmod 700 /etc/monit/monitrc"
|
79
|
+
commands << "#{sudo} chown root:root /etc/monit/monitrc"
|
75
80
|
run commands.join(" && ")
|
76
81
|
# restart monit, as main config is now updated
|
77
|
-
run "sudo service monit restart"
|
82
|
+
run "#{sudo} service monit restart"
|
78
83
|
puts "----------------------------------------"
|
79
|
-
puts "Sleeping for #{(fetch(:monit_daemon_time).to_i + fetch(:monit_start_delay).to_i +
|
84
|
+
puts "Sleeping for #{(fetch(:monit_daemon_time).to_i + fetch(:monit_start_delay).to_i + 10)} seconds to wait for monit to be ready"
|
80
85
|
puts "----------------------------------------"
|
81
|
-
sleep (fetch(:
|
86
|
+
sleep (fetch(:monit_start_delay).to_i + 2)
|
82
87
|
end
|
83
88
|
end
|
84
89
|
|
@@ -87,20 +92,20 @@ Capistrano::Configuration.instance(true).load do
|
|
87
92
|
real_conf = File.join(fetch(:monit_dir), "monit.conf")
|
88
93
|
symlink = File.join(fetch(:monit_etc_conf_d_path), "#{Capistrano::BaseHelper.user_app_env_underscore}.conf")
|
89
94
|
# symlink to include file
|
90
|
-
run("[ -h #{symlink} ] || sudo ln -sf #{real_conf} #{symlink}")
|
95
|
+
run("[ -h #{symlink} ] || #{sudo} ln -sf #{real_conf} #{symlink}")
|
91
96
|
end
|
92
97
|
|
93
98
|
desc "Disable monit services for application"
|
94
99
|
task :disable, :roles => [:app, :db, :web] do
|
95
100
|
symlink = File.join(fetch(:monit_etc_conf_d_path), "#{Capistrano::BaseHelper.user_app_env_underscore}.conf")
|
96
|
-
run("[ ! -h #{symlink} ] || sudo rm -f #{symlink}")
|
101
|
+
run("[ ! -h #{symlink} ] || #{sudo} rm -f #{symlink}")
|
97
102
|
end
|
98
103
|
|
99
104
|
desc "Purge/remove all monit configurations for the application"
|
100
105
|
task :purge, :roles => [:app, :db, :web] do
|
101
106
|
symlink = File.join(fetch(:monit_etc_conf_d_path), "#{Capistrano::BaseHelper.user_app_env_underscore}.conf")
|
102
|
-
run("[ ! -h #{symlink} ] || sudo rm -f #{symlink}")
|
103
|
-
run("[ ! -d #{fetch(:monit_dir)} ] || sudo rm -f #{fetch(:monit_dir)}")
|
107
|
+
run("[ ! -h #{symlink} ] || #{sudo} rm -f #{symlink}")
|
108
|
+
run("[ ! -d #{fetch(:monit_dir)} ] || #{sudo} rm -f #{fetch(:monit_dir)}")
|
104
109
|
end
|
105
110
|
|
106
111
|
desc "Monitor the application"
|
@@ -167,7 +172,8 @@ module Capistrano
|
|
167
172
|
##
|
168
173
|
# Control / Command monit with given arguments
|
169
174
|
def command_monit(command, arguments="")
|
170
|
-
Capistrano::BaseHelper.get_capistrano_instance
|
175
|
+
c = Capistrano::BaseHelper.get_capistrano_instance
|
176
|
+
c.run("#{c.sudo} monit #{arguments} #{command}")
|
171
177
|
end
|
172
178
|
|
173
179
|
end
|
@@ -184,7 +190,7 @@ module Capistrano
|
|
184
190
|
def command_monit(command, service_name="", arguments="")
|
185
191
|
c = Capistrano::BaseHelper.get_capistrano_instance
|
186
192
|
service_name = "#{c.fetch(:user)}_#{c.fetch(:application)}_#{c.fetch(:environment)}_#{c.fetch(:service)}" if service_name == ""
|
187
|
-
c.run("sudo monit #{arguments} #{command} #{service_name}")
|
193
|
+
c.run("#{c.sudo} monit #{arguments} #{command} #{service_name}")
|
188
194
|
end
|
189
195
|
|
190
196
|
##
|
@@ -1,3 +1,9 @@
|
|
1
|
+
# Runit
|
2
|
+
#
|
3
|
+
# Application config and tasks that apply to all services setup with runit for the application
|
4
|
+
#
|
5
|
+
# Recommendation: Everything that should run as either a service or deamon, use runit!
|
6
|
+
|
1
7
|
Capistrano::Configuration.instance(true).load do
|
2
8
|
_cset :runit_dir, defer { "#{shared_path}/runit" }
|
3
9
|
_cset :runit_local_run, File.join(File.expand_path(File.join(File.dirname(__FILE__),"../../../templates")), "runit", "run.erb")
|
@@ -8,6 +14,9 @@ Capistrano::Configuration.instance(true).load do
|
|
8
14
|
_cset :runit_remote_log_run, defer {File.join("/etc", "sv", Capistrano::BaseHelper.user_app_env_path, "log", "run")}
|
9
15
|
_cset :runit_log_user, "syslog"
|
10
16
|
_cset :runit_log_group, "syslog"
|
17
|
+
_cset :runit_restart_interval, 10
|
18
|
+
_cset :runit_restart_count, 7
|
19
|
+
_cset :runit_autorestart_clear_interval, 90
|
11
20
|
|
12
21
|
after "deploy:update", "runit:enable"
|
13
22
|
after "deploy:setup", "runit:setup"
|
@@ -23,7 +32,7 @@ Capistrano::Configuration.instance(true).load do
|
|
23
32
|
|
24
33
|
desc "Disable runit services for application"
|
25
34
|
task :disable, :roles => [:app, :db, :web] do
|
26
|
-
Capistrano::BaseHelper.get_capistrano_instance.run("sudo sv force-stop #{user}_#{application}; true")
|
35
|
+
Capistrano::BaseHelper.get_capistrano_instance.run("#{sudo} sv force-stop #{user}_#{application}; true")
|
27
36
|
Capistrano::RunitBase.app_services_disable(fetch(:application), fetch(:user))
|
28
37
|
end
|
29
38
|
|
@@ -34,7 +43,7 @@ Capistrano::Configuration.instance(true).load do
|
|
34
43
|
|
35
44
|
desc "Purge/remove all runit configurations for the application"
|
36
45
|
task :purge, :roles => [:app, :db, :web] do
|
37
|
-
Capistrano::BaseHelper.get_capistrano_instance.run("sudo sv force-stop #{user}_#{application}; true")
|
46
|
+
Capistrano::BaseHelper.get_capistrano_instance.run("#{sudo} sv force-stop #{user}_#{application}; true")
|
38
47
|
Capistrano::RunitBase.app_services_purge(fetch(:application), fetch(:user))
|
39
48
|
end
|
40
49
|
|
@@ -77,17 +86,17 @@ module Capistrano
|
|
77
86
|
def app_services_create_log_service
|
78
87
|
c = Capistrano::BaseHelper.get_capistrano_instance
|
79
88
|
commands = []
|
80
|
-
commands << "sudo mkdir -p #{File.join("/etc", "sv", Capistrano::BaseHelper.user_app_env_path, "log")}"
|
81
|
-
commands << "sudo chown #{c.fetch(:user)}:root #{File.join("/etc", "sv", Capistrano::BaseHelper.user_app_env_path, "log")}"
|
82
|
-
commands << "sudo mkdir -p '#{File.join("/var", "log", "service", Capistrano::BaseHelper.user_app_env_path, "runit")}'"
|
83
|
-
commands << "sudo chown -R #{c.fetch(:runit_log_user)}:#{c.fetch(:runit_log_group)} '#{File.join("/var", "log", "service", Capistrano::BaseHelper.user_app_env_path, "runit")}'"
|
89
|
+
commands << "#{c.sudo} mkdir -p #{File.join("/etc", "sv", Capistrano::BaseHelper.user_app_env_path, "log")}"
|
90
|
+
commands << "#{c.sudo} chown #{c.fetch(:user)}:root #{File.join("/etc", "sv", Capistrano::BaseHelper.user_app_env_path, "log")}"
|
91
|
+
commands << "#{c.sudo} mkdir -p '#{File.join("/var", "log", "service", Capistrano::BaseHelper.user_app_env_path, "runit")}'"
|
92
|
+
commands << "#{c.sudo} chown -R #{c.fetch(:runit_log_user)}:#{c.fetch(:runit_log_group)} '#{File.join("/var", "log", "service", Capistrano::BaseHelper.user_app_env_path, "runit")}'"
|
84
93
|
|
85
94
|
c.run(commands.join(" && "))
|
86
95
|
Capistrano::BaseHelper.generate_and_upload_config( c.fetch(:runit_local_log_run), c.fetch(:runit_remote_log_run), true )
|
87
96
|
commands = []
|
88
|
-
commands << "sudo chmod u+x '#{File.join("/etc", "sv", Capistrano::BaseHelper.user_app_env_path, "log", "run")}'"
|
89
|
-
commands << "sudo chmod g+x '#{File.join("/etc", "sv", Capistrano::BaseHelper.user_app_env_path, "log", "run")}'"
|
90
|
-
commands << "sudo chown #{c.fetch(:user)}:root '#{File.join("/etc", "sv", Capistrano::BaseHelper.user_app_env_path, "log", "run")}'"
|
97
|
+
commands << "#{c.sudo} chmod u+x '#{File.join("/etc", "sv", Capistrano::BaseHelper.user_app_env_path, "log", "run")}'"
|
98
|
+
commands << "#{c.sudo} chmod g+x '#{File.join("/etc", "sv", Capistrano::BaseHelper.user_app_env_path, "log", "run")}'"
|
99
|
+
commands << "#{c.sudo} chown #{c.fetch(:user)}:root '#{File.join("/etc", "sv", Capistrano::BaseHelper.user_app_env_path, "log", "run")}'"
|
91
100
|
c.run(commands.join(" && "))
|
92
101
|
end
|
93
102
|
|
@@ -96,41 +105,44 @@ module Capistrano
|
|
96
105
|
def app_services_create
|
97
106
|
# SEE http://off-the-stack.moorman.nu/posts/5-user-services-with-runit/ for info on scripts
|
98
107
|
c = Capistrano::BaseHelper.get_capistrano_instance
|
99
|
-
c.run("sudo mkdir -p '#{File.join("/etc", "sv", Capistrano::BaseHelper.user_app_env_path)}'")
|
108
|
+
c.run("#{c.sudo} mkdir -p '#{File.join("/etc", "sv", Capistrano::BaseHelper.user_app_env_path)}'")
|
100
109
|
|
101
110
|
commands = []
|
102
|
-
commands << "sudo chown #{c.fetch(:user)}:root /etc/sv/#{c.fetch(:user)}"
|
103
|
-
commands << "sudo chown #{c.fetch(:user)}:root /etc/sv/#{Capistrano::BaseHelper.user_app_env_path}"
|
111
|
+
commands << "#{c.sudo} chown #{c.fetch(:user)}:root /etc/sv/#{c.fetch(:user)}"
|
112
|
+
commands << "#{c.sudo} chown #{c.fetch(:user)}:root /etc/sv/#{Capistrano::BaseHelper.user_app_env_path}"
|
104
113
|
c.run(commands.join(" && "))
|
105
114
|
Capistrano::BaseHelper.generate_and_upload_config( Capistrano::BaseHelper::get_capistrano_instance.fetch(:runit_local_run), Capistrano::BaseHelper::get_capistrano_instance.fetch(:runit_remote_run), true )
|
106
115
|
Capistrano::BaseHelper.generate_and_upload_config( Capistrano::BaseHelper::get_capistrano_instance.fetch(:runit_local_finish), Capistrano::BaseHelper::get_capistrano_instance.fetch(:runit_remote_finish), true )
|
107
116
|
|
108
117
|
commands = []
|
109
|
-
commands << "sudo chmod u+x '#{File.join("/etc", "sv", Capistrano::BaseHelper.user_app_env_path, "run")}'"
|
110
|
-
commands << "sudo chmod u+x '#{File.join("/etc", "sv", Capistrano::BaseHelper.user_app_env_path, "finish")}'"
|
111
|
-
commands << "sudo chmod g+x '#{File.join("/etc", "sv", Capistrano::BaseHelper.user_app_env_path, "run")}'"
|
112
|
-
commands << "sudo chmod g+x '#{File.join("/etc", "sv", Capistrano::BaseHelper.user_app_env_path, "finish")}'"
|
113
|
-
commands << "sudo chown #{c.fetch(:user)}:root '#{File.join("/etc", "sv", Capistrano::BaseHelper.user_app_env_path, "run")}'"
|
114
|
-
commands << "sudo chown #{c.fetch(:user)}:root '#{File.join("/etc", "sv", Capistrano::BaseHelper.user_app_env_path, "finish")}'"
|
118
|
+
commands << "#{c.sudo} chmod u+x '#{File.join("/etc", "sv", Capistrano::BaseHelper.user_app_env_path, "run")}'"
|
119
|
+
commands << "#{c.sudo} chmod u+x '#{File.join("/etc", "sv", Capistrano::BaseHelper.user_app_env_path, "finish")}'"
|
120
|
+
commands << "#{c.sudo} chmod g+x '#{File.join("/etc", "sv", Capistrano::BaseHelper.user_app_env_path, "run")}'"
|
121
|
+
commands << "#{c.sudo} chmod g+x '#{File.join("/etc", "sv", Capistrano::BaseHelper.user_app_env_path, "finish")}'"
|
122
|
+
commands << "#{c.sudo} chown #{c.fetch(:user)}:root '#{File.join("/etc", "sv", Capistrano::BaseHelper.user_app_env_path, "run")}'"
|
123
|
+
commands << "#{c.sudo} chown #{c.fetch(:user)}:root '#{File.join("/etc", "sv", Capistrano::BaseHelper.user_app_env_path, "finish")}'"
|
115
124
|
c.run(commands.join(" && "))
|
116
125
|
|
117
126
|
Capistrano::RunitBase.app_services_create_log_service
|
118
127
|
end
|
119
128
|
|
120
129
|
def app_services_enable(application, user)
|
121
|
-
|
130
|
+
c = Capistrano::BaseHelper.get_capistrano_instance
|
131
|
+
Capistrano::BaseHelper.get_capistrano_instance.run("[ -h /etc/service/#{user}_#{application}_#{Capistrano::BaseHelper.environment} ] || #{c.sudo} ln -sf /etc/sv/#{Capistrano::BaseHelper.user_app_env_path} /etc/service/#{user}_#{application}_#{Capistrano::BaseHelper.environment}")
|
122
132
|
end
|
123
133
|
|
124
134
|
def app_services_disable(application, user)
|
125
|
-
|
135
|
+
c = Capistrano::BaseHelper.get_capistrano_instance
|
136
|
+
Capistrano::BaseHelper.get_capistrano_instance.run("[ ! -h /etc/service/#{user}_#{application}_#{Capistrano::BaseHelper.environment} ] || #{c.sudo} rm -f /etc/service/#{user}_#{application}_#{Capistrano::BaseHelper.environment}")
|
126
137
|
end
|
127
138
|
|
128
139
|
def app_services_purge(application, user)
|
129
140
|
# this should stop ALL services running for the given application
|
130
141
|
# true is appended to ignore any errors failing to stop the services
|
142
|
+
c = Capistrano::BaseHelper.get_capistrano_instance
|
131
143
|
commands = []
|
132
|
-
commands << "sudo rm -f /etc/service/#{user}_#{application}_#{Capistrano::BaseHelper.environment}"
|
133
|
-
commands << "sudo rm -rf /etc/sv/#{Capistrano::BaseHelper.user_app_env_path}"
|
144
|
+
commands << "#{c.sudo} rm -f /etc/service/#{user}_#{application}_#{Capistrano::BaseHelper.environment}"
|
145
|
+
commands << "#{c.sudo} rm -rf /etc/sv/#{Capistrano::BaseHelper.user_app_env_path}"
|
134
146
|
Capistrano::BaseHelper.get_capistrano_instance.run(commands.join(" && "))
|
135
147
|
end
|
136
148
|
|
@@ -147,7 +159,8 @@ module Capistrano
|
|
147
159
|
end
|
148
160
|
|
149
161
|
def app_services_control(application, user, command, ignore_error = false)
|
150
|
-
Capistrano::BaseHelper.get_capistrano_instance
|
162
|
+
c = Capistrano::BaseHelper.get_capistrano_instance
|
163
|
+
Capistrano::BaseHelper.get_capistrano_instance.run("[ ! -h /etc/service/#{user}_#{application}_#{Capistrano::BaseHelper.environment} ] || #{c.sudo} sv #{command} #{user}_#{application}_#{Capistrano::BaseHelper.environment}; #{"true" if ignore_error != false}")
|
151
164
|
end
|
152
165
|
|
153
166
|
# END - ALL services functions (functions that affects all services for the app)
|
@@ -185,9 +198,9 @@ module Capistrano
|
|
185
198
|
Capistrano::BaseHelper.get_capistrano_instance.run("[ ! -h #{service_path(service_name)}/run ] || rm -f #{service_path(service_name)}/run && rm -f #{service_path(service_name)}/finish")
|
186
199
|
end
|
187
200
|
|
188
|
-
def enable_service(service_name
|
201
|
+
def enable_service(service_name)
|
189
202
|
Capistrano::BaseHelper.get_capistrano_instance.run("cd #{service_path(service_name)} && [ -h ./run ] || ln -sf #{remote_run_config_path(service_name)} ./run")
|
190
|
-
Capistrano::BaseHelper.get_capistrano_instance.run("cd #{service_path(service_name)} && [ -h ./finish ] || ln -sf #{remote_finish_config_path(service_name)} ./finish")
|
203
|
+
Capistrano::BaseHelper.get_capistrano_instance.run("cd #{service_path(service_name)} && [ -h ./finish ] || ln -sf #{remote_finish_config_path(service_name)} ./finish")
|
191
204
|
end
|
192
205
|
|
193
206
|
def purge_service(service_name)
|
@@ -220,6 +233,10 @@ module Capistrano
|
|
220
233
|
commands << "chmod u+x #{Capistrano::RunitBase.remote_run_config_path(service_name)}"
|
221
234
|
commands << "chmod g+x #{Capistrano::RunitBase.remote_run_config_path(service_name)}"
|
222
235
|
end
|
236
|
+
if Capistrano::BaseHelper::remote_file_exists?(Capistrano::RunitBase.remote_finish_config_path(service_name))
|
237
|
+
commands << "chmod u+x #{Capistrano::RunitBase.remote_finish_config_path(service_name)}"
|
238
|
+
commands << "chmod g+x #{Capistrano::RunitBase.remote_finish_config_path(service_name)}"
|
239
|
+
end
|
223
240
|
if Capistrano::BaseHelper::remote_file_exists?(Capistrano::RunitBase.remote_service_log_run_path(service_name))
|
224
241
|
commands << "chmod u+x #{Capistrano::RunitBase.remote_service_log_run_path(service_name)}"
|
225
242
|
commands << "chmod g+x #{Capistrano::RunitBase.remote_service_log_run_path(service_name)}"
|
@@ -236,12 +253,13 @@ module Capistrano
|
|
236
253
|
def create_and_permissions_on_path(log_path, user = nil, group = nil)
|
237
254
|
user = Capistrano::BaseHelper.get_capistrano_instance.fetch(:user) if user.nil?
|
238
255
|
group = "syslog" if group.nil?
|
256
|
+
c = Capistrano::BaseHelper.get_capistrano_instance
|
239
257
|
# will use sudo
|
240
258
|
commands = []
|
241
|
-
commands << "sudo mkdir -p #{log_path}"
|
242
|
-
commands << "sudo chown -R #{user}:#{group} #{log_path}"
|
243
|
-
commands << "sudo chmod u+w #{log_path}"
|
244
|
-
commands << "sudo chmod g+w #{log_path}"
|
259
|
+
commands << "#{c.sudo} mkdir -p #{log_path}"
|
260
|
+
commands << "#{c.sudo} chown -R #{user}:#{group} #{log_path}"
|
261
|
+
commands << "#{c.sudo} chmod u+w #{log_path}"
|
262
|
+
commands << "#{c.sudo} chmod g+w #{log_path}"
|
245
263
|
Capistrano::BaseHelper.get_capistrano_instance.run commands.join(" && ")
|
246
264
|
end
|
247
265
|
|
data/templates/runit/finish.erb
CHANGED
@@ -2,5 +2,12 @@
|
|
2
2
|
# <% c = Capistrano::BaseHelper::get_capistrano_instance %>
|
3
3
|
# Finish/quit services for <%= c.fetch(:application) %> as <%= c.fetch(:user) %> in env <%= Capistrano::BaseHelper.environment %>
|
4
4
|
#
|
5
|
+
# Announce termination
|
6
|
+
#
|
7
|
+
echo "Stopping all services for <%= c.fetch(:application) %> running as <%= c.fetch(:user) %>"
|
8
|
+
|
9
|
+
# Force all services to stop
|
5
10
|
sv -w600 force-stop '<%= c.fetch(:runit_dir) %>/*'
|
11
|
+
|
12
|
+
# "Exit" all services
|
6
13
|
sv exit '<%= c.fetch(:runit_dir) %>/*'
|
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.6
|
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-07-
|
12
|
+
date: 2013-07-08 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: 1132387968025362262
|
103
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
104
|
none: false
|
105
105
|
requirements:
|