nomad

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

commit 1434757c6ee4b4659b758c0953ab9c5f144ffb73
parent bf09c23bef2a88e0103c12a90e3d8b17fabbd49e
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date:   Thu, 20 Apr 2023 23:43:59 +0200

feat: add myheats website

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

diff --git a/hcl/default/myheats/myheats.nomad b/hcl/default/myheats/myheats.nomad @@ -0,0 +1,70 @@ +job "myheats" { + 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" { + to = 443 + static = 44362 + } + } + + service { + port = "https" + } + + task "jekyll" { + driver = "docker" + + config { + image = "127.0.0.1:5000/jekyll-myheats:latest" + ports = ["jekyll"] + } + + resources { + memory = 128 + cpu = 200 + } + } + + 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 @@ -0,0 +1,10 @@ +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_jekyll" }}; + } +}