2013-12-14 45 views
2

嗨,我想我在這裏缺少一些基本的東西。Capistrano在生產中找不到寶石

我正在使用Capistrano進行「整合」,然後進行「測試」。

我似乎無法添加寶石,然後成功部署與Capistrano其中一個網站('測試')。不過,我可以將它成功部署到另一個(「集成」)。

我想添加bootstrap-sass'〜> 3.0.2.0',但是當我嘗試添加它們時發生與其他寶石相同的錯誤。

當我嘗試部署到具有「帽測試部署」測試',我得到它讀取

whenever --update-crontab registration --set environment=testing --roles db" 
    servers: ["test.calm.dhamma.org"] 
    [test.calm.dhamma.org] executing command 
*** [err :: test.calm.dhamma.org] /home/calm/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/spec_set.rb:92:in `block in materialize' 
*** [err :: test.calm.dhamma.org] : 
*** [err :: test.calm.dhamma.org] Could not find bootstrap-sass-3.0.3.0 in any of the sources 
*** [err :: test.calm.dhamma.org] (
*** [err :: test.calm.dhamma.org] Bundler::GemNotFound 
*** [err :: test.calm.dhamma.org]) 
*** [err :: test.calm.dhamma.org] from /home/calm/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/spec_set.rb:85:in `map!' 
*** [err :: test.calm.dhamma.org] from /home/calm/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/spec_set.rb:85:in `materialize' 
*** [err :: test.calm.dhamma.org] from /home/calm/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/definition.rb:114:in `specs' 
*** [err :: test.calm.dhamma.org] from /home/calm/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/definition.rb:159:in `specs_for' 
*** [err :: test.calm.dhamma.org] from /home/calm/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/definition.rb:148:in `requested_specs' 
etc.. 

錯誤我已經花了很長的時間尋找,但沒有成功的答案。我確實有

require 'bundler/capistrano' 

在我的Capfile.rb中,如下所示。

require "rvm/capistrano" 

#set :rvm_type, :system # :user is the default 

set :rvm_ruby_string, ENV['GEM_HOME'].gsub(/.*\//,"") # Read from local system 
puts "RVM ruby string = " 
puts rvm_ruby_string 
#set :rvm_ruby_string, :local 
# 
set :rvm_autolibs_flag, "read-only" 

before 'deploy:setup', 'rvm:install_rvm' 
before 'deploy:setup', 'rvm:install_ruby' 


require 'bundler/capistrano' 

require 'capistrano/ext/multistage' 
set :stages, ["integration","testing", "production"] 
set :default_stage, "integration" 

# use whenever gem. Only if you have chron jobs 
require "whenever/capistrano" 
set :whenever_command, "bundle exec whenever" 

set :application, "registration" 
set :repository, "ssh://[email protected]/home/gitrepo/repositories/registration" 
#set :repository, "ssh://[email protected]/home/gitrepo/repositories/registration" 

set :scm, :git 
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none` 


set :deploy_to,  "/home/calm/wwwshare/registration" 
set :user,   "calm" 
set :use_sudo,  false 
set :ssh_options,  { :forward_agent => true } 

#set :deploy_to, "/home/calm/wwwshare/#{application}" 
set :deploy_via, :remote_cache 

#before "deploy:bundle_gems","deploy:symlink_vendor" 
#after "deploy", "deploy:bundle_gems" 
#after "deploy:bundle_gems", "assets:symlink" 
#after "assets:symlink", "deploy:copy_database_configuration" 
#after "deploy:copy_database_configuration", "deploy:restart" 

# http://beginrescueend.com/integration/capistrano/ 

#set :default_environment, { 
# 'PATH' => "/home/calm/.rvm/gems/ruby-1.9.3-p448/bin:/home/calm/.rvm/gems/[email protected]/bin:/home/calm/.rvm/bin:/home/calm/.rvm/rubies/ruby-1.9.3-p448/bin:$PATH", 
# 'RUBY_VERSION' => 'ruby-1.9.3-p448', 
# 'GEM_HOME'  => '/home/calm/.rvm/gems/ruby-1.9.3-p448', 
# 'GEM_PATH'  => '/home/calm/.rvm/gems/ruby-1.9.3-p448:/home/calm/.rvm/gems/[email protected]', 
# 'BUNDLE_PATH' => '/home/calm/.rvm/gems/ruby-1.9.3-p448' # If you are using bundler. 
#} 

#task :testing do 
# server 'THE-SERVER.mudbugmedia.com', :web, :app, :db, :primary => true 
# set :deploy_to, '/home/calm/wwwshare/#{application}' 
# set :rails_env, 'testing' 
# set :branch, 'master' 
#end 

after 'deploy:setup', :create_configs 
desc 'Create the shared/config dir for various config files' 
task :create_configs do 
    run "mkdir -p #{shared_path}/config" 
    run "touch #{shared_path}/config/database.yml" 
end 

after 'deploy:finalize_update', :update_configs 
desc 'Copy the shared config files to the release config dir' 
task :update_configs do 
    run "cp -Rf #{shared_path}/config/* #{release_path}/config" 
end 

#after 'deploy:finalize_update', :bundle_gems 
#desc "Install gems ??? or require 'bundler/capistrano'" 
#task :bundle_gems do 
# run "cd #{release_path} && bundle install --path vendor/gems" 
#end 


# If you are using Passenger 
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 

我曾嘗試通過編輯的Gemfile和Gemfile.lock的存在是對我的發展和「一體化」的網站和捆綁安裝運行的那些一致的「測試」的網站直接安裝寶石。

然後當我捆綁節目「我得到

bundle show bootstrap-sass 
....../.rvm/gems/ruby-1.9.3-p448/gems/bootstrap-sass-3.0.2.1 

然後:

bundle exec gem list 
Could not find bootstrap-sass-3.0.2.1 in any of the sources 
Run `bundle install` to install missing gems. 

帽測試部署仍然失敗以及

在其工作原理是安裝寶石網站如下圖所示:

bundle show bootstrap-sass 
...../registration/shared/bundle/ruby/1.9.1/gems/bootstrap-sass-3.0.2.1 

這與我在無法正常工作的網站上手動安裝它的位置不同。

所以,我的問題是:

爲什麼Capistrano的失敗,新的寶石添加到一個網站,但成功與其他?

我應該直接在不工作的網站上安裝gem嗎?如果這是一個好主意,我該如何將它安裝到正確的位置?

瑞安

+0

它現在工作 - 似乎有不同的ruby版本的問題。我在本地有1.9.7 p448,測試了1.9.7 p484。我們只是將每臺機器上的所有版本都設置爲同一個版本,我現在可以使用Capistrano根據對Gemfile的更改更新寶石。 – ryan2johnson9

回答

0

現在讓我的評論答案:

它現在的工作 - 它似乎有具有不同Ruby版本的問題。我在本地有1.9.7 p448,測試了1.9.7 p484。我們只是將每臺機器上的所有版本都設置爲同一個版本,我現在可以使用Capistrano根據對Gemfile的更改更新寶石。

相關問題