0
votes

I'm going to deploy my ruby on rails app on my own server. So i decided to follow this tutorial that is from degital ocean:

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

I configured my database.yml which i add host:localhost and configured rben-var in my app directory and Migrate the production database very well. I couldn't start the rails with this command RAILS_ENV=production rails server And i thought maybe it is because of my last time that I set the unicorn as default for my another app(you know i have two other app which i deploy them on the server well but i removed their path from the nginx) then I create config/unicorn.rb finally when I started sudo vi /etc/init.d/unicorn_drug it gives me this error:

master failed to start, check stderr log for details

When i see the log which Is in /shared/log/unicorn.stderr.log i see following error lines. You know i spend two days on this case but I really can't understand what is the error is:

  /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
Did you stop Unicorn in between? It may be running in the background. ps ax | grep -i unicorn.Casper
@Casper i run the command that u shared and get this outputAndroidDev
1092 ? Sl 0:01 unicorn master -c config/unicorn.rb -E production -D 1095 ? Sl 0:00 unicorn worker[0] -c config/unicorn.rb -E production -D 1098 ? Sl 0:00 unicorn worker[1] -c config/unicorn.rb -E production -DAndroidDev

1 Answers

0
votes

The problem is uninitialized constant RegistrationController, your RegistrationController is missing. Also seems that you have named directory to RegistrationController and under that you have placed confirmation_controller. Rename the directory to registration_controller, cause you can not name path or directory with first letter capital, that is only for class name.

Check line no. 8 of your error log:

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