From 2a038e59e8d42f5ac7055d2f6aa592cc32b4e5e3 Mon Sep 17 00:00:00 2001 From: Adrian Cowan Date: Sun, 9 Nov 2025 15:51:25 +1100 Subject: [PATCH] Add sonarr --- 2-nomad-config/secrets/secrets.enc.json | 7 +- 2-nomad-config/sonarr.nomad.hcl | 118 ++++++++++++++++++++++++ 2-nomad-config/sonarr.tf | 78 ++++++++++++++++ 3 files changed, 201 insertions(+), 2 deletions(-) create mode 100644 2-nomad-config/sonarr.nomad.hcl create mode 100644 2-nomad-config/sonarr.tf diff --git a/2-nomad-config/secrets/secrets.enc.json b/2-nomad-config/secrets/secrets.enc.json index 2ce6b12..646c4a2 100644 --- a/2-nomad-config/secrets/secrets.enc.json +++ b/2-nomad-config/secrets/secrets.enc.json @@ -33,6 +33,9 @@ "immich": { "database_pw": "ENC[AES256_GCM,data:SUyMGqu7deZyZpVt,iv:asZehOvn/JamwFyS+Xl9Xpr4JFkKlJjHVw7LywYOxTc=,tag:plRvuv7+ievfEhxurBl7YQ==,type:str]" }, + "sonarr": { + "database_pw": "ENC[AES256_GCM,data:TN381ZYJLeUHX9U3Jnd9+w==,iv:lKaMYHeaSGXJd0/EGxkDY2l2v62xG3xs8TVC0HwXL94=,tag:3z5rK+2RfJHJdQc7KC9KmA==,type:str]" + }, "sops": { "age": [ { @@ -40,8 +43,8 @@ "enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSByUWM4ZDVVbGFrUGdMRHBX\nUFBmU3Nlc0RBSzhFK0tHNHpkQXUvUVdiZUZJCmpRN1lFdENpWW0rcThjVlVQNUl6\nWnlLU0RnQ3FZby81Ly8xTFBrek9nMncKLS0tIFQ4UTRNOC9CRmx4OFJWem1wckZz\nUDFTSzdWZldFK3FqcTNWTWRyNDhHQ2MKS811mR5xn7qiC/aVgPFYJ5c6Q3zxRfcr\nHcvxUvB01vNJKZpRg92vvKPkV6lQO3DXCT98OdfwiymlEOvYxg71Pg==\n-----END AGE ENCRYPTED FILE-----\n" } ], - "lastmodified": "2025-10-13T12:19:46Z", - "mac": "ENC[AES256_GCM,data:QJ1Prqf37xMZbvyMvjBVxZOiOr07CmCYrWmr+5hwDsEmG4eEC9sPF/UY+/Cy2OTzsMp+cHb6C3maAo09O171wj6nJIZucg3B9fjEW2+4AoO217G4vmauMl3FFkut2CuvVV9zt2B/fLAskRg/yeYYOhjzPkWA6lyeV31sV5ZQ6Kw=,iv:5WfkmNr5vdfTqp6+INjQN/Zmc7/iJNc/2auO9h3En08=,tag:snBgJyMzBXVAkV3zERkK8g==,type:str]", + "lastmodified": "2025-11-07T09:57:48Z", + "mac": "ENC[AES256_GCM,data:DPNWxb9zDNLZ5sIBgOvQ+Gky+F+B3MDA9pOcDkBlb7w7WhmOx1rAXzeK3FCbJDb/y6CQnTPHRQWAPo8bgikIrprmP3zxbSTRJVwKcgVj96KnpRCClVeRwOv7AuYOyxIF/xpUL98/SKciVZvcNh/gUqxt7vq3EsBw1yEAGORSKq0=,iv:Vzrpr19T39nVFHFMMcXivHacCgqS1X2+IcI311+er1I=,tag:ZwG0znMH3hoJ4o8WmOUm+g==,type:str]", "encrypted_regex": "^(.*)$", "version": "3.10.2" } diff --git a/2-nomad-config/sonarr.nomad.hcl b/2-nomad-config/sonarr.nomad.hcl new file mode 100644 index 0000000..7b84335 --- /dev/null +++ b/2-nomad-config/sonarr.nomad.hcl @@ -0,0 +1,118 @@ +job "sonarr" { + group "sonarr" { + count = 1 + + network { + mode = "bridge" + port "http" { + to = 8989 + } + } + service { + connect { + sidecar_service { + proxy { + upstreams { + destination_name = "postgres" + local_bind_port = 5432 + } + } + } + } + } + + task "sonarr" { + driver = "docker" + + config { + image = "lscr.io/linuxserver/sonarr:latest" + ports = ["http"] + } + + service { + name = "sonarr" + port = "http" + + tags = [ + "traefik.enable=true", + "traefik.http.routers.sonarr.middlewares=auth@file", + ] + + check { + name = "alive" + type = "tcp" + port = "http" + interval = "10s" + timeout = "2s" + } + } + + env { + PUID = 1000 + PGID = 1000 + TZ = "Australia/Melbourne" + + # https://wiki.servarr.com/sonarr/environment-variables + + # Disable internal auth to use Traefik + Authelia + SONARR__AUTH__REQUIRED = "Enabled" + SONARR__AUTH__METHOD = "External" + + SONARR__POSTGRES__USER = "sonarr" + SONARR__POSTGRES__HOST = "localhost" + SONARR__POSTGRES__PORT = "5432" + SONARR__POSTGRES__MAINDB = "sonarr-main" + SONARR__POSTGRES__LOGDB = "sonarr-log" + } + + volume_mount { + volume = "unraid_appdata_sonarr" + destination = "/config" + read_only = false + } + + volume_mount { + volume = "unraid_media_sonarr" + destination = "/data" + read_only = false + } + + resources { + cpu = 150 + memory = 1024 + } + + template { + data = <