nomad

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

commit 85f7798fe34c1d2185ecef05faa5037b4cdcc585
parent 7e3c808f45b965942d924845902f39c9d06902a5
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date:   Sat,  2 Mar 2024 23:29:33 +0100

feat: add p0c website

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

diff --git a/hcl/default/p0c/p0c.nomad b/hcl/default/p0c/p0c.nomad @@ -0,0 +1,70 @@ +job "p0c" { + 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-p0c: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/p0c.conf:/etc/nginx/conf.d/p0c.conf", + ] + } + + volume_mount { + volume = "tls" + destination = "/etc/letsencrypt" + } + + template { + destination = "${NOMAD_TASK_DIR}/p0c.conf" + data = file("./templates/nginx.conf.tmpl") + } + + resources { + memory = 50 + memory_max = 128 + cpu = 200 + } + } + } +} diff --git a/hcl/default/p0c/templates/nginx.conf.tmpl b/hcl/default/p0c/templates/nginx.conf.tmpl @@ -0,0 +1,10 @@ +server { + listen {{ env "NOMAD_PORT_https" }} ssl; + + ssl_certificate /etc/letsencrypt/live/p0c.ch/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/p0c.ch/privkey.pem; + + location / { + proxy_pass http://{{ env "NOMAD_ADDR_jekyll" }}; + } +}