Improve monitoring of matrix and email2matrix
This commit is contained in:
parent
27a7985665
commit
d916bbedd5
10 changed files with 139 additions and 47 deletions
|
@ -17,13 +17,15 @@ in {
|
||||||
../../system/mathechor.de.nix
|
../../system/mathechor.de.nix
|
||||||
../../system/monitoring
|
../../system/monitoring
|
||||||
../../system/blog.nix
|
../../system/blog.nix
|
||||||
|
../../system/email2matrix.nix
|
||||||
|
../../system/matrix-synapse.nix
|
||||||
|
../../system/coturn.nix
|
||||||
./web.nix
|
./web.nix
|
||||||
./borg.nix
|
./borg.nix
|
||||||
./mail.nix
|
./mail.nix
|
||||||
./boot.nix
|
./boot.nix
|
||||||
./cloud.nix
|
./cloud.nix
|
||||||
./network.nix
|
./network.nix
|
||||||
./matrix.nix
|
|
||||||
./secret
|
./secret
|
||||||
];
|
];
|
||||||
m-0.monitoring = [{
|
m-0.monitoring = [{
|
||||||
|
@ -33,7 +35,7 @@ in {
|
||||||
|
|
||||||
nix.sshServe = {
|
nix.sshServe = {
|
||||||
enable = true;
|
enable = true;
|
||||||
keys = me.keys;
|
keys = me.keys ++ me.backupkeys;
|
||||||
protocol = "ssh-ng";
|
protocol = "ssh-ng";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -57,10 +57,10 @@ in {
|
||||||
rev = "f079966cb808f51fcc67be91b609942cdb49898a";
|
rev = "f079966cb808f51fcc67be91b609942cdb49898a";
|
||||||
sha256 = "0a4j4xajn2yysgcb17jmb6ak148kk0kwf7khml7dbnh7807fv9b6";
|
sha256 = "0a4j4xajn2yysgcb17jmb6ak148kk0kwf7khml7dbnh7807fv9b6";
|
||||||
};
|
};
|
||||||
in ''
|
in ''
|
||||||
${pkgs.python}/bin/python ${atomail}/atomail.py --title "Readlater-E-Mails" --uri="http://hera-intern-v4:8842/rss.xml" /var/www/rss.xml --mode=maildir --file "/var/vmail/maralorn.de/malte.brandy/.Move.readlater/" --max-items=100
|
${pkgs.python}/bin/python ${atomail}/atomail.py --title "Readlater-E-Mails" --uri="http://hera-intern-v4:8842/rss.xml" /var/www/rss.xml --mode=maildir --file "/var/vmail/maralorn.de/malte.brandy/.Move.readlater/" --max-items=100
|
||||||
${pkgs.rsync}/bin/rsync -a /var/vmail/maralorn.de/malte.brandy/.Move.readlater/cur/ /var/vmail/maralorn.de/malte.brandy/.Archiv.unsortiert/cur --remove-source-files
|
${pkgs.rsync}/bin/rsync -a /var/vmail/maralorn.de/malte.brandy/.Move.readlater/cur/ /var/vmail/maralorn.de/malte.brandy/.Archiv.unsortiert/cur --remove-source-files
|
||||||
'';
|
'';
|
||||||
startAt = "19:58:00";
|
startAt = "19:58:00";
|
||||||
serviceConfig.Type = "oneshot";
|
serviceConfig.Type = "oneshot";
|
||||||
};
|
};
|
||||||
|
@ -73,8 +73,10 @@ in {
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
services.postfix.networks =
|
services.postfix = {
|
||||||
[ "[${config.m-0.prefix}::]/64" "10.0.0.0/24" ];
|
networks = [ "[${config.m-0.prefix}::]/64" "10.0.0.0/24" ];
|
||||||
|
transport = "email2matrix.maralorn.de smtp:[::1]:2525";
|
||||||
|
};
|
||||||
mailserver = {
|
mailserver = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableImapSsl = true;
|
enableImapSsl = true;
|
||||||
|
@ -85,7 +87,14 @@ in {
|
||||||
certificateScheme = 1;
|
certificateScheme = 1;
|
||||||
certificateFile = "${certPath}/fullchain.pem";
|
certificateFile = "${certPath}/fullchain.pem";
|
||||||
keyFile = "${certPath}/key.pem";
|
keyFile = "${certPath}/key.pem";
|
||||||
extraVirtualAliases = config.m-0.private.lists;
|
extraVirtualAliases = config.m-0.private.lists // {
|
||||||
|
"weather-channel@maralorn.de" =
|
||||||
|
[ "weather@email2matrix.maralorn.de" ];
|
||||||
|
"subjects-channel@maralorn.de" =
|
||||||
|
[ "subjects@email2matrix.maralorn.de" ];
|
||||||
|
"monitoring-channel@maralorn.de" =
|
||||||
|
[ "monitoring@email2matrix.maralorn.de" ];
|
||||||
|
};
|
||||||
policydSPFExtraConfig = ''
|
policydSPFExtraConfig = ''
|
||||||
Mail_From_reject = False
|
Mail_From_reject = False
|
||||||
HELO_Whitelist = hosteurope.de
|
HELO_Whitelist = hosteurope.de
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -69,32 +69,32 @@ in rec {
|
||||||
targetPkgs = pkgs: (with pkgs; [ sambaFull ]);
|
targetPkgs = pkgs: (with pkgs; [ sambaFull ]);
|
||||||
multiPkgs = pkgs:
|
multiPkgs = pkgs:
|
||||||
(with pkgs;
|
(with pkgs;
|
||||||
with xorg; [
|
with xorg; [
|
||||||
file
|
file
|
||||||
freetype
|
freetype
|
||||||
libpng
|
libpng
|
||||||
mesa_drivers
|
mesa_drivers
|
||||||
zlib
|
zlib
|
||||||
libXi
|
libXi
|
||||||
libXcursor
|
libXcursor
|
||||||
libXrandr
|
libXrandr
|
||||||
libXrender
|
libXrender
|
||||||
libXxf86vm
|
libXxf86vm
|
||||||
libXcomposite
|
libXcomposite
|
||||||
libXext
|
libXext
|
||||||
libX11
|
libX11
|
||||||
libudev
|
libudev
|
||||||
libGLU_combined
|
libGLU_combined
|
||||||
mesa_noglu.osmesa
|
mesa_noglu.osmesa
|
||||||
libdrm
|
libdrm
|
||||||
libpulseaudio
|
libpulseaudio
|
||||||
alsaLib
|
alsaLib
|
||||||
openal
|
openal
|
||||||
mpg123
|
mpg123
|
||||||
libtxc_dxtn
|
libtxc_dxtn
|
||||||
gnutls
|
gnutls
|
||||||
krb5Full
|
krb5Full
|
||||||
]);
|
]);
|
||||||
runScript = "${gw2wrapper}/bin/gw2wrapper";
|
runScript = "${gw2wrapper}/bin/gw2wrapper";
|
||||||
};
|
};
|
||||||
cachix = import sources.cachix { };
|
cachix = import sources.cachix { };
|
||||||
|
@ -169,4 +169,5 @@ in rec {
|
||||||
};
|
};
|
||||||
foreign-home-pkgs = extra-system-pkgs;
|
foreign-home-pkgs = extra-system-pkgs;
|
||||||
eventd = pkgs.callPackage ./eventd { };
|
eventd = pkgs.callPackage ./eventd { };
|
||||||
|
email2matrix = pkgs.callPackage ./email2matrix { };
|
||||||
}
|
}
|
||||||
|
|
12
pkgs/email2matrix/default.nix
Normal file
12
pkgs/email2matrix/default.nix
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{ buildGoModule, fetchFromGitHub, ... }:
|
||||||
|
buildGoModule rec {
|
||||||
|
name = "email2matrix";
|
||||||
|
version = "782bcfdd67983ff27f0b9cec5c81cf1a20796ab0";
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "devture";
|
||||||
|
repo = "email2matrix";
|
||||||
|
rev = version;
|
||||||
|
sha256 = "0nx99iab2y10m4jh4jl9c4y7j4iy8zlyfcn42v4y4mlk1507czlj";
|
||||||
|
};
|
||||||
|
modSha256 = "0nrl1d1628isd6183a9rj4qmsmzpbsf656cm75vw0lz2x0s4x7dg";
|
||||||
|
}
|
16
system/coturn.nix
Normal file
16
system/coturn.nix
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{ config, ... }: {
|
||||||
|
networking.firewall.allowedTCPPorts = [ 3478 ];
|
||||||
|
|
||||||
|
services = {
|
||||||
|
coturn = {
|
||||||
|
enable = true;
|
||||||
|
pkey = "/var/lib/acme/hera.m-0.eu/key.pem";
|
||||||
|
cert = "/var/lib/acme/hera.m-0.eu/fullchain.pem";
|
||||||
|
no-tcp = true;
|
||||||
|
static-auth-secret = config.m-0.private.turn_secret;
|
||||||
|
realm = "maralorn.de";
|
||||||
|
use-auth-secret = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
46
system/email2matrix.nix
Normal file
46
system/email2matrix.nix
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
{ pkgs, config, ... }:
|
||||||
|
let
|
||||||
|
inherit (import ../pkgs) email2matrix;
|
||||||
|
default_mailbox = {
|
||||||
|
MailboxName = "<missing>";
|
||||||
|
MatrixRoomId = "<missing>";
|
||||||
|
MatrixHomeserverUrl = "https://matrix.maralorn.de";
|
||||||
|
MatrixUserId = "@marabot:matrix.maralorn.de";
|
||||||
|
MatrixAccessToken = config.m-0.private.matrix_marabot_token;
|
||||||
|
IgnoreSubject = false;
|
||||||
|
IgnoreBody = false;
|
||||||
|
SkipMarkdown = true;
|
||||||
|
};
|
||||||
|
email2matrix-config = pkgs.writeText "email2matrix-config.json"
|
||||||
|
(builtins.toJSON {
|
||||||
|
Smtp = {
|
||||||
|
ListenInterface = "[::1]:2525";
|
||||||
|
Hostname = "email2matrix.maralorn.de";
|
||||||
|
Workers = 10;
|
||||||
|
};
|
||||||
|
Matrix = {
|
||||||
|
Mappings = [
|
||||||
|
(default_mailbox // {
|
||||||
|
MailboxName = "subjects";
|
||||||
|
MatrixRoomId = "!kTKVQjRwxjaoMQmcve:maralorn.de";
|
||||||
|
IgnoreBody = true;
|
||||||
|
})
|
||||||
|
(default_mailbox // {
|
||||||
|
MailboxName = "monitoring";
|
||||||
|
MatrixRoomId = "!negVsngnYOmXYCLKiO:maralorn.de";
|
||||||
|
})
|
||||||
|
(default_mailbox // {
|
||||||
|
MailboxName = "weather";
|
||||||
|
MatrixRoomId = "!ELeFcSrHXgMqOmwnxg:maralorn.de";
|
||||||
|
})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
Misc = { Debug = true; };
|
||||||
|
});
|
||||||
|
in {
|
||||||
|
systemd.services.email2matrix = {
|
||||||
|
script =
|
||||||
|
"${email2matrix}/bin/devture-email2matrix --config ${email2matrix-config}";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
};
|
||||||
|
}
|
|
@ -2,20 +2,10 @@
|
||||||
let
|
let
|
||||||
hostName = "matrix.maralorn.de";
|
hostName = "matrix.maralorn.de";
|
||||||
inherit (config.m-0) hosts;
|
inherit (config.m-0) hosts;
|
||||||
inherit (../../lib) unstable;
|
|
||||||
in {
|
in {
|
||||||
networking.firewall.allowedTCPPorts = [ 3478 8448 ];
|
networking.firewall.allowedTCPPorts = [ 8448 ];
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
coturn = {
|
|
||||||
enable = true;
|
|
||||||
pkey = "/var/lib/acme/hera.m-0.eu/key.pem";
|
|
||||||
cert = "/var/lib/acme/hera.m-0.eu/fullchain.pem";
|
|
||||||
no-tcp = true;
|
|
||||||
static-auth-secret = config.m-0.private.turn_secret;
|
|
||||||
realm = "maralorn.de";
|
|
||||||
use-auth-secret = true;
|
|
||||||
};
|
|
||||||
nginx = {
|
nginx = {
|
||||||
enable = true;
|
enable = true;
|
||||||
virtualHosts."${hostName}" = {
|
virtualHosts."${hostName}" = {
|
||||||
|
@ -46,6 +36,8 @@ in {
|
||||||
max_upload_size = "30M";
|
max_upload_size = "30M";
|
||||||
create_local_database = false;
|
create_local_database = false;
|
||||||
dynamic_thumbnails = true;
|
dynamic_thumbnails = true;
|
||||||
|
registration_shared_secret =
|
||||||
|
config.m-0.private.matrix_registration_secret;
|
||||||
macaroon_secret_key = config.m-0.private.macaroon_secret;
|
macaroon_secret_key = config.m-0.private.macaroon_secret;
|
||||||
turn_uris = [ "turn:hera.m-0.eu:3478?transport=udp" ];
|
turn_uris = [ "turn:hera.m-0.eu:3478?transport=udp" ];
|
||||||
turn_shared_secret = config.m-0.private.turn_secret;
|
turn_shared_secret = config.m-0.private.turn_secret;
|
||||||
|
@ -92,6 +84,12 @@ in {
|
||||||
tls_certificate_path = "/var/lib/acme/${hostName}/fullchain.pem";
|
tls_certificate_path = "/var/lib/acme/${hostName}/fullchain.pem";
|
||||||
tls_private_key_path = "/var/lib/acme/${hostName}/key.pem";
|
tls_private_key_path = "/var/lib/acme/${hostName}/key.pem";
|
||||||
listeners = [
|
listeners = [
|
||||||
|
{
|
||||||
|
type = "metrics";
|
||||||
|
port = 9148;
|
||||||
|
bind_address = "127.0.0.1";
|
||||||
|
resources = [ ];
|
||||||
|
}
|
||||||
{
|
{
|
||||||
port = 8448;
|
port = 8448;
|
||||||
bind_address = "::";
|
bind_address = "::";
|
|
@ -47,7 +47,7 @@ in {
|
||||||
"receivers" = [{
|
"receivers" = [{
|
||||||
"name" = "team-admins";
|
"name" = "team-admins";
|
||||||
"email_configs" = [{
|
"email_configs" = [{
|
||||||
"to" = "malte.brandy@maralorn.de";
|
"to" = "monitoring@maralorn.de";
|
||||||
"send_resolved" = true;
|
"send_resolved" = true;
|
||||||
}];
|
}];
|
||||||
}];
|
}];
|
||||||
|
@ -73,6 +73,9 @@ in {
|
||||||
"https://wiki.vocalensemble-darmstadt.de"
|
"https://wiki.vocalensemble-darmstadt.de"
|
||||||
"https://intern.vocalensemble-darmstadt.de"
|
"https://intern.vocalensemble-darmstadt.de"
|
||||||
"https://www.vocalensemble-darmstadt.de"
|
"https://www.vocalensemble-darmstadt.de"
|
||||||
|
"https://matrix.maralorn.de"
|
||||||
|
"http://localhost:9090"
|
||||||
|
"http://localhost:9093"
|
||||||
];
|
];
|
||||||
}];
|
}];
|
||||||
relabel_configs = [
|
relabel_configs = [
|
||||||
|
@ -90,6 +93,11 @@ in {
|
||||||
} # The blackbox exporter's real hostname:port.
|
} # The blackbox exporter's real hostname:port.
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
job_name = "matrix";
|
||||||
|
metrics_path = "/_synapse/metrics";
|
||||||
|
static_configs = [{ targets = [ "localhost:9148" ]; }];
|
||||||
|
}
|
||||||
{
|
{
|
||||||
job_name = "nodes";
|
job_name = "nodes";
|
||||||
static_configs = map (entry: {
|
static_configs = map (entry: {
|
||||||
|
|
Loading…
Reference in a new issue