nomad

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

git.nomad (2571B)


      1 job "git" {
      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 "git" {
     16       type = "csi"
     17       source = "git"
     18       access_mode = "multi-node-multi-writer"
     19       attachment_mode = "file-system"
     20     }
     21     volume "stagit" {
     22       type = "csi"
     23       source = "stagit"
     24       access_mode = "multi-node-multi-writer"
     25       attachment_mode = "file-system"
     26     }
     27     volume "tls" {		
     28       type = "csi"		
     29       source = "certbot"		
     30       access_mode = "multi-node-multi-writer"		
     31       attachment_mode = "file-system"		
     32     }
     33 
     34     network {
     35       port "stagit" {
     36         to = 443
     37         static = 44328
     38       }
     39       port "smarthttp" {
     40         to = 443
     41         static = 44318
     42       }
     43     }
     44 
     45     task "smarthttp" {
     46       driver = "podman"
     47 
     48       config {
     49         image = "127.0.0.1:5000/git:latest"
     50         force_pull = true
     51         ports = ["smarthttp"]
     52         volumes = [
     53           # mount the templated config from the task directory to the container
     54           "local/smarthttp.conf:/etc/apache2/conf.d/smarthttp.conf",
     55         ]
     56       }
     57 
     58       template {
     59         destination = "${NOMAD_TASK_DIR}/smarthttp.conf"
     60         data = file("./templates/smarthttp.conf.tmpl")
     61       }
     62 
     63       volume_mount {
     64         volume = "git"
     65         destination = "/srv/git"
     66       }
     67       volume_mount {
     68         volume = "stagit"
     69         destination = "/var/www/localhost/htdocs"
     70       }
     71       volume_mount {		
     72         volume = "tls"		
     73         destination = "/etc/letsencrypt"		
     74       }
     75 
     76       resources {
     77         memory = 32
     78         memory_max = 64
     79         cpu    = 100
     80       }
     81     }
     82 
     83     task "stagit" {
     84       driver = "podman"
     85 
     86       config {
     87         image = "127.0.0.1:5000/git:latest"
     88         force_pull = true
     89         ports = ["stagit"]
     90         volumes = [
     91           # mount the templated config from the task directory to the container
     92           "local/stagit.conf:/etc/apache2/conf.d/stagit.conf",
     93         ]
     94       }
     95 
     96       template {
     97         destination = "${NOMAD_TASK_DIR}/stagit.conf"
     98         data = file("./templates/stagit.conf.tmpl")
     99       }
    100 
    101       volume_mount {
    102         volume = "git"
    103         destination = "/srv/git"
    104       }
    105       volume_mount {
    106         volume = "stagit"
    107         destination = "/var/www/localhost/htdocs"
    108       }
    109       volume_mount {		
    110         volume = "tls"		
    111         destination = "/etc/letsencrypt"		
    112       }
    113 
    114       resources {
    115         memory = 32
    116         memory_max = 64
    117         cpu    = 100
    118       }
    119     }
    120   }
    121 }