"Could not connect to server: No such file or directory" While deploying Rails app with beanstalk "Could not connect to server: No such file or directory" While deploying Rails app with beanstalk postgresql postgresql

"Could not connect to server: No such file or directory" While deploying Rails app with beanstalk


On my side the issue was coming from the fact that I deleted my .elasticbeanstalk/optionsettings and so RACK_ENV was not defined, AWS set it by default to production which led my application to have the wrong database hostname.

I debugged that by adding echo statement in /opt/elasticbeanstalk/hooks/appdeploy/pre/12_db_migration.sh to display RACK_ENV and noticed it was empty.