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:
parent
9689b67895
commit
596c02dfde
1 changed files with 198 additions and 79 deletions
|
|
@ -18,86 +18,85 @@ resource "kubernetes_namespace" "ebook2audiobook" {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# resource "kubernetes_deployment" "ebook2audiobook" {
|
resource "kubernetes_deployment" "ebook2audiobook" {
|
||||||
# metadata {
|
metadata {
|
||||||
# name = "ebook2audiobook"
|
name = "ebook2audiobook"
|
||||||
# namespace = kubernetes_namespace.ebook2audiobook.metadata[0].name
|
namespace = kubernetes_namespace.ebook2audiobook.metadata[0].name
|
||||||
# labels = {
|
labels = {
|
||||||
# app = "ebook2audiobook"
|
app = "ebook2audiobook"
|
||||||
# }
|
tier = var.tier
|
||||||
# }
|
}
|
||||||
# spec {
|
}
|
||||||
# replicas = 1
|
spec {
|
||||||
# strategy {
|
replicas = 0 # Disabled - using audiblez instead
|
||||||
# type = "Recreate"
|
strategy {
|
||||||
# }
|
type = "Recreate"
|
||||||
|
}
|
||||||
|
|
||||||
# selector {
|
selector {
|
||||||
# match_labels = {
|
match_labels = {
|
||||||
# app = "ebook2audiobook"
|
app = "ebook2audiobook"
|
||||||
# }
|
}
|
||||||
# }
|
}
|
||||||
|
|
||||||
# template {
|
template {
|
||||||
# metadata {
|
metadata {
|
||||||
# labels = {
|
labels = {
|
||||||
# app = "ebook2audiobook"
|
app = "ebook2audiobook"
|
||||||
# }
|
}
|
||||||
# }
|
}
|
||||||
|
|
||||||
# spec {
|
spec {
|
||||||
# container {
|
node_selector = {
|
||||||
# name = "ebook2audiobook"
|
"gpu" : "true"
|
||||||
# # image = "docker.io/athomasson2/ebook2audiobook:latest"
|
}
|
||||||
# image = "docker.io/athomasson2/ebook2audiobook:v25.12.30-cu128"
|
toleration {
|
||||||
|
key = "nvidia.com/gpu"
|
||||||
|
operator = "Equal"
|
||||||
|
value = "true"
|
||||||
|
effect = "NoSchedule"
|
||||||
|
}
|
||||||
|
|
||||||
# working_dir = "/app"
|
container {
|
||||||
# # command = ["python", "app.py", "--script_mode", "full_docker"]
|
name = "ebook2audiobook"
|
||||||
# # command = ["/bin/bash", "-c", <<-EOT
|
image = "docker.io/athomasson2/ebook2audiobook:v25.12.30-cu128"
|
||||||
# # # 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
|
|
||||||
# # ]
|
|
||||||
|
|
||||||
# tty = true
|
tty = true
|
||||||
# stdin = true
|
stdin = true
|
||||||
|
|
||||||
# port {
|
port {
|
||||||
# container_port = 7860
|
container_port = 7860
|
||||||
# }
|
}
|
||||||
|
|
||||||
# volume_mount {
|
# LD_LIBRARY_PATH needed for CUDA detection - libcudart.so is in non-standard location
|
||||||
# mount_path = "/app"
|
env {
|
||||||
# name = "data"
|
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 {
|
volume_mount {
|
||||||
# limits = {
|
mount_path = "/home/user"
|
||||||
# "nvidia.com/gpu" = "1"
|
name = "data"
|
||||||
# }
|
}
|
||||||
# }
|
|
||||||
# security_context {
|
|
||||||
# privileged = true
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
|
|
||||||
# volume {
|
resources {
|
||||||
# name = "data"
|
limits = {
|
||||||
# nfs {
|
"nvidia.com/gpu" = "1"
|
||||||
# server = "10.0.10.15"
|
}
|
||||||
# path = "/mnt/main/ebook2audiobook"
|
}
|
||||||
# }
|
}
|
||||||
# }
|
|
||||||
# }
|
volume {
|
||||||
# }
|
name = "data"
|
||||||
# }
|
nfs {
|
||||||
# }
|
server = "10.0.10.15"
|
||||||
|
path = "/mnt/main/ebook2audiobook"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
resource "kubernetes_service" "ebook2audiobook" {
|
resource "kubernetes_service" "ebook2audiobook" {
|
||||||
|
|
@ -241,7 +240,7 @@ resource "kubernetes_deployment" "audiblez" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
spec {
|
spec {
|
||||||
replicas = 1
|
replicas = 0 # Disabled - using audiblez-web instead
|
||||||
selector {
|
selector {
|
||||||
match_labels = {
|
match_labels = {
|
||||||
app = "audiblez"
|
app = "audiblez"
|
||||||
|
|
@ -257,20 +256,20 @@ resource "kubernetes_deployment" "audiblez" {
|
||||||
node_selector = {
|
node_selector = {
|
||||||
"gpu" : "true"
|
"gpu" : "true"
|
||||||
}
|
}
|
||||||
|
toleration {
|
||||||
|
key = "nvidia.com/gpu"
|
||||||
|
operator = "Equal"
|
||||||
|
value = "true"
|
||||||
|
effect = "NoSchedule"
|
||||||
|
}
|
||||||
container {
|
container {
|
||||||
image = "viktorbarzin/audiblez:latest"
|
image = "viktorbarzin/audiblez:latest"
|
||||||
name = "audiblez"
|
name = "audiblez"
|
||||||
command = ["/usr/bin/sleep", "86400"]
|
command = ["/usr/bin/sleep", "infinity"]
|
||||||
volume_mount {
|
volume_mount {
|
||||||
name = "data"
|
name = "data"
|
||||||
mount_path = "/mnt"
|
mount_path = "/mnt"
|
||||||
}
|
}
|
||||||
# security_context {
|
|
||||||
# privileged = true
|
|
||||||
# capabilities {
|
|
||||||
# add = ["SYS_ADMIN"]
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
resources {
|
resources {
|
||||||
limits = {
|
limits = {
|
||||||
"nvidia.com/gpu" = "1"
|
"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
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue