0x0.nomad (2647B)
1 job "0x0" { 2 datacenters = ["dc1"] 3 4 group "server" { 5 count = 1 6 7 volume "0x0" { 8 type = "csi" 9 source = "0x0" 10 access_mode = "multi-node-multi-writer" 11 attachment_mode = "file-system" 12 } 13 14 volume "tls" { 15 type = "csi" 16 source = "certbot" 17 access_mode = "multi-node-multi-writer" 18 attachment_mode = "file-system" 19 } 20 21 network { 22 port "fhost" { 23 to = 8000 24 } 25 port "http" { 26 static = 8998 27 } 28 port "https" { 29 static = 8999 30 } 31 } 32 33 # Prepare database migrations 34 task "db-upgrade" { 35 driver = "podman" 36 37 volume_mount { 38 volume = "0x0" 39 destination = "/usr/src/app/0x0/data" 40 } 41 42 env { 43 FLASK_APP = "fhost" 44 } 45 46 config { 47 image = "127.0.0.1:5000/0x0:latest" 48 force_pull = true 49 command = "/bin/sh" 50 args = ["-c", "flask db upgrade"] 51 } 52 53 resources { 54 memory = 50 55 memory_max = 128 56 cpu = 200 57 } 58 59 lifecycle { 60 hook = "prestart" 61 sidecar = false 62 } 63 } 64 65 task "nginx" { 66 driver = "podman" 67 68 config { 69 image = "docker.io/library/nginx:stable-alpine" 70 force_pull = true 71 ports = ["https", "http"] 72 volumes = [ 73 # mount the templated config from the task directory to the container 74 "local/0x0.conf:/etc/nginx/conf.d/0x0.conf", 75 ] 76 } 77 78 volume_mount { 79 volume = "tls" 80 destination = "/etc/letsencrypt" 81 } 82 83 template { 84 destination = "${NOMAD_TASK_DIR}/0x0.conf" 85 data = file("./templates/nginx.conf.tmpl") 86 } 87 88 resources { 89 memory = 32 90 memory_max = 64 91 cpu = 50 92 } 93 } 94 95 task "fhost" { 96 driver = "podman" 97 98 config { 99 image = "127.0.0.1:5000/0x0:latest" 100 force_pull = true 101 ports = ["fhost"] 102 volumes = [ 103 # mount the templated config from the task directory to the container 104 "local/config.py:/usr/src/app/0x0/instance/config.py", 105 "local/index.html:/usr/src/app/0x0/templates/index.html", 106 ] 107 } 108 109 volume_mount { 110 volume = "0x0" 111 destination = "/usr/src/app/0x0/data" 112 } 113 114 template { 115 destination = "${NOMAD_TASK_DIR}/config.py" 116 data = file("./templates/config.py.tmpl") 117 } 118 template { 119 destination = "${NOMAD_TASK_DIR}/index.html" 120 data = file("./templates/index.html.tmpl") 121 } 122 123 resources { 124 memory = 64 125 memory_max = 128 126 cpu = 200 127 } 128 } 129 } 130 }