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

View File

@@ -7,6 +7,12 @@ job "postgres" {
group "db" {
# Run on primary storage node (zippy) for local disk performance
constraint {
attribute = "${meta.storage_role}"
value = "primary"
}
network {
port "db" {
static = 5432
@@ -23,7 +29,7 @@ job "postgres" {
config {
image = "postgis/postgis:15-3.4-alpine"
ports = ["db"]
volumes = [ "/data/compute/appdata/postgres:/var/lib/postgresql/data" ]
volumes = [ "/data/services/postgres:/var/lib/postgresql/data" ]
}
env {
@@ -72,7 +78,7 @@ job "postgres" {
config {
image = "dpage/pgadmin4:latest"
ports = ["admin"]
volumes = [ "/data/compute/appdata/pgadmin:/var/lib/pgadmin" ]
volumes = [ "/data/services/pgadmin:/var/lib/pgadmin" ]
}
env {

View File

@@ -3,7 +3,7 @@ job "wordpress-backup" {
type = "batch"
periodic {
cron = "*/5 * * * * *"
crons = ["*/5 * * * * *"]
prohibit_overlap = true
}