Migration to upstream mastodon.nix queues definitions

default
dump_stack() 2023-04-14 19:03:56 +00:00
parent 3409eef71e
commit be81a9d207
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC
2 changed files with 13 additions and 29 deletions

View File

@ -5,7 +5,7 @@
systemd.services."mastodon-init-dirs".wantedBy = lib.mkForce [ ];
systemd.services."mastodon-media-auto-remove".startAt = lib.mkForce [ ];
systemd.services."mastodon-media-auto-remove".wantedBy = lib.mkForce [ ];
systemd.services."mastodon-sidekiq".wantedBy = lib.mkForce [ ];
systemd.services."mastodon-sidekiq-all".wantedBy = lib.mkForce [ ];
systemd.services."mastodon-streaming".wantedBy = lib.mkForce [ ];
systemd.services."mastodon-web".wantedBy = lib.mkForce [ ];
systemd.services."postgresqlBackup-mastodon".startAt = lib.mkForce [ ];

View File

@ -34,29 +34,6 @@ let
};
};
sidekiq-manager = pkgs.writers.writePython3 "sidekiq-manager" {} ''
from itertools import permutations
from subprocess import Popen
def sidekiq(queues, connections=16):
mastodon = "${mastodon-lor-sh}"
cmd = [f"{mastodon}/bin/sidekiq", "-r", mastodon]
cmd += ["-c", f"{connections}"]
for q in queues:
cmd += ['-q', q]
return Popen(cmd)
procs = [sidekiq(['mailers', 'pull', 'scheduler'])]
queues = ['default', 'push', 'ingress']
procs += [sidekiq(qs) for qs in permutations(queues)]
p = sidekiq([])
p.wait()
'';
s3cmd = pkgs.writeShellScript "s3cmd" ''
${pkgs.s3cmd}/bin/s3cmd \
--access_key='${secrets.backup.accessKey}' \
@ -114,12 +91,8 @@ in {
rm mastodon.sql.gz.gpg
'';
# Until merge of https://github.com/NixOS/nixpkgs/pull/202408
systemd.services.mastodon-sidekiq.serviceConfig.ExecStart =
lib.mkForce "${sidekiq-manager}";
# https://github.com/mperham/sidekiq/wiki/Memory#bloat
systemd.services.mastodon-sidekiq.environment.MALLOC_ARENA_MAX = "2";
systemd.services.mastodon-sidekiq-all.environment.MALLOC_ARENA_MAX = "2";
services.caddy = {
enable = true;
@ -195,5 +168,16 @@ in {
DEEPL_API_KEY = secrets.DEEPL_API_KEY;
DEEPL_PLAN = "pro";
};
sidekiqProcesses = {
all = { jobClasses = [ ]; threads = null; };
a = { jobClasses = [ "mailers" "pull" "scheduler" ]; threads = null; };
b = { jobClasses = [ "default" "push" "ingress" ]; threads = null; };
c = { jobClasses = [ "default" "ingress" "push" ]; threads = null; };
d = { jobClasses = [ "push" "default" "ingress" ]; threads = null; };
e = { jobClasses = [ "push" "ingress" "default" ]; threads = null; };
f = { jobClasses = [ "ingress" "default" "push" ]; threads = null; };
g = { jobClasses = [ "ingress" "push" "default" ]; threads = null; };
};
};
}