【发布时间】:2012-04-13 11:06:20
【问题描述】:
我想使用 Capistrano 在我的服务器中部署我的应用程序 我有包含以下内容的 deploy.rb 文件:
set :user, "deploy"
set :use_sudo, true
set :deploy_to, "/webapps/#{application}"
#set :deploy_via, :remote_cache #Using this option avoids to do a full repository clone
#RVM
set :rvm_type, :system #System Wide installation
set :rvm_ruby_string, 'ree@K2'
set :rvm_install_shell, :bash
before 'deploy:setup','rvm:install_rvm'
before 'deploy:setup', 'rvm:install_ruby'
# if you're still using the script/reaper helper you will need
# these http://github.com/rails/irs_process_scripts
# If you are using Passenger mod_rails uncomment this:
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
当我设置 root 用户、安装 RVM(系统范围安装)甚至 Ruby Enterprise 时一切正常,但是当我运行 'cap deploy:setup' 设置 use_sudo 选项并部署时用户,得到这个:
$ cap deploy:setup
* executing `deploy:setup'
triggering before callbacks for `deploy:setup'
* executing `rvm:install_rvm'
* executing "bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)"
servers: ["myserver.com"]
Password:
[myserver.com] executing command
[myserver.com] bash -c 'bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)'
*** [err :: myserver.com] bash: line 304: /usr/local/rvm/RELEASE: Permission denied
command finished in 564ms
failed: "bash -c 'bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)'" on myserver.com
我必须做什么才能完成这项工作?我是否必须调整 sudoers 文件中的某些设置?
【问题讨论】:
-
您的部署用户是 sudoer 吗?
-
是的,我认为它包含在 sudoers 文件中
标签: ruby-on-rails ruby rvm capistrano