Sidekiq on Heroku

1. Handle version incompatibilities

If your Sidekiq version is incompatible with Redis 4.6 or later, pin the Redis gem version:

1
gem 'redis', '< 4.6'

Then update the dependency:

1
bundle update redis

2. Configure Sidekiq

1
2
3
4
5
6
7
8
9
10
11
# config/initializers/sidekiq.rb

redis_url = ENV.fetch("REDIS_URL")

Sidekiq.configure_server do |config|
config.redis = { url: redis_url }
end

Sidekiq.configure_client do |config|
config.redis = { url: redis_url }
end

Use the Redis URL provided by Heroku. Avoid setting VERIFY_NONE, because it disables TLS certificate verification.

3. Set default Sidekiq settings

1
2
3
4
# config/sidekiq.yml

concurrency: 5
max_retries: 3

4. Update the Procfile

1
worker: bundle exec sidekiq

5. Enable the worker

Enable the worker in the Heroku dashboard. It is disabled by default.

6. Check the worker logs

1
heroku logs --tail --app APP_NAME --dyno worker