nomad

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

commit d674b82cd701952b3af448ebcf0805e020e98aaa
parent e729dc82e30c2c25e270f815de2060db255157dd
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date:   Fri, 21 Jul 2023 00:24:29 +0200

feat(infra): add docker-pull job

Diffstat:
Ahcl/infra/registry/docker-pull.nomad | 38++++++++++++++++++++++++++++++++++++++
Ahcl/infra/registry/templates/pull.sh.tmpl | 5+++++
2 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/hcl/infra/registry/docker-pull.nomad b/hcl/infra/registry/docker-pull.nomad @@ -0,0 +1,38 @@ +# Create a kv entry registry/images in Consul with the following YAML config: +# --- +# - image1:latest +# - image2:v2 + +job "docker-pull" { + datacenters = ["dc1"] + type = "sysbatch" + + periodic { + cron = "@daily" + } + + group "pull" { + count = 1 + + task "docker" { + driver = "raw_exec" + + template { + destination = "${NOMAD_TASK_DIR}/pull.sh" + data = file("./templates/pull.sh.tmpl") + perms = 755 + } + + config { + command = "/usr/bin/sh" + args = ["-c", "local/pull.sh"] + } + + resources { + memory = 64 + memory_max = 256 + cpu = 300 + } + } + } +} diff --git a/hcl/infra/registry/templates/pull.sh.tmpl b/hcl/infra/registry/templates/pull.sh.tmpl @@ -0,0 +1,5 @@ +#!/usr/bin/env sh +# Pull a set of images +{{ range $k, $v := key "registry/images" | parseYAML }} +podman pull {{ $v }} +{{- end }}