看到一个奇怪的问题启动独角兽服务器 -bundle exec ruby unicorn_rails.rb
开始没问题,但是当我访问一个 URL 时,它显示:
Mysql2::Error (Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2))
所以似乎 unicorn 没有连接到在 database.yml 中配置的远程服务器(因为它试图在本地连接),尽管其他命令,例如bundle exec rails console
,工作正常。即使环境设置正确,它似乎也忽略了该设置。这以前可以工作,但有些东西破坏了它。
我把完整的堆栈跟踪放在这里: https ://gist.github.com/mahemoff/6029630
数据库.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