1

Trying to send emails with Sidekiq using Redis_To_Go, but my worker keeps crashing. I've done everything I could find, and I'm sure this is a small issue. Though I can't figure it out!

./Procfile.txt:

web: bundle exec rails server -p $PORT
worker: bundle exec sidekiq -c 5 -v

./config/initializers/redis.rb

$redis = Redis::Namespace.new("ihms_env_app", :redis => Redis.new)

uri = URI.parse(ENV["REDISTOGO_URL"])
REDIS = Redis.new(:url => ENV['REDISTOGO_URL'])

I've scaled the workers from 0 to 1

$ heroku ps
=== web (1X): `bin/rails server -p $PORT -e $RAILS_ENV`
web.1: up 2014/05/08 10:46:56 (~ 7m ago)

=== worker (1X): `bundle exec rake jobs:work`
worker.1: crashed 2014/05/08 10:47:00 (~ 7m ago)

log

heroku[worker.1]: State changed from crashed to starting
heroku[worker.1]: State changed from starting to up
heroku[worker.1]: Starting process with command `bundle exec rake jobs:work`
app[worker.1]: 
app[worker.1]: rake aborted!
app[worker.1]: Don't know how to build task 'jobs:work'

in console, I've run

heroku config:set REDIS_PROVIDER=REDISTOGO_URL
user2402831
  • 693
  • 10
  • 22

2 Answers2

2

Hmm.

Your output from heroku ps and the logs indicates that you're trying, and failing, to run a rake task called "jobs:work".

What happens when you run: bundle exec rake jobs:work in your local directory? I'm going to guess it fails?

The Procfile you provide contradicts your logs. It has Sidekiq and not rake as the command. Are you sure you've checked it in to to your git repo and deployed it?

Jon Mountjoy
  • 4,498
  • 22
  • 24
  • Yes, running that command in my local directory fails. I thought the same thing and tried to re-push up to the Heroku repository but was given 'Already up-to date'. I just added a space in procfile and resubmitted, restarted heroku and am still getting a crashed worker. Procfile.txt is directory root with .gitignore and gemfile correct? – user2402831 May 08 '14 at 15:45
  • Ah. No. You've named the Procfile incorrectly. It should be named `Procfile` (see [docs](https://devcenter.heroku.com/articles/procfile#process-types-as-templates)) - not `Procfile.txt` – Jon Mountjoy May 08 '14 at 15:46
  • I had just thought of that immediately after posting my comment. When the docs said "A Procfile is a text file named Procfile placed in the root of your application", I just made an assumption. Works now with the renamed file. Thanks! – user2402831 May 08 '14 at 15:49
0

Looks like you need a conditional initializer in your redis.rb file, such as:

if ENV["REDISCLOUD_URL"]
    uri = URI.parse(ENV["REDISCLOUD_URL"])
    $redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
end

For more details, see my answer to Redis looking for env redis url variable not sure where to put env variable bad URI(is not URI?): (URI::InvalidURIError)

Community
  • 1
  • 1
Itamar Haber
  • 47,336
  • 7
  • 91
  • 117