blacksteel/matrix-synapse: use unix socket

This commit is contained in:
Guanran Wang 2024-06-20 13:58:28 +08:00
parent a4f013938e
commit ad037b6f6a
Signed by: nyancat
GPG key ID: 91F97D9ED12639CF

View file

@ -66,14 +66,15 @@
{ {
name = "synapse"; name = "synapse";
type = "tcp"; type = "tcp";
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";
type = "tcp"; type = "tcp";
localIP = "127.0.0.1";
remotePort = 8700; remotePort = 8700;
plugin = { plugin = {
type = "unix_domain_socket"; type = "unix_domain_socket";
@ -83,7 +84,6 @@
{ {
name = "mastodon-web"; name = "mastodon-web";
type = "tcp"; type = "tcp";
localIP = "127.0.0.1";
remotePort = 8900; remotePort = 8900;
plugin = { plugin = {
type = "unix_domain_socket"; type = "unix_domain_socket";
@ -93,7 +93,6 @@
{ {
name = "mastodon-streaming"; name = "mastodon-streaming";
type = "tcp"; type = "tcp";
localIP = "127.0.0.1";
remotePort = 9000; remotePort = 9000;
plugin = { plugin = {
type = "unix_domain_socket"; type = "unix_domain_socket";
@ -103,9 +102,9 @@
{ {
name = "mastodon-system"; name = "mastodon-system";
type = "tcp"; type = "tcp";
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 +113,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 +238,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 +246,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 +277,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;