nuc: switch to caddy

This commit is contained in:
Rouven Seifert 2024-05-21 18:44:04 +02:00
parent 6e82ae5be8
commit 657ae1385e
10 changed files with 69 additions and 98 deletions

View file

@ -32,6 +32,7 @@ in
matrix-synapse = {
enable = true;
configureRedisLocally = true;
enableRegistrationScript = false;
extraConfigFiles = [ config.age.secrets."matrix/shared".path ];
log = {
root.level = "WARNING";
@ -41,10 +42,9 @@ in
server_name = config.networking.domain;
listeners = [{
port = 8008;
bind_addresses = [ "::1" ];
path = "/run/matrix-synapse/server.sock";
mode = "666";
type = "http";
tls = false;
x_forwarded = true;
resources = [{
names = [ "client" "federation" ];
@ -57,29 +57,24 @@ in
enable = true;
settings = {
SYNCV3_SERVER = "https://${domain}";
SYNCV3_BINDADDR = "/run/matrix-sliding-sync/server.sock";
};
environmentFile = config.age.secrets."matrix/sync".path;
};
nginx = {
recommendedProxySettings = true;
caddy = {
virtualHosts = {
# synapse
"${domain}" = {
# locations."/".extraConfig = "return 404;";
# # proxy to synapse
# locations."/_matrix".proxyPass = "http://[::1]:8008";
locations."/".proxyPass = "http://[::1]:8008";
locations."~ ^/(client/|_matrix/client/unstable/org.matrix.msc3575/sync)".proxyPass = "http://localhost:8009";
# locations."/_synapse/client".proxyPass = "http://[::1]:8008";
};
"${domain}".extraConfig = ''
reverse_proxy /client/* unix//run/matrix-sliding-sync/server.sock
reverse_proxy /_matrix/client/unstable/org.matrix.msc3575/sync* unix//run/matrix-sliding-sync/server.sock
reverse_proxy unix//run/matrix-synapse/server.sock
'';
# element
"${domainClient}" = {
root = pkgs.element-web.override {
"${domainClient}".extraConfig = ''
root '${pkgs.element-web.override {
conf = {
default_server_config = {
inherit (clientConfig) "m.homeserver";
@ -87,13 +82,23 @@ in
};
disable_3pid_login = true;
};
};
};
}}'
'';
};
};
};
systemd.services.matrix-synapse.after = [ "matrix-synapse-pgsetup.service" ];
systemd.services.matrix-synapse = {
after = [ "matrix-synapse-pgsetup.service" ];
serviceConfig = {
RuntimeDirectory = "matrix-synapse";
};
};
systemd.services.matrix-sliding-sync = {
serviceConfig = {
RuntimeDirectory = "matrix-sliding-sync";
};
};
systemd.services.matrix-synapse-pgsetup = {
description = "Prepare Synapse postgres database";