mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 14:01:34 +01:00
outline: Configure backups
This commit is contained in:
parent
33e53f46da
commit
996cbb34ee
2 changed files with 22 additions and 3 deletions
|
|
@ -37,20 +37,21 @@
|
|||
|
||||
forgejo = {
|
||||
enable = true;
|
||||
doBackups = true;
|
||||
domain = "git.sstork.dev";
|
||||
doBackups = true;
|
||||
ssh.enable = true;
|
||||
};
|
||||
|
||||
hedgedoc = {
|
||||
enable = true;
|
||||
doBackups = true;
|
||||
domain = "docs.${sproutedDomain}";
|
||||
doBackups = true;
|
||||
};
|
||||
|
||||
outline = {
|
||||
enable = true;
|
||||
domain = "wiki.${sproutedDomain}";
|
||||
doBackups = true;
|
||||
};
|
||||
|
||||
it-tools = {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,14 @@
|
|||
{ config, lib, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.custom.services.outline;
|
||||
|
||||
dataDir = "/var/lib/outline";
|
||||
inherit (config.services.outline) user;
|
||||
in
|
||||
{
|
||||
options.custom.services.outline = {
|
||||
|
|
@ -13,6 +21,7 @@ in
|
|||
type = lib.types.port;
|
||||
default = 32886;
|
||||
};
|
||||
doBackups = lib.mkEnableOption "";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
|
@ -60,5 +69,14 @@ in
|
|||
};
|
||||
|
||||
systemd.services.outline.enableStrictShellChecks = false;
|
||||
|
||||
custom.services.resticBackups.outline = lib.mkIf cfg.doBackups {
|
||||
conflictingService = "outline.service";
|
||||
paths = [ dataDir ];
|
||||
extraConfig.backupPrepareCommand = ''
|
||||
${lib.getExe pkgs.sudo} --user=${user} ${lib.getExe' config.services.postgresql.package "pg_dump"} outline --format=custom --file=${dataDir}/db.dump
|
||||
'';
|
||||
restoreCommand.postRestore = "sudo --user=${user} pg_restore --clean --if-exists --dbname outline ${dataDir}/db.dump";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue