Add sabnzbd

This commit is contained in:
IamTheFij 2023-02-27 11:43:07 -08:00
parent 2f9d0533e0
commit f46cb72681
4 changed files with 134 additions and 0 deletions

View File

@ -239,6 +239,9 @@
- name: media-downloads - name: media-downloads
path: /srv/volumes/media-write/Downloads path: /srv/volumes/media-write/Downloads
read_only: false read_only: false
- name: sabnzbd-config
path: /srv/volumes/media-write/Downloads/sabnzbd
read_only: false
- name: photoprism-media - name: photoprism-media
path: /srv/volumes/photos/Photoprism path: /srv/volumes/photos/Photoprism
read_only: false read_only: false

View File

@ -0,0 +1,26 @@
job "sabnzbd" {
schedule = "@daily"
config {
repo = "rclone::ftp,env_auth:/nomad/sabnzbd"
passphrase = env("BACKUP_PASSPHRASE")
}
backup {
paths = ["/data/media-write/Downloads/sabnzbd"]
# Because path is absolute
restore_opts {
Target = "/"
}
}
forget {
KeepLast = 2
KeepHourly = 24
KeepDaily = 30
KeepWeekly = 8
KeepMonthly = 6
KeepYearly = 2
Prune = true
}
}

View File

@ -4,6 +4,88 @@ job "ipdvr" {
type = "service" type = "service"
group "sabnzbd" {
network {
mode = "bridge"
port "main" {
host_network = "loopback"
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"
port = "main"
connect {
sidecar_service {
proxy {
local_service_port = 8080
}
}
sidecar_task {
resources {
cpu = 50
memory = 20
memory_max = 50
}
}
}
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" { group "nzbget" {
network { network {
mode = "bridge" mode = "bridge"
@ -127,6 +209,11 @@ job "ipdvr" {
destination_name = "nzbget" destination_name = "nzbget"
local_bind_port = 6789 local_bind_port = 6789
} }
upstreams {
destination_name = "sabnzbd"
local_bind_port = 8080
}
} }
} }

View File

@ -31,6 +31,24 @@ resource "nomad_job" "ipdvr" {
jobspec = file("${path.module}/ip-dvr.nomad") jobspec = file("${path.module}/ip-dvr.nomad")
} }
resource "consul_config_entry" "sabnzbd_intents" {
depends_on = [nomad_job.ipdvr]
name = "sabnzbd"
kind = "service-intentions"
config_json = jsonencode({
Sources = [
{
Action = "allow"
Name = "sonarr"
Precedence = 9
Type = "consul"
},
]
})
}
resource "consul_config_entry" "nzbget_intents" { resource "consul_config_entry" "nzbget_intents" {
depends_on = [nomad_job.ipdvr] depends_on = [nomad_job.ipdvr]