这个Capistrano错误输出是什么意思?

时间:2013-09-02 21:45:13

标签: ruby-on-rails ruby deployment rvm capistrano

我正在尝试配置Capistrano将我的OS X系统中的Rails 3.2.14应用程序部署到CentOS 6 VPS。

我在两台机器上都有RVM gemsets,名为“ruby-1.9.3@rails_3_personal”。

我安装了capistrano和rvm / capistrano宝石。

我确保登录用户在目标服务器上具有所需的目录权限。

当我跑...

cap deploy:setup -d

我得到了这个输出......

        triggering load callbacks
      * 2013-09-02 14:06:45 executing `deploy:setup'
      * executing "mkdir -p /opt/deployed_rails_apps/my_app /opt/deployed_rails_apps/my_app/releases /opt/deployed_rails_apps/my_app/shared /opt/deployed_rails_apps/my_app/shared/system /opt/deployed_rails_apps/my_app/shared/log /opt/deployed_rails_apps/my_app/shared/pids"
    Preparing to execute command: "mkdir -p /opt/deployed_rails_apps/my_app /opt/deployed_rails_apps/my_app/releases /opt/deployed_rails_apps/my_app/shared /opt/deployed_rails_apps/my_app/shared/system /opt/deployed_rails_apps/my_app/shared/log /opt/deployed_rails_apps/my_app/shared/pids"
    Execute ([Yes], No, Abort) ?  |y|  y
        servers: ["my_domain.com"]
        [user_name@my_domain.com] executing command
     ** [out :: user_name@my_domain.com] /home/user_name/.rvm//scripts/selector: line 709: /db: No such file or directory
     ** [out :: user_name@my_domain.com] /home/user_name/.rvm//scripts/functions/db: line 18: /db: No such file or directory
    ** [out :: user_name@my_domain.com] /home/user_name/.rvm//scripts/functions/gemset: line 21: /db: No such file or directory
     ** [out :: user_name@my_domain.com] mkdir: cannot create directory `/ruby-1.9.3-p448': Permission denied
     ** [out :: user_name@my_domain.com] 
     ** [out :: user_name@my_domain.com] Error: RVM was unable to use 'ruby-1.9.3-p448@rails_3_personal'
        command finished in 388ms
    failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell 'ruby-1.9.3-p448@rails_3_personal' -c 'mkdir -p /opt/deployed_rails_apps/my_app /opt/deployed_rails_apps/my_app/releases /opt/deployed_rails_apps/my_app/shared /opt/deployed_rails_apps/my_app/shared/system /opt/deployed_rails_apps/my_app/shared/log /opt/deployed_rails_apps/my_app/shared/pids'" on user_name@my_domain.com
  • 为什么Capistrano会尝试创建/ruby-1.9.3-p448

  • 这个错误是什么意思? (另外两个喜欢吗?)路径甚至不是有效路径(“//”)。

         ** [out :: user_name@my_domain.com] /home/user_name/.rvm//scripts/selector: line 709: /db: No such file
    
  • 此外......“Error: RVM was unable to use 'ruby-1.9.3-p448@rails_3_personal'

    好的,“无法使用。”为什么呢?我该如何解决?

这是我的deploy.rb ...

require "bundler/capistrano"

require "rvm/capistrano"

set :rvm_ruby_string, 'ruby-1.9.3-p448@rails_3_personal'

set :rvm_type, :user

set :application, 'my_app'

set :repository, 'git@github.com:GithubUser/my_app.git'

set :deploy_to, "/opt/deployed_rails_apps/#{application}"

set :use_sudo, false

set :scm, "git"
set :branch, "master"

set :user, 'user_name'

set :deploy_via, :remote_cache

# Keep only 5 releases --------------------------------
set :keep_releases, 5
after "deploy:update", "deploy:cleanup"
# -----------------------------------------------------

load 'deploy/assets'

role :app, 'user_name@my_domain.com'
role :web, 'user_name@my_domain.com'

namespace :deploy do

  task :start, :roles => :app do
    run "touch #{current_release}/tmp/restart.txt"
  end

  task :stop, :roles => :app do
    # Do nothing.
  end

  desc "Restart Application"
  task :restart, :roles => :app do
    run "touch #{current_release}/tmp/restart.txt"
  end

end

2 个答案:

答案 0 :(得分:0)

我认为问题实际上是这个脚本:

 ** [out :: user_name@my_domain.com] /home/user_name/.rvm//scripts/selector: line 709: /db: No such file or directory
似乎在你的require "rvm/capistrano"中调用了女巫。您可以尝试对其进行注释并手动设置路径:

set :default_environment, {
    'PATH' => PATH,
    'GEM_HOME'     => GEM_HOME,
    'GEM_PATH'     => GEM_PATH,
}

要查看您的值,您可以在切换到gemset后看到rvm info

答案 1 :(得分:0)

这是一个错误,并通过https://github.com/wayneeseguin/rvm/issues/2186

修复

需要在服务器上更新到最新版本的rvm:

rvm get head