From a73c4331f8b0beda80ef811991ac305098245f56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Ezr?= Date: Thu, 24 Oct 2019 18:03:41 +0200 Subject: [PATCH] Fixes #28126 - improve dynflow sidekiq service --- extras/systemd/dynflow-sidekiq@.service | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/extras/systemd/dynflow-sidekiq@.service b/extras/systemd/dynflow-sidekiq@.service index 221668bdd77..6331aff6557 100644 --- a/extras/systemd/dynflow-sidekiq@.service +++ b/extras/systemd/dynflow-sidekiq@.service @@ -1,16 +1,26 @@ [Unit] -Description=Foreman jobs daemon on sidekiq +Description=Foreman jobs daemon - %i on sidekiq Documentation=https://theforeman.org After=network.target remote-fs.target nss-lookup.target [Service] -Type=forking +Type=simple User=foreman TimeoutSec=90 Environment=RAILS_ENV=production Environment=DYNFLOW_SIDEKIQ_SCRIPT=/usr/share/foreman/extras/dynflow-sidekiq.rb +# Greatly reduce Ruby memory fragmentation and heap usage +# https://www.mikeperham.com/2018/04/25/taming-rails-memory-bloat/ +Environment=MALLOC_ARENA_MAX=2 WorkingDirectory=/usr/share/foreman ExecStart=/usr/bin/sidekiq -e ${RAILS_ENV} -r ${DYNFLOW_SIDEKIQ_SCRIPT} -C /etc/foreman/dynflow/%i.yml +ExecReload=/usr/bin/kill -TSTP $MAINPID + +SyslogIdentifier=dynflow-sidekiq@%i + +# if we crash, restart +RestartSec=1 +Restart=on-failure [Install] WantedBy=multi-user.target