Ruby on rails Bundler在部署期间未正确安装gems(我认为是RVM问题)
我在一个盒子上运行了一个应用程序,我正在尝试向盒子中添加另一个应用程序 它们都使用RVM 问题是,对于我添加到框中的新应用程序,我的部署过程失败 部署时,我会调用Ruby on rails Bundler在部署期间未正确安装gems(我认为是RVM问题),ruby-on-rails,ruby,rvm,vlad-deployer,Ruby On Rails,Ruby,Rvm,Vlad Deployer,我在一个盒子上运行了一个应用程序,我正在尝试向盒子中添加另一个应用程序 它们都使用RVM 问题是,对于我添加到框中的新应用程序,我的部署过程失败 部署时,我会调用 RVM info 看看我用的是什么ruby。以下是输出: ruby-1.9.3-p392: system: uname: "Linux li83-41 2.6.39.1-linode34 #1 SMP Tue Jun 21 10:29:24 EDT 2011 i686 GNU/Linux" sys
RVM info
看看我用的是什么ruby。以下是输出:
ruby-1.9.3-p392:
system:
uname: "Linux li83-41 2.6.39.1-linode34 #1 SMP Tue Jun 21 10:29:24 EDT 2011 i686 GNU/Linux"
system: "ubuntu/10.04/i386"
bash: "/bin/bash => GNU bash, version 4.1.5(1)-release (i486-pc-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.22.3 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "4 days 21 hours 14 minutes 38 seconds ago"
path: "/usr/local/rvm"
ruby:
interpreter: "ruby"
version: "1.9.3p392"
date: "2013-02-22"
platform: "i686-linux"
patchlevel: "2013-02-22 revision 39386"
full_version: "ruby 1.9.3p392 (2013-02-22 revision 39386) [i686-linux]"
homes:
gem: "/usr/local/rvm/gems/ruby-1.9.3-p392"
ruby: "/usr/local/rvm/rubies/ruby-1.9.3-p392"
binaries:
ruby: "/usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby"
irb: "/usr/local/rvm/rubies/ruby-1.9.3-p392/bin/irb"
gem: "/usr/local/rvm/rubies/ruby-1.9.3-p392/bin/gem"
rake: "/usr/local/rvm/gems/ruby-1.9.3-p392/bin/rake"
environment:
PATH: "/usr/local/rvm/gems/ruby-1.9.3-p392/bin:/usr/local/rvm/gems/ruby-1.9.3-p392@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p392/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
GEM_HOME: "/usr/local/rvm/gems/ruby-1.9.3-p392"
GEM_PATH: "/usr/local/rvm/gems/ruby-1.9.3-p392:/usr/local/rvm/gems/ruby-1.9.3-p392@global"
MY_RUBY_HOME: "/usr/local/rvm/rubies/ruby-1.9.3-p392"
IRBRC: "/usr/local/rvm/rubies/ruby-1.9.3-p392/.irbrc"
RUBYOPT: ""
gemset: ""
引发此错误:
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Installing rake (10.1.0)
Installing i18n (0.6.5)
Installing minitest (4.7.5)
Installing multi_json (1.7.9)
Installing atomic (1.1.13)
Installing thread_safe (0.1.2)
Installing tzinfo (0.3.37)
Installing activesupport (4.0.0)
Gem::InstallError: activesupport requires Ruby version >= 1.9.3.
An error occurred while installing activesupport (4.0.0), and Bundler cannot
continue.
Make sure that `gem install activesupport -v '4.0.0'` succeeds before bundling.
rake aborted!
我在这里束手无策:看起来我在使用ruby1.9.3-p392,但bundler告诉我需要ruby>=1.9.3
这是我的.bundle/config:
---
BUNDLE_PATH: vendor/bundle
BUNDLE_DISABLE_SHARED_GEMS: '1'
BUNDLE_FROZEN: '1'
另外,如果我ssh到该框中,看起来我使用的是正确的ruby:
$ which ruby
/usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby
运行bundle安装可以很好地工作
有什么想法吗
编辑#1
我正在使用Vlad,这里是deploy.rb:
set :repository, repo_location
set :revisions, 5
set :revision, "HEAD"
set :domain, domain
set :user, login_user
set :deploy_to, deploy_dir
set :deploy_env, "production"
namespace :vlad do
desc 'Restart Passenger'
remote_task :restart_app do
puts "Restarting passenger..."
run "touch #{current_release}/tmp/restart.txt"
end
desc 'Runs our full deployment'
task :deploy => ['vlad:update',
'vlad:symlink',
'vlad:rvm_info',
'vlad:update_bundle',
'vlad:migrate_database',
'vlad:cleanup',
'vlad:restart_app']
desc 'Symlinks your custom directories'
remote_task :symlink do
run "ln -s #{shared_path}/environments #{latest_release}/config/environments"
run "ln -s #{shared_path}/database.yml #{current_path}/config/database.yml"
run "ln -s #{shared_path}/config.yml #{current_path}/config/config.yml"
end
desc 'Show RVM Info for debug purposes'
remote_task :rvm_info do
run "cd #{current_path} && rvm info"
end
desc 'Update the Bundler bundle we use to include any new gems in the Gemfile'
remote_task :update_bundle do
run "cd #{current_path} && bundle install --deployment"
end
# copied from the vlad source, integrate migrate does not work as it's missing
# the && between the cd and the db migrate task itself. bug is already tracked
# at http://rubyforge.org/tracker/?group_id=4213&atid=16258&func=detail&aid=28445,
# but currently does not do anything.
remote_task :migrate, :roles => :app do
break unless target_host == Rake::RemoteTask.hosts_for(:app).first
directory = case migrate_target.to_sym
when :current then current_path
when :latest then latest_release
else raise(ArgumentError, "unknown migration target #{migrate_target.inspect}")
end
run(["cd #{directory}",
"bundle exec #{rake_cmd} db:migrate #{migrate_args} RAILS_ENV=#{rails_env}"].join(" && "))
end
end
这不是rvm故障。。。这是关于如何运行命令的问题,
vlad
不像使用ssh
那样使用登录会话,因此需要手动加载rvm:
set :command_prefix, [". `/usr/local/rvm/bin/rvm . do rvm env --path`"]
我无法基于vlad代码对其进行测试,但这应该是一个良好的开端。您使用的是capistrano吗?如果是,则显示capfileI正在使用Vlad-使用deploy.rb更新问题。
set :command_prefix, [". `/usr/local/rvm/bin/rvm . do rvm env --path`"]