nomad

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

xmpp-web.nomad (1992B)


      1 job "xmpp-web" {
      2   datacenters = ["dc1"]
      3 
      4   group "server" {
      5     count = 1
      6 
      7     volume "tls" {
      8       type = "csi"
      9       source = "certbot"
     10       access_mode = "multi-node-multi-writer"
     11       attachment_mode = "file-system"
     12     }
     13     network {
     14       port "server" {
     15         to = 80
     16       }
     17       port "https" {
     18         static = 44410
     19       }
     20     }
     21 
     22     task "nginx" {
     23       driver = "podman"
     24 
     25       config {
     26         image = "docker.io/library/nginx:stable-alpine"
     27         ports = ["https"]
     28         volumes = [
     29           # mount the templated config from the task directory to the container
     30           "local/xmpp-web.conf:/etc/nginx/conf.d/xmpp-web.conf",
     31         ]
     32       }
     33 
     34       volume_mount {
     35         volume = "tls"
     36         destination = "/etc/letsencrypt"
     37       }
     38 
     39       template {
     40         destination = "${NOMAD_TASK_DIR}/xmpp-web.conf"
     41         data = file("./templates/nginx.conf.tmpl")
     42       }
     43 
     44       resources {
     45         memory = 50
     46         memory_max = 128
     47         cpu    = 100
     48       }
     49     }
     50 
     51     task "server" {
     52       driver = "podman"
     53 
     54       env {
     55         APP_DEFAULT_DOMAIN = "in0rdr.ch"
     56 
     57         # The server container passes to upstream XMPP_WS
     58         # https://github.com/nioc/xmpp-web/blob/master/docs/docker/default.conf.template
     59         # https://github.com/nioc/xmpp-web/blob/master/docs/docker/Dockerfile
     60         XMPP_WS = "https://in0rdr.ch:5281/xmpp-websocket"
     61 
     62         # APP_WS is the websocket used locally in the web app (local.js).
     63         # We route the websocket request directly to the upstream server.
     64         # https://github.com/nioc/xmpp-web/blob/master/public/local.js
     65         APP_WS = "wss://chat.in0rdr.ch/xmpp-websocket"
     66 
     67         APP_GUEST_DESCRIPTION = "Welcome guest 👋"
     68         XMPP_ANON_HOST = "anon.in0rdr.ch"
     69       }
     70 
     71       config {
     72         image = "docker.io/nioc/xmpp-web:latest"
     73         force_pull = true
     74         ports = ["server"]
     75       }
     76 
     77       resources {
     78         memory = 150
     79         memory_max = 300
     80         cpu    = 300
     81       }
     82     }
     83   }
     84 }