Problem
デプロイ対象のhost数が多い場合、capistranoでデプロイした時に以下のエラーが発生します
$ bundle exec cap production deploy
...
SSHKit::Runner::ExecuteError: Exception while executing on host xxx.xxx.xxx: connection closed by remote host
Solution
段階的にデプロイを実行するように、deploy.rbに以下のコードを追記します
# deploy.rb
module SSHKit
class Coordinator
private
def default_options
{ in: :groups, limit: 5 }
end
end
end
...