From 48a48bb080417c08ebb4133125352bbd180f4eea Mon Sep 17 00:00:00 2001 From: Ian Fijolek Date: Mon, 23 Oct 2023 12:59:11 -0700 Subject: [PATCH] Move sonarr and nzbget to their own jobs --- services/ip-dvr.nomad | 212 ------------------------------------------ services/main.tf | 5 - services/nzbget.tf | 35 +++++++ services/sonarr.tf | 35 +++++++ 4 files changed, 70 insertions(+), 217 deletions(-) delete mode 100644 services/ip-dvr.nomad create mode 100644 services/nzbget.tf create mode 100644 services/sonarr.tf diff --git a/services/ip-dvr.nomad b/services/ip-dvr.nomad deleted file mode 100644 index 2d0fe8d..0000000 --- a/services/ip-dvr.nomad +++ /dev/null @@ -1,212 +0,0 @@ -job "ipdvr" { - region = "global" - datacenters = ["dc1"] - - type = "service" - - group "sabnzbd" { - network { - mode = "bridge" - - port "main" { - %{~ if use_wesher ~} - host_network = "wesher" - %{~ endif ~} - to = 8080 - } - } - - volume "sabnzbd-config" { - type = "host" - read_only = false - source = "sabnzbd-config" - } - - volume "media-downloads" { - type = "host" - read_only = false - source = "media-downloads" - } - - service { - name = "sabnzbd" - provider = "nomad" - port = "main" - - tags = [ - "traefik.enable=true", - "traefik.http.routers.sabnzbd.entryPoints=websecure", - ] - } - - task "sabnzbd" { - driver = "docker" - - config { - image = "linuxserver/sabnzbd" - ports = ["main"] - } - - env = { - "PGID" = 100 - "PUID" = 1001 - "TZ" = "America/Los_Angeles" - } - - volume_mount { - volume = "sabnzbd-config" - destination = "/config" - read_only = false - } - - volume_mount { - volume = "media-downloads" - destination = "/downloads" - read_only = false - } - - resources { - cpu = 400 - memory = 500 - memory_max = 800 - } - } - } - - group "nzbget" { - network { - mode = "bridge" - port "main" { - %{~ if use_wesher ~} - host_network = "wesher" - %{~ endif ~} - static = 6789 - } - } - - volume "nzbget-config" { - type = "host" - read_only = false - source = "nzbget-config" - } - - volume "media-downloads" { - type = "host" - read_only = false - source = "media-downloads" - } - - service { - name = "nzbget" - provider = "nomad" - port = "main" - - tags = [ - "traefik.enable=true", - "traefik.http.routers.nzbget.entryPoints=websecure", - ] - } - - task "nzbget" { - driver = "docker" - - config { - image = "linuxserver/nzbget" - ports = ["main"] - } - - env = { - "PGID" = 100 - "PUID" = 1001 - "TZ" = "America/Los_Angeles" - } - - volume_mount { - volume = "nzbget-config" - destination = "/config" - read_only = false - } - - volume_mount { - volume = "media-downloads" - destination = "/downloads" - read_only = false - } - - resources { - cpu = 200 - memory = 300 - memory_max = 500 - } - } - } - - - group "sonarr" { - network { - mode = "bridge" - port "main" { - %{~ if use_wesher ~} - host_network = "wesher" - %{~ endif ~} - to = 8989 - } - } - - volume "sonarr-data" { - type = "host" - read_only = false - source = "sonarr-data" - } - - volume "media-write" { - type = "host" - read_only = false - source = "media-write" - } - - service { - name = "sonarr" - provider = "nomad" - port = "main" - - tags = [ - "traefik.enable=true", - "traefik.http.routers.sonarr.entryPoints=websecure", - ] - } - - task "sonarr" { - driver = "docker" - - config { - image = "lscr.io/linuxserver/sonarr:3.0.10" - ports = ["main"] - } - - env = { - "PGID" = 100 - "PUID" = 1001 - "TZ" = "America/Los_Angeles" - } - - volume_mount { - volume = "sonarr-data" - destination = "/config" - read_only = false - } - - volume_mount { - volume = "media-write" - destination = "/media" - read_only = false - } - - resources { - cpu = 100 - memory = 500 - memory_max = 700 - } - } - } -} diff --git a/services/main.tf b/services/main.tf index 120eaf6..e69de29 100644 --- a/services/main.tf +++ b/services/main.tf @@ -1,5 +0,0 @@ -resource "nomad_job" "ipdvr" { - jobspec = templatefile("${path.module}/ip-dvr.nomad", { - use_wesher = var.use_wesher, - }) -} diff --git a/services/nzbget.tf b/services/nzbget.tf new file mode 100644 index 0000000..acc71c7 --- /dev/null +++ b/services/nzbget.tf @@ -0,0 +1,35 @@ +module "nzbget" { + source = "./service" + + name = "nzbget" + image = "linuxserver/nzbget:v21.1-ls138" + + ingress = true + service_port = 6789 + use_wesher = var.use_wesher + + env = { + PGID = 100 + PUID = 1001 + TZ = "America/Los_Angeles" + } + + host_volumes = [ + { + name = "nzbget-config" + dest = "/config" + read_only = false + }, + { + name = "media-downloads" + dest = "/downloads" + read_only = false + }, + ] + + resources = { + cpu = 200 + memory = 300 + memory_max = 500 + } +} diff --git a/services/sonarr.tf b/services/sonarr.tf new file mode 100644 index 0000000..adc080a --- /dev/null +++ b/services/sonarr.tf @@ -0,0 +1,35 @@ +module "sonarr" { + source = "./service" + + name = "sonarr" + image = "lscr.io/linuxserver/sonarr:3.0.10" + + ingress = true + service_port = 8989 + use_wesher = var.use_wesher + + env = { + PGID = 100 + PUID = 1001 + TZ = "America/Los_Angeles" + } + + host_volumes = [ + { + name = "sonarr-data" + dest = "/config" + read_only = false + }, + { + name = "media-write" + dest = "/media" + read_only = false + }, + ] + + resources = { + cpu = 100 + memory = 500 + memory_max = 700 + } +}