Sidekiq installations notes

REDIS

  • download redis and run $ make from downloaded redis directory
  • run $ src/redis-server

Easiest to use Redis with Brew:

  • Once installed via $ brew install redis you can run it with $ redis-server /usr/local/etc/redis.conf
user:~ user$ brew install redis
==> Downloading https://homebrew.bintray.com/bottles/redis-3.0.5.yosemite.bottle.tar.gz
######################################################################## 100,0%
==> Pouring redis-3.0.5.yosemite.bottle.tar.gz
==> Caveats
To have launchd start redis at login:
  ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
Then to load redis now:
  launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
Or, if you don't want/need launchctl, you can just run:
  redis-server /usr/local/etc/redis.conf
==> Summary
🍺  /usr/local/Cellar/redis/3.0.5: 9 files, 892K
user:~ user$ 
  • To use Redis with Heroku run $ heroku addons:create redistogo
  • Set the Config Env Variables for REDIS_PROVIDER to REDISTOGO_URL (REDISTOGO_URL should be set automatically when installing redistogo.)

SIDEKIQ

  • add sidekiq gem to gem file
  • run $ bundle install
  • run sidekiq from the root of your rails app directory with $ bundle exec sidekiq

TESTING

  • add the following to your spec_helper.rb
require 'sidekiq/testing'
Sidekiq::Testing.inline!
  • no need to change your tests
  • change email sendouts in rails app to AppMailer.delay... and remove the ...deliver at the end
# before
AppMailer.send_forgot_password(user).deliver
# after
AppMailer.delay.send_forgot_password(user)