Switch back to custom mastodon.nix queue definitions

This commit is contained in:
dump_stack() 2023-04-20 17:20:32 +00:00
parent 391c3bf46f
commit bab7179c36
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC
2 changed files with 27 additions and 3 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-all".wantedBy = lib.mkForce [ ];
systemd.services."mastodon-sidekiq".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,6 +34,29 @@ 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'])]
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}' \
@ -91,6 +114,9 @@ in {
rm mastodon.sql.gz.gpg
'';
systemd.services.mastodon-sidekiq-all.serviceConfig.ExecStart =
lib.mkForce "${sidekiq-manager}";
# https://github.com/mperham/sidekiq/wiki/Memory#bloat
systemd.services.mastodon-sidekiq-all.environment.MALLOC_ARENA_MAX = "2";
@ -168,7 +194,5 @@ in {
DEEPL_API_KEY = secrets.DEEPL_API_KEY;
DEEPL_PLAN = "pro";
};
sidekiqThreads = 128;
};
}