Resque不从配置中选择正确的服务器

时间:2012-09-05 22:37:39

标签: ruby-on-rails redis resque unicorn

我正在尝试将我的Reddis服务器移到外部盒子上。在github上通过Resque自述文件。

在开发模式下,它可以正常加载配置并连接到6379上的localhost:

resque.rb初始化

 rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..'
 rails_env = ENV['RAILS_ENV'] || 'development'

 resque_config = YAML.load_file(rails_root + '/config/resque.yml')
 Resque.redis = resque_config[rails_env]

resque.yaml

 development: localhost:6379
 playground: redis1.play.xxx.com:6379
 production: redis1.pro.xxx.com:6379

但是,在游乐场/制作模式中,它会回退到开发服务器并且无法连接。我假设这是因为独角兽没有正确宣布环境?

如果我在初始化程序中用'playground'替换'development',它就可以了。

我开始独角兽:

 unicorn -c config/unicorn.rb -E playground -l 8000 -D

我怎样才能让它拿起正确的conf ??

1 个答案:

答案 0 :(得分:0)

最后整理了虽然我真的不明白为什么......如果有人想要插话,我会在几天内不接受我自己的答案。

通过让上帝管理服务而不是手动启动/停止,它会选择正确的环境。

现在我正在连接到一个没有问题的远程redis服务。