nomad

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

commit 81fc16a777eca705add0863cdb7a88a74620f877
parent a6fdc09c4749f8c14c085330dd9ef9f332f26778
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date:   Thu, 20 Apr 2023 23:37:13 +0200

feat: rename myheats-demo

Diffstat:
Ahcl/default/myheats-demo/myheats.nomad | 89+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ahcl/default/myheats-demo/templates/nginx.conf.tmpl | 10++++++++++
Dhcl/default/myheats/myheats.nomad | 89-------------------------------------------------------------------------------
Dhcl/default/myheats/templates/nginx.conf.tmpl | 10----------
4 files changed, 99 insertions(+), 99 deletions(-)

diff --git a/hcl/default/myheats-demo/myheats.nomad b/hcl/default/myheats-demo/myheats.nomad @@ -0,0 +1,89 @@ +job "myheats-demo" { + datacenters = ["dc1"] + + vault { + policies = ["myheats"] + change_mode = "noop" + } + + group "server" { + count = 1 + + volume "tls" { + type = "csi" + source = "certbot" + access_mode = "multi-node-multi-writer" + attachment_mode = "file-system" + } + + network { + port "myheats" { + to = 3000 + } + port "https" { + to = 443 + static = 44395 + } + } + + service { + port = "https" + } + + task "myheats" { + driver = "docker" + + config { + image = "127.0.0.1:5000/myheats-demo:latest" + ports = ["myheats"] + } + + env { + REACT_APP_DOC_TITLE = "MyHeats Demo 🔥" + } + + template { + # render sensitive env vars in a template from Vault secrets + 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}}" +EOT + } + + resources { + memory = 512 + cpu = 300 + } + } + + task "nginx" { + driver = "docker" + + 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" + } + + template { + destination = "${NOMAD_TASK_DIR}/myheats-demo.conf" + data = file("./templates/nginx.conf.tmpl") + } + + resources { + memory = 128 + cpu = 200 + } + } + } +} diff --git a/hcl/default/myheats-demo/templates/nginx.conf.tmpl b/hcl/default/myheats-demo/templates/nginx.conf.tmpl @@ -0,0 +1,10 @@ +server { + listen 443 ssl; + + ssl_certificate /etc/letsencrypt/live/myheats-demo.in0rdr.ch/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/myheats-demo.in0rdr.ch/privkey.pem; + + location / { + proxy_pass http://{{ env "NOMAD_ADDR_myheats" }}; + } +} diff --git a/hcl/default/myheats/myheats.nomad b/hcl/default/myheats/myheats.nomad @@ -1,89 +0,0 @@ -job "myheats" { - datacenters = ["dc1"] - - vault { - policies = ["myheats"] - change_mode = "noop" - } - - group "server" { - count = 1 - - volume "tls" { - type = "csi" - source = "certbot" - access_mode = "multi-node-multi-writer" - attachment_mode = "file-system" - } - - network { - port "myheats" { - to = 3000 - } - port "https" { - to = 443 - static = 44395 - } - } - - service { - port = "https" - } - - task "myheats" { - driver = "docker" - - config { - image = "127.0.0.1:5000/myheats:latest" - ports = ["myheats"] - } - - env { - REACT_APP_DOC_TITLE = "Savognin Heats 🔥" - } - - template { - # render sensitive env vars in a template from Vault secrets - 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}}" -EOT - } - - resources { - memory = 512 - cpu = 300 - } - } - - task "nginx" { - driver = "docker" - - config { - image = "nginx:stable-alpine" - ports = ["https"] - volumes = [ - # mount the templated config from the task directory to the container - "local/myheats.conf:/etc/nginx/conf.d/myheats.conf", - ] - } - - volume_mount { - volume = "tls" - destination = "/etc/letsencrypt" - } - - template { - destination = "${NOMAD_TASK_DIR}/myheats.conf" - data = file("./templates/nginx.conf.tmpl") - } - - resources { - memory = 128 - cpu = 200 - } - } - } -} diff --git a/hcl/default/myheats/templates/nginx.conf.tmpl b/hcl/default/myheats/templates/nginx.conf.tmpl @@ -1,10 +0,0 @@ -server { - listen 443 ssl; - - ssl_certificate /etc/letsencrypt/live/myheats.in0rdr.ch/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/myheats.in0rdr.ch/privkey.pem; - - location / { - proxy_pass http://{{ env "NOMAD_ADDR_myheats" }}; - } -}