Project

General

Profile

SolidQueueConfiguration » History » Version 1

Nishida Yuya, 2025-07-25 01:00

1 1 Nishida Yuya
h2. Solid Queue configuration
2
3
"Solid Queue":https://github.com/rails/solid_queue is a Database-backed Active Job backend. I've tested to following install and configuration steps on a fresh Debian/GNU Linux 12 with Redmine 6.0.6 and Solid Queue 1.2.0.
4
5
h3. 1. Install solid_queue
6
7
# Add the gem as dependency in @Gemfile.local@ file. If the file doesn't exist, you need to create it.
8
<pre>
9
gem 'solid_queue'
10
</pre>
11
# Run @bundle install@ to install the dependency
12
13
h3. 2. Configure Redmine database to setup tables for solid_queue (single database case)
14
15
Run following to 
16
17
<pre>
18
bin/rails solid_queue:install
19
</pre>
20
21
Write db/migrate/20250701000000_add_solid_queue_tables.rb as following:
22
23
<pre>
24
cat <<EOF > db/migrate/20250701000000_add_solid_queue_tables.rb
25
class AddSolidQueueTables < ActiveRecord::Migration[7.2]
26
  def change
27
$(sed -e '1 d' -e '$ d' db/queue_schema.rb | sed -e 's|^  |    |')
28
  end
29
end
30
EOF
31
</pre>
32
33
h3. 3. Configure Redmine to use @solid_queue@ as backend
34
35
# Create @config/additional_environment.rb@ file if the file does not exist by copying the existing example file:
36
<pre>
37
cp config/additional_environment.rb.example config/additional_environment.rb
38
</pre>
39
# Add the below config line to the file:
40
<pre>
41
config.active_job.queue_adapter = :solid_queue
42
</pre>
43
# Restart Redmine to reload the configuration file.
44
45
h3. 4. Test the configuration
46
47
# Browse to Information tab from Redmine Administration page and check the mailer queue value:
48
<pre>
49
  Mailer queue                   ActiveJob::QueueAdapters::SolidQueueAdapter
50
</pre> 
51
# Perform some actions in Redmine in order to trigger some notifications emails. In this step, Redmine only pushes the background jobs to SolidQueue backend.
52
# Temporary start Solid Queue supervisor in order to process the queue and send the emails:
53
<pre>
54
RAILS_ENV=production bin/jobs start
55
</pre>
56
57
    Output example of startup process:
58
<pre>
59
I, [2025-07-24T11:53:53.590961 #24399]  INFO -- : SolidQueue-1.2.1 Started Supervisor (40.1ms)  pid: 24399, hostname: "vagrant", process_id: 5, name: "supervisor-9318434042b90e70bf75"
60
I, [2025-07-24T11:53:53.642738 #24405]  INFO -- : SolidQueue-1.2.1 Started Dispatcher (43.7ms)  pid: 24405, hostname: "vagrant", process_id: 6, name: "dispatcher-6709740a9c0eb52cc355", polling_interval: 1, batch_size: 500, concurrency_maintenance_interval: 600
61
I, [2025-07-24T11:53:53.647923 #24408]  INFO -- : SolidQueue-1.2.1 Started Worker (42.7ms)  pid: 24408, hostname: "vagrant", process_id: 7, name: "worker-beadd9266ccccca675d0", polling_interval: 0.1, queues: "*", thread_pool_size: 3
62
I, [2025-07-24T11:53:53.686615 #24412]  INFO -- : SolidQueue-1.2.1 Started Scheduler (76.3ms)  pid: 24412, hostname: "vagrant", process_id: 8, name: "scheduler-b85c19cbe69292d9a6af", recurring_schedule: ["clear_solid_queue_finished_jobs"]
63
</pre>
64
65
    Output example of job processing:
66
<pre>
67
I, [2025-07-24T11:54:50.951148 #24408]  INFO -- : [ActiveJob] [Mailer::DeliveryJob] [d02bcf2d-73a3-42e9-a0fb-2832679cfc4b] Performing Mailer::DeliveryJob (Job ID: d02bcf2d-73a3-42e9-a0fb-2832679cfc4b) from SolidQueue(mailers) enqueued at 2025-07-24T11:54:50.682261303Z with arguments: "Mailer", "issue_edit", "deliver_now", {:args=>[#<GlobalID:0x00007a885a2747e8 @uri=#<URI::GID gid://redmine-app/User/1>>, #<GlobalID:0x00007a885a2aff78 @uri=#<URI::GID gid://redmine-app/Journal/1>>]}
68
I, [2025-07-24T11:54:51.421949 #24408]  INFO -- : [ActiveJob] [Mailer::DeliveryJob] [d02bcf2d-73a3-42e9-a0fb-2832679cfc4b] Performed Mailer::DeliveryJob (Job ID: d02bcf2d-73a3-42e9-a0fb-2832679cfc4b) from SolidQueue(mailers) in 559.55ms
69
</pre>
70
# If everything went well, stop the command. 
71
72
h3. 5. Configure Solid Queue supervisor to run as a system service
73
74
# Write @/etc/systemd/system/redmine_solid_queue.service@ file. example:
75
<pre>
76
[Unit]
77
Description=Solid Queue for Redmine
78
After=network.target nss-lookup.target remote-fs.target
79
80
[Service]
81
Type=simple
82
User=vagrant
83
Group=vagrant
84
WorkingDirectory=/opt/redmine
85
Environment=RAILS_ENV=production
86
ExecStart=/home/vagrant/.local/share/mise/shims/bundle exec bin/jobs start
87
TimeoutSec=300
88
ExecReload=/bin/kill -TSTP ${MAINPID}
89
ExecStop=/bin/kill -INT ${MAINPID}
90
RestartSec=1
91
Restart=on-failure
92
SyslogIdentifier=redmine_solid_queue
93
94
[Install]
95
WantedBy=multi-user.target
96
</pre>
97
# Enable and start the service:
98
<pre>
99
sudo systemctl enable redmine_solid_queue.service
100
sudo systemctl start redmine_solid_queue.service
101
</pre>
102
# Test again the email notifications