matrix: initialise DB if missing

This commit is contained in:
Michele Guerini Rocco 2020-10-26 00:48:10 +01:00
parent 5e20edc46e
commit b34a44098f
Signed by: rnhmjoj
GPG Key ID: BFBAF4C975F76450

View File

@ -135,9 +135,18 @@ in
};
# Use the Postrges database
### Database
services.postgresql.enable = true;
# Create database on the first run
services.postgresql.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";
'';
# Handles users behind a NAT,
# needed for reliable VoIP.