nomad

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

pico.nomad (2919B)


      1 # https://github.com/picosh/git-pr/blob/main/docker-compose.prod.yml
      2 job "pico" {
      3   datacenters = ["dc1"]
      4 
      5   priority = 80
      6 
      7   constraint {
      8     # image only built for arm
      9     attribute = "${attr.cpu.arch}"
     10     value     = "arm64"
     11   }
     12 
     13   group "server" {
     14     count = 1
     15 
     16     volume "pico" {
     17       type = "csi"
     18       source = "pico"
     19       access_mode = "multi-node-multi-writer"
     20       attachment_mode = "file-system"
     21     }
     22     volume "tls" {
     23       type = "csi"
     24       source = "certbot"
     25       access_mode = "multi-node-multi-writer"
     26       attachment_mode = "file-system"
     27     }
     28 
     29     network {
     30       port "web" {
     31         to = 3000
     32       }
     33       port "ssh" {
     34         to = 2222
     35         static = 44405
     36       }
     37       port "https" {
     38         static = 44406
     39       }
     40     }
     41 
     42     task "web" {
     43       driver = "podman"
     44 
     45       config {
     46         image = "ghcr.io/picosh/pico/git-web:latest"
     47         ports = ["web"]
     48         volumes = [
     49           # mount the templated config from the task directory to the container
     50           "local/git-pr.toml:/app/git-pr.toml",
     51         ]
     52       }
     53 
     54       template {
     55         destination = "${NOMAD_TASK_DIR}/.env"
     56         data = file("./templates/.env.tmpl")
     57         env = true
     58       }
     59 
     60       template {
     61         destination = "${NOMAD_TASK_DIR}/git-pr.toml"
     62         data = file("./templates/git-pr.toml.tmpl")
     63       }
     64 
     65       volume_mount {
     66         volume = "pico"
     67         destination = "/app/data"
     68       }
     69 
     70       resources {
     71         memory = 256
     72         memory_max = 512
     73         cpu    = 250
     74       }
     75     }
     76 
     77     task "ssh" {
     78       driver = "podman"
     79 
     80       config {
     81         image = "ghcr.io/picosh/pico/git-ssh:latest"
     82         ports = ["ssh"]
     83         volumes = [
     84           # mount the templated config from the task directory to the container
     85           "local/git-pr.toml:/app/git-pr.toml",
     86         ]
     87       }
     88 
     89       template {
     90         destination = "${NOMAD_TASK_DIR}/.env"
     91         data = file("./templates/.env.tmpl")
     92         env = true
     93       }
     94 
     95       template {
     96         destination = "${NOMAD_TASK_DIR}/git-pr.toml"
     97         data = file("./templates/git-pr.toml.tmpl")
     98       }
     99 
    100       volume_mount {
    101         volume = "pico"
    102         destination = "/app/data"
    103       }
    104 
    105       resources {
    106         memory = 256
    107         memory_max = 512
    108         cpu    = 250
    109       }
    110     }
    111 
    112     task "nginx" {
    113       driver = "podman"
    114 
    115       config {
    116         image = "docker.io/library/nginx:stable-alpine"
    117         ports = ["https"]
    118         volumes = [
    119           # mount the templated config from the task directory to the container
    120           "local/pico.conf:/etc/nginx/conf.d/pico.conf",
    121         ]
    122       }
    123 
    124       volume_mount {
    125         volume = "tls"
    126         destination = "/etc/letsencrypt"
    127       }
    128 
    129       template {
    130         destination = "${NOMAD_TASK_DIR}/pico.conf"
    131         data = file("./templates/nginx.conf.tmpl")
    132       }
    133 
    134       resources {
    135         memory = 50
    136         memory_max = 128
    137         cpu    = 200
    138       }
    139     }
    140   }
    141 }