nomad

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

commit e48b1458dfa6050139ace029d6f0877514ba70ca
parent 3ee376e043dea42e6e4812664580c53f1ad51c41
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date:   Fri,  1 Mar 2024 08:24:53 +0100

feat: add hivedav website

Diffstat:
Ahcl/default/hivedav/hivedav.nomad | 70++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ahcl/default/hivedav/templates/nginx.conf.tmpl | 10++++++++++
2 files changed, 80 insertions(+), 0 deletions(-)

diff --git a/hcl/default/hivedav/hivedav.nomad b/hcl/default/hivedav/hivedav.nomad @@ -0,0 +1,70 @@ +job "hivedav" { + datacenters = ["dc1"] + + group "server" { + count = 1 + + volume "tls" { + type = "csi" + source = "certbot" + access_mode = "multi-node-multi-writer" + attachment_mode = "file-system" + } + + network { + port "jekyll" { + to = 4000 + } + port "https" {} + } + + service { + port = "https" + } + + task "jekyll" { + driver = "podman" + + config { + image = "127.0.0.1:5000/jekyll-hivedav:latest" + force_pull = true + ports = ["jekyll"] + } + + resources { + memory = 50 + memory_max = 128 + cpu = 200 + } + } + + task "nginx" { + driver = "podman" + + config { + image = "docker.io/library/nginx:stable-alpine" + ports = ["https"] + volumes = [ + # mount the templated config from the task directory to the container + "local/hivedav.conf:/etc/nginx/conf.d/hivedav.conf", + ] + } + + volume_mount { + volume = "tls" + destination = "/etc/letsencrypt" + } + + template { + destination = "${NOMAD_TASK_DIR}/hivedav.conf" + data = file("./templates/nginx.conf.tmpl") + } + + resources { + memory = 50 + memory_max = 128 + cpu = 200 + } + } + } +} diff --git a/hcl/default/hivedav/templates/nginx.conf.tmpl b/hcl/default/hivedav/templates/nginx.conf.tmpl @@ -0,0 +1,10 @@ +server { + listen {{ env "NOMAD_PORT_https" }} ssl; + + ssl_certificate /etc/letsencrypt/live/hivedav.p0c.ch/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/hivedav.p0c.ch/privkey.pem; + + location / { + proxy_pass http://{{ env "NOMAD_ADDR_jekyll" }}; + } +}