RVM + Capistrano失败错误错误?

时间:2013-02-15 07:52:44

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

我目前正在部署我的应用程序,但由于一些奇怪的原因,我在执行上限时仍然遇到此错误:deploy。我已尝试过互联网上的所有内容,无法找到解决此问题的方法

*** [deploy:update_code] rolling back
failed: "rvm_path=/usr/local/rvm /usr/local/rvm/bin/rvm-shell 'default' -c 'git clone -q --depth 1 git@github.com:username/appname.git /var/www/site/app/releases/20130215074544 && cd /var/www/site/app/releases/20130215074544 && git checkout -q -b deploy ab30e0f75c1876026a6c658094170e73 && (echo ab30e0f75c1876026a6c658094170e73 > /var/www/site/app/releases/20130215074544/REVISION)'" on xxx.xxx.xx.xxx

我不确定这意味着什么,并尝试了从stackoverflow问题建议谷歌的一切,没有任何工作。

我甚至在我的部署文件中尝试了这个但是没有用过

require "rvm/capistrano"
set :rvm_ruby_string, 'default'
set :rvm_type, :system

的Gemfile

group :development, :test do
  gem "capistrano", "~> 2.14.2"
  gem 'rvm-capistrano', '~> 1.3.0.rc9'
end

deploy.rb

set :rvm_ruby_string, :local        # use the same ruby as used locally for deployment

before 'deploy', 'rvm:install_rvm'  # update RVM
before 'deploy', 'rvm:install_ruby' # install Ruby and create gemset (both if missing)

require "rvm/capistrano"

    set :application, "appname"
    set :repository, "git@github.com:username/appname.git"

    set :scm, 'git'

    role :web, "xxx.xxx.xx.xxx" # Your HTTP server, Apache/etc
    role :app, "xxx.xxx.xx.xxx" # This may be the same as your `Web` server
    role :db, "xxx.xxx.xx.xxx", :primary => true # This is where Rails migrations will run

    set :user, 'usernameyousetupforserver'
    set :branch, "master"
    set :rvm_type, :user

    set :git_shallow_clone, 1
    set :use_sudo, false
    set :deploy_to, "/path/public/#{application}"
    set :deloy_via, :remote_cache
    set :keep_releases, 1
    set :rails_env, "production"
    set :migrate_target, :latest

    default_run_options[:pty] = true
    ssh_options[:forward_agent] = true



     namespace :deploy do
       task :start do ; end
       task :stop do ; end
       task :restart, :roles => :app, :except => { :no_release => true } do
         run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
       end
     end

     namespace :deploy do
       desc "Recreate symlink"
       task :resymlink, :roles => :app do
         run "rm -f #{current_path} && ln -s #{release_path} #{current_path}"
       end
     end

开发日志

    * 2013-02-16 12:39:55 executing `deploy'
* 2013-02-16 12:39:55 executing `deploy:update'
* transaction: start
* 2013-02-16 12:39:55 executing `deploy:update_code'
  executing locally: "git ls-remote git@github.com:username/appname.git master"
  command finished in 1310ms
* executing "git clone -q --depth 1 git@github.com:username/appname.git /var/www/site/app/releases/20130216183956 && cd /var/www/site/app/releases/20130216183956 && git checkout -q -b deploy ab30e0f75c1876026a6c658094170e73 && (echo ab30e0f75c1876026a6c658094170e73 > /var/www/site/app/releases/20130216183956/REVISION)"
  servers: ["xxx.xxx.xx.xxx"]
ssword: 
  [xxx.xxx.xx.xxx] executing command
  command finished in 22960ms
* 2013-02-16 12:40:24 executing `deploy:finalize_update'
  triggering before callbacks for `deploy:finalize_update'
* 2013-02-16 12:40:24 executing `deploy:assets:symlink'
* executing "rm -rf /var/www/site/app/releases/20130216183956/public/assets &&\\\n        mkdir -p /var/www/site/app/releases/20130216183956/public &&\\\n        mkdir -p /var/www/site/app/shared/assets &&\\\n        ln -s /var/www/site/app/shared/assets /var/www/site/app/releases/20130216183956/public/assets"
  servers: ["xxx.xxx.xx.xxx"]
  [xxx.xxx.xx.xxx] executing command
  command finished in 716ms
* executing "chmod -R -- g+w /var/www/site/app/releases/20130216183956 && rm -rf -- /var/www/site/app/releases/20130216183956/public/system && mkdir -p -- /var/www/site/app/releases/20130216183956/public/ && ln -s -- /var/www/site/app/shared/system /var/www/site/app/releases/20130216183956/public/system && rm -rf -- /var/www/site/app/releases/20130216183956/log && ln -s -- /var/www/site/app/shared/log /var/www/site/app/releases/20130216183956/log && rm -rf -- /var/www/site/app/releases/20130216183956/tmp/pids && mkdir -p -- /var/www/site/app/releases/20130216183956/tmp/ && ln -s -- /var/www/site/app/shared/pids /var/www/site/app/releases/20130216183956/tmp/pids"
  servers: ["xxx.xxx.xx.xxx"]
  [xxx.xxx.xx.xxx] executing command
  command finished in 521ms
  triggering after callbacks for `deploy:update_code'
* 2013-02-16 12:40:25 executing `deploy:assets:precompile'
* executing "cd /var/www/site/app/releases/20130216183956 && rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile"
  servers: ["xxx.xxx.xx.xxx"]
  [xxx.xxx.xx.xxx] executing command
* [out :: xxx.xxx.xx.xxx] Could not find aws-sdk-1.8.2 in any of the sources
* [out :: xxx.xxx.xx.xxx] Run `bundle install` to install missing gems.
  command finished in 1132ms
* [deploy:update_code] rolling back
* executing "rm -rf /var/www/site/app/releases/20130216183956; true"
  servers: ["xxx.xxx.xx.xxx"]
  [xxx.xxx.xx.xxx] executing command
  command finished in 508ms
Failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell 'ruby-1.9.3-p385' -c 'cd /var/www/site/app/releases/20130216183956 && rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile'" on xxx.xxx.xx.xxx

导致此错误的原因是什么,我该怎么做才能解决?

2 个答案:

答案 0 :(得分:2)

您似乎错过了阅读文档https://github.com/wayneeseguin/rvm-capistrano#readme

此处描述了新版本1.3.0.rc11:https://github.com/wayneeseguin/rvm-capistrano/blob/feature/readme_for_1.3.0/README.md

我看到脚本中没有捆绑器集成:

require "rvm/capistrano"
require "bundler/capistrano"
load 'deploy/assets'

这是我的部署脚本,例如app https://github.com/mpapis/ad/blob/master/config/deploy.rb

答案 1 :(得分:1)

转到github settings ssh section并将远程服务器用户的ssh公钥添加到密钥中。这个键在linux上的/home/username/.ssh/id_rsa.pub下。