2012-02-07 73 views
0

我試圖部署1次到服務器(cap deploy:cold),它一直要求我安裝寶石。只是一個例子:第一次部署 - 需要在服務器上安裝所有的寶石

*** [err :: ip-address] Could not find net-ssh-2.3.0 in any of the sources 

有什麼我可以安裝所需的所有寶石一槍?

這裏是我的deploy.rb文件,Gemfile中:

deploy.rb

set :application, "myapp" 
set :repository, "repo goes here" 
set :scm, :git 
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none` 

role :web, "ipaddress"       # Your HTTP server, Apache/etc 
role :app, "ipaddress"       # This may be the same as your `Web` server 
role :db, "ipaddress", :primary => true # This is where Rails migrations will run 
# role :db, "your slave db-server here" 

# if you're still using the script/reaper helper you will need 
# these http://github.com/rails/irs_process_scripts 

set :deploy_to, "/home/deploy/#{application}" 
set :rails_env, 'production' 
set :branch, "master" 

set :scm, :git 
set :user, "user" 
set :runner, "user" 
# ssh_options[:port] = 2232 
set :use_sudo, false 
set :normalize_asset_timestamps, false 


# If you are using Passenger mod_rails uncomment this: 
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 

namespace :bundler do 
    task :create_symlink, :roles => :app do 
    shared_dir = File.join(shared_path, 'bundle') 
    release_dir = File.join(current_release, '.bundle') 
    run("mkdir -p #{shared_dir} && ln -s #{shared_dir} #{release_dir}") 
    end 

    task :bundle_new_release, :roles => :app do 
    bundler.create_symlink 
    run "cd #{release_path} && bundle install --without test" 
    end 

    task :lock, :roles => :app do 
    run "cd #{current_release} && bundle lock;" 
    end 

    task :unlock, :roles => :app do 
    run "cd #{current_release} && bundle unlock;" 
    end 
end 

after "deploy", "deploy:cleanup" 

namespace :deploy do 

    desc "Restarting mod_rails with restart.txt" 
    task :restart, :roles => :app, :except => { :no_release => true } do 
     run "touch #{current_path}/tmp/restart.txt" 
    end 

    [:start, :stop].each do |t| 
     desc "#{t} task is a no-op with mod_rails" 
     task t, :roles => :domain do ; end 
    end 
end 

task :after_update_code do 
run "ln -nfs #{deploy_to}/shared/config/database.yml #{release_path}/config/database.yml" 
end 

的Gemfile:

source 'http://rubygems.org' 

gem 'rails', '3.1.3' 

# Bundle edge Rails instead: 
# gem 'rails',  :git => 'git://github.com/rails/rails.git' 



gem 'json' 
gem 'rake', '0.9.2.2' 
gem 'mysql2' 
gem 'capistrano' 
gem 'therubyracer' 

# Gems used only for assets and not required 
# in production environments by default. 
group :assets do 
    gem 'sass-rails', '~> 3.1.5' 
    gem 'coffee-rails', '~> 3.1.1' 
    gem 'uglifier', '>= 1.0.3' 
end 

gem 'jquery-rails' 

# To use ActiveModel has_secure_password 
# gem 'bcrypt-ruby', '~> 3.0.0' 

# Use unicorn as the web server 
# gem 'unicorn' 

# Deploy with Capistrano 
# gem 'capistrano' 

# To use debugger 
# gem 'ruby-debug' 
+1

Th是後可能會幫助你:http://stackoverflow.com/questions/7706485/do-i-need-to-install-bundler-manually-on-my-server-before-being-able-to-deploy-w – DemitryT 2012-02-07 20:37:13

+0

謝謝,我看到了 - 我在機器上安裝了打包程序,但是我的應用程序尚未部署,因此我無法打包安裝。 – fatfrog 2012-02-07 20:50:08

+0

請嘗試我在下面添加的答案,如果passanger_ruby與capistrano正在使用的相同,則在您的deploy.rb文件 – DemitryT 2012-02-07 20:51:09

回答

0

嘗試添加這對您的deploy.rb

set :bundle_without, [:development, :test] 
require 'bundler/capistrano' 
+0

我試過了,但仍然得到:** [out :: ip-address]無法在任何來源 – fatfrog 2012-02-07 20:51:38

+0

嗯找到net-ssh-2.3.0這真的很奇怪,我認爲這樣做。你看看這個頁面嗎? http://gembundler.com/deploying.html – DemitryT 2012-02-07 21:01:41

+0

我在底部注意到了這個錯誤:failed:「env PATH =/opt/ruby​​/bin /:$ PATH sh -c'cd/home/deploy/tomahawk/releases/20120207210055 && bundle exec rake RAILS_ENV = production RAILS_GROUPS = assets assets:precompile'「 – fatfrog 2012-02-07 21:02:20

1

也許如果你改變th是線

run "cd #{release_path} && bundle install --without test" 

run "cd #{release_path} && bundle install --path=you_gem_path --without #{bundle_without.join(' ')}" 

您可以通過運行

$ echo $GEM_PATH 

找到你的寶石路徑,你也必須設置bundle_without 可以將其設置在文件

的開始
set :bundle_without,  [:development, :test] 
相關問題