nomad

HCL and Docker files for Nomad deployments
git clone https://git.in0rdr.ch/nomad.git
Log | Files | Refs | Pull requests

commit 2e325327644c13c83eb7a353dd684ec9ee1343fa
parent 58c935dbb41fbf8233ea53e05a74f11a630dd2b2
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date:   Thu,  6 Jun 2024 08:52:21 +0200

feat(snapshot): add consul-kv job

Diffstat:
Mhcl/infra/snapshots/README | 4+---
Mhcl/infra/snapshots/nomad-snapshots.nomad | 4+++-
Mhcl/infra/snapshots/templates/snapshot.sh.tmpl | 7+++++--
3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/hcl/infra/snapshots/README b/hcl/infra/snapshots/README @@ -12,12 +12,10 @@ nomad run nomad-snapshots.nomad The jobs can be dispatched to either take snapshots of Nomad or Consul state: - nomad job dispatch -meta service=nomad snapshot - nomad job dispatch -meta service=consul snapshot +- nomad job dispatch -meta service=consul-kv snapshot The service meta parameter is required. -Prevent "volume max claim reached" on the CSI volume. Don't dispatch periodic -jobs for different services (meta param) at the same time (adapt cron schedule). - EXEC DRIVER ----------- diff --git a/hcl/infra/snapshots/nomad-snapshots.nomad b/hcl/infra/snapshots/nomad-snapshots.nomad @@ -8,10 +8,12 @@ job "snapshot" { } periodic { - # At minute 6 past every hour + # At minute 12 past every hour crons = [ "12 */1 * * *" ] + # prevents "volume max claim reached" on CSI volume + prohibit_overlap = true } group "snapshot" { diff --git a/hcl/infra/snapshots/templates/snapshot.sh.tmpl b/hcl/infra/snapshots/templates/snapshot.sh.tmpl @@ -3,7 +3,7 @@ # Script to create snapshots from Nomad or Consul storage. # Invoke with name of the service [nomad consul] as first arg. # -# Example: ./snapshot.sh consul +# Example: ./snapshot.sh consul-kv set -o errexit set -o nounset @@ -19,8 +19,11 @@ case "$1" in consul) consul snapshot save consul-state-{{ timestamp "20060102" }}-{{ timestamp "unix" }}.snap ;; + consul-kv) + consul kv export > consul-kv-{{ timestamp "20060102" }}-{{ timestamp "unix" }}.json + ;; *) - echo "Usage: $0 {nomad|consul}" + echo "Usage: $0 {nomad|consul|consul-kv}" ;; esac