Improve backup job configuration

Add lidarr, fix hosts to 'nomad' since host names change with containers and nodes
and don't make a difference, make most jobs daily, exclude sonarr and lidarr zip backups
from restic backups.
This commit is contained in:
IamTheFij 2023-08-03 09:55:00 -07:00
parent e63327428f
commit d8f8884cb8
8 changed files with 127 additions and 9 deletions

View File

@ -1,5 +1,5 @@
job "grafana" {
schedule = "0 * * * *"
schedule = "@daily"
config {
repo = "rclone::ftp,env_auth:/nomad/grafana"
@ -26,8 +26,14 @@ job "grafana" {
backup {
paths = ["/local/grafana"]
# Because path is absolute
backup_opts {
Host = "nomad"
}
restore_opts {
Host = ["nomad"]
# Because path is absolute
Target = "/"
}
}

View File

@ -0,0 +1,56 @@
job "lidarr" {
schedule = "@daily"
config {
repo = "rclone::ftp,env_auth:/nomad/lidarr"
passphrase = env("BACKUP_PASSPHRASE")
}
task "Backup main database" {
postgres "Backup database" {
hostname = env("MYSQL_HOST")
port = env("MYSQL_PORT")
username = env("MYSQL_USER")
password = env("MYSQL_PASSWORD")
database = "lidarr"
no_tablespaces = true
dump_to = "/data/nas-container/lidarr/Backups/dump-lidarr.sql"
}
}
task "Backup logs database" {
postgres "Backup database" {
hostname = env("MYSQL_HOST")
port = env("MYSQL_PORT")
username = env("MYSQL_USER")
password = env("MYSQL_PASSWORD")
database = "lidarr-logs"
no_tablespaces = true
dump_to = "/data/nas-container/lidarr/Backups/dump-lidarr-logs.sql"
}
}
backup {
paths = ["/data/nas-container/lidarr"]
backup_opts {
Exclude = ["lidarr_backup_*.zip"]
Host = "nomad"
}
restore_opts {
Host = ["nomad"]
# Because path is absolute
Target = "/"
}
}
forget {
KeepLast = 2
KeepDaily = 30
KeepWeekly = 8
KeepMonthly = 6
KeepYearly = 2
Prune = true
}
}

View File

@ -26,8 +26,14 @@ job "lldap" {
backup {
paths = ["/local/lldap"]
# Because path is absolute
backup_opts {
Host = "nomad"
}
restore_opts {
Host = ["nomad"]
# Because path is absolute
Target = "/"
}
}

View File

@ -1,5 +1,5 @@
job "nextcloud" {
schedule = "0 * * * *"
schedule = "@daily"
config {
repo = "rclone::ftp,env_auth:/nomad/nextcloud"
@ -18,8 +18,14 @@ job "nextcloud" {
backup {
paths = ["/data/nextcloud"]
# Because path is absolute
backup_opts {
Host = "nomad"
}
restore_opts {
Host = ["nomad"]
# Because path is absolute
Target = "/"
}
}

View File

@ -13,8 +13,14 @@ job "nzbget" {
# Queued nzb files
"/data/media-write/Downloads/nzb",
]
# Because path is absolute
backup_opts {
Host = "nomad"
}
restore_opts {
Host = ["nomad"]
# Because path is absolute
Target = "/"
}
}

View File

@ -29,8 +29,14 @@ job "photoprism" {
"/local/photoprism",
"/data/nas-container/photoprism",
]
# Because path is absolute
backup_opts {
Host = "nomad"
}
restore_opts {
Host = ["nomad"]
# Because path is absolute
Target = "/"
}
}

View File

@ -8,8 +8,14 @@ job "sabnzbd" {
backup {
paths = ["/data/media-write/Downloads/sabnzbd"]
# Because path is absolute
backup_opts {
Host = "nomad"
}
restore_opts {
Host = ["nomad"]
# Because path is absolute
Target = "/"
}
}

View File

@ -6,11 +6,37 @@ job "sonarr" {
passphrase = env("BACKUP_PASSPHRASE")
}
task "Backup main database" {
sqlite "Backup database" {
path = "/data/sonarr/sonarr.db"
dump_to = "/data/sonarr/Backups/sonarr.db.bak"
}
}
task "Backup logs database" {
sqlite "Backup database" {
path = "/data/sonarr/logs.db"
dump_to = "/data/sonarr/Backups/logs.db.bak"
}
}
backup {
# Not dunping sqlite because sonarr makes dumps
paths = ["/data/sonarr"]
# Because path is absolute
backup_opts {
Exclude = [
"sonarr_backup_*.zip",
"*.db",
"*.db-shm",
"*.db-wal",
]
Host = "nomad"
}
restore_opts {
Host = ["nomad"]
# Because path is absolute
Target = "/"
}
}