Running Sidekiq Locally in Rails

Recently, I needed to debug some issues with a Sidekiq queue in a Ruby on Rails app and figured I’d take the time to figure out how to run Sidekiq locally. Thankfully, it’s really quite easy!

Assumed environment:

  • Ruby on Rails app installed and configured
  • Redis installed and running
  • Sidekiq
    • Installed (via Rail’s Gemfile)
    • Configured to use local Redis
    • Set up to use the username/password in the Rails config file (probably config/settings.yml)
# In a terminal, start Rails server
bundle exec rails server

# In another terminal, start Sidekiq
bundle exec sidekiq

# Retrieve Sidekiq creds from config/settings.yml

# Access the Sidekiq web UI by
# using the above creds to log in at: 
# http://127.0.0.1:3000/sidekiq

Optionally, you can add require 'sidekiq/testing/inline' to config/environments/development.rb to have Sidekiq bypass Redis and process jobs immediately (this makes debugging a bit easier).

Happy coding!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.