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.
This commit is contained in:
Yaya 2024-03-30 13:03:37 +01:00 committed by Yureka
parent c5550f4f34
commit dcd0f499c6

View file

@ -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 <https://docs.gitlab.com/ee/administration/sidekiq/extra_sidekiq_processes.html#manage-thread-counts-explicitly> 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" "."
]
);
};
};