Serge Vinogradoff
Serge Vinogradoff

Reputation: 2272

How to get Sidekiq working on Heroku?

It's my first attempt to get Redis working on Heroku.

I've added one worker dyno (just today, so didn't pay yet), added RedisToGo Nano add-on, tested background jobs on my local machine, and pushed the app to heroku.

heroku ps

gives

=== web: `bundle exec rails server -p $PORT`
web.1: up 2013/03/03 18:26:09 (~ 37m ago)

=== worker: `bundle exec rake jobs:work`
worker.1: crashed 2013/03/03 19:02:15 (~ 1m ago)

Sidekiq Web Interface says that one job is enqueued, but zero processed or failed.

I'm guessing it's because my worker dyno is crashed.

Are there any noob mistakes that I don't know about?

(e.g. I need to run some command to start listening to background jobs etc)

heroku logs --tail doesn't show any errors, so I don't understand why my worker dyno chashes.

Upvotes: 8

Views: 7409

Answers (2)

Antonio Jha
Antonio Jha

Reputation: 1309

Also make sure you setup REDIS_PROVIDER:

heroku config:set REDIS_PROVIDER=REDISTOGO_URL

Sidekiq's GitHub page also has instruction. Click here

Upvotes: 0

Serge Vinogradoff
Serge Vinogradoff

Reputation: 2272

I did some research and fixed it like this:

Under app's root directory I created a file called "Procfile" with this content:

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

Got this idea from here.

After that it worked ok.

Upvotes: 16

Related Questions