開発したアプリなど一覧

Unicorn で Rails アプリが起動しなかったので対処

アフィリエイトリンクを含む場合があります

ある Web アプリをアップデートして Capistrano でデプロイしたところ、Unicorn の起動に失敗したようで正常に動作しなかった。

$ bundle exec unicorn_rails -c config/unicorn.rb -E production -D master failed to start, check stderr log for details

Unicorn のエラーログを確認すると以下のようなメッセージが記録されていた。

$ tail log/unicorn_error.log I, [2019-03-18T17:58:44.148164 #25195] INFO -- : Refreshing Gem list ArgumentError: wrong number of arguments (given 0, expected 2) /home/ryomatsu/projects/example/shared/bundle/ruby/2.6.0/gems/unicorn-5.5.0/lib/unicorn.rb:49:in `block in builder' /home/ryomatsu/projects/example/shared/bundle/ruby/2.6.0/gems/unicorn-5.5.0/bin/unicorn_rails:139:in `block in rails_builder' /home/ryomatsu/projects/example/shared/bundle/ruby/2.6.0/gems/unicorn-5.5.0/lib/unicorn/http_server.rb:794:in `build_app!' /home/ryomatsu/projects/example/shared/bundle/ruby/2.6.0/gems/unicorn-5.5.0/lib/unicorn/http_server.rb:141:in `start' /home/ryomatsu/projects/example/shared/bundle/ruby/2.6.0/gems/unicorn-5.5.0/bin/unicorn_rails:209:in `<top (required)>' /home/ryomatsu/projects/example/shared/bundle/ruby/2.6.0/bin/unicorn_rails:23:in `load' /home/ryomatsu/projects/example/shared/bundle/ruby/2.6.0/bin/unicorn_rails:23:in `<top (required)>'

ArgumentError: wrong number of arguments (given 0, expected 2) ということで Unicorn の起動時に何らかのメソッドを実行しようとして引数が足りなくてエラーが出ているようだ。

stackoverflow を見たところ、unicorn_rails のバージョンアップによるものらしい。

ruby on rails - Unicorn Refreshing Gem List - Stack Overflow

これを見て unicorn_rails の バージョンを確認してみる。

$ bundle exec gem list | grep unicorn unicorn (5.5.0)

バージョン 5.5.0 なので Stack Overflow の書き込みと同様のようだ。

Gemfile を編集し、バージョン 5.4.1 を指定し、bundle install を行う。

$ vim Gemfile gem 'unicorn', '5.4.1' $ $ bundle install $ bundle exec gem list | grep unicorn unicorn (5.4.1)

この状態でデプロイを行うと正常に動作するようになった。

Sponsored Link

コメント

タイトルとURLをコピーしました