0

Fresh server, installed using the digital ocean guide here.

  • Ubuntu 14.04
  • Passenger 5.0.18
  • Nginx 1.8.0

I can deploy my app to the server via capistrano no problem. I can also load the rails console using RAILS_ENV=production bundle exec rails c and query User.first with proper returns.

Nginx doesn't seem to want to connect to the proper database.

Access denied for user 'root'@'XXX.XXX.XXX.XXX' (using password: NO) (Mysql2::Error)

It keeps trying to connect to XXX.XXX.XXX.XXX which is a local IP instead of YYY.YYY.YYY.YYY which is a remote RDS server as defined in the database.yml.

The error page shows RAILS_ENV is set to production.

3
  • Nginx doesn't connect to mysql. It is passenger failing. Seems that Rails is taking the configuraton from some other file
    – ignivs
    Sep 17, 2015 at 19:20
  • @ignivs Right, bad wording. How do I determine exactly what Passenger is loading for its database.yml, it appears that's what's wrong. The app_root is correct.
    – nitsujri
    Sep 18, 2015 at 1:11
  • Took a look on the problem, do you happen to have a config.ru file in your rails application? if so, you may have to define ` RACK_ENV=production `
    – ignivs
    Sep 21, 2015 at 15:18

1 Answer 1

0

My problem was in the environmental variables were not being loaded into Nginx properly.

/etc/environments is where the variables were stored and the call to load them needed to be placed higher up in the .bashrc

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .