retrospring/lib/capistrano/tasks/restart.rake

39 lines
893 B
Ruby
Raw Normal View History

2017-03-29 22:00:47 +02:00
namespace :deploy do
task :start do
on roles(:all) do
puts "------- skip start"
next
2017-03-29 22:00:47 +02:00
rvm_prefix = "#{fetch(:rvm1_auto_script_path)}/rvm-auto.sh #{fetch(:rvm1_ruby_version)}"
execute :tmux, 'new-session',
'-d',
'-s', 'retrospring',
'-n', 'retrospring',
'-c', '/usr/home/justask/apps/retrospring/current',
"'#{rvm_prefix} bundle exec foreman start'"
end
end
task :stop do
on roles(:all) do
puts "------- skip stop"
next
2017-03-29 22:40:40 +02:00
execute :sh, '-c', '\'tmux list-panes -t retrospring -F "#{pane_pid}" | xargs kill\''
2017-03-29 22:00:47 +02:00
end
end
desc 'Restart the server'
task :restart do
on roles(:all) do
puts "------- skip restart"
next
2017-03-29 22:00:47 +02:00
info 'Restarting application server'
invoke('deploy:stop')
2017-04-01 00:09:15 +02:00
info 'Waiting 5 seconds'
sleep 5
2017-03-29 22:00:47 +02:00
invoke('deploy:start')
end
end
end