前提・実現したいこと
前提
Ruby2.5.1
MySQL 5.6.47
unicorn 5.4.1
EC2サーバーにて
bundle exec unicorn_rails -c config/unicorn.rb -E production -D
を入力しunicornを起動させたい。
発生している問題・エラーメッセージ
bundler: failed to load command: unicorn_rails (/home/ec2-user/.rbenv/versions/2.5.1/bin/unicorn_rails) ArgumentError: config_file=config/unicorn.rb would not be accessible in working_directory=/var/www/kirakushare/current /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/unicorn.rb:4: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:84:in `instance_eval' /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' /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' /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' /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' /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' /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)>' /home/ec2-user/.rbenv/versions/2.5.1/bin/unicorn_rails:23:in `load' /home/ec2-user/.rbenv/versions/2.5.1/bin/unicorn_rails:23:in `<top (required)>' master failed to start, check stderr log for details [ec2-user@ip-172-31-35-144 kirakushare]$ git pull origi
該当のソースコード
ruby
1app_path = File.expand_path('../../', __FILE__) 2 3worker_processes 1 4working_directory "#{app_path}/current" 5 6listen "#{app_path}/tmp/sockets/unicorn.sock" 7pid "#{app_path}/tmp/pids/unicorn.pid" 8stderr_path "#{app_path}/log/unicorn.stderr.log" 9stdout_path "#{app_path}/log/unicorn.stdout.log" 10 11timeout 60 12 13 14preload_app true 15GC.respond_to?(:copy_on_write_friendly=) && GC.copy_on_write_friendly = true 16 17check_client_connection false 18 19run_once = true 20 21before_fork do |server, worker| 22 defined?(ActiveRecord::Base) && 23 ActiveRecord::Base.connection.disconnect! 24 25 if run_once 26 run_once = false # prevent from firing again 27 end 28 29 old_pid = "#{server.config[:pid]}.oldbin" 30 if File.exist?(old_pid) && server.pid != old_pid 31 begin 32 sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU 33 Process.kill(sig, File.read(old_pid).to_i) 34 rescue Errno::ENOENT, Errno::ESRCH => e 35 logger.error e 36 end 37 end 38end 39 40after_fork do |_server, _worker| 41 defined?(ActiveRecord::Base) && ActiveRecord::Base.establish_connection 42end
試したこと
working_directory
にアクセスできないというエラーが出ているので、
app_path
の中身を../増やすなどしたが改善がみられなかった。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/07/23 02:49