本番環境でunicornが起動しなくて困っております。
[ec2-user@ip-10-0-1-60 music_app]$ bundle exec unicorn_rails -c /var/www/rails/music_app/config/unicorn.conf.rb -D -E production bundler: failed to load command: unicorn_rails (/home/ec2-user/.rbenv/versions/2.5.3/bin/unicorn_rails) ArgumentError: directory for pid=/var/www/rails/music_app/tmp/pids/unicorn.pid not writable /home/ec2-user/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/unicorn-5.4.1/lib/unicorn/configurator.rb:100:in `block in reload' /home/ec2-user/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/unicorn-5.4.1/lib/unicorn/configurator.rb:96:in `each' /home/ec2-user/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/unicorn-5.4.1/lib/unicorn/configurator.rb:96:in `reload' /home/ec2-user/.rbenv/versions/2.5.3/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.3/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.3/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.3/lib/ruby/gems/2.5.0/gems/unicorn-5.4.1/bin/unicorn_rails:209:in `new' /home/ec2-user/.rbenv/versions/2.5.3/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.3/bin/unicorn_rails:23:in `load' /home/ec2-user/.rbenv/versions/2.5.3/bin/unicorn_rails:23:in `<top (required)>' master failed to start, check stderr log for details
権限周りなのかと思ったのですがそういうわけでもなかったです
# set lets $worker = 2 $timeout = 30 $app_dir = "/var/www/rails/music_app" $listen = File.expand_path 'tmp/sockets/.unicorn.sock', $app_dir $pid = File.expand_path 'tmp/pids/unicorn.pid', $app_dir $std_log = File.expand_path 'log/unicorn.log', $app_dir # set config worker_processes $worker working_directory $app_dir stderr_path $std_log stdout_path $std_log timeout $timeout listen $listen pid $pid # loading booster preload_app true # before starting processes before_fork do |server, worker| defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect! old_pid = "#{server.config[:pid]}.oldbin" if old_pid != server.pid begin Process.kill "QUIT", File.read(old_pid).to_i rescue Errno::ENOENT, Errno::ESRCH end end end # after finishing processes after_fork do |server, worker| defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection end
もしわかる方がいればご教授いただけないでしょうか?
宜しくお願いします。
あなたの回答
tips
プレビュー