【问题标题】:Capistrano deploy unicorn ERROR uninitialized constant RAILS_ENV (NameError)Capistrano 部署独角兽 ERROR 未初始化常量 RAILS_ENV (NameError)
【发布时间】:2015-12-07 19:31:26
【问题描述】:

我刚刚使用 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 默认页面问题。有人可以分享我做错了什么或错过了什么吗?

【问题讨论】:

    标签: ruby-on-rails nginx capistrano unicorn


    【解决方案1】:

    对于任何人来说,修复 unicorn 模板 5.0+ 都可以,参考:

    https://github.com/rubber/rubber/issues/570

    【讨论】:

    • 有趣...我在其他地方回答了我自己的问题... lmfao
    【解决方案2】:

    您通常需要清除默认的 nginx 虚拟主机 /etc/nginx/sites-enabled/default,只需删除该文件即可。

    【讨论】:

    • 那个目录不存在。我认为这是因为我部署了 Rubber/Capistrano。因此,我看到了一个 conf.d/rubber/ 文件夹,其中包含各自的 .conf 文件。
    • 你在什么操作系统上部署?
    • 运行nginx -t查看nginx所在的位置,然后查看sites-enabled目录看看里面有没有东西。如果您的应用程序共享配置文件夹没有任何内容或符号链接,那么您也需要进行设置
    • 不确定我应该寻找什么sudo nginx -t 产量:nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
    • K 现在做ls /etc/nginx/sites-enabled 并确保那里有输出而不是默认输出
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多