nomad

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

certbot.levant (1252B)


      1 # https://learn.hashicorp.com/tutorials/nomad/levant-abstract-jobs
      2 [[- /* Template defaults as json */ -]]
      3 [[- $Values := (fileContents "defaults.json" | parseJSON ) ]]
      4 
      5 job "certbot" {
      6   datacenters = ["dc1"]
      7   type = "batch"
      8 
      9   periodic {
     10     cron = "@daily"
     11   }
     12 
     13   group "certbot" {
     14     count = 1
     15 
     16     volume "certbot-data" {
     17       type = "csi"
     18       source = "certbot"
     19       access_mode = "multi-node-multi-writer"
     20       attachment_mode = "file-system"
     21     }
     22 
     23     network {
     24       port "http" {
     25         to = 80
     26         static = 8080
     27       }
     28       port "https" {
     29         to = 443
     30         static = 4433
     31       }
     32     }
     33 
     34 [[ range $i,$d := $Values.domains ]]
     35     task "request-[[ $d ]]" {
     36       driver = "podman"
     37 
     38       volume_mount {
     39         volume = "certbot-data"
     40         destination = "/etc/letsencrypt"
     41       }
     42 
     43       config {
     44         image = "certbot/certbot:arm64v8-latest"
     45         ports = ["http", "https"]
     46         # https://eff-certbot.readthedocs.io/en/stable/using.html#re-creating-and-updating-existing-certificates
     47         args = ["certonly", "--standalone", "-n", "-m", "mail@example.com", "--agree-tos", "--domains", "[[ $d ]]", "--staging"]
     48       }
     49 
     50       resources {
     51         memory = 32
     52         cpu    = 100
     53       }
     54     }
     55 [[ end ]]
     56   }
     57 }