我真的非常需要這個問題的幫助,而不是一點點迷路。Rails 3.2.2 RVM系統寬Capistrano安裝找不到寶石
我試圖部署一個使用Capistrano Ext的新生產服務器,以允許登臺和生產服務器,但是無法成功運行bundle install --deployment。
帽分期部署工作正常,以現有的Ubuntu系統,但新的服務器恆定失敗如下
my-app$ sh -c 'cd /var/www/html/rails/myapp/releases/20120519174459&& export PATH=/usr/local/bin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/opt/local/bin:/usr/local/rvm/gems/ruby-1.9.3-p194/bin:/usr/local/rvm/gems/[email protected]/bin:/usr/local/rvm/rubies/ruby-1.9.3-p194/bin:/usr/local/rvm/bin && bundle install --deployment'
Fetching gem metadata from http://rubygems.org/......
Fetching gem metadata from http://rubygems.org/..
Installing rake (0.9.2.2)
Gem::LoadError: Could not find rubygems-bundler (>= 0) amongst []
An error occured while installing rake (0.9.2.2), and Bundler cannot continue.
Make sure that `gem install rake -v '0.9.2.2'` succeeds before bundling.
在任何其他目錄中的紅寶石-v和Rails -v產生預期的結果
my-home$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
my-home$ rails -v
Rails 3.2.2
當地的寶石對生產Server顯示他們是所有可用一上市
my-home$ gem list
*** LOCAL GEMS ***
actionmailer (3.2.3, 3.2.2)
actionpack (3.2.3, 3.2.2)
active_utils (1.0.3)
activemerchant (1.21.0)
activemodel (3.2.3, 3.2.2)
activerecord (3.2.3, 3.2.2)
activeresource (3.2.3, 3.2.2)
activesupport (3.2.3, 3.2.2)
addressable (2.2.7)
ansi (1.4.2)
arel (3.0.2)
bcrypt-ruby (3.0.1)
bootstrap-sass (2.0.1)
builder (3.0.0)
bundle (0.0.1)
bundler (1.1.3, 1.0.21)
cancan (1.6.7)
capistrano (2.12.0, 2.11.2)
capistrano-ext (1.2.1)
cocaine (0.2.1)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.3.3, 1.2.0)
daemon_controller (1.0.0)
devise (2.0.4)
erubis (2.7.0)
execjs (1.3.2, 1.3.0)
faraday (0.7.6)
fastthread (1.0.7)
haml (3.1.4)
hashie (1.2.0)
highline (1.6.12, 1.6.11)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.3)
jquery-datatables-rails (1.9.1.3)
jquery-rails (2.0.2, 2.0.1)
jquery-ui-rails (0.3.0)
jruby-pageant (1.0.2)
json (1.7.3, 1.6.5)
libv8 (3.3.10.4 x86_64-linux)
mail (2.4.4)
metaclass (0.0.1)
mime-types (1.18, 1.17.2)
minitest (2.11.3)
mocha (0.10.5)
money (3.7.1)
multi_json (1.3.5, 1.1.0)
multipart-post (1.1.5)
mysql2 (0.3.11)
net-scp (1.0.4)
net-sftp (2.0.5)
net-ssh (2.4.0, 2.3.0)
net-ssh-gateway (1.1.0)
nifty-generators (0.4.6)
oauth (0.4.5)
oauth2 (0.5.2)
omniauth (1.0.3)
omniauth-facebook (1.2.0)
omniauth-google (1.0.1)
omniauth-linkedin (0.0.6)
omniauth-oauth (1.0.1)
omniauth-oauth2 (1.0.0)
omniauth-twitter (0.0.8)
orm_adapter (0.0.6)
paperclip (3.0.2)
passenger (3.0.12)
polyamorous (0.5.0)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.3, 3.2.2)
railties (3.2.3, 3.2.2)
rake (0.9.2.2)
rdoc (3.12)
RedCloth (4.2.9)
rubygems-bundler (1.0.0)
rvm (1.11.3.3)
sass (3.1.18, 3.1.15)
sass-rails (3.2.5)
simple_form (2.0.1)
simple_oauth (0.1.5)
sprockets (2.1.3, 2.1.2)
sqlite3 (1.3.6)
squeel (1.0.1)
therubyracer (0.10.1, 0.9.10)
thor (0.14.6)
tilt (1.3.3)
timeliness (0.3.4)
treetop (1.4.10)
turn (0.9.4)
twitter (2.2.0)
tzinfo (0.3.33, 0.3.32)
uglifier (1.2.4, 1.2.3)
validates_timeliness (3.0.8)
warden (1.1.1)
will_paginate (3.0.3)
的RVM全系統在服務器上似乎是正確的
my-home$ rvm list
rvm rubies
=* ruby-1.9.3-p194 [ x86_64 ]
# => - current
# =* - current && default
# * - default
my-home$ rvm info
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
You need to change your terminal settings to allow shell login.
Please visit https://rvm.io/workflow/screen/ for example.
ruby-1.9.3-p194:
system:
uname: "Linux totg01 2.6.38-14-generiC#58-Ubuntu SMP Tue Mar 27 20:04:55 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux"
bash: "/bin/bash => GNU bash, version 4.2.8(1)-release (x86_64-pc-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.13.5 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]"
updated: "4 days 2 hours 5 minutes 13 seconds ago"
ruby:
interpreter: "ruby"
version: "1.9.3p194"
date: "2012-04-20"
platform: "x86_64-linux"
patchlevel: "2012-04-20 revision 35410"
full_version: "ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]"
homes:
gem: "/usr/local/rvm/gems/ruby-1.9.3-p194"
ruby: "/usr/local/rvm/rubies/ruby-1.9.3-p194"
binaries:
ruby: "/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby"
irb: "/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/irb"
gem: "/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/gem"
rake: "/usr/local/rvm/gems/ruby-1.9.3-p194/bin/rake"
environment:
PATH: "/usr/local/rvm/gems/ruby-1.9.3-p194/bin:/usr/local/rvm/gems/[email protected]/bin:/usr/local/rvm/rubies/ruby-1.9.3-p194/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-p194"
GEM_PATH: "/usr/local/rvm/gems/ruby-1.9.3-p194:/usr/local/rvm/gems/[email protected]"
MY_RUBY_HOME: "/usr/local/rvm/rubies/ruby-1.9.3-p194"
IRBRC: "/usr/local/rvm/rubies/ruby-1.9.3-p194/.irbrc"
RUBYOPT: ""
gemset: ""
但有一個史詩般的應用程序目錄失敗,因爲沒有什麼./vendor/bundle
app-dir$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
app-dir$ rails -v
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler/spec_set.rb:90:in `block in materialize': Could not find rake-0.9.2.2 in any of the sources (Bundler::GemNotFound)
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler/spec_set.rb:83:in `map!'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler/spec_set.rb:83:in `materialize'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler/definition.rb:127:in `specs'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler/environment.rb:27:in `specs'
from /usr/local/rvm/gems/[email protected]/gems/rubygems-bundler-1.0.0/lib/rubygems-bundler/noexec.rb:41:in `candidate?'
from /usr/local/rvm/gems/[email protected]/gems/rubygems-bundler-1.0.0/lib/rubygems-bundler/noexec.rb:59:in `setup'
from /usr/local/rvm/gems/[email protected]/gems/rubygems-bundler-1.0.0/lib/rubygems-bundler/noexec.rb:74:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:9:in `<main>'
該系統Ubuntu的11.04和紅寶石使用RVM全系統安裝有1.93作爲默認
的deploy.rb如下:
# This has been added due to multi deployment staging
set :stages, %w(staging production)
set :default_stage, "staging"
require 'capistrano/ext/multistage'
default_run_options[:pty] = true
set :user, 'appuser'
set :application, "app"
set :keep_releases, 10
set :deploy_to, "/var/www/html/rails/#{application}"
set :repository, "[email protected]:/myapps/rails/#{application}.git"
set :deploy_via, :copy
set :ssh_options, {:forward_agent => true}
set :scm, :git
set :branch, 'master'
set :scm_verbose, true
set :use_sudo, false
# This has been added due to multi deployment staging
# since :domain is defined in another file (staging.rb and production.rb),
# we need to delay its assignment until they're loaded
set(:domain) { "#{domain}" }
role(:web) { domain }
role(:app) { domain }
role(:db, :primary => true) { domain }
# If you are using Passenger mod_rails uncomment this:
namespace :deploy do
desc "cause Passenger to initiate a restart"
task :restart do
run "touch #{current_path}/tmp/restart.txt"
end
desc "reload the database with seed data"
task :seed do
run "cd #{current_path}; rake db:seed RAILS_ENV=production"
end
end
before "deploy:assets:precompile", :bundle_install
after "deploy:update_code", :bundle_install
desc "install the necessary prerequisites"
task :bundle_install, :roles => :app do
run "cd #{release_path}&& export PATH=/usr/local/bin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/opt/local/bin:/usr/local/rvm/gems/ruby-1.9.3-p194/bin:/usr/local/rvm/gems/[email protected]/bin:/usr/local/rvm/rubies/ruby-1.9.3-p194/bin:/usr/local/rvm/bin && bundle install --deployment"
run "cp -Rf #{shared_path}/config/* #{release_path}/config/"
end
另外兩個臨時和生產文件....
部署/ staging.rb
set :domain, "staging.myapp.com"
set :rails_env, "staging"
set :default_environment, {
'PATH' => "/usr/local/bin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/opt/local/bin"
}
部署/ production.rb
set :domain, "production.myapp.com"
set :rails_env, "production"
set :default_environment, {
'PATH' => "/usr/local/rvm/gems/ruby-1.9.3-p194/bin:/usr/local/rvm/gems/[email protected]/bin:/usr/local/rvm/rubies/ruby-1.9.3-p194/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/mysql/bin"
}
所以失敗正在試圖捆綁在新提供的應用程序目錄中安裝 - 部署。如果軟件包安裝--nodeployment運行它工作正常!
我做了什麼錯或未配置。我花了2天嘗試排序了這一點,但它doen't似乎使爲什麼
感謝指針。最後,我不得不刪除所有的寶石,ruby實例和rvm,然後重新安裝!我不知道在安裝過程中到底出了什麼問題。完成之後,我可以使用rvm shell從命令行安裝bundle -deployment(就像使用rvm-capistrano gem一樣)。當我添加您的解決方案時,它也與Capistrano合作,非常感謝這些想法,如果我沒有損壞安裝,這將最初解決問題! – pshear0
你最初的問題是由'rubygems-bundler 1.0.0'造成的 - rvm的新安裝也拉來了它的新版本 - '1.0.2'這個問題已經解決了 – mpapis
你剛剛結束了幾個小時的痛苦和困惑。 – Max