SidekiqConfiguration » History » Version 3

Version 2 (Marius BALTEANU, 2020-06-13 17:27) → Version 3/4 (Go MAEDA, 2020-06-14 03:41)

h2. Sidekiq Sideqik configuration

"Sidekiq": Sidekiq is one of the more widely used background job frameworks that you can configure as queuing backend. I've tested to following install and configuration steps on a fresh Ubuntu 18.04 with Redmine 4.1.1, Redis version 4 and Sidekiq 6.

h3. 1. Prerequisites:

# Install redis-server.

h3. 2. Install sidekiq sideqik

# Add the gem as dependency in @Gemfile.local@ file. If the file doesn't exist, you need to create it.
gem 'sidekiq'
# Run @bundle install@ to install the dependency

h3. 3. Configure Sidekiq

# Create @config/sidekiq.yml@ @config/sideqik.yml@ file inside Redmine directory and set the queues
- mailers

h3. 4. Configure Redmine to use @sidekiq@ as backend

# Create @config/additional_environment.rb@ file if the file does not exist by copying the existing example file:
cp config/additional_environment.rb.example config/additional_environment.rb@
# Add the below config line to the file:
config.active_job.queue_adapter = :sidekiq
# Restart Redmine to reload the configuration file.

h3. 5. Test the configuration

# Browse to Information tab from Redmine Administration page and check the mailer queue value:
Mailer queue ActiveJob::QueueAdapters::SidekiqAdapter
# Perform some actions in Redmine in order to trigger some notifications emails. In this step, Redmine only pushes the background jobs to Sidekiq backend.
# Temporary start sidekiq in order to process the queue and send the emails:
RAILS_ENV=production bundle exec sidekiq

Output example of startup process:
2020-06-13T15:08:12.470Z pid=23782 tid=gqluhczs2 INFO: Booted Rails application in production environment
2020-06-13T15:08:12.470Z pid=23782 tid=gqluhczs2 INFO: Running in ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]
2020-06-13T15:08:12.470Z pid=23782 tid=gqluhczs2 INFO: See LICENSE and the LGPL-3.0 for licensing details.
2020-06-13T15:08:12.470Z pid=23782 tid=gqluhczs2 INFO: Upgrade to Sidekiq Pro for more features and support:
2020-06-13T15:08:12.471Z pid=23782 tid=gqluhczs2 INFO: Booting Sidekiq 6.0.7 with redis options {}

Output example of job processing:
2020-06-13T14:53:19.773Z pid=23268 tid=gmo48ykw4 class=ActionMailer::DeliveryJob jid=0b1943f5a675330944781492 INFO: start
2020-06-13T14:53:21.171Z pid=23268 tid=gmo48ykw4 class=ActionMailer::DeliveryJob jid=0b1943f5a675330944781492 elapsed=1.397 INFO: done
# If everything went well, stop the command.

h3. 6. Configure sidekiq to run as a system service

# Follow the official steps described in
# The above steps points to a @sidekiq.service@ example file which can be used to configure the service
# During service configuration, at least the following information must be provided:

* @WorkingDirectory@
* @User@
* @Group@

I recommend to carefully read all the instructions and how to configure the service.
# Enable and start the service:
sudo systemctl enable sidekiq
sudo systemctl start sidekiq
# Test again the email notifications