Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Capistrano Deploy Timeout

Alright, so, I've looked around on the web and it doesn't really look like a lot of other people have this issue, but maybe something else is wrong with what we're doing.

I've mananged to distill it down to what I think is a useful test case:

config/deploy.rb:

## Excerpt
task :big_delay, :roles => :web do
  run "sleep 480"
  run "echo Meow Meow Meow"
end 

And stupid_script.sh:

#!/bin/sh
ssh foo 'sleep 480; echo Meow Meow Meow'

Where foo is the name of the same server we deploy to.

When I run both of these it should connect to the other box, do nothing for 8 minutes, then spit out some useless text and complete.

The stupid_script works, and the cap task fails. I see the remote command finish with ps xf, but cap doesn't seem to notice anymore. If the sleep is 20 instead of 240, the cap task works fine.

Obviously this task is super useless, but we do have expensive things run on deploy that trigger this, and I've made this to rule out any blame on ssh.

Another data point, if we ssh into the box and put the code there and then run cap deploy from there, then it works fine.

So... there seems to be some weird interplay going on between ssh and capistrano. Thoughts?

like image 968
psycotica0 Avatar asked Jul 19 '12 22:07

psycotica0


1 Answers

Set ClientAliveInterval and ClientAliveCountMax in /etc/ssh/sshd_config on the server as choover suggests. I had the exact same issue with "assets:precompile" on my deploy until I made that change.

like image 85
Kris Braun Avatar answered Oct 15 '22 17:10

Kris Braun