I just updated Capistrano from v2 to version v3.1.
I rewrote my tasks, including one that launches a shell script that restarts NGINX among other things. To restart NGINX, I have to work as sudo , which causes an error:
Sorry, you must have TTY to run sudo
In Capistrano 2, to solve this problem, I added to my Capfile:
default_run_options[:pty] = true
What is equivalent for Capistrano v3?
My deploy.rb file looks like this:
# config valid only for Capistrano 3.1 lock '3.1.0' set :application, 'APP_NAME' namespace :deploy do desc 'Restart NGINX' task :restart do on roles(:app), in: :sequence, wait: 5 do execute :sudo, "./restart.sh" end end end
ruby capistrano capistrano3
ajtrichards
source share