简体   繁体   English

delayed_job没有拿起铁轨环境

[英]delayed_job not picking up the rails environment

Followed this question about delayed_job and monit 关注了delayed_job和monit这个问题

Its working on my development machine. 它在我的开发机器上工作。 But whenever I try to run on production, it just dies with following on delayed_job.log 但每当我尝试在生产上运行时,它就会在delayed_job.log上跟随死亡

*** Starting job worker delayed_job host:mail.welcometonewnepal.com pid:356
#<Mysql::Error: Access denied for user 'root'@'localhost' (using password: YES)>
*** Starting job worker delayed_job host:mail.welcometonewnepal.com pid:441
#<Mysql::Error: Access denied for user 'root'@'localhost' (using password: YES)>
*** Starting job worker delayed_job host:mail.welcometonewnepal.com pid:448
#<Mysql::Error: Access denied for user 'root'@'localhost' (using password: YES)>

And I m going to run in production env 而我将在生产环境中运行

ruby script/delayed_job start -e production

Still it errors out. 仍然出错了。 I m noticing that this is due to the environment not set so that it tries to pick up the development environment. 我注意到这是由于未设置环境以致它试图获取开发环境。

/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:365:in `read': No such file or directory - /home/millisami/rails_apps/wnn_finale/config/environments/-e.rb (Errno::ENOENT)

Why isn't the environment parameter not set properly? 为什么环境参数设置不正确?

只是用

ruby RAILS_ENV=production script/delayed_job start

I might be worng here, but are you using this gist as script/delayed_job? 我可能会在这里,但你是否正在使用这个要点作为脚本/ delayed_job? If so, it doesn't need the "-e" - simply calling script/delayed_job start production or chaning the line that starts with ENV['RAILS_ENV'] (replacing "development" with "production") should be sufficient. 如果是这样,它不需要“-e” - simply calling script/delayed_job start production或者修改以ENV['RAILS_ENV']开头的行(将“development”替换为“production”)应该就足够了。

If you still get errors from MySQL afterwards, you should double check your username and password. 如果您之后仍然从MySQL收到错误,则应仔细检查您的用户名和密码。

只是为了帮助人们找到这个问题和旧答案:脚本不再接受环境参数: https//github.com/collectiveidea/delayed_job/issues/7

Try script/delayed_job start -- production . 尝试script/delayed_job start -- production I don't think you pass the environment to DJ the same way as you would to script/server . 我不认为你以与script/server相同的方式将环境传递给DJ。 This answer is specific to the delayed_job file that we use, I'm looking for a gist of it. 这个答案特定于我们使用的delayed_job文件,我正在寻找它的要点。

EDIT: Here is the gist of the file we use. 编辑:这是我们使用的文件的要点

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM