【发布时间】:2013-07-03 19:09:35
【问题描述】:
这就是我为什么要进行上限部署的原因
** [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 应用中的 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 路径吗?
【问题讨论】:
-
RVM 是否以其他方式工作?您的
.bashrc中有类似## RVM [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"的内容吗? `
标签: ruby sinatra rvm capistrano