Enable Postgres on Linode server
This commit is contained in:
@@ -4,6 +4,7 @@ let
|
|||||||
syncs = [
|
syncs = [
|
||||||
"nas"
|
"nas"
|
||||||
"dns"
|
"dns"
|
||||||
|
"linode"
|
||||||
];
|
];
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
@@ -44,6 +45,12 @@ in
|
|||||||
];
|
];
|
||||||
id = "C4XJCH7-3ZNW6XZ-R5DB2EU-OEGVVT2-WPHQAG7-UDWER36-6NO5KZR-4MN5VAK";
|
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 = {
|
folders = {
|
||||||
"mkrvy-tc6x9" = {
|
"mkrvy-tc6x9" = {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../../profiles/linode.nix
|
../../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