When I did bundle exec cap production deploy, i got error messages like mkdir: cannot create directory /usr/share/nginx/www/appname/releases/20131216155457: Permission denied
Capistrano3 doesn't have set use_sudo and default_run_options. I read that Passwordless sudo is better, so I did visudo username ALL=NOPASSWD:ALL, but still I got the same errors.
set :application, 'appname.com'
set :repo_url, 'git@bitbucket.org:user/myapp.git'
set :user, 'username'
set :branch, 'master'
set :deploy_to, '/usr/share/nginx/www/appname'
set :keep_releases, 5
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
end
end
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
end
end
after :finishing, 'deploy:cleanup'
end
Does anyone give me any advice around this problem? Thank you for your help.