nomad

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

commit 177cbcaf9ce8a68ac9a0c3722fd11547566eddeb
parent 08c4b23a8c8b90ba7cb0e316410ba306b0e867f3
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date:   Fri, 27 Sep 2024 19:46:29 +0200

feat(myheats): add VITE_API_WS

Diffstat:
Mhcl/default/myheats-demo/myheats-demo.nomad | 15++++++++-------
Mhcl/default/myheats-demo/templates/env.local.tmpl | 4+++-
Mhcl/default/myheats-demo/templates/nginx.conf.tmpl | 2+-
3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/hcl/default/myheats-demo/myheats-demo.nomad b/hcl/default/myheats-demo/myheats-demo.nomad @@ -36,11 +36,16 @@ job "myheats-demo" { config { image = "127.0.0.1:5000/myheats-nginx:latest" + command = "/bin/sh" + # prod build with .env.production and move to Nginx serve dir + args = ["-c", "npm run build && cp -r dist /srv/app && nginx -g 'daemon off;'"] force_pull = true 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", + # mount prod variables to app build dir + "secrets/env:/app/.env.production", ] } @@ -59,15 +64,11 @@ job "myheats-demo" { volume = "tls" destination = "/etc/letsencrypt" } - volume_mount { - volume = "myheats-demo" - destination = "/app" - } resources { - memory = 50 - memory_max = 128 - cpu = 200 + memory = 100 + memory_max = 256 + cpu = 300 } } diff --git a/hcl/default/myheats-demo/templates/env.local.tmpl b/hcl/default/myheats-demo/templates/env.local.tmpl @@ -6,8 +6,10 @@ VITE_APP_DOC_TITLE='MyHeats Demo' # Cookie TTL in seconds (session ttl in the admin/judges frontend), 60m VITE_SESSION_TTL=259200 #27h -# Full URI to backend API +# Full URI to backend http API VITE_API_URI=http://{{ env "NOMAD_IP_http" }} +# Full URI to backend websocket API +VITE_API_WS=ws://{{ env "NOMAD_IP_http" }} # Backend API port VITE_API_PORT={{ env "NOMAD_PORT_http" }} # Locale for frontend date formatting diff --git a/hcl/default/myheats-demo/templates/nginx.conf.tmpl b/hcl/default/myheats-demo/templates/nginx.conf.tmpl @@ -4,7 +4,7 @@ server { ssl_certificate /etc/letsencrypt/live/myheats-demo.p0c.ch/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/myheats-demo.p0c.ch/privkey.pem; - root /app; + root /srv/app; location / { try_files $uri /index.html;