2

I am trying to load a simple ruby app on heroku that periodically runs a background task using resque, which checks an email account. It works fine locally with foreman, but keeps crashing on heroku.

I think maybe the Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch comes from my while loop, which is perpetual and therefore longer than 60 seconds? Should I be using some different kind of process to launch smsnotify.rb?

Any help would be extremely appreciated!

My heroku logs:

2013-04-06T20:49:15+00:00 heroku[slugc]: Slug compilation finished
2013-04-06T20:49:18+00:00 heroku[web.1]: Starting process with command `bundle exec ruby smsnotify.rb -p 9129`
2013-04-06T20:49:21+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.0/lib/active_support/multibyte.rb:26: warning: already initialized constant VALID_CHARACTER
2013-04-06T20:50:19+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2013-04-06T20:50:19+00:00 heroku[web.1]: Stopping process with SIGKILL
2013-04-06T20:50:20+00:00 heroku[web.1]: Process exited with status 137
2013-04-06T20:50:20+00:00 heroku[web.1]: State changed from starting to crashed

My Procfile:

web: bundle exec ruby smsnotify.rb -p $PORT
resque: env TERM_CHILD=1 bundle exec rake jobs:work

smsnotify.rb:

require "./email_checker"
require 'hirefire'
require 'resque' 
Resque.redis = 'redis://redistogo:removed:removed/'
HireFire::Initializer.initialize!

while true do
  Resque.enqueue(EmailChecker)
  sleep 30
  puts "Starting Email Job"
end
Nick5a1
  • 917
  • 3
  • 15
  • 28
  • 3
    I don't think you can actually do that in heroku. The alternative they offer for background processing is with Delayed Job (DJ). This explains the whole process better: https://devcenter.heroku.com/articles/delayed-job , remember that you'll be charge for `worker` usage. – fmendez Apr 06 '13 at 01:02
  • Thanks - I've switched to using resque and checking the email account in the background. Again this works fine locally but I get the `Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch` error when starting the app on heroku. Maybe the error comes from my while loop, which is perpetual and therefore longer than 60 seconds? Should I be using some different kind of process to launch smsnotify.rb? – Nick5a1 Apr 06 '13 at 21:04
  • I've updated the question. Heroku does support Resque. Can anyone provide some guidance please? – Nick5a1 Apr 07 '13 at 19:00
  • 1
    Are you supposed to use the `worker` process type in your `Procfile` rather than the `web` type? https://devcenter.heroku.com/articles/procfile#process-types-as-templates – jefflunt Apr 08 '13 at 19:50
  • after switching it from a web type to a worker type I get the following error 2013-04-08T20:23:41+00:00 heroku[web.1]: Starting process with command 'bundle exec rackup config.ru -p 34012' 2013-04-08T20:23:42+00:00 app[web.1]: configuration /app/config.ru not found. This is not a rails app though, just a ruby app. – Nick5a1 Apr 13 '13 at 00:02

1 Answers1

0

You aren't starting up a process that is binding to a port, so it is complaining.

You just need to change your Procfile to say 'worker' instead of 'web'

If you have a web frontend to this, then you will need a worker and a web

J_McCaffrey
  • 1,455
  • 12
  • 15
  • then I get the following error `2013-04-08T20:23:41+00:00 heroku[web.1]: Starting process with command 'bundle exec rackup config.ru -p 34012' 2013-04-08T20:23:42+00:00 app[web.1]: configuration /app/config.ru not found`. This is not a rails app though, just a ruby app. – Nick5a1 Apr 08 '13 at 20:26
  • that's odd. If your procfile only has worker: bundle exec ruby smsnotify.rb resque: env TERM_CHILD=1 bundle exec rake jobs:work I don't see where that rackup call would be coming from – J_McCaffrey Apr 09 '13 at 14:14