0

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

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

我安装了 capistrano 和 rvm/capistrano gems。

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

当我跑...

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
4

2 回答 2

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,
}

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

于 2013-09-02T23:00:18.060 回答
0

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

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

rvm get head
于 2013-09-03T19:12:55.057 回答