nomad

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

conversejs.nomad (1823B)


      1 # https://conversejs.org/docs/html/quickstart.html#option-2-self-hosting
      2 
      3 job "conversejs" {
      4   datacenters = ["dc1"]
      5 
      6   group "server" {
      7     count = 1
      8 
      9     volume "tls" {
     10       type = "csi"
     11       source = "certbot"
     12       access_mode = "multi-node-multi-writer"
     13       attachment_mode = "file-system"
     14     }
     15     network {
     16       port "https" {
     17         static = 44415
     18       }
     19     }
     20 
     21     task "nginx" {
     22       driver = "podman"
     23 
     24       artifact {
     25         source      = "https://github.com/conversejs/converse.js/releases/download/v12.0.0/converse.js-12.0.0.tgz"
     26         destination = "${NOMAD_TASK_DIR}"
     27         options {
     28           checksum = "sha256:41684fcfa5f8c7a79a0b557834db5c57c016005bff66d6e002587252f3676bbb"
     29         }
     30       }
     31 
     32       config {
     33         image = "docker.io/library/nginx:stable-alpine"
     34         ports = ["https"]
     35         volumes = [
     36           # mount the templated config from the task directory to the container
     37           "local/conversejs.conf:/etc/nginx/conf.d/conversejs.conf",
     38           "local/index.html:${NOMAD_TASK_DIR}/index.html",
     39         ]
     40         command = "/bin/sh"
     41         args = ["-c", <<EOT
     42           rm -rf /usr/share/nginx/html/*
     43           cp -r ${NOMAD_TASK_DIR}/package/dist/* /usr/share/nginx/html/
     44           cp ${NOMAD_TASK_DIR}/index.html /usr/share/nginx/html/
     45           nginx -g 'daemon off;'
     46         EOT
     47         ]
     48       }
     49 
     50       volume_mount {
     51         volume = "tls"
     52         destination = "/etc/letsencrypt"
     53       }
     54 
     55       template {
     56         destination = "${NOMAD_TASK_DIR}/conversejs.conf"
     57         data = file("./templates/nginx.conf.tmpl")
     58       }
     59       template {
     60         destination = "${NOMAD_TASK_DIR}/index.html"
     61         data = file("./templates/index.html.tmpl")
     62       }
     63 
     64       resources {
     65         memory = 50
     66         memory_max = 128
     67         cpu    = 100
     68       }
     69     }
     70   }
     71 }