add postgress backup job
This commit is contained in:
parent
9c02f03cac
commit
732d4b458d
53
nomad-job/backup-postgress.nomad
Normal file
53
nomad-job/backup-postgress.nomad
Normal file
@ -0,0 +1,53 @@
|
||||
|
||||
job "backup-postgress" {
|
||||
datacenters = ["homelab"]
|
||||
priority = 50
|
||||
type = "batch"
|
||||
meta {
|
||||
forcedeploy = "0"
|
||||
}
|
||||
|
||||
constraint {
|
||||
attribute = "${attr.cpu.arch}"
|
||||
value = "amd64"
|
||||
}
|
||||
periodic {
|
||||
cron = "0 3 * * *"
|
||||
prohibit_overlap = true
|
||||
}
|
||||
group "backup-postgress" {
|
||||
network {
|
||||
mode = "host"
|
||||
}
|
||||
vault {
|
||||
policies = ["access-tables"]
|
||||
}
|
||||
task "backup" {
|
||||
driver = "docker"
|
||||
service {
|
||||
name = "backup-postgress"
|
||||
}
|
||||
config {
|
||||
image = "ducampsv/docker-backup-postgres:latest"
|
||||
volumes = [
|
||||
"/mnt/diskstation/git/backup/postgres:/backup"
|
||||
]
|
||||
}
|
||||
template {
|
||||
data = <<EOH
|
||||
{{ with secret "secrets/data/database/dump"}}
|
||||
PGUSER = "dump"
|
||||
PGPASSWORD = "{{ .Data.data.password }}"
|
||||
PGHOST = "db1.ducamps.win"
|
||||
{{end}}
|
||||
EOH
|
||||
destination = "secrets/secrets.env"
|
||||
env = true
|
||||
}
|
||||
resources {
|
||||
memory = 25
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user