Rails trying to connect to unconfgured MySQL on request -


seeing weird problem starting unicorn server - bundle exec ruby unicorn_rails.rb starts okay, when visit url, shows:

mysql2::error (can't connect local mysql server through socket '/var/run/mysqld/mysqld.sock' (2)) 

so seems unicorn isn't connecting remote server that's configured in database.yml (as it's trying connect locally), despite other commands, e.g. bundle exec rails console, working fine. seems ignoring setting though environment set right. working before, has broken it.

i put full stack trace here: https://gist.github.com/mahemoff/6029630

database.yml:

staging:   adapter: mysql2   database: slide_staging   host: 192.168.1.255   port: 3306   pool: 5   username: deploy   password: <%= env['db_pass'] || "notconfiguredyet" %>   timeout: 5000   reconnect: true 

it might linked unicorn configuration..

especially if preload app. have these lines inside?

before_fork |server, worker|   # following highly recomended rails + "preload_app true"   # there's no need master process hold connection   defined?(activerecord::base) ,     activerecord::base.connection.disconnect!  end  after_fork |server, worker|   # following *required* rails + "preload_app true",   defined?(activerecord::base) ,     activerecord::base.establish_connection end 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -