我想cap production deploy:check
,但收到错误消息mkdir: cannot create directory /var/www: Permission denied
。
我正在使用Capistrano3和Rails4。
我认为sudo在我的情况下不起作用。
deploy.rb
set :application, 'appname.com'
set :repo_url, 'git@bitbucket.org:user/myapp.git'
set :user, 'username'
set :use_sudo, true
set :branch, 'master'
set :deploy_to, '/var/www/myapp'
set :pty, true
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
production.rb
set :stage, :production
set :branch, 'master'
role :all, %w{appname.com}
server 'appname.com', user: 'username', port: 'port_number', roles: %w{web app db}, my_property: :my_value
我读了这些文章。
Capistrano is hanging when prompting for SUDO password to an Ubuntu box
capistrano deployment with use_sudo=true - permissions problem
所以我将default_run_options[:pty] = true
添加到deploy.rb,但我只得undefined local variable or method default_run_options for main:Object
感谢您的建议。