需要一些帮助将Resque Web UI(Rack config.ru)连接到带有AUTH的Redis服务器
使用Resque + Unicorn + Nginx并使用apt-get install(Debian)和gem install安装大部分
因此,基本上Unicorn使用标准config.ru加载resque-web(通过Rack)
http://etagwerker.wordpress.com/2011/06/27/how-to-setup-resque-web-with-nginx-and-unicorn/
#!/usr/bin/env ruby
# Put this in /var/www/resque-web/config.ru
require 'logger'
$LOAD_PATH.unshift ::File.expand_path(::File.dirname(__FILE__) + '/lib')
require 'resque/server'
Resque::Server.use Rack::Auth::Basic do |username, password|
password == '{{password}}' # password
end
# Set the RESQUE_CONFIG env variable if you’ve a `resque.rb` or similar
# config file you want loaded on boot.
if ENV['RESQUECONFIG'] && ::File.exists?(::File.expand_path(ENV['RESQUE_CONFIG']))
load ::File.expand_path(ENV['RESQUE_CONFIG'])
end
use Rack::ShowExceptions
run Resque::Server.new
Run Code Online (Sandbox Code Playgroud)
我试图找到如何使用AUTH连接到具有AUTH的Redis服务器:http: //redis.io/topics/security(基本上在/etc/redis/redis.conf中)
此机架配置似乎只使用默认值(localhost与标准6379端口)连接到"vanilla"Redis服务器 - 如何指定Redis连接,以便我可以通过以下格式传递用户/传递
redis://user:PASSWORD@redis-server:6379
Run Code Online (Sandbox Code Playgroud)
我尝试使用ENV ['RESQUE_CONFIG']来加载resque.rb文件
要求'resque'
Resque.redis = Redis.new(:password =>'{{password}}')
这是通过/etc/unicorn/resque-web.conf获取的
# Put this in /etc/unicorn/resque-web.conf
RAILS_ROOT=/var/www/resque-web
RAILS_ENV=production
RESQUE_CONFIG=/var/www/resque-web/config/resque.rb
Run Code Online (Sandbox Code Playgroud)
但它仍然没有真正起作用
顺便说一下,一切都可以在没有Redis AUTH的情况下工作,只需使用"vanilla"localhost Redis连接
试试这个
redis_client = Redis.new(:url =>"redis:// user:PASSWORD @ redis-server:6379")
然后这样做
Resque.redis = redis_client
希望这有帮助