Late night capistrano

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.

Published by

Paweł Gościcki

Ruby/Rails programmer.

6 thoughts on “Late night capistrano”

  1. 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?

  2. Evan: there is no default “after_deploy” task. There is, however, a default “after_deploy” hook. You use it like that:

    task :after_deploy, :roles => :app do
      custom_functions
      (...)
    end
    

    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 at after_deploy I cannot use deploy_with_migrations as this code will not be executed.

  3. 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.

Comments are closed.