Corrected postgres setting for matrix-synapse

This commit is contained in:
Craige McWhirter 2020-08-04 07:32:42 +10:00
parent 60a877c115
commit d6963248ae
Signed by: sercanto
GPG key ID: 7DBA9F5689EFB6AA

View file

@ -8,6 +8,13 @@
../secrets/matrix.nix ../secrets/matrix.nix
]; ];
i18n = {
extraLocaleSettings = {
LC_COLLATE = "C"; # Ensure correct locale for postgres
LC_CTYPE = "C"; # Ensure correct locale for postgres
};
};
services = { services = {
matrix-synapse = { matrix-synapse = {
@ -22,7 +29,7 @@
resources = [ resources = [
{ {
compress = true; compress = true;
names = [ "client" "webclient" ]; names = [ "client" ];
} { } {
compress = false; compress = false;
names = [ "federation" ]; names = [ "federation" ];
@ -100,20 +107,25 @@
postgresql = { postgresql = {
enable = true; enable = true;
};
};
services.postgresql = {
ensureDatabases = [ "matrix-synapse" ]; # Ensure the database persists ensureDatabases = [ "matrix-synapse" ]; # Ensure the database persists
ensureUsers = [ ensureUsers = [
{ {
name = "matrix-synapse"; # Ensure the database user persists name = "matrix-synapse"; # Ensure the database user persists
ensurePermissions = { # Ensure the database permissions persist ensurePermissions = { # Ensure the database permissions persist
#"DATABASE \"matrix-synapse\"" = "ALL PRIVILEGES"; "DATABASE \"matrix-synapse\"" = "ALL PRIVILEGES";
#"ALL TABLES IN SCHEMA public" = "ALL PRIVILEGES"; "ALL TABLES IN SCHEMA public" = "ALL PRIVILEGES";
}; };
} }
]; ];
# Initial database creation
initialScript = pkgs.writeText "synapse-init.sql" ''
CREATE ROLE "matrix-synapse" WITH LOGIN PASSWORD 'synapse';
CREATE DATABASE "matrix-synapse" WITH OWNER "matrix-synapse"
TEMPLATE template0
LC_COLLATE = "C"
LC_CTYPE = "C";
'';
};
}; };
security.acme = { security.acme = {