nomad

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

pico.nomad (2809B)


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