conduit stuff because it can't go a single day without breaking (at least the cpu usage is normal now)

This commit is contained in:
jacekpoz 2023-07-30 01:15:35 +02:00
parent b56abf26ca
commit 3f19bdcf5f

View file

@ -3,7 +3,15 @@
pkgs,
inputs,
...
}: {
}: let
caddyConfig = ''
reverse_proxy /_matrix/* localhost:6167
header /.well-known/matrix/* Content-Type application/json
header /.well-known/matrix/* Access-Control-Allow-Origin *
respond /.well-known/matrix/server `{"m.server": "m.jacekpoz.pl:443"}`
respond /.well-known/matrix/client `{"m.homeserver":{"base_url":"https://m.jacekpoz.pl"}}`
'';
in {
services.matrix-conduit = {
enable = true;
@ -14,23 +22,16 @@
database_backend = "rocksdb";
port = 6167;
max_request_size = 100000000;
rocksdb_max_open_files = 20;
};
};
services.caddy = {
enable = true;
virtualHosts."m.jacekpoz.pl".extraConfig = ''
reverse_proxy /_matrix/* localhost:6167
header /.well-known/matrix/* Content-Type application/json
header /.well-known/matrix/* Access-Control-Allow-Origin *
respond /.well-known/matrix/server `{"m.server": "m.jacekpoz.pl:443"}`
respond /.well-known/matrix/client `{"m.homeserver":{"base_url":"https://m.jacekpoz.pl"}}`
'';
virtualHosts."jacekpoz.pl:8448".extraConfig = ''
reverse_proxy /_matrix/* localhost:6167
'';
virtualHosts."m.jacekpoz.pl".extraConfig = caddyConfig;
virtualHosts."jacekpoz.pl:8448".extraConfig = caddyConfig;
};
networking.firewall.allowedTCPPorts = [ 80 443 8448 ];
networking.firewall.allowedUDPPorts = [ 80 443 8448 ];
networking.firewall.allowedTCPPorts = [ 80 443 6167 8448 ];
networking.firewall.allowedUDPPorts = [ 80 443 6167 8448 ];
}