Add audiblez-web service and refactor ebook2audiobook deployments

Uncomment ebook2audiobook deployment with proper GPU tolerations
(set to 0 replicas). Disable audiblez CLI deployment in favor of
audiblez-web. Add new audiblez-web deployment, service, and ingress
with GPU support, large upload limits, and auth protection.
This commit is contained in:
Viktor Barzin 2026-02-06 20:22:05 +00:00
parent 9689b67895
commit 596c02dfde

View file

@ -18,86 +18,85 @@ resource "kubernetes_namespace" "ebook2audiobook" {
}
# resource "kubernetes_deployment" "ebook2audiobook" {
# metadata {
# name = "ebook2audiobook"
# namespace = kubernetes_namespace.ebook2audiobook.metadata[0].name
# labels = {
# app = "ebook2audiobook"
# }
# }
# spec {
# replicas = 1
# strategy {
# type = "Recreate"
# }
resource "kubernetes_deployment" "ebook2audiobook" {
metadata {
name = "ebook2audiobook"
namespace = kubernetes_namespace.ebook2audiobook.metadata[0].name
labels = {
app = "ebook2audiobook"
tier = var.tier
}
}
spec {
replicas = 0 # Disabled - using audiblez instead
strategy {
type = "Recreate"
}
# selector {
# match_labels = {
# app = "ebook2audiobook"
# }
# }
selector {
match_labels = {
app = "ebook2audiobook"
}
}
# template {
# metadata {
# labels = {
# app = "ebook2audiobook"
# }
# }
template {
metadata {
labels = {
app = "ebook2audiobook"
}
}
# spec {
# container {
# name = "ebook2audiobook"
# # image = "docker.io/athomasson2/ebook2audiobook:latest"
# image = "docker.io/athomasson2/ebook2audiobook:v25.12.30-cu128"
spec {
node_selector = {
"gpu" : "true"
}
toleration {
key = "nvidia.com/gpu"
operator = "Equal"
value = "true"
effect = "NoSchedule"
}
# working_dir = "/app"
# # command = ["python", "app.py", "--script_mode", "full_docker"]
# # command = ["/bin/bash", "-c", <<-EOT
# # # echo "Uninstalling current pytorch"
# # # pip uninstall -y torch torchvision torchaudio coqui-tts pyannote.audio torchcodec || true
# # # echo "Installing cuda13 compatible pytorch"
# # # pip install --pre --extra-index-url https://download.pytorch.org/whl/nightly/cu130 torch torchvision torchaudio pyannote.audio torchcodec triton deepspeed coqui-tts-trainer
# # # #pip install torch==2.9.0 torchvision==0.24.0 torchaudio==2.9.0 --index-url https://download.pytorch.org/whl/cu130
# # # echo "Starting main container"
# # #python app.py --script_mode full_docker
# # sleep 3600
# # EOT
# # ]
container {
name = "ebook2audiobook"
image = "docker.io/athomasson2/ebook2audiobook:v25.12.30-cu128"
# tty = true
# stdin = true
tty = true
stdin = true
# port {
# container_port = 7860
# }
port {
container_port = 7860
}
# volume_mount {
# mount_path = "/app"
# name = "data"
# }
# LD_LIBRARY_PATH needed for CUDA detection - libcudart.so is in non-standard location
env {
name = "LD_LIBRARY_PATH"
value = "/usr/local/lib/python3.12/site-packages/nvidia/cuda_runtime/lib:/usr/local/lib/python3.12/site-packages/nvidia/cudnn/lib"
}
# resources {
# limits = {
# "nvidia.com/gpu" = "1"
# }
# }
# security_context {
# privileged = true
# }
# }
volume_mount {
mount_path = "/home/user"
name = "data"
}
# volume {
# name = "data"
# nfs {
# server = "10.0.10.15"
# path = "/mnt/main/ebook2audiobook"
# }
# }
# }
# }
# }
# }
resources {
limits = {
"nvidia.com/gpu" = "1"
}
}
}
volume {
name = "data"
nfs {
server = "10.0.10.15"
path = "/mnt/main/ebook2audiobook"
}
}
}
}
}
}
resource "kubernetes_service" "ebook2audiobook" {
@ -241,7 +240,7 @@ resource "kubernetes_deployment" "audiblez" {
}
}
spec {
replicas = 1
replicas = 0 # Disabled - using audiblez-web instead
selector {
match_labels = {
app = "audiblez"
@ -257,20 +256,20 @@ resource "kubernetes_deployment" "audiblez" {
node_selector = {
"gpu" : "true"
}
toleration {
key = "nvidia.com/gpu"
operator = "Equal"
value = "true"
effect = "NoSchedule"
}
container {
image = "viktorbarzin/audiblez:latest"
name = "audiblez"
command = ["/usr/bin/sleep", "86400"]
command = ["/usr/bin/sleep", "infinity"]
volume_mount {
name = "data"
mount_path = "/mnt"
}
# security_context {
# privileged = true
# capabilities {
# add = ["SYS_ADMIN"]
# }
# }
resources {
limits = {
"nvidia.com/gpu" = "1"
@ -289,3 +288,123 @@ resource "kubernetes_deployment" "audiblez" {
}
}
# Audiblez Web UI
resource "kubernetes_deployment" "audiblez-web" {
metadata {
name = "audiblez-web"
namespace = kubernetes_namespace.ebook2audiobook.metadata[0].name
labels = {
app = "audiblez-web"
tier = var.tier
}
}
spec {
replicas = 1
strategy {
type = "Recreate"
}
selector {
match_labels = {
app = "audiblez-web"
}
}
template {
metadata {
labels = {
app = "audiblez-web"
}
}
spec {
node_selector = {
"gpu" : "true"
}
toleration {
key = "nvidia.com/gpu"
operator = "Equal"
value = "true"
effect = "NoSchedule"
}
container {
# Use digest to bypass local registry cache
image = "docker.io/viktorbarzin/audiblez-web@sha256:eb6d13e6372b931bcac45ca389c063dfadc7b3fc2a607127fc76c5627b13a34c"
image_pull_policy = "Always"
name = "audiblez-web"
port {
container_port = 8000
}
volume_mount {
name = "data"
mount_path = "/mnt"
}
resources {
limits = {
"nvidia.com/gpu" = "1"
}
}
# liveness_probe {
# http_get {
# path = "/health"
# port = 8000
# }
# initial_delay_seconds = 10
# period_seconds = 30
# }
# readiness_probe {
# http_get {
# path = "/health"
# port = 8000
# }
# initial_delay_seconds = 5
# period_seconds = 10
# }
}
volume {
name = "data"
nfs {
server = "10.0.10.15"
path = "/mnt/main/audiblez"
}
}
}
}
}
}
resource "kubernetes_service" "audiblez-web" {
metadata {
name = "audiblez-web"
namespace = kubernetes_namespace.ebook2audiobook.metadata[0].name
labels = {
"app" = "audiblez-web"
}
}
spec {
selector = {
app = "audiblez-web"
}
port {
name = "http"
port = 80
target_port = 8000
}
}
}
module "audiblez-web-ingress" {
source = "../ingress_factory"
namespace = kubernetes_namespace.ebook2audiobook.metadata[0].name
name = "audiblez-web"
host = "audiblez"
tls_secret_name = var.tls_secret_name
protected = true
max_body_size = "500m" # Allow large EPUB uploads
proxy_timeout = 3600 # Long timeout for conversions
}