【发布时间】:2012-01-10 20:50:34
【问题描述】:
我已将 capistrano 配置为跨三台物理服务器进行部署。我想将重新启动任务配置为顺序转到每个服务器并重新启动应用程序,而不是一次转到所有服务器的默认方式。
这是当前的部署任务:
namespace :deploy do
task :start, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && bundle exec unicorn_rails -c #{current_path}/config/unicorn.rb -E #{rails_env} -D"
end
task :stop, :roles => :app, :except => { :no_release => true } do
run "kill `cat #{current_path}/tmp/pids/unicorn.pid`"
end
task :restart, :roles => :app, :except => { :no_release => true } do
stop
sleep(10)
start
end
end
我在想这样的事情:
#this does not work
task :sequential_restart do
find_servers(:roles => :app).each
restart
end
end
有什么想法吗?
【问题讨论】: