生产模式ruby应用程序不运行,unicorn和nginx

时间:2017-02-27 10:36:40

标签: ruby-on-rails ruby ruby-on-rails-3 nginx

我要在我自己的服务器上的rails app上部署我的ruby。所以我决定按照这个来自degital ocean的教程:

https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-unicorn-and-nginx-on-ubuntu-14-04

我配置了我的database.yml,我在我的app目录中添加了host:localhost并配置了rben-var,并且很好地迁移了生产数据库。 我无法使用此命令启动rails RAILS_ENV =生产轨道服务器 我想也许是因为我最后一次将独角兽设置为我的另一个应用程序的默认设置(你知道我有另外两个应用程序,我在服务器上部署它们但我从nginx删除了它们的路径) 然后我创建config / unicorn.rb 终于当我开始 sudo vi /etc/init.d/unicorn_drug它给了我这个错误:

master failed to start, check stderr log for details

当我看到/shared/log/unicorn.stderr.log中的日志时,我看到以下错误行。 你知道我在这个案子上花了两天时间,但我真的无法理解错误是什么:

  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:752:in `call'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:752:in `build_app!'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:129:in `start'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/bin/unicorn:126:in `<top (required)>'
  /root/.rbenv/versions/2.2.3/bin/unicorn:23:in `load'
  /root/.rbenv/versions/2.2.3/bin/unicorn:23:in `<top (required)>'
I, [2017-02-27T13:38:21.860366 #1848]  INFO -- : Refreshing Gem list
NameError: uninitialized constant RegistrationController
  /root/drug_api/app/controllers/RegistrationController/confirmations_controller.rb:1:in `<top (required)>'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-5.0.1/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-5.0.1/lib/active_support/concurrency/share_lock.rb:150:in `exclusive'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-5.0.1/lib/active_support/dependencies/interlock.rb:11:in `loading'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/engine.rb:476:in `block (2 levels) in eager_load!'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/engine.rb:475:in `each'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/engine.rb:475:in `block in eager_load!'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/engine.rb:473:in `each'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/engine.rb:473:in `eager_load!'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/engine.rb:354:in `eager_load!'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/application/finisher.rb:59:in `each'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/application/finisher.rb:59:in `block in <module:Finisher>'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/initializable.rb:30:in `instance_exec'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/initializable.rb:30:in `run'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/initializable.rb:55:in `block in run_initializers'
  /root/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
  /root/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
  /root/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
  /root/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
  /root/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:345:in `each'
  /root/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:345:in `call'
  /root/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
  /root/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
  /root/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/initializable.rb:54:in `run_initializers'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/application.rb:352:in `initialize!'
  /root/drug_api/config/environment.rb:5:in `<top (required)>'
  config.ru:4:in `require_relative'
  config.ru:4:in `block in <main>'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `instance_eval'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `initialize'
  config.ru:1:in `new'
  config.ru:1:in `<main>'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/lib/unicorn.rb:56:in `eval'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/lib/unicorn.rb:56:in `block in builder'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:752:in `call'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:752:in `build_app!'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:129:in `start'
  /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/bin/unicorn:126:in `<top (required)>'
  /root/.rbenv/versions/2.2.3/bin/unicorn:23:in `load'
  /root/.rbenv/versions/2.2.3/bin/unicorn:23:in `<top (required)>'

1 个答案:

答案 0 :(得分:0)

问题是未初始化的常量RegistrationController,您的RegistrationController丢失了。你似乎已经将目录命名为RegistrationController,并且你已经放置了confirmation_controller。将目录重命名为registration_controller,因为您无法使用首字母大写命名路径或目录,仅用于类名。

检查行号。 8错误日志:

NameError: uninitialized constant RegistrationController
  /root/drug_api/app/controllers/RegistrationController/confirmations_controller.rb:1:in `<top (required)>'