feat(comfyui): add Dockerfile, playbook, and Terraform configurations for ComfyUI setup

This commit is contained in:
2025-06-08 21:18:53 +02:00
parent d969525b58
commit 359b6d47aa
18 changed files with 400 additions and 170 deletions
+4
View File
@@ -0,0 +1,4 @@
locals {
comfyui_version = "frontend${var.tag}"
}
+98
View File
@@ -0,0 +1,98 @@
resource "kubernetes_namespace" "comfyui" {
metadata {
name = "comfyui"
}
}
resource "kubernetes_service_account" "comfyui" {
metadata {
name = "comfyui-sa"
namespace = kubernetes_namespace.comfyui.metadata[0].name
}
automount_service_account_token = false
}
resource "kubernetes_deployment" "comfyui" {
metadata {
name = "comfyui"
namespace = kubernetes_namespace.comfyui.metadata[0].name
labels = {
comfyui = "comfyui"
}
}
spec {
replicas = 1
selector {
match_labels = {
comfyui = "comfyui"
}
}
strategy {
type = "RollingUpdate"
}
template {
metadata {
labels = {
comfyui = "comfyui"
}
}
spec {
service_account_name = kubernetes_service_account.comfyui.metadata[0].name
automount_service_account_token = false
container {
name = "comfyui"
image = "a13labs/comfyui:${local.comfyui_version}"
security_context {
allow_privilege_escalation = false
}
port {
name = "frontend"
container_port = 5173
protocol = "TCP"
}
env {
name = "DEV_SERVER_COMFYUI_URL"
value = coalesce(var.backend, "http://localhost:8188")
}
}
}
}
}
}
resource "kubernetes_service" "comfyui" {
metadata {
name = "frontend"
namespace = kubernetes_namespace.comfyui.metadata[0].name
}
spec {
selector = {
comfyui = "comfyui"
}
port {
name = "frontend"
port = 5173
target_port = 5173
}
}
lifecycle {
ignore_changes = [
metadata[0].annotations
]
}
}
@@ -0,0 +1,9 @@
terraform {
required_version = "~>1.8"
required_providers {
kubernetes = {
source = "hashicorp/kubernetes"
version = "2.36.0"
}
}
}
@@ -0,0 +1,11 @@
variable "tag" {
description = "The version of app to install"
type = string
default = "v0.0.1"
}
variable "backend" {
description = "The backend to use for ComfyUI"
type = string
default = ""
}