mjolnir working

set up a janitor for compressing state
This commit is contained in:
Anish Lakhwara 2022-10-10 20:57:43 +10:00
parent 9394544e07
commit 0c04c38779
4 changed files with 31 additions and 10 deletions

View file

@ -0,0 +1,21 @@
{ pkgs, ... }:
{
environment.systemPackages = [ pkgs.matrix-synapse-tools.rust-synapse-compress-state ];
systemd.services.compress-matrix-state = {
serviceConfig.Type = "oneshot";
path = [
pkgs.matrix-synapse-tools.rust-synapse-compress-state
];
script = ''
synapse_auto_compressor -p "host=/run/postgresql port=5432 user=matrix-synapse dbname=matrix-synapse" -n 2000000 -c 10000
'';
serviceConfig = {
User = "matrix-synapse";
};
};
systemd.timers.compress-matrix-state = {
wantedBy = [ "timers.target" ];
partOf = [ "compress-matrix-state.service" ];
timerConfig.OnCalendar = [ "weekly" ];
};
}

View file

@ -1,16 +1,16 @@
{ config, lib, pkgs, ... }: { self, config, lib, pkgs, ... }:
{ {
imports = [ imports = [
./mautrix-telegram.nix ./mautrix-telegram.nix
# ./mjolnir.nix # need to create the mod user ./mjolnir.nix
./heisenbridge.nix ./heisenbridge.nix
./compress-state-service.nix
]; ];
environment.systemPackages = [ pkgs.matrix-synapse-tools.rust-synapse-compress-state ];
age.secrets.synapse-database-password.file = "${self}/secrets/synapse-database-password.age"; age.secrets.synapse-database-password.file = "${self}/secrets/synapse-database-password.age";
age.secrets.synapse-database-password.owner = "matrix-synapse"; age.secrets.synapse-database-password.owner = "matrix-synapse";
age.secrets.synapse-database-password.file = "${self}/secrets/synapse-config.age"; age.secrets.synapse-config.file = "${self}/secrets/synapse-config.age";
age.secrets.synapse-database-password.owner = "matrix-synapse"; age.secrets.synapse-config.owner = "matrix-synapse";
services.matrix-synapse = { services.matrix-synapse = {
enable = true; enable = true;
@ -50,7 +50,6 @@
"turn:turn.sealight.xyz:3478?transport=tcp" "turn:turn.sealight.xyz:3478?transport=tcp"
]; ];
# turn_shared_secret = config.services.coturn.static-auth-secret; # turn_shared_secret = config.services.coturn.static-auth-secret;
extraConfig = "/run/agenix/synapse-config";
# Example config (saved as secret??) # Example config (saved as secret??)
# '' # ''
# max_upload_size: "50M" # max_upload_size: "50M"
@ -59,12 +58,13 @@
# enable_registration_without_verification: true # enable_registration_without_verification: true
# ''; # '';
enable_metrics = true; enable_metrics = true;
enable_registration = true; enable_registration = false;
database = { database = {
name = "psycopg2"; name = "psycopg2";
args.passfile = "/run/agenix/synapse-database-password"; args.passfile = "/run/agenix/synapse-database-password";
}; };
}; };
extraConfigFiles = [ "/run/agenix/synapse-config" ];
## coturn based TURN server integration (TURN server setup mentioned later), ## coturn based TURN server integration (TURN server setup mentioned later),
## shared secret generated while configuring coturn ## shared secret generated while configuring coturn
## and reused here (power of Nix being a real programming language) ## and reused here (power of Nix being a real programming language)

View file

@ -1,7 +1,7 @@
{ config, lib, pkgs, ... }: { self, config, lib, pkgs, ... }:
{ {
age.secrets.telegram-matrix-env.file = "${self}/secrets/telegram-matrix-env.age"; age.secrets.telegram-matrix-env.file = "${self}/secrets/telegram-matrix-env.age";
age.secrets.telegram-matrix-env.owner = "mautrix-telegram"; #age.secrets.telegram-matrix-env.owner = "mautrix-telegram";
services.mautrix-telegram = { services.mautrix-telegram = {
enable = true; enable = true;
environmentFile = "/run/agenix/telegram-matrix-env"; environmentFile = "/run/agenix/telegram-matrix-env";

View file

@ -1,4 +1,4 @@
{ pkgs, lib, config, ... }: { self, pkgs, lib, config, ... }:
{ {
age.secrets.sealight-mod-password.file = "${self}/secrets/sealight-mod-password.age"; age.secrets.sealight-mod-password.file = "${self}/secrets/sealight-mod-password.age";
age.secrets.sealight-mod-password.owner = "mjolnir"; age.secrets.sealight-mod-password.owner = "mjolnir";