nomad

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

prune-cronjob.nomad (1226B)


      1 job "0x0-cronjob" {
      2   datacenters = ["dc1"]
      3   type = "batch"
      4 
      5   periodic {
      6     crons = [
      7       "@daily"
      8     ]
      9   }
     10 
     11   group "cron" {
     12     count = 1
     13 
     14     volume "0x0" {
     15       type = "csi"
     16       source = "0x0"
     17       access_mode = "multi-node-multi-writer"
     18       attachment_mode = "file-system"
     19     }
     20 
     21     task "prune" {
     22       driver = "podman"
     23 
     24       env {
     25         FLASK_APP = "fhost"
     26       }
     27 
     28       config {
     29         image = "127.0.0.1:5000/0x0:latest"
     30         command = "/opt/venv/bin/flask"
     31         args = ["prune"]
     32         volumes = [
     33           # mount the templated config from the task directory to the container
     34           "local/config.py:/usr/src/app/0x0/instance/config.py",
     35           "local/index.html:/usr/src/app/0x0/templates/index.html",
     36         ]
     37       }
     38 
     39       volume_mount {
     40         volume = "0x0"
     41         destination = "/usr/src/app/0x0/data"
     42       }
     43 
     44       template {
     45         destination = "${NOMAD_TASK_DIR}/config.py"
     46         data = file("./templates/config.py.tmpl")
     47       }
     48       template {
     49         destination = "${NOMAD_TASK_DIR}/index.html"
     50         data = file("./templates/index.html.tmpl")
     51       }
     52 
     53       resources {
     54         memory = 50
     55         memory_max = 256
     56         cpu    = 100
     57       }
     58     }
     59   }
     60 }