Search code examples
ruby-on-railsherokudelayed-jobsidekiq

Heroku Delayed Job and Sidekiq in the Same app


I am currently running delayed::job on my Heroku instance for quite a few different types of jobs (exporting large lists etc.) and I'm using the awesome progress job gem that shows a progress bar of the job to the user who made the request.

I'd like to be able to run a sidekiq worker as well for other jobs, not involving the user, that I don't need a progress bar for, because of it's obvious memory improvements over Delayed::Job.

Is it possible for me to run both delayed job and sidekiq on the same heroku app? If so is there any examples I can follow? I'm confused on how I would setup the procfile or this.

Below is my Procfile. I don't see how to start both Delayed Job and Sidekiq? If I do something like just add bundle exec sidekiq on a worker line below, it seems to replace delayed job?

Procfile:

web: bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}
web: bundle exec puma -C config/puma.rb
worker: bundle exec rake jobs:work

Solution

  • It is possible.

    First, You should solve similar interfaces conflict problem like .delay. here: Run Delayed Jobs and Sidekiq at the same time

    Second, you should set multiple active_job adapter configuration. here: http://edgeguides.rubyonrails.org/active_job_basics.html#backends

    About Procfile, You can register multiple worker For example)

    web: bundle exec puma -t 5:5 -p ${PORT:-3000} -C config/puma.rb
    worker: bundle exec sidekiq
    delayedjobworker: bundle exec rake jobs:work
    

    Check https://devcenter.heroku.com/articles/procfile#more-process-type-examples