无法启动独角兽。

时间:2012-05-26 04:56:38

标签: ruby-on-rails-3 unicorn

我正在尝试用独角兽开始我的应用程序,但无法启动。 我有一个参数错误parse_rackup_file: rackup file (config.ru) not readable (ArgumentError)

我的环境是rbenv ruby​​1.9.3和rails 3.1.3。

怎么了?

Mac-mini:rails_app Macmini$ cap deploy:start
  * executing `deploy:start'
  * executing "cd /home/deployer/public_html/rails_app/current/; bundle exec unicorn -c /home/deployer/public_html/rails_app/current/config/unicorn.rb -E production -D"
    servers: ["211.125.67.15"]
    [211.125.67.15] executing command
*** [err :: 211.125.67.15] /home/deployer/public_html/rails_app/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/lib/unicorn/configurator.rb:610:in `parse_rackup_file': rackup file (config.ru) not readable (ArgumentError)
*** [err :: 211.125.67.15] from /home/deployer/public_html/rails_app/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/lib/unicorn/configurator.rb:76:in `reload'
*** [err :: 211.125.67.15] from /home/deployer/public_html/rails_app/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/lib/unicorn/configurator.rb:67:in `initialize'
*** [err :: 211.125.67.15] from /home/deployer/public_html/rails_app/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/lib/unicorn/http_server.rb:104:in `new'
*** [err :: 211.125.67.15] from /home/deployer/public_html/rails_app/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/lib/unicorn/http_server.rb:104:in `initialize'
*** [err :: 211.125.67.15] from /home/deployer/public_html/rails_app/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/bin/unicorn:121:in `new'
*** [err :: 211.125.67.15] from /home/deployer/public_html/rails_app/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/bin/unicorn:121:in `<top (required)>'
*** [err :: 211.125.67.15] from /home/deployer/public_html/rails_app/shared/bundle/ruby/1.9.1/bin/unicorn:23:in `load'
*** [err :: 211.125.67.15] from /home/deployer/public_html/rails_app/shared/bundle/ruby/1.9.1/bin/unicorn:23:in `<main>'
*** [err :: 211.125.67.15] master failed to start, check stderr log for details
    command finished in 1021ms
failed: "env RBENV_ROOT=/usr/local/rbenv PATH=/usr/local/rbenv/shims:/usr/local/rbenv/bin:$PATH sh -c 'cd /home/deployer/public_html/rails_app/current/; bundle exec unicorn -c /home/deployer/public_html/rails_app/current/config/unicorn.rb -E production -D'" on 211.125.67.15
Mac-mini:rails_app Macmini$ 

1 个答案:

答案 0 :(得分:2)

我通过添加

解决了这个问题
working_directory("/path/to/rails_root") 

config/unicorn.rb

您可以参考此处的文档: http://unicorn.bogomips.org/Unicorn/Configurator.html#method-i-working_directory