SidekiqConfiguration » History » Version 5
Marius BĂLTEANU, 2024-01-29 18:13
Remove custom queue name
1 | 3 | Go MAEDA | h2. Sidekiq configuration |
---|---|---|---|
2 | 1 | Marius BĂLTEANU | |
3 | 3 | Go MAEDA | "Sidekiq":https://sidekiq.org/ 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. |
4 | 1 | Marius BĂLTEANU | |
5 | h3. 1. Prerequisites: |
||
6 | |||
7 | # Install redis-server. |
||
8 | |||
9 | 3 | Go MAEDA | h3. 2. Install sidekiq |
10 | 1 | Marius BĂLTEANU | |
11 | # Add the gem as dependency in @Gemfile.local@ file. If the file doesn't exist, you need to create it. |
||
12 | <pre> |
||
13 | gem 'sidekiq' |
||
14 | </pre> |
||
15 | # Run @bundle install@ to install the dependency |
||
16 | |||
17 | 5 | Marius BĂLTEANU | h3. 3. Configure Redmine to use @sidekiq@ as backend |
18 | 1 | Marius BĂLTEANU | |
19 | # Create @config/additional_environment.rb@ file if the file does not exist by copying the existing example file: |
||
20 | <pre> |
||
21 | cp config/additional_environment.rb.example config/additional_environment.rb |
||
22 | 4 | Mischa The Evil | </pre> |
23 | 1 | Marius BĂLTEANU | # Add the below config line to the file: |
24 | <pre> |
||
25 | config.active_job.queue_adapter = :sidekiq |
||
26 | </pre> |
||
27 | # Restart Redmine to reload the configuration file. |
||
28 | |||
29 | 5 | Marius BĂLTEANU | h3. 4. Test the configuration |
30 | 1 | Marius BĂLTEANU | |
31 | # Browse to Information tab from Redmine Administration page and check the mailer queue value: |
||
32 | <pre> |
||
33 | Mailer queue ActiveJob::QueueAdapters::SidekiqAdapter |
||
34 | </pre> |
||
35 | # Perform some actions in Redmine in order to trigger some notifications emails. In this step, Redmine only pushes the background jobs to Sidekiq backend. |
||
36 | # Temporary start sidekiq in order to process the queue and send the emails: |
||
37 | <pre> |
||
38 | RAILS_ENV=production bundle exec sidekiq |
||
39 | </pre> |
||
40 | |||
41 | Output example of startup process: |
||
42 | <pre> |
||
43 | 2020-06-13T15:08:12.470Z pid=23782 tid=gqluhczs2 INFO: Booted Rails 5.2.4.2 application in production environment |
||
44 | 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] |
||
45 | 2020-06-13T15:08:12.470Z pid=23782 tid=gqluhczs2 INFO: See LICENSE and the LGPL-3.0 for licensing details. |
||
46 | 2020-06-13T15:08:12.470Z pid=23782 tid=gqluhczs2 INFO: Upgrade to Sidekiq Pro for more features and support: https://sidekiq.org |
||
47 | 2020-06-13T15:08:12.471Z pid=23782 tid=gqluhczs2 INFO: Booting Sidekiq 6.0.7 with redis options {} |
||
48 | </pre> |
||
49 | |||
50 | Output example of job processing: |
||
51 | <pre> |
||
52 | 2020-06-13T14:53:19.773Z pid=23268 tid=gmo48ykw4 class=ActionMailer::DeliveryJob jid=0b1943f5a675330944781492 INFO: start |
||
53 | 2020-06-13T14:53:21.171Z pid=23268 tid=gmo48ykw4 class=ActionMailer::DeliveryJob jid=0b1943f5a675330944781492 elapsed=1.397 INFO: done |
||
54 | </pre> |
||
55 | 2 | Marius BĂLTEANU | # If everything went well, stop the command. |
56 | 1 | Marius BĂLTEANU | |
57 | 5 | Marius BĂLTEANU | h3. 5. Configure sidekiq to run as a system service |
58 | 1 | Marius BĂLTEANU | |
59 | # Follow the official steps described in https://github.com/mperham/sidekiq/wiki/Deployment#running-your-own-process |
||
60 | # The above steps points to a @sidekiq.service@ example file which can be used to configure the service |
||
61 | # During service configuration, at least the following information must be provided: |
||
62 | |||
63 | * @WorkingDirectory@ |
||
64 | * @User@ |
||
65 | * @Group@ |
||
66 | |||
67 | I recommend to carefully read all the instructions and how to configure the service. |
||
68 | # Enable and start the service: |
||
69 | <pre> |
||
70 | sudo systemctl enable sidekiq |
||
71 | sudo systemctl start sidekiq |
||
72 | </pre> |
||
73 | # Test again the email notifications |