Add backups for photoprism
This commit is contained in:
parent
c5135be4a0
commit
b098a325f8
@ -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") -}}
|
||||
|
47
services/backups/jobs/photoprism.hcl
Normal file
47
services/backups/jobs/photoprism.hcl
Normal 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
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user