【发布时间】:2013-04-26 10:01:46
【问题描述】:
需要帮助将 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 端口的本地主机)连接到“香草”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 的情况下运行,并且只使用“vanilla”本地主机 Redis 连接
【问题讨论】: