From dcd0f499c6e5d5d480a0190bf33e5e361867e69d Mon Sep 17 00:00:00 2001 From: Yaya Date: Sat, 30 Mar 2024 13:03:37 +0100 Subject: [PATCH] nixos/gitlab: Add option sidekiq.concurrency. This commit adds an option to configure the amount of threads to use with sidekiq-cluster. The GitLab default is currently set to 20 threads. In space constrained environments this may become a problem with running out of memory as a result. --- nixos/modules/services/misc/gitlab.nix | 27 ++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/nixos/modules/services/misc/gitlab.nix b/nixos/modules/services/misc/gitlab.nix index db62d6f90901..6619949f5540 100644 --- a/nixos/modules/services/misc/gitlab.nix +++ b/nixos/modules/services/misc/gitlab.nix @@ -901,6 +901,16 @@ in { ''; }; + sidekiq.concurrency = mkOption { + type = with types; nullOr int; + default = null; + description = lib.mdDoc '' + How many processor threads to use for processing sidekiq background job queues. When null, the GitLab default is used. + + See for details. + ''; + }; + sidekiq.memoryKiller.enable = mkOption { type = types.bool; default = true; @@ -1454,12 +1464,17 @@ in { TimeoutSec = "infinity"; Restart = "always"; WorkingDirectory = "${cfg.packages.gitlab}/share/gitlab"; - ExecStart = utils.escapeSystemdExecArgs [ - "${cfg.packages.gitlab}/share/gitlab/bin/sidekiq-cluster" - "-e" "production" - "-r" "." - "*" # all queue groups - ]; + ExecStart = utils.escapeSystemdExecArgs ( + [ + "${cfg.packages.gitlab}/share/gitlab/bin/sidekiq-cluster" + "*" # all queue groups + ] ++ lib.optionals (cfg.sidekiq.concurrency != null) [ + "--concurrency" (toString cfg.sidekiq.concurrency) + ] ++ [ + "--environment" "production" + "--require" "." + ] + ); }; };