当我bundle exec cap production deploy
时,我收到了mkdir: cannot create directory /usr/share/nginx/www/appname/releases/20131216155457: Permission denied
Capistrano3没有set use_sudo
和default_run_options
。我读到无密码sudo更好,所以我做了visudo username ALL=NOPASSWD:ALL
,但我仍然遇到了同样的错误。
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
有没有人就这个问题给我任何建议? 谢谢你的帮助。
答案 0 :(得分:5)
尝试设置appname
文件夹
chown deployer:www-data -R /usr/share/nginx/www/appname
其中deployer是您的部署用户,而group是用户组
答案 1 :(得分:0)
应该是
chown username:groupname -R /path/to/project