matrix: moved to own dir + added housecleaning
This commit is contained in:
parent
5aea8b7afb
commit
5bdebc357a
5 changed files with 52 additions and 2 deletions
|
@ -25,8 +25,7 @@
|
||||||
./gerd/services/searx.nix
|
./gerd/services/searx.nix
|
||||||
./gerd/services/miniflux.nix
|
./gerd/services/miniflux.nix
|
||||||
|
|
||||||
./gerd/services/element.nix
|
./gerd/services/matrix
|
||||||
./gerd/services/matrix-synapse.nix
|
|
||||||
|
|
||||||
./gerd/services/uptime-kuma.nix
|
./gerd/services/uptime-kuma.nix
|
||||||
|
|
||||||
|
|
7
machines/gerd/services/matrix/default.nix
Normal file
7
machines/gerd/services/matrix/default.nix
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./matrix-synapse.nix
|
||||||
|
./element.nix
|
||||||
|
./housecleaning.nix
|
||||||
|
];
|
||||||
|
}
|
38
machines/gerd/services/matrix/housecleaning.nix
Normal file
38
machines/gerd/services/matrix/housecleaning.nix
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
# delete empty directories
|
||||||
|
# - https://github.com/element-hq/synapse/issues/7690
|
||||||
|
# - https://github.com/matrix-org/synapse/issues/7690
|
||||||
|
systemd.services.matrix-synapse.preStart =
|
||||||
|
''${pkgs.findutils}/bin/find ${config.services.matrix-synapse.dataDir}/media_store -empty -type d -delete'';
|
||||||
|
|
||||||
|
systemd.timers."matrix-synapse-housecleaning-empty-dirs" = {
|
||||||
|
wantedBy = [ "timers.target" ];
|
||||||
|
timerConfig = {
|
||||||
|
OnCalendar = "Mon *-*-* 04:00:00";
|
||||||
|
Unit = config.systemd.services.matrix-synapse.name;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# vacuum database
|
||||||
|
systemd.services."matrix-synapse-psql-vacuum" = let
|
||||||
|
psqlUser = config.systemd.services.postgresql.serviceConfig.user;
|
||||||
|
dbName = config.services.matrix-synapse.settings.database.args.database;
|
||||||
|
in {
|
||||||
|
serviceConfig = {
|
||||||
|
User = psqlUser;
|
||||||
|
ExecStart = pkgs.writeScript "matrix-synapse-psql-vacuum.sh" ''
|
||||||
|
${config.services.postgresql.package}/bin/psql -d ${dbName} -c "vacuum full"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.timers."matrix-synapse-housecleaning-vacuum-db" = {
|
||||||
|
wantedBy = [ "timers.target" ];
|
||||||
|
timerConfig = {
|
||||||
|
OnCalendar = "Mon *-*-* 04:00:00";
|
||||||
|
Unit = config.systemd.services.matrix-synapse-psql-vacuum.name;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -74,6 +74,12 @@ in {
|
||||||
allowed_lifetime_min = "1d";
|
allowed_lifetime_min = "1d";
|
||||||
allowed_lifetime_max = "1y";
|
allowed_lifetime_max = "1y";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
# automatically forget room on leave/kick/ban, and
|
||||||
|
# purge from db after X time
|
||||||
|
forget_rooms_on_leave = true;
|
||||||
|
forgotten_room_retention_period = "28d";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue