abstract
1- unicornが起動できない 2- エラーログを確認しようと思ったがunicorn.logが生成されていない 3- 別件だがNginxのログファイルも生成されていない(こちらはログファイルの記述自体を削除したのでエラーは吐かれていない)
こちらの記事を参考にrailsアプリをデプロイしようとしています。
https://qiita.com/naoki_mochizuki/items/5a1757d222806cbe0cd1
sudo service nginx start
コマンドでNginxを起動した後に下記の画面が表示されたので
Nginx起動後
bash
1[username@ip]$ unicorn_rails -c /var/www/rails/rails_app/config/unicorn.conf.rb -D -E production 2Traceback (most recent call last): 3 11: from /home/username/.rbenv/versions/2.5.1/bin/unicorn_rails:23:in `<main>' 4 10: from /home/username/.rbenv/versions/2.5.1/bin/unicorn_rails:23:in `load' 5 9: from /home/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.5.1/bin/unicorn_rails:209:in `<top (required)>' 6 8: from /home/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.5.1/bin/unicorn_rails:209:in `new' 7 7: from /home/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.5.1/lib/unicorn/http_server.rb:79:in `initialize' 8 6: from /home/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.5.1/lib/unicorn/http_server.rb:79:in `new' 9 5: from /home/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.5.1/lib/unicorn/configurator.rb:77:in `initialize' 10 4: from /home/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.5.1/lib/unicorn/configurator.rb:84:in `reload' 11 3: from /home/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.5.1/lib/unicorn/configurator.rb:84:in `instance_eval' 12 2: from /var/www/rails/rails_app/config/unicorn.conf.rb:10:in `reload' 13 1: from /home/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.5.1/lib/unicorn/configurator.rb:607:in `working_directory' 14/home/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/unicorn-5.5.1/lib/unicorn/configurator.rb:607:in `chdir': No such file or directory @ dir_s_chdir - /var/www/rails/rails_app (Errno::ENOENT) 15master failed to start, check stderr log for details
unicornのエラーログを確認しようとしたところアプリケーション配下のlog
ディレクトリにunicorn.log
が存在していませんでした。
bash
1[username@ip log]$ ls 2production.log 3 4[username@ip rails_app]$ less log/unicorn.stderr.log 5log/unicorn.stderr.log: No such file or directory
ログの確認方法 or ログファイルが生成されていない原因を教えていただけると幸いです。
プロセスの確認↓
[username@ip rails_app]$ ps -ef | grep unicorn username 30290 29889 0 06:36 pts/0 00:00:00 grep --color=auto unicorn [username@ip rails_app]$ ps -ef | grep unicorn | grep -v grep //出力なし
unicorn.conf.rb
unicorn.conf.rb
1# set lets 2 $worker = 2 3 $timeout = 30 4 $app_dir = "/var/www/rails/rails_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 33

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/01/26 07:01