diff --git a/bin/background_jobs b/bin/background_jobs index f28e2f722dc77538eda2b7ce9a2ef3ccab1d201f..9d12422b81a416e9f66627be0020a8597a95181e 100755 --- a/bin/background_jobs +++ b/bin/background_jobs @@ -38,7 +38,14 @@ start_no_deamonize() start_sidekiq() { - exec bundle exec sidekiq -C "${sidekiq_config}" -e $RAILS_ENV -P $sidekiq_pidfile "$@" + cmd="exec" + chpst=$(which chpst) + + if [ -n "$chpst" ]; then + cmd="${cmd} ${chpst} -P" + fi + + ${cmd} bundle exec sidekiq -C "${sidekiq_config}" -e $RAILS_ENV -P $sidekiq_pidfile "$@" } load_ok() diff --git a/changelogs/unreleased/40396-use-pgroups-for-background-jobs.yml b/changelogs/unreleased/40396-use-pgroups-for-background-jobs.yml new file mode 100644 index 0000000000000000000000000000000000000000..578c780e1a1d6098dba347599deb9e716d5feda3 --- /dev/null +++ b/changelogs/unreleased/40396-use-pgroups-for-background-jobs.yml @@ -0,0 +1,5 @@ +--- +title: 'If chpst is available, make fron-source installations run sidekiq as a process group leader' +merge_request: 25654 +author: +type: other diff --git a/doc/install/installation.md b/doc/install/installation.md index fb24d4fa0ef1b2b90308ca2f5fff92eb9bfbcc74..61f544deabe7805e3d6764c711da08c90b69a288 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -9,7 +9,8 @@ On heavily used GitLab instances the memory usage of the Sidekiq background work Omnibus packages solve this by [letting the Sidekiq terminate gracefully](../administration/operations/sidekiq_memory_killer.md) if it uses too much memory. After this termination Runit will detect Sidekiq is not running and will start it. -Since installations from source don't have Runit, Sidekiq can't be terminated and its memory usage will grow over time. +Since installations from source don't use Runit for process supervision, Sidekiq +can't be terminated and its memory usage will grow over time. ## Select Version to Install @@ -72,7 +73,8 @@ Install the required packages (needed to compile Ruby and native extensions to R ```sh sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libre2-dev \ libreadline-dev libncurses5-dev libffi-dev curl openssh-server checkinstall libxml2-dev \ - libxslt-dev libcurl4-openssl-dev libicu-dev logrotate rsync python-docutils pkg-config cmake + libxslt-dev libcurl4-openssl-dev libicu-dev logrotate rsync python-docutils pkg-config cmake \ + runit ``` Ubuntu 14.04 (Trusty Tahr) doesn't have the `libre2-dev` package available, but