Enable Postgres on Linode server
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
{
|
||||
imports = [
|
||||
../../profiles/linode.nix
|
||||
./postgres.nix
|
||||
];
|
||||
networking.hostName = "linode";
|
||||
networking.hostName = "linode";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
{ config, ... }:
|
||||
|
||||
{
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
checkConfig = true;
|
||||
ensureDatabases = [ "synapse" "nextcloud" ];
|
||||
ensureUsers = [ {
|
||||
name = "synapse";
|
||||
ensurePermissions."DATABASE synapse" = "ALL PRIVILEGES";
|
||||
} {
|
||||
name = "root";
|
||||
ensurePermissions."ALL TABLES IN SCHEMA public" = "ALL PRIVILEGES";
|
||||
} ];
|
||||
settings = {
|
||||
log_connections = true;
|
||||
log_statement = "all";
|
||||
logging_collector = true;
|
||||
};
|
||||
identMap = ''
|
||||
root root root
|
||||
'';
|
||||
};
|
||||
|
||||
services.postgresqlBackup.enable = true;
|
||||
|
||||
services.logrotate = {
|
||||
enable = true;
|
||||
paths = {
|
||||
postgres = {
|
||||
enable = true;
|
||||
path = "${config.services.postgresqlBackup.location}/*.gz";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.syncthing.folders."postgres-backups" = {
|
||||
path = "${config.services.postgresqlBackup.location}";
|
||||
enable = true;
|
||||
devices = [ "nas" ];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user