From 9a46bc9ebc80dd00c011406ffaf1932bc566719b Mon Sep 17 00:00:00 2001 From: Nathaniel Landau Date: Sat, 21 Oct 2023 22:19:23 -0400 Subject: [PATCH] feat(sabnzbd): add nomad job for sabnzbd --- templates/nomad_jobs/sabnzbd.hcl | 100 +++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 templates/nomad_jobs/sabnzbd.hcl diff --git a/templates/nomad_jobs/sabnzbd.hcl b/templates/nomad_jobs/sabnzbd.hcl new file mode 100644 index 0000000..8086a77 --- /dev/null +++ b/templates/nomad_jobs/sabnzbd.hcl @@ -0,0 +1,100 @@ +job "sabnzbd" { + region = "global" + datacenters = ["{{ datacenter_name }}"] + type = "service" + + constraint { + attribute = "${node.unique.name}" + operator = "regexp" + value = "macmini" + } + + update { + max_parallel = 1 + health_check = "checks" + min_healthy_time = "10s" + healthy_deadline = "5m" + progress_deadline = "10m" + auto_revert = true + canary = 0 + stagger = "30s" + } + + group "sabnzbd" { + + count = 1 + + restart { + attempts = 0 + delay = "30s" + } + + network { + port "http" { + static = "8080" + to = "8080" + } + + } + + task "sabnzbd" { + + env { + PUID = "${meta.PUID}" + PGID = "${meta.PGID}" + TZ = "America/New_York" + + } + + driver = "docker" + config { + image = "ghcr.io/linuxserver/sabnzbd" + hostname = "${NOMAD_TASK_NAME}" + volumes = [ + "${meta.nfsStorageRoot}/pi-cluster/${NOMAD_TASK_NAME}:/config", + "${meta.nfsStorageRoot}/media/downloads/nzb:/nzbd", + "${meta.nfsStorageRoot}/media/downloads/temp:/incomplete-downloads", + "${meta.nfsStorageRoot}/media/downloads/complete:/downloads", + "${meta.nfsStorageRoot}/nate:/nate" + ] + ports = ["http"] + } // docker config + + service { + port = "http" + name = "${NOMAD_TASK_NAME}" + provider = "nomad" + tags = [ + "traefik.enable=true", + "traefik.http.routers.${NOMAD_TASK_NAME}.rule=Host(`sab.{{ homelab_domain_name }}`)", + "traefik.http.routers.${NOMAD_TASK_NAME}.entryPoints=web,websecure", + "traefik.http.routers.${NOMAD_TASK_NAME}.service=${NOMAD_TASK_NAME}", + "traefik.http.routers.${NOMAD_TASK_NAME}.tls=true", + "traefik.http.routers.${NOMAD_TASK_NAME}.tls.certresolver=cloudflare", + // "traefik.http.routers.${NOMAD_TASK_NAME}.middlewares=authelia@file" + ] + + check { + type = "tcp" + port = "http" + interval = "30s" + timeout = "4s" + } + check_restart { + limit = 0 + grace = "1m" + } + } // service + + // resources { + // cpu = 100 # MHz + // memory = 300 # MB + // } // resources + + } // task + + + } // group + + +} // job