0
我遵循了一些關於如何在heroku上設置resque的指南,但它們已經過時。Heroku如何在rails 3應用程序上設置resque web?
我config.ru:
require File.dirname(__FILE__) + '/config/environment'
require 'resque/server'
Resque::Server.class_eval do
use Rack::Auth::Basic do |email, password|
user = User.authenticate(email, password)
user && user.admin?
end
end
app = Rack::Builder.new {
use Rails::Rack::Static
map "/resque" do
run Resque::Server
end
map "/" do
run ActionController::Dispatcher.new
end
}.to_app
run app
在LIB /任務/ resque.task:
require 'resque/tasks'
task "resque:setup" => :environment do
ENV['QUEUE'] = '*'
end
desc "Alias for resque:work (To run workers on Heroku)"
task "jobs:work" => "resque:work"
我已經加入這個我的Gemfile:
gem "resque"
在initalizers
然後/resque.rb:
ENV["REDISTOGO_URL"] ||= "mydatabaseurl"
uri = URI.parse(ENV["REDISTOGO_URL"])
Resque.redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password, :thread_safe => true)
我正在使用redistogo nano heroku插件。
在Heroku上的應用程序崩潰與錯誤:
/app/config.ru:16:in `block (2 leve
ls) in <main>': uninitialized constant Rails::Rack::Static (NameError)
軌道版本是3.2.11
更新到最新版本,請,3.2.11有執行遠程代碼的危險錯誤。資料來源:http://arstechnica.com/security/2013/01/extremely-crtical-ruby-on-rails-bug-threatens-more-than-200000-sites/ – Pigueiras 2013-04-10 16:23:19
是3.2.11不保存? – 2013-04-10 16:26:13
解決方法是在這個問題上的答案:http://stackoverflow.com/questions/6682265/heroku-cedar-no-static-assets-for-mounted-resque-front-end – 2013-04-10 16:27:46