Add backups for photoprism

This commit is contained in:
IamTheFij 2022-11-15 09:19:55 -08:00
parent c5135be4a0
commit b098a325f8
2 changed files with 54 additions and 0 deletions

View File

@ -187,6 +187,13 @@ ${file("${module_path}/jobs/grafana.hcl")}
{{ end -}}
{{ end -}}
{{ range service "photoprism" -}}
# photoprism .Node {{ .Node }}
{{ if eq .Node (env "node.unique.name") -}}
${file("${module_path}/jobs/photoprism.hcl")}
{{ end -}}
{{ end -}}
{{ range service "lldap" -}}
# lldap .Node {{ .Node }}
{{ if eq .Node (env "node.unique.name") -}}

View File

@ -0,0 +1,47 @@
job "photoprism" {
schedule = "10 * * * *"
config {
repo = "rclone::ftp,env_auth:/nomad/photoprism"
passphrase = env("BACKUP_PASSPHRASE")
}
task "Create local photoprism dir" {
pre_script {
on_backup = "mkdir -p /local/photoprism"
}
}
task "Backup database" {
mysql "Backup database" {
hostname = env("MYSQL_HOST")
port = env("MYSQL_PORT")
database = "photoprism"
username = env("MYSQL_USER")
password = env("MYSQL_PASSWORD")
no_tablespaces = true
dump_to = "/local/photoprism/dump.sql"
}
}
# NOTE: Right now the cache and sidecar files are stored in the task local
# storage and not in a volume that can be backed up. This was done to allow
# Photoprism to be moved between hosts. If this directory becomes large and
# costly to move between hosts or regenerate, then it may be worth putting it
# on a host volume so it can be backed up as well. Possibly once I get NFS
# shares running from the Proxmox host available to the VMs for faster shared
# storage.
backup {
paths = ["/local/photoprism"]
# Because path is absolute
restore_opts {
Target = "/"
}
}
forget {
KeepLast = 2
Prune = true
}
}