Move postgres to zippy.
This commit is contained in:
@@ -3,11 +3,17 @@ job "postgres-backup" {
|
|||||||
type = "batch"
|
type = "batch"
|
||||||
|
|
||||||
periodic {
|
periodic {
|
||||||
cron = "22 22 * * * *"
|
crons = ["22 22 * * * *"]
|
||||||
prohibit_overlap = true
|
prohibit_overlap = true
|
||||||
}
|
}
|
||||||
|
|
||||||
group "db" {
|
group "db" {
|
||||||
|
# Run on primary storage node (zippy) where postgres runs
|
||||||
|
constraint {
|
||||||
|
attribute = "${meta.storage_role}"
|
||||||
|
value = "primary"
|
||||||
|
}
|
||||||
|
|
||||||
task "backup" {
|
task "backup" {
|
||||||
driver = "raw_exec"
|
driver = "raw_exec"
|
||||||
|
|
||||||
@@ -21,7 +27,7 @@ job "postgres-backup" {
|
|||||||
data = <<EOH
|
data = <<EOH
|
||||||
set -e
|
set -e
|
||||||
/run/current-system/sw/bin/nomad alloc exec -job -task=postgres postgres \
|
/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)" | \
|
echo "last_success $(date +%s)" | \
|
||||||
/run/current-system/sw/bin/curl --data-binary @- http://pushgateway.service.consul:9091/metrics/job/postgres_backup
|
/run/current-system/sw/bin/curl --data-binary @- http://pushgateway.service.consul:9091/metrics/job/postgres_backup
|
||||||
EOH
|
EOH
|
||||||
|
|||||||
@@ -7,6 +7,12 @@ job "postgres" {
|
|||||||
|
|
||||||
|
|
||||||
group "db" {
|
group "db" {
|
||||||
|
# Run on primary storage node (zippy) for local disk performance
|
||||||
|
constraint {
|
||||||
|
attribute = "${meta.storage_role}"
|
||||||
|
value = "primary"
|
||||||
|
}
|
||||||
|
|
||||||
network {
|
network {
|
||||||
port "db" {
|
port "db" {
|
||||||
static = 5432
|
static = 5432
|
||||||
@@ -23,7 +29,7 @@ job "postgres" {
|
|||||||
config {
|
config {
|
||||||
image = "postgis/postgis:15-3.4-alpine"
|
image = "postgis/postgis:15-3.4-alpine"
|
||||||
ports = ["db"]
|
ports = ["db"]
|
||||||
volumes = [ "/data/compute/appdata/postgres:/var/lib/postgresql/data" ]
|
volumes = [ "/data/services/postgres:/var/lib/postgresql/data" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
env {
|
env {
|
||||||
@@ -72,7 +78,7 @@ job "postgres" {
|
|||||||
config {
|
config {
|
||||||
image = "dpage/pgadmin4:latest"
|
image = "dpage/pgadmin4:latest"
|
||||||
ports = ["admin"]
|
ports = ["admin"]
|
||||||
volumes = [ "/data/compute/appdata/pgadmin:/var/lib/pgadmin" ]
|
volumes = [ "/data/services/pgadmin:/var/lib/pgadmin" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
env {
|
env {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ job "wordpress-backup" {
|
|||||||
type = "batch"
|
type = "batch"
|
||||||
|
|
||||||
periodic {
|
periodic {
|
||||||
cron = "*/5 * * * * *"
|
crons = ["*/5 * * * * *"]
|
||||||
prohibit_overlap = true
|
prohibit_overlap = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user