switch to synapse away from conduit
Some checks failed
Test action / kaas (push) Failing after 1s

This commit is contained in:
Chris Kruining 2025-09-11 16:43:54 +02:00
parent d4eff47049
commit d74f67e4fb
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
2 changed files with 120 additions and 26 deletions

View file

@ -4,8 +4,7 @@ let
cfg = config.${namespace}.services.authentication.zitadel; cfg = config.${namespace}.services.authentication.zitadel;
db_name = "zitadel"; database = "zitadel";
db_user = "zitadel";
in in
{ {
options.${namespace}.services.authentication.zitadel = { options.${namespace}.services.authentication.zitadel = {
@ -72,9 +71,9 @@ in
Host = "localhost"; Host = "localhost";
# Zitadel will report error if port is not set # Zitadel will report error if port is not set
Port = 5432; Port = 5432;
Database = db_name; Database = database;
User = { User = {
Username = db_user; Username = database;
SSL.Mode = "disable"; SSL.Mode = "disable";
}; };
Admin = { Admin = {
@ -105,10 +104,10 @@ in
postgresql = { postgresql = {
enable = true; enable = true;
ensureDatabases = [ db_name ]; ensureDatabases = [ database ];
ensureUsers = [ ensureUsers = [
{ {
name = db_user; name = database;
ensureDBOwnership = true; ensureDBOwnership = true;
} }
]; ];

View file

@ -1,9 +1,15 @@
{ config, lib, pkgs, namespace, ... }: { config, lib, pkgs, namespace, ... }:
let let
inherit (builtins) toString toJSON;
inherit (lib) mkIf mkEnableOption; inherit (lib) mkIf mkEnableOption;
cfg = config.${namespace}.services.communication.conduit; cfg = config.${namespace}.services.communication.conduit;
domain = "matrix.kruining.eu";
domain = "kruining.eu";
fqn = "matrix.${domain}";
port = 4001;
database = "synapse";
in in
{ {
options.${namespace}.services.communication.conduit = { options.${namespace}.services.communication.conduit = {
@ -20,13 +26,13 @@ in
services = { services = {
matrix-conduit = { matrix-conduit = {
enable = true; enable = false;
settings.global = { settings.global = {
address = "::"; address = "::";
port = 4001; port = port;
server_name = "matrix.kruining.eu"; server_name = domain;
database_backend = "rocksdb"; database_backend = "rocksdb";
# database_path = "/var/lib/matrix-conduit/"; # database_path = "/var/lib/matrix-conduit/";
@ -38,27 +44,115 @@ in
}; };
}; };
# postgresql = { matrix-synapse = {
# enable = true; enable = true;
# ensureDatabases = [ "conduit" ];
# ensureUsers = [ extras = [ "oidc" ];
# { plugins = with config.services.matrix-synapse.package.plugins; [];
# name = "conduit";
# ensureDBOwnership = true; settings = {
# } server_name = domain;
# ]; public_baseurl = "https://${fqn}";
# };
enable_registration = false;
registration_shared_secret = "tZtBnlhEmLbMwF0lQ112VH1Rl5MkZzYH9suI4pEoPXzk6nWUB8FJF4eEnwLkbstz";
url_preview_enabled = true;
precence.enabled = true;
database = {
# this is postgresql (also the default, but I prefer to be explicit)
name = "psycopg2";
args = {
database = database;
user = database;
};
};
listeners = [
{
bind_addresses = ["::"];
port = port;
type = "http";
tls = false;
x_forwarded = true;
resources = [
{
names = [ "client" "federation" ];
compress = true;
}
];
}
];
};
};
mautrix-signal = {
enable = true;
registerToSynapse = true;
settings = {
appservice = {
provisioning.enabled = false;
port = 40011;
};
homeserver = {
address = "http://[::1]:${toString port}";
domain = domain;
};
bridge = {
permissions = {
"@chris:${domain}" = "admin";
};
};
};
};
mautrix-whatsapp = {
enable = true;
registerToSynapse = true;
settings = {
appservice = {
provisioning.enabled = false;
port = 40012;
};
homeserver = {
address = "http://[::1]:${toString port}";
domain = domain;
};
bridge = {
permissions = {
"@chris:${domain}" = "admin";
};
};
};
};
postgresql = {
enable = true;
ensureDatabases = [ database ];
ensureUsers = [
{
name = database;
ensureDBOwnership = true;
}
];
};
caddy = { caddy = {
enable = true; enable = true;
virtualHosts = let virtualHosts = let
inherit (builtins) toJSON;
server = { server = {
"m.server" = "${domain}:443"; "m.server" = "${fqn}:443";
}; };
client = { client = {
"m.homeserver".base_url = "https://${domain}"; "m.homeserver".base_url = "https://${fqn}";
"m.identity_server".base_url = "https://auth.amarth.cloud"; "m.identity_server".base_url = "https://auth.amarth.cloud";
}; };
in { in {
@ -67,9 +161,10 @@ in
header /.well-known/matrix/* Access-Control-Allow-Origin * header /.well-known/matrix/* Access-Control-Allow-Origin *
respond /.well-known/matrix/server `${toJSON server}` respond /.well-known/matrix/server `${toJSON server}`
respond /.well-known/matrix/client `${toJSON client}` respond /.well-known/matrix/client `${toJSON client}`
'';
"${fqn}".extraConfig = ''
reverse_proxy /_matrix/* http://::1:4001 reverse_proxy /_matrix/* http://::1:4001
# reverse_proxy /_synapse/client/* http://::1:4001 reverse_proxy /_synapse/client/* http://::1:4001
''; '';
}; };
}; };