nomad

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

diary.nomad (1427B)


      1 job "diary" {
      2   datacenters = ["dc1"]
      3 
      4   priority = 80
      5 
      6   constraint {
      7     # image only built for arm
      8     attribute = "${attr.cpu.arch}"
      9     value     = "arm64"
     10   }
     11 
     12   group "server" {
     13     count = 1
     14 
     15     volume "tls" {
     16       type = "csi"
     17       source = "certbot"
     18       access_mode = "multi-node-multi-writer"
     19       attachment_mode = "file-system"
     20     }
     21 
     22     network {
     23       port "jekyll" {
     24         to = 4000
     25       }
     26       port "https" {
     27         static = 44362
     28       }
     29     }
     30 
     31     task "jekyll" {
     32       driver = "podman"
     33 
     34       config {
     35         image = "127.0.0.1:5000/jekyll-diary:20396e66bbefea76eb1ea691de8e152b9f0fafa5"
     36         force_pull = true
     37         ports = ["jekyll"]
     38       }
     39 
     40       resources {
     41         memory = 50
     42         memory_max = 128
     43         cpu = 200
     44       }
     45     }
     46 
     47     task "nginx" {
     48       driver = "podman"
     49 
     50       config {
     51         image = "docker.io/library/nginx:stable-alpine"
     52         ports = ["https"]
     53         volumes = [
     54           # mount the templated config from the task directory to the container
     55           "local/diary.conf:/etc/nginx/conf.d/diary.conf",
     56         ]
     57       }
     58 
     59       volume_mount {
     60         volume = "tls"
     61         destination = "/etc/letsencrypt"
     62       }
     63 
     64       template {
     65         destination = "${NOMAD_TASK_DIR}/diary.conf"
     66         data = file("./templates/nginx.conf.tmpl")
     67       }
     68 
     69       resources {
     70         memory = 50
     71         memory_max = 128
     72         cpu    = 200
     73       }
     74     }
     75   }
     76 }