Enable Postgres on Linode server

This commit is contained in:
Greg Hellings
2022-04-12 03:00:04 +00:00
parent 49fb61ed94
commit 28ebd30001
3 changed files with 51 additions and 1 deletions
+7
View File
@@ -4,6 +4,7 @@ let
syncs = [
"nas"
"dns"
"linode"
];
in
{
@@ -44,6 +45,12 @@ in
];
id = "C4XJCH7-3ZNW6XZ-R5DB2EU-OEGVVT2-WPHQAG7-UDWER36-6NO5KZR-4MN5VAK";
};
linode = {
addresses = [
"tcp://linode.thehellings.com:22000"
];
id = "3PHWAI5-ILAWGGD-S5FC5QM-M2WQ2FX-PZ3IXQF-QVRKANG-WXAACJC-2MZN3Q5";
};
};
folders = {
"mkrvy-tc6x9" = {
+2 -1
View File
@@ -3,6 +3,7 @@
{
imports = [
../../profiles/linode.nix
./postgres.nix
];
networking.hostName = "linode";
networking.hostName = "linode";
}
+42
View File
@@ -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" ];
};
}