EC2よりrailsアプリをデプロイしようと考えています。
bundle exec unicorn_rails -c /var/www/rails/music_app/config/unicorn.conf.rb -D -E production の後に
Elsaticアドレスをブラウザでたたいたところ応答がなかったためlog/unicorn.pidをみたところ以下のエラーが出てきました。
[ec2-user@ip-10-0-0-181 log]$ vi unicorn.log I, [2020-11-25T11:49:01.522140 #11588] INFO -- : Refreshing Gem list I, [2020-11-25T11:49:03.559958 #11588] INFO -- : listening on addr=/var/www/rails/music_app/tmp/sockets/.unicorn.sock fd=8 I, [2020-11-25T11:49:03.602171 #11588] INFO -- : master process ready I, [2020-11-25T11:49:03.610534 #11594] INFO -- : worker=1 ready I, [2020-11-25T11:49:03.611615 #11592] INFO -- : worker=0 ready I, [2020-11-25T12:37:05.403432 #11588] INFO -- : reaped #<Process::Status: pid 11592 exit 0> worker=0 I, [2020-11-25T12:37:05.403529 #11588] INFO -- : reaped #<Process::Status: pid 11594 exit 0> worker=1 I, [2020-11-25T12:37:05.403596 #11588] INFO -- : master complete I, [2020-11-25T12:38:31.094288 #12421] INFO -- : Refreshing Gem list I, [2020-11-25T12:38:32.659186 #12421] INFO -- : unlinking existing socket=/var/www/rails/music_app/tmp/sockets/.unicorn.sock I, [2020-11-25T12:38:32.659361 #12421] INFO -- : listening on addr=/var/www/rails/music_app/tmp/sockets/.unicorn.sock fd=8 I, [2020-11-25T12:38:32.692011 #12421] INFO -- : master process ready I, [2020-11-25T12:38:32.698648 #12425] INFO -- : worker=0 ready I, [2020-11-25T12:38:32.700654 #12427] INFO -- : worker=1 ready I, [2020-11-25T13:06:09.143465 #12421] INFO -- : reaped #<Process::Status: pid 12425 exit 0> worker=0 I, [2020-11-25T13:06:09.143563 #12421] INFO -- : reaped #<Process::Status: pid 12427 exit 0> worker=1 I, [2020-11-25T13:06:09.143626 #12421] INFO -- : master complete I, [2020-11-25T13:06:25.498304 #12813] INFO -- : Refreshing Gem list I, [2020-11-25T13:06:27.057117 #12813] INFO -- : unlinking existing socket=/var/www/rails/music_app/tmp/sockets/.unicorn.sock I, [2020-11-25T13:06:27.057288 #12813] INFO -- : listening on addr=/var/www/rails/music_app/tmp/sockets/.unicorn.sock fd=8 I, [2020-11-25T13:06:27.086848 #12813] INFO -- : master process ready I, [2020-11-25T13:06:27.093492 #12817] INFO -- : worker=0 ready I, [2020-11-25T13:06:27.095438 #12819] INFO -- : worker=1 ready bundler: failed to load command: unicorn_rails (/home/ec2-user/.rbenv/versions/2.5.3/bin/unicorn_rails) ArgumentError: Already running on PID:12813 (or pid=/var/www/rails/music_app/tmp/pids/unicorn.pid is stale) /home/ec2-user/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/unicorn-5.7.0/lib/unicorn/http_server.rb:207:in `pid=' /home/ec2-user/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/unicorn-5.7.0/lib/unicorn/http_server.rb:139:in `start' /home/ec2-user/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/unicorn-5.7.0/bin/unicorn_rails:209:in `<top (required)>' /home/ec2-user/.rbenv/versions/2.5.3/bin/unicorn_rails:23:in `load' /home/ec2-user/.rbenv/versions/2.5.3/bin/unicorn_rails:23:in `<top (required)>' bundler: failed to load command: unicorn_rails (/home/ec2-user/.rbenv/versions/2.5.3/bin/unicorn_rails) ArgumentError: Already running on PID:12813 (or pid=/var/www/rails/music_app/tmp/pids/unicorn.pid is stale) /home/ec2-user/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/unicorn-5.4.1/lib/unicorn/http_server.rb:205:in `pid=' /home/ec2-user/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/unicorn-5.4.1/lib/unicorn/http_server.rb:137:in `start'
pid:12813が原因だと思ったので
terminal
1[ec2-user@ip-10-0-0-181 log]$ ps aux | grep 12813 2ec2-user 19682 0.0 0.0 119420 952 pts/0 S+ 11:59 0:00 grep --color=auto 12813
19682をkillしようとしたのですが以下のように返されてしまいます。
terminal
1[ec2-user@ip-10-0-0-181 log]$ kill 19682 2-bash: kill: (19682) - No such process 3
unicorn.conf.rbの設定ミスでエラーが出てしまっているのかわからず、困惑しております。。
分かる方がいれば教えていただけないでしょうか。。
unicorn
1# set lets 2 $worker = 2 3 $timeout = 30 4 $app_dir = "/var/www/rails/music_app" 5 $listen = File.expand_path 'tmp/sockets/.unicorn.sock', $app_dir 6 $pid = File.expand_path 'tmp/pids/unicorn.pid', $app_dir 7 $std_log = File.expand_path 'log/unicorn.log', $app_dir 8 # set config 9 worker_processes $worker 10 working_directory $app_dir 11 stderr_path $std_log 12 stdout_path $std_log 13 timeout $timeout 14 listen $listen 15 pid $pid 16 # loading booster 17 preload_app true 18 # before starting processes 19 before_fork do |server, worker| 20 defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect! 21 old_pid = "#{server.config[:pid]}.oldbin" 22 if old_pid != server.pid 23 begin 24 Process.kill "QUIT", File.read(old_pid).to_i 25 rescue Errno::ENOENT, Errno::ESRCH 26 end 27 end 28 end 29 # after finishing processes 30 after_fork do |server, worker| 31 defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection 32 end
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2020/11/27 03:00