nomad

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

snac.nomad (2322B)


      1 # https://git.snac.social/snac/snac-docker-compose
      2 
      3 job "snac" {
      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 "snac" {
     18       type = "csi"
     19       source = "snac"
     20       access_mode = "multi-node-multi-writer"
     21       attachment_mode = "file-system"
     22     }
     23 
     24     network {
     25       port "http" {
     26         to = 8001
     27       }
     28       port "https" {
     29         static = 44411
     30       }
     31     }
     32 
     33     task "nginx" {
     34       driver = "podman"
     35 
     36       config {
     37         image = "docker.io/library/nginx:stable-alpine"
     38         ports = ["https"]
     39         volumes = [
     40           # mount the templated config from the task directory to the container
     41           "local/snac.conf:/etc/nginx/conf.d/snac.conf",
     42         ]
     43       }
     44 
     45       volume_mount {
     46         volume = "tls"
     47         destination = "/etc/letsencrypt"
     48       }
     49 
     50       template {
     51         destination = "${NOMAD_TASK_DIR}/snac.conf"
     52         data = file("./templates/nginx.conf.tmpl")
     53       }
     54 
     55       resources {
     56         memory = 50
     57         memory_max = 256
     58         cpu    = 200
     59       }
     60     }
     61 
     62     task "snac" {
     63       driver = "podman"
     64 
     65       config {
     66         image = "127.0.0.1:5000/snac:2.81"
     67         force_pull = true
     68         ports = ["http"]
     69         volumes = [
     70           # mount the templated config from the task directory to the container
     71           "local/greeting.html:/data/data/greeting.html",
     72           "local/server.json:/data/data/server.json",
     73           "local/style.css:/data/data/style.css"
     74         ]
     75       }
     76 
     77       env {
     78         # https://comam.es/snac-doc/snac.8.html#ENVIRONMENT
     79         #DEBUG = 100
     80       }
     81 
     82       volume_mount {
     83         volume = "snac"
     84         destination = "/data/data"
     85       }
     86 
     87       template {
     88         destination = "${NOMAD_TASK_DIR}/greeting.html"
     89         data = file("./templates/greeting.html.tmpl")
     90       }
     91       template {
     92         destination = "${NOMAD_TASK_DIR}/server.json"
     93         data = file("./templates/server.json.tmpl")
     94       }
     95       template {
     96         destination = "${NOMAD_TASK_DIR}/style.css"
     97         data = file("./templates/style.css.tmpl")
     98       }
     99 
    100       resources {
    101         memory = 512
    102         memory_max = 1024
    103         cpu    = 500
    104       }
    105     }
    106   }
    107 }