データベース更新後、うまく反映されなかったのでunicornを再起動してみたら、これまで繋がっていたのに繋がらなくなってしまいました。
[ec2-user@ip-172-31-44-15 ryotei]$ RAILS_SERVE_STATIC_FILES=1 unicorn_rails -c config/unicorn.rb -E production -D Traceback (most recent call last): 10: from /home/ec2-user/.rbenv/versions/2.5.1/bin/unicorn_rails:23:in `<main>' 9: from /home/ec2-user/.rbenv/versions/2.5.1/bin/unicorn_rails:23:in `load' 8: from /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.4.1/bin/unicorn_rails:209:in `<top (required)>' 7: from /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.4.1/bin/unicorn_rails:209:in `new' 6: from /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.4.1/lib/unicorn/http_server.rb:77:in `initialize' 5: from /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.4.1/lib/unicorn/http_server.rb:77:in `new' 4: from /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.4.1/lib/unicorn/configurator.rb:77:in `initialize' 3: from /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.4.1/lib/unicorn/configurator.rb:84:in `reload' 2: from /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.4.1/lib/unicorn/configurator.rb:84:in `instance_eval' 1: from config/unicorn.rb:3:in `reload' /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.4.1/lib/unicorn/configurator.rb:592:in `working_directory': config_file=config/unicorn.rb would not be accessible in working_directory=/var/www/current (ArgumentError) master failed to start, check stderr log for details
I, [2020-03-27T03:46:52.246112 #15065] INFO -- : worker=0 ready /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.4.1/lib/unicorn/http_server.rb:205:in `pid=': Already running on PID:15060 (or pid=/var/www/ryotei/tmp/pids/unicorn.pid is stale) (ArgumentError) from /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.4.1/lib/unicorn/http_server.rb:137:in `start' from /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.4.1/bin/unicorn_rails:209:in `<top (required)>' from /home/ec2-user/.rbenv/versions/2.5.1/bin/unicorn_rails:23:in `load' from /home/ec2-user/.rbenv/versions/2.5.1/bin/unicorn_rails:23:in `<main>' I, [2020-03-27T03:49:56.985806 #15060] INFO -- : reaped #<Process::Status: pid 15065 exit 0> worker=0 I, [2020-03-27T03:49:56.985936 #15060] INFO -- : master complete I, [2020-03-27T03:50:10.393338 #15183] INFO -- : Refreshing Gem list I, [2020-03-27T03:50:11.992737 #15183] INFO -- : listening on addr=0.0.0.0:3000 fd=11 I, [2020-03-27T03:50:11.997961 #15183] INFO -- : master process ready I, [2020-03-27T03:50:12.002744 #15223] INFO -- : worker=0 ready E, [2020-03-27T03:54:56.180225 #15183] ERROR -- : worker=0 PID:15223 timeout (61s > 60s), killing E, [2020-03-27T03:54:56.182980 #15183] ERROR -- : reaped #<Process::Status: pid 15223 SIGKILL (signal 9)> worker=0 I, [2020-03-27T03:54:56.185929 #15229] INFO -- : worker=0 ready E, [2020-03-27T04:13:42.778450 #15183] ERROR -- : worker=0 PID:15229 timeout (61s > 60s), killing E, [2020-03-27T04:13:42.782199 #15183] ERROR -- : reaped #<Process::Status: pid 15229 SIGKILL (signal 9)> worker=0 I, [2020-03-27T04:13:42.785316 #15315] INFO -- : worker=0 ready
config/deploy.rb
lock '3.12.1' set :application, 'ryotei' set :branch, 'master' set :repo_url, 'git@github.com:annaPanda8170/ryotei.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' set :ssh_options, auth_methods: ['publickey'], keys: ['~/.ssh/ryotei.pem'] set :unicorn_pid, -> { "#{shared_path}/tmp/pids/unicorn.pid" } set :unicorn_config_path, -> { "#{current_path}/config/unicorn.rb" } set :keep_releases, 5 after 'deploy:publishing', 'deploy:restart' namespace :deploy do task :restart do invoke 'unicorn:restart' end end
config/unicorn.rb
app_path = File.expand_path('../../../', __FILE__) worker_processes 1 working_directory "#{app_path}/current" pid "#{app_path}/shared/tmp/pids/unicorn.pid" listen "#{app_path}/shared/tmp/sockets/unicorn.sock" stderr_path "#{app_path}/shared/log/unicorn.stderr.log" stdout_path "#{app_path}/shared/log/unicorn.stdout.log" timeout 60 preload_app true GC.respond_to?(:copy_on_write_friendly=) && GC.copy_on_write_friendly = true check_client_connection false run_once = true before_fork do |server, worker| defined?(ActiveRecord::Base) && ActiveRecord::Base.connection.disconnect! if run_once run_once = false end old_pid = "#{server.config[:pid]}.oldbin" if File.exist?(old_pid) && server.pid != old_pid begin sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU Process.kill(sig, File.read(old_pid).to_i) rescue Errno::ENOENT, Errno::ESRCH => e logger.error e end end end after_fork do |_server, _worker| defined?(ActiveRecord::Base) && ActiveRecord::Base.establish_connection end
見ていただければ幸いです。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。