2

Rails 4.2 アプリ用に Unicorn サーバーをブートストラップしようとして、Ubuntu 14.04 サーバー インスタンスに SSH 接続するだけです。

cd /home/sh0/app/current/api
bundle exec unicorn -E production -c /home/sh0/app/current/api/config/unicorn.rb

しかし、それは失敗します!

/usr/local/lib/ruby/gems/2.0.0/gems/unicorn-4.9.0/lib/unicorn/configurator.rb:657:in `parse_rackup_file': rackup file (config.ru) not readable (ArgumentError)
        from /usr/local/lib/ruby/gems/2.0.0/gems/unicorn-4.9.0/lib/unicorn/configurator.rb:77:in `reload'
        from /usr/local/lib/ruby/gems/2.0.0/gems/unicorn-4.9.0/lib/unicorn/configurator.rb:68:in `initialize'
        from /usr/local/lib/ruby/gems/2.0.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:100:in `new'
        from /usr/local/lib/ruby/gems/2.0.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:100:in `initialize'
        from /usr/local/lib/ruby/gems/2.0.0/gems/unicorn-4.9.0/bin/unicorn:126:in `new'
        from /usr/local/lib/ruby/gems/2.0.0/gems/unicorn-4.9.0/bin/unicorn:126:in `<top (required)>'
        from /home/sh0/app/releases/20150514055558/api/bin/unicorn:16:in `load'
        from /home/sh0/app/releases/20150514055558/api/bin/unicorn:16:in `<main>'

では、なぜdangファイルが見つからないのでしょうか? config.ruローカル開発の目的で、すぐそこにあります-フラグなしでUnicornを起動すると、開発環境にあるかのように問題ありません。

bundle exec unicorn

通常(開発、この環境で必要な本番ではありません)ブートストラップOK:

I, [2015-05-14T06:00:44.081575 #5859]  INFO -- : listening on addr=0.0.0.0:8080 fd=9
I, [2015-05-14T06:00:44.081818 #5859]  INFO -- : worker=0 spawning...
I, [2015-05-14T06:00:44.082427 #5859]  INFO -- : master process ready
I, [2015-05-14T06:00:44.083162 #5862]  INFO -- : worker=0 spawned pid=5862
I, [2015-05-14T06:00:44.083380 #5862]  INFO -- : Refreshing Gem list
I, [2015-05-14T06:00:45.399105 #5862]  INFO -- : worker=0 ready

では、この 2 つの試みの合間に何かをしてみます。

リモートサーバーで:

cd /home/sh0/app/current/api
unicorn -c config/unicorn.rb 

working_directoryこのエラー メッセージに注目してください。

/usr/local/lib/ruby/gems/2.0.0/gems/unicorn-4.9.0/lib/unicorn/configurator.rb:539:in `working_directory': config_file=config/unicorn.rb would not be accessible in working_directory=/home/sh0/app/current (ArgumentError)
4

2 に答える 2

3

の設定を間違えましたconfig/unicorn.rb

Rails プロジェクトはリポジトリのベースにないためworking_directory、そのファイルでデフォルトで指定されているものを更新する必要がありました。

新しい構成は次のとおりです。

working_directory "/home/sh0/app/current/api"
于 2015-05-14T21:17:41.453 に答える