Retrospring/lib/capistrano/tasks/restart.rake

33 lines
799 B
Ruby
Raw Normal View History

2017-03-29 13:00:47 -07:00
namespace :deploy do
task :start do
on roles(:all) do
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
2017-03-29 13:40:40 -07:00
execute :sh, '-c', '\'tmux list-panes -t retrospring -F "#{pane_pid}" | xargs kill\''
2017-03-29 13:00:47 -07:00
end
end
desc 'Restart the server'
task :restart do
on roles(:all) do
info 'Restarting application server'
invoke('deploy:stop')
info 'Waiting 2 seconds'
sleep 2
invoke('deploy:start')
end
end
end