infra/stacks/atuin/main.tf
Viktor Barzin 11b3d92684
[ci skip] migrate 29 services from inline NFS to CSI-backed PV/PVC
Batch migration of all single-volume and simple multi-volume stacks.
All services verified healthy after migration. Uses nfs-truenas
StorageClass with soft,timeo=30,retrans=3 mount options to eliminate
stale NFS mount hangs.

Services: atuin, audiobookshelf, calibre, changedetection, diun,
excalidraw, forgejo, freshrss, grampsweb, hackmd, health,
isponsorblocktv, matrix, meshcentral, n8n, navidrome, ntfy, ollama,
onlyoffice, owntracks, paperless-ngx, poison-fountain, send,
stirling-pdf, tandoor, wealthfolio, whisper, woodpecker, ytdlp
2026-03-02 00:15:39 +00:00

155 lines
3.3 KiB
HCL

variable "tls_secret_name" { type = string }
variable "nfs_server" { type = string }
variable "postgresql_host" { type = string }
variable "atuin_postgresql_password" { type = string }
resource "kubernetes_namespace" "atuin" {
metadata {
name = "atuin"
labels = {
tier = local.tiers.aux
}
}
}
module "tls_secret" {
source = "../../modules/kubernetes/setup_tls_secret"
namespace = kubernetes_namespace.atuin.metadata[0].name
tls_secret_name = var.tls_secret_name
}
module "nfs_config" {
source = "../../modules/kubernetes/nfs_volume"
name = "atuin-config"
namespace = kubernetes_namespace.atuin.metadata[0].name
nfs_server = var.nfs_server
nfs_path = "/mnt/main/atuin"
}
resource "kubernetes_deployment" "atuin" {
wait_for_rollout = false
metadata {
name = "atuin"
namespace = kubernetes_namespace.atuin.metadata[0].name
labels = {
app = "atuin"
tier = local.tiers.aux
}
}
spec {
replicas = 1
selector {
match_labels = {
app = "atuin"
}
}
template {
metadata {
labels = {
app = "atuin"
}
}
spec {
container {
name = "atuin"
image = "ghcr.io/atuinsh/atuin:3f775df"
args = ["start"]
port {
container_port = 8888
}
env {
name = "ATUIN_HOST"
value = "0.0.0.0"
}
env {
name = "ATUIN_PORT"
value = "8888"
}
env {
name = "ATUIN_OPEN_REGISTRATION"
value = "false"
}
env {
name = "ATUIN_DB_URI"
value = "postgres://atuin:${var.atuin_postgresql_password}@${var.postgresql_host}:5432/atuin"
}
env {
name = "RUST_LOG"
value = "info"
}
volume_mount {
name = "config"
mount_path = "/config"
}
resources {
requests = {
memory = "16Mi"
cpu = "10m"
}
limits = {
memory = "128Mi"
cpu = "100m"
}
}
liveness_probe {
http_get {
path = "/healthz"
port = 8888
}
initial_delay_seconds = 10
period_seconds = 30
}
readiness_probe {
http_get {
path = "/healthz"
port = 8888
}
initial_delay_seconds = 5
period_seconds = 10
}
}
volume {
name = "config"
persistent_volume_claim {
claim_name = module.nfs_config.claim_name
}
}
}
}
}
}
resource "kubernetes_service" "atuin" {
metadata {
name = "atuin"
namespace = kubernetes_namespace.atuin.metadata[0].name
labels = {
app = "atuin"
}
}
spec {
selector = {
app = "atuin"
}
port {
name = "http"
port = 80
target_port = 8888
}
}
}
module "ingress" {
source = "../../modules/kubernetes/ingress_factory"
namespace = kubernetes_namespace.atuin.metadata[0].name
name = "atuin"
tls_secret_name = var.tls_secret_name
}