Add Sidekiq Gem
Add the Sidekiq gem to the
Gemfile and run
Once the gem is installed create a
sidekiq.yml file under the
config directory. Specify the desired concurrency and queue names (you can have multiple, i.e. default, high, low)
sidekiq.yml is created, you will need to setup the server and client initializers. Create a
sidekiq.rb file under
config/initializers that establishes Sidekiq's connection to Redis.
The last step is to setup a
docker-compose.yml file to bring the services up. You will need to define two services
redis service will pull a standard Redis image and run on port
6379 on the host. As part of the setup a password is added and the redis data is setup to store in the volume
tmp/db on the host.
sidekiq service builds its image from the Ruby project
build: .). This means we need to create a
Dockerfile in the root of the Ruby project directory. We will use a Sinatra application as an example with a
Dockerfile installs the necessary dependencies and setups an application called
APP (mapping to
/app) for our application. With this file available we can complete the
docker-compose.yml file .
docker-compose up and your services should be running.