blacksteel/matrix-synapse: use unix socket

This commit is contained in:
Guanran Wang 2024-06-20 13:58:28 +08:00
parent 5d517a233c
commit 1e51748533

View file

@ -67,8 +67,11 @@
name = "synapse"; name = "synapse";
type = "tcp"; type = "tcp";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 8100;
remotePort = 8600; remotePort = 8600;
plugin = {
type = "unix_domain_socket";
unixPath = "/run/matrix-synapse/synapse.sock";
};
} }
{ {
name = "syncv3"; name = "syncv3";
@ -106,6 +109,7 @@
localIP = "127.0.0.1"; localIP = "127.0.0.1";
remotePort = 9100; remotePort = 9100;
plugin = { plugin = {
# FIXME:
type = "static_file"; type = "static_file";
localPath = "/var/lib/mastodon/public-system"; localPath = "/var/lib/mastodon/public-system";
}; };
@ -114,7 +118,7 @@
}; };
}; };
systemd.services.frp.serviceConfig.SupplementaryGroups = ["mastodon"]; systemd.services.frp.serviceConfig.SupplementaryGroups = ["mastodon" "matrix-synapse"];
services.postgresql = { services.postgresql = {
enable = true; enable = true;
@ -239,6 +243,7 @@
services.matrix-synapse = { services.matrix-synapse = {
enable = true; enable = true;
withJemalloc = true; withJemalloc = true;
enableRegistrationScript = false;
extraConfigFiles = [config.sops.secrets."synapse/secret".path]; extraConfigFiles = [config.sops.secrets."synapse/secret".path];
settings = { settings = {
server_name = "ny4.dev"; server_name = "ny4.dev";
@ -246,11 +251,8 @@
presence.enabled = false; # tradeoff presence.enabled = false; # tradeoff
listeners = [ listeners = [
{ {
port = 8100; path = "/run/matrix-synapse/synapse.sock";
bind_addresses = ["127.0.0.1"];
type = "http"; type = "http";
tls = false;
x_forwarded = true;
resources = [ resources = [
{ {
names = ["client" "federation"]; names = ["client" "federation"];
@ -280,18 +282,24 @@
}; };
}; };
systemd.services.matrix-synapse.environment = config.networking.proxy.envVars; systemd.services.matrix-synapse = {
environment = config.networking.proxy.envVars;
serviceConfig.RuntimeDirectory = ["matrix-synapse"];
};
services.matrix-sliding-sync = { services.matrix-sliding-sync = {
enable = true; enable = true;
environmentFile = config.sops.secrets."syncv3/environment".path; environmentFile = config.sops.secrets."syncv3/environment".path;
settings = { settings = {
SYNCV3_SERVER = "http://127.0.0.1:8100"; SYNCV3_SERVER = "/run/matrix-synapse/synapse.sock";
SYNCV3_BINDADDR = "/run/matrix-sliding-sync/sync.sock"; SYNCV3_BINDADDR = "/run/matrix-sliding-sync/sync.sock";
}; };
}; };
systemd.services.matrix-sliding-sync.serviceConfig.RuntimeDirectory = ["matrix-sliding-sync"]; systemd.services.matrix-sliding-sync.serviceConfig = {
RuntimeDirectory = ["matrix-sliding-sync"];
SupplementaryGroups = ["matrix-synapse"];
};
services.mastodon = { services.mastodon = {
enable = true; enable = true;