rails 4 deployment - rake stderr:config.eager_load设置为nil ..不正确的错误消息

时间:2014-07-19 15:04:07

标签: ruby-on-rails-4 deployment

在Capistrano的项目暂存部署期间,要解决常见的数据库访问错误,我注意到了rake stderr行:

  rake stderr: config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly..

但是,我的config / environments / * rb文件已根据需要正确设置.. 为什么这条消息?我错过了什么?

我的config / environments / development.rb

 config.eager_load = false

我的config / environments / production.rb

 config.eager_load = true

我的config / environments / test.rb

config.eager_load = false

这是控制台日志的摘录

    Tasks: TOP => db:migrate
    (See full trace by running task with --trace)

    SSHKit::Command::Failed: rake exit status: 1
    rake stdout: Nothing written
    rake stderr: config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly:

      * development - set it to false
      * test - set it to false (unless you use a tool that preloads your test environment)
      * production - set it to true

    rake aborted!
    Mysql2::Error: Access denied for user 'root'@'localhost' (using password: NO)

2 个答案:

答案 0 :(得分:3)

使用

进行部署时遇到了类似的问题
cap staging deploy

问题是capistrano正在寻找数据库myapp_staging,而我需要myapp_production

我通过添加

修复了它
set :stage, "production"
config/deploy/staging.rb中的

答案 1 :(得分:1)

(在评论中回答。转换为社区wiki答案。见Question with no answers, but issue solved in the comments (or extended in chat)

@amoebe写道:

  

我认为这里的主要问题是错误的MySQL凭证。

OP写道:

  

您是对的,我必须通过capistrano任务(setup:upload_yml)管理我的生产/暂存部署凭据,以上传secrets.ymldatabase.ym l进入我的远程服务器......现在运行正常...