build03, web02: backup postgresql
This commit is contained in:
parent
2aa87e5b0f
commit
8ce44ebf9a
5 changed files with 59 additions and 9 deletions
hosts
modules/nixos/monitoring
|
@ -1,6 +1,30 @@
|
||||||
{ pkgs, ... }:
|
{
|
||||||
|
config,
|
||||||
|
inputs,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
imports = [
|
||||||
|
inputs.self.nixosModules.backup
|
||||||
|
];
|
||||||
|
|
||||||
|
services.postgresqlBackup = {
|
||||||
|
enable = true;
|
||||||
|
compression = "none";
|
||||||
|
startAt = "daily";
|
||||||
|
};
|
||||||
|
|
||||||
|
nixCommunity.backup = [
|
||||||
|
{
|
||||||
|
name = "postgresql";
|
||||||
|
after = [ config.systemd.services.postgresqlBackup.name ];
|
||||||
|
paths = [ config.services.postgresqlBackup.location ];
|
||||||
|
startAt = "daily";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
services.postgresql.ensureUsers = [ { name = "telegraf"; } ];
|
services.postgresql.ensureUsers = [ { name = "telegraf"; } ];
|
||||||
|
|
||||||
systemd.services.postgresql.postStart = ''
|
systemd.services.postgresql.postStart = ''
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./gandi.nix
|
./gandi.nix
|
||||||
|
./postgresql.nix
|
||||||
inputs.self.nixosModules.monitoring
|
inputs.self.nixosModules.monitoring
|
||||||
inputs.self.nixosModules.nginx
|
inputs.self.nixosModules.nginx
|
||||||
];
|
];
|
||||||
|
|
31
hosts/web02/postgresql.nix
Normal file
31
hosts/web02/postgresql.nix
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
inputs,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
inputs.self.nixosModules.backup
|
||||||
|
];
|
||||||
|
|
||||||
|
services.postgresqlBackup = {
|
||||||
|
enable = true;
|
||||||
|
compression = "none";
|
||||||
|
startAt = "daily";
|
||||||
|
};
|
||||||
|
|
||||||
|
nixCommunity.backup = [
|
||||||
|
{
|
||||||
|
name = "postgresql";
|
||||||
|
after = [ config.systemd.services.postgresqlBackup.name ];
|
||||||
|
paths = [ config.services.postgresqlBackup.location ];
|
||||||
|
startAt = "daily";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
services.postgresql = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.postgresql_17;
|
||||||
|
};
|
||||||
|
}
|
|
@ -5,6 +5,7 @@
|
||||||
(lib.genAttrs
|
(lib.genAttrs
|
||||||
[
|
[
|
||||||
"borgbackup-job-github-org.service"
|
"borgbackup-job-github-org.service"
|
||||||
|
"borgbackup-job-postgresql.service"
|
||||||
]
|
]
|
||||||
(name: {
|
(name: {
|
||||||
expr = ''absent_over_time(task_last_run{name="${name}"}[1d])'';
|
expr = ''absent_over_time(task_last_run{name="${name}"}[1d])'';
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
{
|
{ config, inputs, ... }:
|
||||||
config,
|
|
||||||
inputs,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
{
|
||||||
systemd.services.grafana.after = [ config.systemd.services.prometheus.name ];
|
systemd.services.grafana.after = [ config.systemd.services.prometheus.name ];
|
||||||
|
|
||||||
|
@ -68,8 +63,6 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
services.postgresql = {
|
services.postgresql = {
|
||||||
enable = true;
|
|
||||||
package = pkgs.postgresql_17;
|
|
||||||
ensureDatabases = [ "grafana" ];
|
ensureDatabases = [ "grafana" ];
|
||||||
ensureUsers = [
|
ensureUsers = [
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue