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