nomad

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

snikket.nomad (2880B)


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