capistranoでの自動デプロイで下記のエラーが出てしまいます.
ターミナル上でのSSH接続に関しては問題なくできています。
EC2の再起動もしてみたのですが特に変化なしです。
何か原因が分かる方いませんでしょうか。
00:09 bundler:install 01 $HOME/.rbenv/bin/rbenv exec bundle install --path /var/www/EnDes/shared/bundle --jobs 4 --without development test --deployment --quiet 01 /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:289:in `find_spec_for_exe' 01 : 01 can't find gem bundler (>= 0.a) with executable bundle 01 ( 01 Gem::GemNotFoundException 01 ) 01 from /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:308:in `activate_bin_path' 01 from /home/ec2-user/.rbenv/versions/2.5.1/bin/bundle:23:in `<main>' #<Thread:0x00007f88a986cfc0@/Users/nakashun1129/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sshkit-1.21.0/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true): Traceback (most recent call last): 1: from /Users/nakashun1129/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sshkit-1.21.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute' /Users/nakashun1129/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sshkit-1.21.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as ec2-user@18.177.227.174: bundle exit status: 1 (SSHKit::Runner::ExecuteError) bundle stdout: Nothing written bundle stderr: /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException) from /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:308:in `activate_bin_path' from /home/ec2-user/.rbenv/versions/2.5.1/bin/bundle:23:in `<main>' (Backtrace restricted to imported tasks) cap aborted! SSHKit::Runner::ExecuteError: Exception while executing as ec2-user@18.177.227.174: bundle exit status: 1 bundle stdout: Nothing written bundle stderr: /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException) from /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:308:in `activate_bin_path' from /home/ec2-user/.rbenv/versions/2.5.1/bin/bundle:23:in `<main>' Caused by: SSHKit::Command::Failed: bundle exit status: 1 bundle stdout: Nothing written bundle stderr: /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException) from /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:308:in `activate_bin_path' from /home/ec2-user/.rbenv/versions/2.5.1/bin/bundle:23:in `<main>' Tasks: TOP => deploy:updated => bundler:install (See full trace by running task with --trace) The deploy has failed with an error: Exception while executing as ec2-user@18.177.227.174: bundle exit status: 1 bundle stdout: Nothing written bundle stderr: /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException) from /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:308:in `activate_bin_path' from /home/ec2-user/.rbenv/versions/2.5.1/bin/bundle:23:in `<main>' ** DEPLOY FAILED ** Refer to log/capistrano.log for details. Here are the last 20 lines: DEBUG [ca75d211] Command: cd /var/www/EnDes/releases/20200311142800 && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.5.1" ; $HOME/.rbenv/bin/rbenv exec bundle check --path /var/www/EnDes/shared/bundle ) DEBUG [ca75d211] /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:289:in `find_spec_for_exe' DEBUG [ca75d211] : DEBUG [ca75d211] can't find gem bundler (>= 0.a) with executable bundle DEBUG [ca75d211] ( DEBUG [ca75d211] Gem::GemNotFoundException DEBUG [ca75d211] ) DEBUG [ca75d211] from /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:308:in `activate_bin_path' DEBUG [ca75d211] from /home/ec2-user/.rbenv/versions/2.5.1/bin/bundle:23:in `<main>' DEBUG [ca75d211] Finished in 0.203 seconds with exit status 1 (failed). INFO [8ce06e7b] Running $HOME/.rbenv/bin/rbenv exec bundle install --path /var/www/EnDes/shared/bundle --jobs 4 --without development test --deployment --quiet as ec2-user@18.177.227.174
bundlerのバージョンを確認しても特に問題ありませんでした
BUNDLED WITH 2.1.4 Bundler version 2.1.4
deploy.rb # config valid only for current version of Capistrano # capistranoのバージョンを記載。固定のバージョンを利用し続け、バージョン変更によるトラブルを防止する lock '3.11.2' # Capistranoのログの表示に利用する set :application, 'EnDes' # どのリポジトリからアプリをpullするかを指定する set :repo_url, 'git@github.com:nakashun1129/EnDes.git' # バージョンが変わっても共通で参照するディレクトリを指定 set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system', 'public/uploads') set :rbenv_type, :user set :rbenv_ruby, '2.5.1' #カリキュラム通りに進めた場合、2.5.1か2.3.1です # どの公開鍵を利用してデプロイするか set :ssh_options, auth_methods: ['publickey'], keys: ['~/.ssh/EnDes.pem'] # プロセス番号を記載したファイルの場所 set :unicorn_pid, -> { "#{shared_path}/tmp/pids/unicorn.pid" } # Unicornの設定ファイルの場所 set :unicorn_config_path, -> { "#{current_path}/config/unicorn.rb" } set :keep_releases, 5 # デプロイ処理が終わった後、Unicornを再起動するための記述 after 'deploy:publishing', 'deploy:restart' namespace :deploy do task :restart do invoke 'unicorn:restart' end end
deploy/production.rb server '~~.~~~.~~~.~~~', user: 'ec2-user', roles: %w{app db web}
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。