Move postgres to zippy.

This commit is contained in:
2025-10-22 14:05:45 +01:00
parent f414ac0146
commit a948f26ffb
3 changed files with 17 additions and 5 deletions

View File

@@ -3,11 +3,17 @@ job "postgres-backup" {
type = "batch"
periodic {
cron = "22 22 * * * *"
crons = ["22 22 * * * *"]
prohibit_overlap = true
}
group "db" {
# Run on primary storage node (zippy) where postgres runs
constraint {
attribute = "${meta.storage_role}"
value = "primary"
}
task "backup" {
driver = "raw_exec"
@@ -21,7 +27,7 @@ job "postgres-backup" {
data = <<EOH
set -e
/run/current-system/sw/bin/nomad alloc exec -job -task=postgres postgres \
pg_dumpall -U postgres > /data/compute/appdata/db-backups/postgresql/backup.sql && \
pg_dumpall -U postgres > /data/services/db-backups/postgresql/backup.sql && \
echo "last_success $(date +%s)" | \
/run/current-system/sw/bin/curl --data-binary @- http://pushgateway.service.consul:9091/metrics/job/postgres_backup
EOH