Excerpt from my current Capistrano cheat sheet:
cap deploy_with_migrations
- will deploy normally and then run 'rake db:migrate' (SCARY!)
- 'cap disable_web' (FIRST!)
- WILL NOT RUN ANY :after_deploy methods (FUCK!)
Now don’t get me wrong, I really love Capistrano (now at 1.4) as it makes my development life a lot easier. It’s just those little bits that bite you in the ass in the most unexpected moment.
Oh, and I’m sure there’s a reasonable explanation for this behaviour.
UPDATE: It has its own ticket now.
i don’t think there’s a default after_deploy task even with the normal `cap deploy`. after_update_code sure, but after_deploy? after_migrate? those doesn’t exist out of the box. you can use after_update_code to do some more extra tasks after deploying, but what do you need to do after migration anyway?
Evan: there is no default “after_deploy” task. There is, however, a default “after_deploy” hook. You use it like that:
What I was gripping about is that it does not get executed after
deploy_with_migrations
, which is kind of weird. Since I have important tasks executed atafter_deploy
I cannot usedeploy_with_migrations
as this code will not be executed.I just opened a ticket for this exact problem because it is causing me the same grief. The ticket is over at http://dev.rubyonrails.org/ticket/7897
I’ll try to keep you updated. I have 3 solutions to this and waiting to hear back from Jamis or whomever wants to look into it before submitting a patch.
I’m glad to hear I’m not alone in my pain.
Just define :after_deploy_with_migrations task in your recipes file.
There is one caveat (feature?) though: (at least for me) after_deploy_with_migrations seems not to be executed if cap_deploy_with_migrations task fails at some point. Other that it works just fine.
This is only a workaround that does not fix the described underlying problem.