【问题标题】:using apn_sender on heroku在heroku上使用apn_sender
【发布时间】:2011-07-07 18:48:15
【问题描述】:

我们在 rails 中构建了一个 api,并将其托管在 heroku 上,并使用 apn_sender 进行推送通知。我们使用 apn_sender 让所有东西都在本地运行,但是当我们将其推送到 heroku 并运行时

heroku rake apn:sender

我们收到以下错误“连接被拒绝 - 无法在 127.0.0.1:6379 上连接到 Redis”

我们添加了 redistogo 插件。

更新

我们添加了 resque.rb 初始化器:

require 'resque'

uri = URI.parse(ENV["REDISTOGO_URL"])
Resque.redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)

并调用启动worker

heroku rake environment apn:sender

一切似乎都正常。

【问题讨论】:

  • 您是否配置了插件以及此Heroku help page 上的文档?
  • 请您告诉我您遵循了哪个指南来完成此操作?
  • 关注了 heroku 帮助页面上的内容。似乎它应该在这一点上工作。不知道为什么 apn 试图连接到 127.0.0.1 的 redis。
  • 请斯科特,你能告诉我你是怎么做到的吗?将不胜感激!

标签: ruby-on-rails-3 heroku apple-push-notifications resque


【解决方案1】:

好的,所以经过进一步测试,我在上面输入的更新在崩溃之前无法正常工作很长时间。然后我们关注了这个http://blog.redistogo.com/2010/07/26/resque-with-redis-to-go/

变化

task "resque:setup" => :environment do
  ENV['QUEUE'] = '*'
end

task "apn:setup" => :environment do
  ENV['QUEUE'] = '*'
end

desc "Alias for resque:work (To run workers on Heroku)"
task "jobs:work" => "resque:work"

desc "Alias for apn:work (To run workers on Heroku)"
task "jobs:work" => "apn:work"

它就像一个魅力。另请注意,我们必须在 heroku 中添加一个工人测功机,费用为 0.05/小时或 35 美元/月。

【讨论】:

  • 我能够让这个解决方案工作,但我还需要使用 resque 来完成其他后台任务。在配置东西时遇到问题,因此 apn_sender 工作,同时保持 resque 正常工作。
猜你喜欢
  • 2012-12-06
  • 2012-03-29
  • 2019-05-09
  • 1970-01-01
  • 2017-03-13
  • 1970-01-01
  • 2012-07-11
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多