I\'ve been trying to get Resque (with Resque server) & RedisToGo working on heroku (cedar) for awhile now, but I keep running into this error:
Redis::CannotC
I think your Procfile
has a typo. Why do you have two web
processes? I'd stick with one and use unicorn.
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
When using unicorn with resque, you have to define the resque redis connection each time unicorn forks. Here are the relevant files.
config/initializers/redis.rb
uri = URI.parse(ENV["REDIS_WORKER"])
REDIS_WORKER = Redis.new(host: uri.host, port: uri.port, password: uri.password)
config/initializers/resque.rb
Resque.redis = REDIS_WORKER
config/unicorn.rb
before_fork do |server, worker|
if defined?(Resque)
Resque.redis.quit
Rails.logger.info("Disconnected from Redis")
end
end
after_fork do |server, worker|
if defined?(Resque)
Resque.redis = REDIS_WORKER
Rails.logger.info("Connected to Redis")
end
end
See this gist for the complete unicorn.rb