Reputation: 8247
I have a capistrano task I'd like to run twice during a deploy.
Specifically, I'd like to run a puma phased restart before I start deploying and after assets are compiled (part of capistrano-puma gem). The reason for running the phased restart before is to reduce memory usage to the point where the new asset compilation task (which starts a rails environment) does not cause the server to go into memory swap. We've been doing this manually, but sometimes forget.
If I add this to my deploy file:
before 'deploy:started', "puma:phased-restart"
Then my phased restarts are only run once and puma ends up running out of the wrong release directory.
How can I re-enable a capistrano task and allow it to run twice?
Upvotes: 1
Views: 437
Reputation: 8247
Very similar to running rake tasks twice, you can re-enable the task:
Just add this to your deploy file
after 'deploy:started', 'reenable_phased_restart'
task :reenable_phased_restart do
::Rake.application['puma:phased-restart'].reenable
end
Upvotes: 1