cantonic
cantonic

Reputation: 1033

Capistrano: "cap deploy" doesn't take effect when deploying a Rails application

I am deploying my rails application using Capistrano. Once I have made changes to my app I do "cap deploy" and it seems working properly, but changes don't take effect. I always have to do "cap deploy:stop" and "cap deploy:start" and then everything is fine. So I guess it has to do with "cap deploy:restart" which is run when deploying changes.

here is my deploy.rb: deploy.rb gist

Hope that someone can help.

Thank you in advance

Upvotes: 2

Views: 633

Answers (2)

iltempo
iltempo

Reputation: 16012

Just noticed in line (105) in your gist

task :restart, :except => { :no_release => true } do
  if File.exist?("/tmp/unicorn.example.pid")
    run "kill -s USR2 `cat /tmp/unicorn.example.pid`"
  end
end

that you are testing for the pid file existence on your local machine. Instead you should do that on your server. Try changing it to

task :restart, :except => { :no_release => true } do
  run "test -f /tmp/unicorn.example.pid && kill -s USR2 `cat /tmp/unicorn.example.pid`"
end

But remember that it still fails silently if the pid file is missing.

Upvotes: 1

iltempo
iltempo

Reputation: 16012

If you restart unicorn using the USR2 signal it doesn't automatically know the correct environment for bundler. Check out this gist (specially the before_exec block) and adjust your unicorn config accordingly.

https://gist.github.com/534668

Hope that helps.

Upvotes: 1

Related Questions