From 39d5aaaae11c972f4b838d98a069bbc792c3b6ad Mon Sep 17 00:00:00 2001 From: mrekucci Date: Thu, 29 Aug 2024 18:23:05 +0200 Subject: [PATCH] fix: detect in-progress backup on Geth node start --- .../templates/jobs/mev-commit-geth.nomad.j2 | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/infrastructure/nomad/playbooks/templates/jobs/mev-commit-geth.nomad.j2 b/infrastructure/nomad/playbooks/templates/jobs/mev-commit-geth.nomad.j2 index b8c29c076..b9010d71f 100644 --- a/infrastructure/nomad/playbooks/templates/jobs/mev-commit-geth.nomad.j2 +++ b/infrastructure/nomad/playbooks/templates/jobs/mev-commit-geth.nomad.j2 @@ -107,6 +107,17 @@ job "{{ job.name }}" { {{- end }} {% endraw %} + {% raw %} + {{ with nomadVar "nomad/jobs" }} + BACKUP="{{ .MEV_COMMIT_GETH_CHAIN_BACKUP }}" + {{ end }} + {% endraw %} + + if [[ "${BACKUP}" == "true" ]]; then + echo "Detected ongoing data backup, terminating..." + exit 1 + fi + BACKUP_FILE="local/backups/$( ls -1 local/backups/ | sed -r 's/(.*)_dirty/\1/' | @@ -267,6 +278,17 @@ job "{{ job.name }}" { {{- end }} {% endraw %} + {% raw %} + {{ with nomadVar "nomad/jobs" }} + BACKUP="{{ .MEV_COMMIT_GETH_CHAIN_BACKUP }}" + {{ end }} + {% endraw %} + + if [[ "${BACKUP}" == "true" ]]; then + echo "Detected ongoing data backup, terminating..." + exit 1 + fi + mkdir -p "${GETH_DATA_DIR}" > /dev/null 2>&1 {% if job.artifacts | selectattr('keystore', 'defined') | list | length > 0 %}