2

我目前正在部署我的应用程序,出于某种奇怪的原因,我在执行 cap: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

宝石文件

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

部署.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

是什么导致了这个错误,我能做些什么来解决它?

4

2 回答 2

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'

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

于 2013-02-15T19:39:31.703 回答
1

转到您的github 设置 ssh 部分并将远程服务器用户的 ssh 公钥添加到您的密钥中。这个密钥/home/username/.ssh/id_rsa.pub在 linux 下。

于 2013-02-15T16:09:23.990 回答