为什么我的暴发户 Unicorn rails 服务器错误 "rackup file (config.ru) not readable"

Why come my upstart Unicorn rails server errors "rackup file (config.ru) not readable"

我有一个 Rails 应用程序通过 Capistrano 部署到 Ubuntu 14.04 Amazon EC2 实例,然后通过标准 "upstart" 服务启动 Unicorn 服务器。

# Upstart Configuration

description     "Outright Mental Shop Webservice"
author          "Outright Mental Inc."

start on (net-device-up
          and local-filesystems
          and runlevel [2345])

stop on runlevel [016]

respawn

script
    cd /home/sh0/app/current/api
    exec su -s /bin/sh -c 'exec "[=12=]" "$@"' sh0 -- unicorn -c config/unicorn.rb
end script

作为测试,我以用户 sh0 和 运行 身份通过 ssh 进入该机器,确切命令在上面我的 upstart 配置文件的 script 块中。我的 tail -f /home/sh0/app/shared/log/unicorn.stderr.log 看起来不错:

I, [2015-05-16T00:15:36.966576 #2803]  INFO -- : Refreshing Gem list
I, [2015-05-16T00:15:38.320758 #2803]  INFO -- : unlinking existing socket=/home/sh0/app/shared/.unicorn.sock
I, [2015-05-16T00:15:38.321051 #2803]  INFO -- : listening on addr=/home/sh0/app/shared/.unicorn.sock fd=10
I, [2015-05-16T00:15:38.321385 #2803]  INFO -- : listening on addr=0.0.0.0:8080 fd=11
I, [2015-05-16T00:15:38.367685 #2808]  INFO -- : worker=1 ready
I, [2015-05-16T00:15:38.369270 #2803]  INFO -- : master process ready
I, [2015-05-16T00:15:38.372035 #2811]  INFO -- : worker=2 ready
I, [2015-05-16T00:15:38.372576 #2806]  INFO -- : worker=0 ready
I, [2015-05-16T00:15:38.375378 #2814]  INFO -- : worker=3 ready

但是当我尝试 sudo service sh0 start 我的 sudo tail -f /var/log/upstart/sh0.log 看起来很糟糕:

/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/current/api/bin/unicorn:16:in `load'
        from /home/sh0/app/current/api/bin/unicorn:16:in `<main>'

有什么建议吗?

答:完全没有理由。

sudo reboot now

它奏效了。关于原因的任何评论可能会受到未来开发人员的赞赏。