nixos/mastodon: Fix sidekiq's DB_POOL, add configurable concurrency

The `services.mastodon` module currently hardcodes sidekiq's concurrency
to 25, but doesn't set a DB pool size, which defaults to 5 or the number
of configured web threads.

(This behaviour is very strange, and arguably a mastodon bug.)

This also makes sidekiq's concurrency configurable, because 25 is a tad
high for the hardware I'm running it on.
This commit is contained in:
embr 2021-09-04 10:53:09 +02:00 committed by Kerstin
parent 2977fc3a10
commit 8c1e6a8598

View file

@ -154,10 +154,15 @@ in {
};
sidekiqPort = lib.mkOption {
description = "TCP port used by the mastodon-sidekiq service";
description = "TCP port used by the mastodon-sidekiq service.";
type = lib.types.port;
default = 55002;
};
sidekiqThreads = lib.mkOption {
description = "Worker threads used by the mastodon-sidekiq service.";
type = lib.types.int;
default = 25;
};
vapidPublicKeyFile = lib.mkOption {
description = ''
@ -524,9 +529,10 @@ in {
wantedBy = [ "multi-user.target" ];
environment = env // {
PORT = toString(cfg.sidekiqPort);
DB_POOL = toString cfg.sidekiqThreads;
};
serviceConfig = {
ExecStart = "${cfg.package}/bin/sidekiq -c 25 -r ${cfg.package}";
ExecStart = "${cfg.package}/bin/sidekiq -c ${toString cfg.sidekiqThreads} -r ${cfg.package}";
Restart = "always";
RestartSec = 20;
EnvironmentFile = "/var/lib/mastodon/.secrets_env";