nomad

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

commit 9d7a688a650c9001e775e8248ad87a4d615b82fa
parent 92a6e1b032e56b92521287ee4991aebd9c0557e2
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date:   Mon,  3 Jul 2023 05:13:23 +0200

feat(myheats-demo): vite with nginx

Diffstat:
Mhcl/default/myheats-demo/myheats-demo.nomad | 49++++++++++++++++++++-----------------------------
Mhcl/default/myheats-demo/templates/nginx.conf.tmpl | 4+++-
2 files changed, 23 insertions(+), 30 deletions(-)

diff --git a/hcl/default/myheats-demo/myheats-demo.nomad b/hcl/default/myheats-demo/myheats-demo.nomad @@ -15,11 +15,14 @@ job "myheats-demo" { access_mode = "multi-node-multi-writer" attachment_mode = "file-system" } + volume "myheats-demo" { + type = "csi" + source = "myheats-demo" + access_mode = "multi-node-multi-writer" + attachment_mode = "file-system" + } network { - port "myheats" { - to = 3000 - } port "https" {} } @@ -27,17 +30,20 @@ job "myheats-demo" { port = "https" } - task "myheats" { + task "nginx" { driver = "podman" config { - image = "127.0.0.1:5000/myheats:latest" - force_pull = true - ports = ["myheats"] + image = "nginx:stable-alpine" + ports = ["https"] + volumes = [ + # mount the templated config from the task directory to the container + "local/myheats-demo.conf:/etc/nginx/conf.d/myheats-demo.conf", + ] } env { - REACT_APP_DOC_TITLE = "MyHeats Demo 🔥" + VITE_APP_DOC_TITLE = "MyHeats Demo" } template { @@ -45,34 +51,19 @@ job "myheats-demo" { env = true destination = "${NOMAD_SECRETS_DIR}/env" data = <<EOT -REACT_APP_SUPABASE_URL = "https://aaxkgqazjhwumoljibld.supabase.co" -REACT_APP_SUPABASE_KEY = "{{with secret "kv/myheats"}}{{index .Data.data.supabase_key}}{{end}}" +VITE_APP_SUPABASE_URL = "https://aaxkgqazjhwumoljibld.supabase.co" +VITE_APP_SUPABASE_KEY = "{{with secret "kv/myheats"}}{{index .Data.data.supabase_key}}{{end}}" EOT } - resources { - memory = 50 - memory_max = 512 - cpu = 300 - } - } - - task "nginx" { - driver = "podman" - - config { - image = "nginx:stable-alpine" - ports = ["https"] - volumes = [ - # mount the templated config from the task directory to the container - "local/myheats-demo.conf:/etc/nginx/conf.d/myheats-demo.conf", - ] - } - volume_mount { volume = "tls" destination = "/etc/letsencrypt" } + volume_mount { + volume = "myheats-demo" + destination = "/app" + } template { destination = "${NOMAD_TASK_DIR}/myheats-demo.conf" diff --git a/hcl/default/myheats-demo/templates/nginx.conf.tmpl b/hcl/default/myheats-demo/templates/nginx.conf.tmpl @@ -4,7 +4,9 @@ server { ssl_certificate /etc/letsencrypt/live/myheats-demo.in0rdr.ch/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/myheats-demo.in0rdr.ch/privkey.pem; + root /app; + location / { - proxy_pass http://{{ env "NOMAD_ADDR_myheats" }}; + try_files $uri /index.html; } }