akshah123's solution is the answer, I wanted to share my observations if that may help others.
in the deploy/your_environment.rb (ex: deploy/staging.rb
) or deploy.rb
you can add:
after 'deploy:publishing', 'deploy:restart'
namespace :deploy do
desc 'for resetting symlinks that are getting stuck in the normal deploy process'
task :restart do
invoke 'unicorn:reload'
end
end
Depending on how your Capistrano is setup you may see the following:
Skipping task `unicorn:start'.
Capistrano tasks may only be invoked once. Since task `unicorn:start' was previously invoked, invoke("unicorn:start") at /Users/newman/.rvm/gems/ruby-2.6.3/gems/capistrano3-unicorn-0.2.1/lib/capistrano3/tasks/unicorn.rake:49 will be skipped.
If you really meant to run this task again, use invoke!("unicorn:start")
THIS BEHAVIOR MAY CHANGE IN A FUTURE VERSION OF CAPISTRANO. Please join the conversation here if this affects you.
This should be okay in most cases, as the redundancy is being handled and the desired result of remapping the symlinks occurs. The suggested fix from the message likely can't /doesn't need to be implemented in this case, as we are implicitly calling unicorn:start
from calling unicorn:reload
, in other words: invoke! unicorn:reload
does not handle / prevent this message from rendering.