Capistranoで自動デプロイコマンド実行中に以下のようなエラーが表示されました。
unicorn:start 01 $HOME/.rbenv/bin/rbenv exec bundle exec unicorn -c /var/www/aaaa/current/config/unicorn.rb -E deployment -D 01 master failed to start, check stderr log for details raceback (most recent call last): 1: from /Users/ユーザ/.rbenv/versions/2.5.8/lib/ruby/gems/2.5.0/gems/sshkit-1.21.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute' /Users/ユーザ名/.rbenv/versions/2.5.8/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@Elasticip番号: bundle exit status: 1 (SSHKit::Runner::ExecuteError) bundle stdout: Nothing written bundle stderr: master failed to start, check stderr log for details (Backtrace restricted to imported tasks) cap aborted! SSHKit::Runner::ExecuteError: Exception while executing as ec2-user@Elasticip番号: bundle exit status: 1 bundle stdout: Nothing written bundle stderr: master failed to start, check stderr log for details Caused by: SSHKit::Command::Failed: bundle exit status: 1 bundle stdout: Nothing written bundle stderr: master failed to start, check stderr log for details Tasks: TOP => unicorn:start (See full trace by running task with --trace) The deploy has failed with an error: Exception while executing as ec2-user@Elasticip番号: bundle exit status: 1 bundle stdout: Nothing written bundle stderr: master failed to start, check stderr log for details ** DEPLOY FAILED ** Refer to log/capistrano.log for details. Here are the last 20 lines: DEBUG [29071733] Finished in 0.090 seconds with exit status 0 (successful). INFO [d932a065] Running $HOME/.rbenv/bin/rbenv exec bundle exec rake db:migrate as ec2-user@Elasticip番号 DEBUG [d932a065] Command: cd /var/www/aaaa/releases/20200823130418 && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.5.8" RAILS_ENV="production" ; $HOME/.rbenv/bin/rbenv exec bundle exec rake db:migrate ) INFO [d932a065] Finished in 1.997 seconds with exit status 0 (successful). INFO [470b4d91] Running /usr/bin/env ln -s /var/www/aaaa/releases/20200823130418 /var/www/aaaa/releases/current as ec2-user@Elasticip番号: DEBUG [470b4d91] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.5.8" ; /usr/bin/env ln -s /var/www/aaaa/releases/20200823130418 /var/www/aaaa/releases/current ) INFO [470b4d91] Finished in 0.115 seconds with exit status 0 (successful). INFO [b553c215] Running /usr/bin/env mv /var/www/aaaa/releases/current /var/www/aaaa as ec2-user@Elasticip番号: DEBUG [b553c215] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.5.8" ; /usr/bin/env mv /var/www/aaaa/releases/current /var/www/aaaa ) INFO [b553c215] Finished in 0.118 seconds with exit status 0 (successful). DEBUG [4b04f1eb] Running if test ! -d /var/www/aaaa/current; then echo "Directory does not exist '/var/www/aaaa/current'" 1>&2; false; fi as ec2-user@Elasticip番号 DEBUG [4b04f1eb] Command: if test ! -d /var/www/aaaa/current; then echo "Directory does not exist '/var/www/aaaa/current'" 1>&2; false; fi DEBUG [4b04f1eb] Finished in 0.095 seconds with exit status 0 (successful). DEBUG [18f80244] Running [ -e /var/www/aaaa/shared/tmp/pids/unicorn.pid ] && kill -0 `cat /var/www/aaaa/shared/tmp/pids/unicorn.pid` as ec2-user@Elasticip番号 DEBUG [18f80244] Command: [ -e /var/www/aaaa/shared/tmp/pids/unicorn.pid ] && kill -0 `cat /var/www/aaaa/shared/tmp/pids/unicorn.pid` DEBUG [18f80244] bash: 0 行: kill: (18514) - そのようなプロセスはありません DEBUG [18f80244] Finished in 0.100 seconds with exit status 1 (failed). INFO [c49dc855] Running $HOME/.rbenv/bin/rbenv exec bundle exec unicorn -c /var/www/aaaa/current/config/unicorn.rb -E deployment -D as ec2-user@Elasticip番号: DEBUG [c49dc855] Command: cd /var/www/aaaa/current && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.5.8" RAILS_ENV="production" ; $HOME/.rbenv/bin/rbenv exec bundle exec unicorn -c /var/www/aaaa/current/config/unicorn.rb -E deployment -D ) DEBUG [c49dc855] master failed to start, check stderr log for details
unicorn.rb
1app_path = File.expand_path('../../../', __FILE__) 2 3 4worker_processes 1 5# currentを指定 6working_directory "#{app_path}/current" 7 8# それぞれ、sharedの中を参照するよう変更 9 10pid "#{app_path}/shared/tmp/pids/unicorn.pid" 11 12listen "#{app_path}/shared/tmp/sockets/unicorn.sock" 13 14stderr_path "#{app_path}/shared/log/unicorn.stderr.log" 15 16stdout_path "#{app_path}/shared/log/unicorn.stdout.log" 17#Railsアプリケーションの応答を待つ上限時間を設定 18timeout 60 19 20#以下は応用的な設定なので説明は割愛 21 22preload_app true 23GC.respond_to?(:copy_on_write_friendly=) && GC.copy_on_write_friendly = true 24 25check_client_connection false 26 27run_once = true 28 29before_fork do |server, worker| 30 defined?(ActiveRecord::Base) && 31 ActiveRecord::Base.connection.disconnect! 32 33 if run_once 34 run_once = false # prevent from firing again 35 end 36 37 old_pid = "#{server.config[:pid]}.oldbin" 38 if File.exist?(old_pid) && server.pid != old_pid 39 begin 40 sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU 41 Process.kill(sig, File.read(old_pid).to_i) 42 rescue Errno::ENOENT, Errno::ESRCH => e 43 logger.error e 44 end 45 end 46end 47 48after_fork do |_server, _worker| 49 defined?(ActiveRecord::Base) && ActiveRecord::Base.establish_connection 50end
unicornの起動でエラーが起きているように見えます。
原因わかる方いませんでしょうか?
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。