【问题标题】:Problems with sudo when deploying RVM with Capistrano使用 Capistrano 部署 RVM 时出现 sudo 问题
【发布时间】: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


【解决方案1】:

请使用1.1.0进行测试:

gem install rvm-capistrano

【讨论】:

  • 谢谢,我已经发布了链接到这个问题的问题。我希望他们能解决这个问题。
  • 谢谢,直到今天我才有时间测试它。它似乎有效。但是,现在这一次,ruby 企业没有安装:Warning: *** [err :: myserver.com] Failed to create the file ruby-enterprise-1.8.7-2012.02.tar.gz
  • @ianenri 打开一个新问题,提供更多详细信息。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-07-12
  • 1970-01-01
  • 2012-03-22
  • 2014-07-07
  • 2014-05-30
相关资源
最近更新 更多