Godzilla74
Godzilla74

Reputation: 2502

Capistrano deploy unicorn ERROR uninitialized constant RAILS_ENV (NameError)

I just successfully deployed my RoR app to AWS using Rubber & Capistrano. However, when I navigate to the page it shows the default nginx page. Clearly, I missed something during the setup phase to point nginx/unicorn to the right directory to serve my app.

default nginx

When I run tail -f log/unicorn.stderr.log I see the following:

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>'

I assume since the environment was appended to my app name that Rubber.env existed, however this error makes me think otherwise. Heck, I'm not even sure this issue even applies to the nginx default page issue. Can someone please share what I've done wrong, or missed?

Upvotes: 0

Views: 613

Answers (2)

dbKooper
dbKooper

Reputation: 1045

For anyone looking, fixing unicorn template 5.0+ will work, refer:

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

Upvotes: 1

CWitty
CWitty

Reputation: 4526

You need to wipe out the default nginx virtualhost usually at /etc/nginx/sites-enabled/default, just delete that file and then you should be good to go.

Upvotes: 0

Related Questions