commit d4a6421d06e55e06e508f247e880b6ea57664d20 parent df40a1f5c87e1bed07537fcadfa063b1083b813f Author: Andreas Gruhler <agruhl@gmx.ch> Date: Sun, 28 Sep 2025 15:03:19 +0200 feat(0x0): add prune cronjob Diffstat:
| A | hcl/default/0x0/prune-cronjob.nomad | | | 60 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 60 insertions(+), 0 deletions(-)
diff --git a/hcl/default/0x0/prune-cronjob.nomad b/hcl/default/0x0/prune-cronjob.nomad @@ -0,0 +1,60 @@ +job "0x0-cronjob" { + datacenters = ["dc1"] + type = "batch" + + periodic { + crons = [ + "@daily" + ] + } + + group "cron" { + count = 1 + + volume "0x0" { + type = "csi" + source = "0x0" + access_mode = "multi-node-multi-writer" + attachment_mode = "file-system" + } + + task "prune" { + driver = "podman" + + env { + FLASK_APP = "fhost" + } + + config { + image = "127.0.0.1:5000/0x0:latest" + command = "/opt/venv/bin/flask" + args = ["prune"] + volumes = [ + # mount the templated config from the task directory to the container + "local/config.py:/usr/src/app/0x0/instance/config.py", + "local/index.html:/usr/src/app/0x0/templates/index.html", + ] + } + + volume_mount { + volume = "0x0" + destination = "/usr/src/app/0x0/data" + } + + template { + destination = "${NOMAD_TASK_DIR}/config.py" + data = file("./templates/config.py.tmpl") + } + template { + destination = "${NOMAD_TASK_DIR}/index.html" + data = file("./templates/index.html.tmpl") + } + + resources { + memory = 50 + memory_max = 256 + cpu = 100 + } + } + } +}