Capistrano 部署独角兽错误未初始化常量 RAILS_ENV (NameError)
Capistrano deploy unicorn ERROR uninitialized constant RAILS_ENV (NameError)
我刚刚使用 Rubber & Capistrano 成功地将我的 RoR 应用程序部署到 AWS。但是,当我导航到该页面时,它会显示默认的 nginx 页面。显然,我在设置阶段错过了一些东西,无法将 nginx/unicorn 指向正确的目录来为我的应用程序提供服务。
当我 运行 tail -f log/unicorn.stderr.log
我看到以下内容:
E, [2015-12-07T14:23:41.253757 #3808] ERROR -- : reaped #<Process::Status: pid 24405 exit 1> worker=0
E, [2015-12-07T14:23:41.301617 #24409] ERROR -- : uninitialized constant RAILS_ENV (NameError)
/ebs/microposts2-production/current/config/unicorn.rb:73:in `rescue in block in reload'
/ebs/microposts2-production/current/config/unicorn.rb:61:in `block in reload'
/ebs/microposts2-production/shared/bundle/ruby/2.0.0/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:611:in `call'
/ebs/microposts2-production/shared/bundle/ruby/2.0.0/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:611:in `init_worker_process'
/ebs/microposts2-production/shared/bundle/ruby/2.0.0/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:639:in `worker_loop'
/ebs/microposts2-production/shared/bundle/ruby/2.0.0/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:508:in `spawn_missing_workers'
/ebs/microposts2-production/shared/bundle/ruby/2.0.0/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:519:in `maintain_worker_count'
/ebs/microposts2-production/shared/bundle/ruby/2.0.0/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:283:in `join'
/ebs/microposts2-production/shared/bundle/ruby/2.0.0/gems/unicorn-5.0.1/bin/unicorn_rails:209:in `<top (required)>'
/ebs/microposts2-production/shared/bundle/ruby/2.0.0/bin/unicorn_rails:23:in `load'
/ebs/microposts2-production/shared/bundle/ruby/2.0.0/bin/unicorn_rails:23:in `<main>'
我假设因为环境被附加到我的应用程序名称中 Rubber.env
存在,但是这个错误让我不这么认为。哎呀,我什至不确定这个问题是否适用于 nginx 默认页面问题。有人可以分享我做错或遗漏的事情吗?
您通常需要在 /etc/nginx/sites-enabled/default
清除默认的 nginx 虚拟主机,只需删除该文件即可。
对于任何正在寻找的人,修复 unicorn 模板 5.0+ 都可以,请参考:
我刚刚使用 Rubber & Capistrano 成功地将我的 RoR 应用程序部署到 AWS。但是,当我导航到该页面时,它会显示默认的 nginx 页面。显然,我在设置阶段错过了一些东西,无法将 nginx/unicorn 指向正确的目录来为我的应用程序提供服务。
当我 运行 tail -f log/unicorn.stderr.log
我看到以下内容:
E, [2015-12-07T14:23:41.253757 #3808] ERROR -- : reaped #<Process::Status: pid 24405 exit 1> worker=0
E, [2015-12-07T14:23:41.301617 #24409] ERROR -- : uninitialized constant RAILS_ENV (NameError)
/ebs/microposts2-production/current/config/unicorn.rb:73:in `rescue in block in reload'
/ebs/microposts2-production/current/config/unicorn.rb:61:in `block in reload'
/ebs/microposts2-production/shared/bundle/ruby/2.0.0/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:611:in `call'
/ebs/microposts2-production/shared/bundle/ruby/2.0.0/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:611:in `init_worker_process'
/ebs/microposts2-production/shared/bundle/ruby/2.0.0/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:639:in `worker_loop'
/ebs/microposts2-production/shared/bundle/ruby/2.0.0/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:508:in `spawn_missing_workers'
/ebs/microposts2-production/shared/bundle/ruby/2.0.0/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:519:in `maintain_worker_count'
/ebs/microposts2-production/shared/bundle/ruby/2.0.0/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:283:in `join'
/ebs/microposts2-production/shared/bundle/ruby/2.0.0/gems/unicorn-5.0.1/bin/unicorn_rails:209:in `<top (required)>'
/ebs/microposts2-production/shared/bundle/ruby/2.0.0/bin/unicorn_rails:23:in `load'
/ebs/microposts2-production/shared/bundle/ruby/2.0.0/bin/unicorn_rails:23:in `<main>'
我假设因为环境被附加到我的应用程序名称中 Rubber.env
存在,但是这个错误让我不这么认为。哎呀,我什至不确定这个问题是否适用于 nginx 默认页面问题。有人可以分享我做错或遗漏的事情吗?
您通常需要在 /etc/nginx/sites-enabled/default
清除默认的 nginx 虚拟主机,只需删除该文件即可。
对于任何正在寻找的人,修复 unicorn 模板 5.0+ 都可以,请参考: