nomad

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

hortusfox-cronjobs.nomad (1397B)


      1 # https://github.com/danielbrendel/hortusfox-web?tab=readme-ov-file#cronjobs
      2 
      3 job "hortusfox-cronjobs" {
      4   datacenters = ["dc1"]
      5   type = "batch"
      6 
      7   vault {}
      8 
      9   periodic {
     10     crons = [
     11       "@hourly"
     12     ]
     13   }
     14 
     15   group "cron" {
     16     count = 1
     17 
     18     task "recurring" {
     19       driver = "podman"
     20 
     21       config {
     22         image = "docker.io/curlimages/curl:latest"
     23         entrypoint = [""]
     24         command = "/bin/sh"
     25         args = ["-c", "curl -v https://plants.in0rdr.ch/cronjob/tasks/recurring?cronpw=$CRONPW"]
     26       }
     27 
     28       template {
     29         env = true
     30         destination = "${NOMAD_SECRETS_DIR}/env"
     31         data = <<EOT
     32 CRONPW = "{{with secret "kv/hortusfox-cronjobs"}}{{index .Data.data.CRONPW}}{{end}}"
     33 EOT
     34       }
     35 
     36       resources {
     37         memory = 50
     38         memory_max = 256
     39         cpu    = 100
     40       }
     41     }
     42 
     43     task "backup" {
     44       driver = "podman"
     45 
     46       config {
     47         image = "docker.io/curlimages/curl:latest"
     48         entrypoint = [""]
     49         command = "/bin/sh"
     50         args = ["-c", "curl -v https://plants.in0rdr.ch/cronjob/backup/auto?cronpw=$CRONPW"]
     51       }
     52 
     53       template {
     54         env = true
     55         destination = "${NOMAD_SECRETS_DIR}/env"
     56         data = <<EOT
     57 CRONPW = "{{with secret "kv/hortusfox-cronjobs"}}{{index .Data.data.CRONPW}}{{end}}"
     58 EOT
     59       }
     60 
     61       resources {
     62         memory = 50
     63         memory_max = 256
     64         cpu    = 100
     65       }
     66     }
     67   }
     68 }