The app deploys fine if I want to tolerate downtime from manually stopping and starting unicorn after a deployment. However, I want to use the zero-downtime unicorn settings, but it isn't working because the new unicorn process that starts up is looking at the old deployment release path. Nothing special, simple cap restart in deploy.rb:
desc "Zero-downtime restart of Unicorn"
task :restart, :except => { :no_release => true } do
run "cd #{current_path}; #{try_sudo} kill -s USR2 `cat /var/www/appname/shared/pids/unicorn.pid`"
end
I know that it's looking at the wrong directory because if the views don't change, and if I set keep_releases
to 1 or 2, the unicorn logs will show an error because the directory it's trying to start up in was deleted:
/var/www/appname/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:425:in `chdir': No such file or directory - /var/www/appname/releases/20130330104246 (Errno::ENOENT)
I've been trying to debug this on and off for several weeks now. Any help getting this working is greatly appreciated!