需要一些帮助将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
我正在尝试根据以下文档找到如何使用AUTH将其连接到Redis服务器:http://redis.io/topics/security(基本上在/etc/redis/redis.conf中)
此机架配置似乎只使用默认值(带有标准6379端口的localhost)连接到“vanilla”Redis服务器 - 如何指定Redis连接,以便我可以通过以下格式传递用户/传递
redis://user:PASSWORD@redis-server:6379
我尝试使用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
但它仍然没有真正起作用
答案 0 :(得分:6)
试试这个
redis_client = Redis.new(:url =>“redis:// user:PASSWORD @ redis-server:6379”)
然后执行此操作
Resque.redis = redis_client
希望这个帮助