2013-10-26 11 views
14

Capistrano v3でアプリケーションを展開する際に問題があります。私は「$キャップ生産デプロイ」を実行すると、私はエラーが表示さ...Capistrano v3でバンドルが見つかりませんでした

INFO [825ad68d] Running /usr/bin/env bundle --gemfile /home/username/www/myapp/releases/20131026181031/Gemfile --path /home/username/www/myapp/shared/bundle --deployment --quiet --binstubs /home/username/www/myapp/shared/bin --without development test on myhostname.com 
DEBUG [825ad68d] Command: cd /home/username/www/myapp/releases/20131026181031 && (RAILS_ENV=production /usr/bin/env bundle --gemfile /home/username/www/myapp/releases/20131026181031/Gemfile --path /home/username/www/myapp/shared/bundle --deployment --quiet --binstubs /home/username/www/myapp/shared/bin --without development test) 
DEBUG [825ad68d] /usr/bin/env: 
DEBUG [825ad68d] bundle 
DEBUG [825ad68d] : No such file or directory 

しかし、私は最後のコマンドを実行したときに...

cd /home/username/www/myapp/releases/20131026181031 && (RAILS_ENV=production /usr/bin/env bundle --gemfile /home/username/www/myapp/releases/20131026181031/Gemfile --path /home/username/www/myapp/shared/bundle --deployment --quiet --binstubs /home/username/www/myapp/shared/bin --without development test) 

...私のサーバー、私はドンのSSH経由何か誤りがあるのを見ます。

ここ

私のサーバーの環境は次のとおりです。

  • のUbuntu 13.04
  • RVM 1.23.5
  • RubyGemsの1.8.25
  • バンドラー1.3.5
  • ルビー1.9.3p448
  • カピストラーノ(3.0.0)
  • capistrano-bundler(1.0.0)
  • ここ
  • カピストラーノレール(1.0.0)

カピストラーノの設定は、以下を参照してください

... 
group :development do 
    ... 
    # Deploy with Capistrano 
    gem 'capistrano', '~> 3.0.0' 
    gem 'capistrano-rails' 
    gem 'capistrano-bundler' 
end 
... 

カピストラーノの宝石を含んでいる私のGemfileの一部です:

Capfile

require 'capistrano/setup' 
require 'capistrano/deploy' 
require 'capistrano/bundler' 
require 'capistrano/rails/assets' 
require 'capistrano/rails/migrations' 

Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r } 

のconfig/deploy.rb

set :application, 'myapp' 
set :repo_url, "/home/username/repository/#{fetch(:application)}.git" 
set :deploy_to, "/home/usename/www/#{fetch(:application)}" 
set :scm, :git 
set :branch, "master" 
set :format, :pretty 
set :use_sudo, false 

set :linked_files, %w{config/database.yml} 
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system} 

set :keep_releases, 5 

SSHKit.config.command_map[:rake] = "bundle exec rake" 
SSHKit.config.command_map[:rails] = "bundle exec rails" 

namespace :deploy do 

    desc 'Restart application' 
    task :restart do 
    on roles(:app), in: :sequence, wait: 5 do 
     # Your restart mechanism here, for example: 
     # execute :touch, release_path.join('tmp/restart.txt') 
    end 
    end 

    after :restart, :clear_cache do 
    on roles(:web), in: :groups, limit: 3, wait: 10 do 
     # Here we can do anything such as: 
     # within release_path do 
     # execute :rake, 'cache:clear' 
     # end 
    end 
    end 

    after :finishing, 'deploy:cleanup' 
end 

設定/展開/ production.rb

set :stage, :production 

set :bundle_gemfile, -> { release_path.join('Gemfile') } 
set :bundle_dir, -> { shared_path.join('bundle') } 
set :bundle_flags, '--deployment --quiet' 
set :bundle_without, %w{development test}.join(' ') 
set :bundle_binstubs, -> { shared_path.join('bin') } 
set :bundle_roles, :all 

role :app, %w{myhostname.com} 
role :web, %w{myhostname.com} 
role :db, %w{myhostname.com} 

server 'myhostname.com', user: 'username', roles: %w{web app}, my_property: :my_value 

fetch(:default_env).merge!(rails_env: :production) 

私を助けてください。

はGemfileにカピストラーノ-RVMを追加し、

... 
group :development do 
    ... 
    gem 'capistrano', '~> 3.0.0' 
    gem 'capistrano-rails' 
    gem 'capistrano-bundler' 
    gem 'capistrano-rvm' 
end 
... 

を行うCapfile

に次の行を追加します。

は、私は手順を実行して、私の問題を解決してきました

を解決しました

require 'capistrano/rvm' 

deploy.rbファイルにこれらの行を追加します。私のサーバー上でssh経由で私はすべてのエラーが表示されない

set :rvm_ruby_version, '1.9.3-p448' 
set :default_env, { rvm_bin_path: '~/.rvm/bin' } 
SSHKit.config.command_map[:rake] = "#{fetch(:default_env)[:rvm_bin_path]}/rvm ruby-#{fetch(:rvm_ruby_version)} do bundle exec rake" 
+1

が重複する可能性はありませんcapistranoからの作業] http://stackoverflow.com/questions/19363077/bundle-install-doesnt-work-from-capistrano) –

+0

gemfileに宝石 'capistrano-rvm'を追加した後、バンドルを実行し、require' capistrano/'Capfile'の' rvm' –

答えて

7

あなたがcapistrano-rvmを追加しなければならなかったようです。 ルビーbundlerのパスを処理します。 [バンドルインストールの

bundle install doesn't work from capistrano

+0

私はcapistrano-rvmを追加して問題を解決しましたが、別の問題が発生しました。 (RVM_BIN_PATH =〜/ .rvm/bin RAILS_ENV =〜/)は、以下のようになります: 'DEBUG [3686e995]コマンド:cd/home/username/www/myapp/releases/20131027130646 && .rvm/bin/rvm ruby​​-1.9.3-p448 rake assetsを実行する:プリコンパイル) DEBUG [3686e995] \t /home/username/.rvm/gems/[email protected]/gems/bundler-1.3 0.5/LIB /バンドラ/ spec_set.rb:92:ブロック内のマテリアで」 DEBUG [3686e995]: DEBUGは[3686e995]ソース DEBUG [3686e995]( DEBUGのいずれかにI18N-0.6.1を見つけることができませんでし[3686e995] \t Bundler :: GemNotFound' – ekondr

+0

@ekondr '' 'RAILS_ENV'''は' '' set:rails_env、 '' ''の代わりにproduction "' 'を追加しようとしていません。 fetch(:default_env).merge!(rails_env::production) '' ' – freemanoid

+0

' fetch(:default_env).merge!(rails_env::production) 'の代わりに' set:rails_env、 "production"を追加しましたが、何も変わりませんでした。 – ekondr

0

...。

表示されている問題はおそらく、rbenv、chruby、またはrvmがないことが原因です。これは本当に一般的なものであり、ここに(あなたのケースのために働く方)、解決を検証および/または回避する方法をここに文書化されています:

+1

解決方法については、そのリンクの指示がありません。しかし、問題の良い説明。 – Altonymous

0

あなたは

set :rvm_type, :system 
set :rvm_ruby_version, 'ruby-<version>@<gemset>' 
次のようにシステムRVM(パス=は/ usr/local/RVM/binに/ RVM)、セットカピストラーノ-バンドラを使用する場合に
関連する問題