需要使用AUTH将Resque Web UI(Rack config.ru)连接到Redis服务器的帮助
使用Resque + Unicorn + Nginx并使用apt-get install(Debian)和gem install进行安装
所以基本上,独角兽使用标准的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端口的本地主机)连接到“原始” 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
但是它仍然不能正常工作
顺便说一句,没有Redis AUTH且仅使用“香草”本地主机Redis连接,一切都能正常工作
尝试一下
redis_client = Redis.new(:url => "redis://user:PASSWORD@redis-server:6379")