If for some reason you want to run more than one task after deploying with capistrano. Create a task that invokes all the tasks you want:
# capistrano/tasks/after_deploy_hooks.rake
namespace :deploy do
desc 'Deploy hooks'
task :after_deploy_tasks do
on roles(:app) do
within current_path do
invoke 'service:restart'
invoke 'sidekiq:restart'
invoke 'deploy:update_cron'
end
end
end
end
In this task I'm triggering the restart of the webservice, and sidekiq. And running another task to update the crontab.
Using invoke
will call the task you pass as argument.
And then, inside deploy.rb
add the following line at the end of the file.
after :deploy, 'deploy:after_deploy_tasks'
The line above is a hook to run the task after deploy
is done.