Cap部署失败 - rvm路径不正确

时间:2013-07-03 19:09:36

标签: ruby sinatra rvm capistrano

以下是我为什么要进行上限部署的原因 ** [deploy:update_code] exception while rolling back: Capistrano::CommandError, failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell 'ruby-1.9.3-p327@faxattach' -c 'rm -rf /srv/faxattach/releases/20130703184411; true'" on faxattach-staging-new failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell 'ruby-1.9.3-p327@faxattach' -c 'git clone -q git@github.com:chintanparikh/faxattach.git /srv/faxattach/releases/20130703184411 && cd /srv/faxattach/releases/20130703184411 && git checkout -q -b deploy a237b155f1fe4acef23ad4b594749c567a213117 && (echo a237b155f1fe4acef23ad4b594749c567a213117 > /srv/faxattach/releases/20130703184411/REVISION)'" on faxattach-staging-new

看起来问题出在rvm_path中。我的rvm路径是/usr/local/rvm,但我不知道如何改变它 -

这是我的sinatra app中的deploy.rb:

require 'capistrano/ext/multistage'
require 'rvm/capistrano'

set :stages, %w(production staging development)
set :default_stage, "staging"

set :rvm_ruby_string, 'ruby-1.9.3-p327@faxattach'
set :rvm_type, :user

# Bundler tasks
# require 'bundler/capistrano'
set :application, 'faxattach'
set :apikey, 'MHaBUh3Kctz2x500l5LPMFjo9LNLDKfl6EHF69C1Fq2WrIuB66yw6k5xj30dI17IZ'
set :ssh_options, {forward_agent: true}
# do not use sudo
set :use_sudo, false
set(:run_method) { use_sudo ? :sudo : :run }

# # needed to correctly handle sudo password prompt
default_run_options[:pty] = true

set :user, 'faxattach'
set :group, 'faxattach'
set :runner, 'faxattach'

# Where will it be located on the server?
set :deploy_to, "/srv/#{application}"
set :unicorn_conf, "#{deploy_to}/current/config/unicorn.rb"
set :unicorn_pid, "#{deploy_to}/shared/pids/unicorn.pid"

# Unicorn control tasks
namespace :deploy do
  task :restart do
    run "if [ -f #{unicorn_pid} ] && [ -e /proc/`cat #{unicorn_pid}` ]; then kill -USR2 `cat #{unicorn_pid}`; else cd #{deploy_to}/current && API_KEY=#{apikey} bundle exec unicorn -c #{unicorn_conf} -E #{rails_env} -D; fi"
  end
  task :start do
    run "cd #{deploy_to}/current && bundle exec unicorn -c #{unicorn_conf} -E #{rails_env} -D"
  end
  task :end do
    run "if [ -f #{unicorn_pid} ]; then kill -QUIT `cat #{unicorn_pid}`; fi"
  end
end

我是如何改变rvm路径的?

1 个答案:

答案 0 :(得分:2)

通过将:rvm_type设置为:system

来解决此问题
set :rvm_type, :system