add audiobook-search service to servarr stack
- New audiobook-search deployment + service + ingress (Authentik-protected) - qBittorrent: add NFS mount for /audiobooks (shared with Audiobookshelf) - Cloudflare DNS: add audiobook-search.viktorbarzin.me - Env vars: QBITTORRENT_URL/PASS, AUDIOBOOKSHELF_URL/TOKEN from ESO
This commit is contained in:
parent
dbff547741
commit
4ca7af8818
4 changed files with 146 additions and 0 deletions
BIN
config.tfvars
BIN
config.tfvars
Binary file not shown.
120
stacks/servarr/audiobook-search/main.tf
Normal file
120
stacks/servarr/audiobook-search/main.tf
Normal file
|
|
@ -0,0 +1,120 @@
|
||||||
|
variable "tls_secret_name" {}
|
||||||
|
variable "tier" { type = string }
|
||||||
|
variable "audiobookshelf_token" {
|
||||||
|
type = string
|
||||||
|
sensitive = true
|
||||||
|
}
|
||||||
|
variable "qbittorrent_password" {
|
||||||
|
type = string
|
||||||
|
sensitive = true
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "kubernetes_deployment" "audiobook_search" {
|
||||||
|
metadata {
|
||||||
|
name = "audiobook-search"
|
||||||
|
namespace = "servarr"
|
||||||
|
labels = {
|
||||||
|
app = "audiobook-search"
|
||||||
|
tier = var.tier
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spec {
|
||||||
|
replicas = 1
|
||||||
|
selector {
|
||||||
|
match_labels = {
|
||||||
|
app = "audiobook-search"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
template {
|
||||||
|
metadata {
|
||||||
|
labels = {
|
||||||
|
app = "audiobook-search"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spec {
|
||||||
|
container {
|
||||||
|
image = "viktorbarzin/audiobook-search:latest"
|
||||||
|
image_pull_policy = "Always"
|
||||||
|
name = "audiobook-search"
|
||||||
|
|
||||||
|
port {
|
||||||
|
container_port = 8000
|
||||||
|
}
|
||||||
|
env {
|
||||||
|
name = "QBITTORRENT_URL"
|
||||||
|
value = "http://qbittorrent.servarr.svc.cluster.local"
|
||||||
|
}
|
||||||
|
env {
|
||||||
|
name = "QBITTORRENT_PASS"
|
||||||
|
value = var.qbittorrent_password
|
||||||
|
}
|
||||||
|
env {
|
||||||
|
name = "AUDIOBOOKSHELF_URL"
|
||||||
|
value = "http://audiobookshelf.audiobookshelf.svc.cluster.local"
|
||||||
|
}
|
||||||
|
env {
|
||||||
|
name = "AUDIOBOOKSHELF_TOKEN"
|
||||||
|
value = var.audiobookshelf_token
|
||||||
|
}
|
||||||
|
resources {
|
||||||
|
requests = {
|
||||||
|
cpu = "10m"
|
||||||
|
memory = "64Mi"
|
||||||
|
}
|
||||||
|
limits = {
|
||||||
|
memory = "128Mi"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
liveness_probe {
|
||||||
|
http_get {
|
||||||
|
path = "/health"
|
||||||
|
port = 8000
|
||||||
|
}
|
||||||
|
initial_delay_seconds = 10
|
||||||
|
period_seconds = 30
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lifecycle {
|
||||||
|
ignore_changes = [spec[0].template[0].spec[0].dns_config]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "kubernetes_service" "audiobook_search" {
|
||||||
|
metadata {
|
||||||
|
name = "audiobook-search"
|
||||||
|
namespace = "servarr"
|
||||||
|
labels = {
|
||||||
|
app = "audiobook-search"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
spec {
|
||||||
|
selector = {
|
||||||
|
app = "audiobook-search"
|
||||||
|
}
|
||||||
|
port {
|
||||||
|
name = "http"
|
||||||
|
port = 80
|
||||||
|
target_port = 8000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module "ingress" {
|
||||||
|
source = "../../../modules/kubernetes/ingress_factory"
|
||||||
|
namespace = "servarr"
|
||||||
|
name = "audiobook-search"
|
||||||
|
tls_secret_name = var.tls_secret_name
|
||||||
|
protected = true
|
||||||
|
extra_annotations = {
|
||||||
|
"gethomepage.dev/enabled" = "true"
|
||||||
|
"gethomepage.dev/name" = "Audiobook Search"
|
||||||
|
"gethomepage.dev/description" = "Search & download audiobooks"
|
||||||
|
"gethomepage.dev/icon" = "audiobookshelf.png"
|
||||||
|
"gethomepage.dev/group" = "Media & Entertainment"
|
||||||
|
"gethomepage.dev/pod-selector" = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -114,3 +114,11 @@ module "aiostreams" {
|
||||||
tier = local.tiers.aux
|
tier = local.tiers.aux
|
||||||
nfs_server = var.nfs_server
|
nfs_server = var.nfs_server
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module "audiobook_search" {
|
||||||
|
source = "./audiobook-search"
|
||||||
|
tls_secret_name = var.tls_secret_name
|
||||||
|
tier = local.tiers.aux
|
||||||
|
audiobookshelf_token = data.kubernetes_secret.eso_secrets.data["audiobookshelf_api_token"]
|
||||||
|
qbittorrent_password = data.kubernetes_secret.eso_secrets.data["qbittorrent_password"]
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,14 @@ module "nfs_downloads" {
|
||||||
nfs_path = "/mnt/main/servarr/downloads"
|
nfs_path = "/mnt/main/servarr/downloads"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module "nfs_audiobooks" {
|
||||||
|
source = "../../../modules/kubernetes/nfs_volume"
|
||||||
|
name = "servarr-qbittorrent-audiobooks"
|
||||||
|
namespace = "servarr"
|
||||||
|
nfs_server = var.nfs_server
|
||||||
|
nfs_path = "/mnt/main/audiobookshelf/audiobooks"
|
||||||
|
}
|
||||||
|
|
||||||
resource "kubernetes_deployment" "qbittorrent" {
|
resource "kubernetes_deployment" "qbittorrent" {
|
||||||
metadata {
|
metadata {
|
||||||
name = "qbittorrent"
|
name = "qbittorrent"
|
||||||
|
|
@ -80,6 +88,10 @@ resource "kubernetes_deployment" "qbittorrent" {
|
||||||
name = "downloads"
|
name = "downloads"
|
||||||
mount_path = "/downloads"
|
mount_path = "/downloads"
|
||||||
}
|
}
|
||||||
|
volume_mount {
|
||||||
|
name = "audiobooks"
|
||||||
|
mount_path = "/audiobooks"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
volume {
|
volume {
|
||||||
name = "data"
|
name = "data"
|
||||||
|
|
@ -93,6 +105,12 @@ resource "kubernetes_deployment" "qbittorrent" {
|
||||||
claim_name = module.nfs_downloads.claim_name
|
claim_name = module.nfs_downloads.claim_name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
volume {
|
||||||
|
name = "audiobooks"
|
||||||
|
persistent_volume_claim {
|
||||||
|
claim_name = module.nfs_audiobooks.claim_name
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue