Q&A
###前提・実現したいこと
vagrant(CentOS6)上のRailsアプリケーションをunicorn+nginxで構築したサーバで動かしたい。
別の環境では動くことが確認できているのですが、現在うまく立ち上がらずに困っています。
###発生している問題・エラーメッセージ
$ rake unicorn:start bundle exec unicorn_rails -c /vagrant/config/unicorn/development.rb -E development -D master failed to start, check stderr log for details rake aborted! Command failed with status (1): [bundle exec unicorn_rails -c /vagrant/conf...] /vagrant/lib/tasks/unicorn.rake:16:in `block (2 levels) in <top (required)>' Tasks: TOP => unicorn:start (See full trace by running task with --trace)
ログ
I, [2016-09-28T12:30:47.815853 #7554] INFO -- : Refreshing Gem list I, [2016-09-28T12:30:55.425176 #7554] INFO -- : unlinking existing socket=/tmp/unicorn.sock F, [2016-09-28T12:30:55.425724 #7554] FATAL -- : error adding listener addr=/tmp/unicorn.sock bundler: failed to load command: unicorn_rails (/usr/local/rbenv/versions/2.2.5/bin/unicorn_rails) Errno::EPERM: Operation not permitted @ unlink_internal - /tmp/unicorn.sock /usr/local/rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/lib/unicorn/socket_helper.rb:113:in `unlink' /usr/local/rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/lib/unicorn/socket_helper.rb:113:in `rescue in bind_listen' /usr/local/rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/lib/unicorn/socket_helper.rb:107:in `bind_listen' /usr/local/rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:231:in `listen' /usr/local/rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:808:in `block in bind_new_listeners!' /usr/local/rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:808:in `each' /usr/local/rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:808:in `bind_new_listeners!' /usr/local/rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:130:in `start' /usr/local/rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/bin/unicorn_rails:209:in `<top (required)>' /usr/local/rbenv/versions/2.2.5/bin/unicorn_rails:23:in `load' /usr/local/rbenv/versions/2.2.5/bin/unicorn_rails:23:in `<top (required)>'
/config/unicorn/development.rb
# -*- coding: utf-8 -*- @app_path = '/vagrant' worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3) timeout 150 preload_app true # 更新時ダウンタイム無し listen "/tmp/unicorn.sock" pid "/tmp/unicorn.pid" before_fork do |server, worker| Signal.trap 'TERM' do puts 'Unicorn master intercepting TERM and sending myself QUIT instead' Process.kill 'QUIT', Process.pid end defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect! end after_fork do |server, worker| Signal.trap 'TERM' do puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT' end defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection end
super userでrake unicorn:start
すると、通るのですが502 Bad Gatewayとなってしまいます。
何かヒントでもいただければ幸いです。よろしくお願いいたします。
回答1件
あなたの回答
tips
プレビュー
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。