···
GITLAB_REDIS_CONFIG_FILE = pkgs.writeText "redis.yml" (builtins.toJSON redisConfig);
prometheus_multiproc_dir = "/run/gitlab";
RAILS_ENV = "production";
158
+
MALLOC_ARENA_MAX = "2";
gitlab-rake = pkgs.stdenv.mkDerivation {
···
description = "Extra configuration to merge into shell-config.yml";
656
+
puma.workers = mkOption {
659
+
apply = x: builtins.toString x;
661
+
The number of worker processes Puma should spawn. This
662
+
controls the amount of parallel Ruby code can be
663
+
executed. GitLab recommends <quote>Number of CPU cores -
664
+
1</quote>, but at least two.
668
+
Each worker consumes quite a bit of memory, so
669
+
be careful when increasing this.
675
+
puma.threadsMin = mkOption {
678
+
apply = x: builtins.toString x;
680
+
The minimum number of threads Puma should use per
685
+
Each thread consumes memory and contributes to Global VM
686
+
Lock contention, so be careful when increasing this.
692
+
puma.threadsMax = mkOption {
695
+
apply = x: builtins.toString x;
697
+
The maximum number of threads Puma should use per
698
+
worker. This limits how many threads Puma will automatically
699
+
spawn in response to requests. In contrast to workers,
700
+
threads will never be able to run Ruby code in parallel, but
701
+
give higher IO parallelism.
705
+
Each thread consumes memory and contributes to Global VM
706
+
Lock contention, so be careful when increasing this.
712
+
sidekiq.memoryKiller.enable = mkOption {
716
+
Whether the Sidekiq MemoryKiller should be turned
717
+
on. MemoryKiller kills Sidekiq when its memory consumption
718
+
exceeds a certain limit.
720
+
See <link xlink:href="https://docs.gitlab.com/ee/administration/operations/sidekiq_memory_killer.html"/>
725
+
sidekiq.memoryKiller.maxMemory = mkOption {
728
+
apply = x: builtins.toString (x * 1024);
730
+
The maximum amount of memory, in MiB, a Sidekiq worker is
731
+
allowed to consume before being killed.
735
+
sidekiq.memoryKiller.graceTime = mkOption {
738
+
apply = x: builtins.toString x;
740
+
The time MemoryKiller waits after noticing excessive memory
741
+
consumption before killing Sidekiq.
745
+
sidekiq.memoryKiller.shutdownWait = mkOption {
748
+
apply = x: builtins.toString x;
750
+
The time allowed for all jobs to finish before Sidekiq is
···
] ++ optional (cfg.databaseHost == "") "postgresql.service";
wantedBy = [ "gitlab.target" ];
partOf = [ "gitlab.target" ];
996
-
environment = gitlabEnv;
1096
+
environment = gitlabEnv // (optionalAttrs cfg.sidekiq.memoryKiller.enable {
1097
+
SIDEKIQ_MEMORY_KILLER_MAX_RSS = cfg.sidekiq.memoryKiller.maxMemory;
1098
+
SIDEKIQ_MEMORY_KILLER_GRACE_TIME = cfg.sidekiq.memoryKiller.graceTime;
1099
+
SIDEKIQ_MEMORY_KILLER_SHUTDOWN_WAIT = cfg.sidekiq.memoryKiller.shutdownWait;
···
# Needed for GitLab project imports
1113
+
procps # Sidekiq MemoryKiller
1014
-
Restart = "on-failure";
1120
+
Restart = "always";
WorkingDirectory = "${cfg.packages.gitlab}/share/gitlab";
ExecStart="${cfg.packages.gitlab.rubyEnv}/bin/sidekiq -C \"${cfg.packages.gitlab}/share/gitlab/config/sidekiq_queues.yml\" -e production";
···
WorkingDirectory = "${cfg.packages.gitlab}/share/gitlab";
1148
-
ExecStart = "${cfg.packages.gitlab.rubyEnv}/bin/puma -C ${cfg.statePath}/config/puma.rb -e production";
1254
+
ExecStart = concatStringsSep " " [
1255
+
"${cfg.packages.gitlab.rubyEnv}/bin/puma"
1257
+
"-C ${cfg.statePath}/config/puma.rb"
1258
+
"-w ${cfg.puma.workers}"
1259
+
"-t ${cfg.puma.threadsMin}:${cfg.puma.threadsMax}"