namespace :deploy do before :starting, :check_sidekiq_hooks do invoke 'sidekiq:add_default_hooks' if fetch(:sidekiq_default_hooks) end end namespace :sidekiq do task :add_default_hooks do after 'deploy:starting', 'sidekiq:quiet' after 'deploy:updated', 'sidekiq:stop' after 'deploy:published', 'sidekiq:start' after 'deploy:failed', 'sidekiq:restart' end desc 'Restart sidekiq' task :restart do invoke! 'sidekiq:stop' invoke! 'sidekiq:start' end end