Add single sidekiq process for new scheduler queue

This commit is contained in:
Basti 2021-12-05 16:27:05 -06:00
parent 38756fd296
commit a0de016e1c
Signed by untrusted user: basti
GPG Key ID: 9F88009D31D99C72
2 changed files with 33 additions and 0 deletions

View File

@ -77,6 +77,18 @@ template "/lib/systemd/system/mastodon-sidekiq.service" do
notifies :restart, "service[mastodon-sidekiq]", :delayed
end
# mastodon-sidekiq-scheduler service
#
template "/lib/systemd/system/mastodon-sidekiq-scheduler.service" do
source "mastodon-sidekiq-scheduler.systemd.service.erb"
variables user: mastodon_user,
app_dir: mastodon_path,
bundle_path: "/opt/ruby_build/builds/#{ruby_version}/bin/bundle",
sidekiq_threads: 1
notifies :run, "execute[systemctl daemon-reload]", :immediately
notifies :restart, "service[mastodon-sidekiq-scheduler]", :delayed
end
# mastodon-streaming service
#
template "/lib/systemd/system/mastodon-streaming.service" do
@ -176,6 +188,10 @@ application mastodon_path do
action [:enable, :start]
end
service "mastodon-sidekiq-scheduler" do
action [:enable, :start]
end
service "mastodon-streaming" do
action [:enable, :start]
end

View File

@ -0,0 +1,17 @@
[Unit]
Description=mastodon-sidekiq-scheduler
Requires=redis-server.service
After=redis-server.service
[Service]
Type=simple
User=<%= @user %>
WorkingDirectory=<%= @app_dir %>
Environment="RAILS_ENV=production"
Environment="LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.1"
ExecStart=<%= @bundle_path %> exec sidekiq -c <%= @sidekiq_threads %> -q scheduler
TimeoutSec=15
Restart=always
[Install]
WantedBy=multi-user.target