Commit acee972a by Andrew Babichev

Hook monit tasks to deploy flow explicitly

parent 97c2a601
namespace :load do namespace :load do
task :defaults do task :defaults do
set :sneakers_monit_default_hooks, true
set :sneakers_monit_conf_dir, -> { '/etc/monit/conf.d' } set :sneakers_monit_conf_dir, -> { '/etc/monit/conf.d' }
set :sneakers_monit_use_sudo, true set :sneakers_monit_use_sudo, true
set :sneakers_monit_bin, '/usr/bin/monit' set :sneakers_monit_bin, '/usr/bin/monit'
...@@ -7,8 +8,21 @@ namespace :load do ...@@ -7,8 +8,21 @@ namespace :load do
end end
end end
namespace :deploy do
before :starting, :check_sidekiq_monit_hooks do
if fetch(:sneakers_default_hooks) && fetch(:sneakers_monit_default_hooks)
invoke 'sneakers:monit:add_default_hooks'
end
end
end
namespace :sneakers do namespace :sneakers do
namespace :monit do namespace :monit do
task :add_default_hooks do
before 'deploy:updating', 'sneakers:monit:unmonitor'
after 'deploy:published', 'sneakers:monit:monitor'
end
desc 'Config Sneakers monit-service' desc 'Config Sneakers monit-service'
task :config do task :config do
on roles(fetch(:sneakers_role)) do |role| on roles(fetch(:sneakers_role)) do |role|
...@@ -57,9 +71,6 @@ namespace :sneakers do ...@@ -57,9 +71,6 @@ namespace :sneakers do
end end
end end
before 'deploy:updating', 'sneakers:monit:unmonitor'
after 'deploy:published', 'sneakers:monit:monitor'
def sneakers_service_name def sneakers_service_name
fetch(:sneakers_service_name, "sneakers_#{fetch(:application)}_#{fetch(:sneakers_env)}") fetch(:sneakers_service_name, "sneakers_#{fetch(:application)}_#{fetch(:sneakers_env)}")
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment