add iSCSI persistent volume for plotting-book SQLite database

Create a 1Gi PVC using iscsi-truenas StorageClass, mount at /data,
and set DB_PATH=/data/database.sqlite for persistent storage.
This commit is contained in:
Viktor Barzin 2026-03-07 21:57:22 +00:00
parent 5e2e6aa2f4
commit 54cdc0259a
No known key found for this signature in database
GPG key ID: 0EB088298288D958

View file

@ -32,6 +32,22 @@ module "tls_secret" {
tls_secret_name = var.tls_secret_name
}
resource "kubernetes_persistent_volume_claim" "plotting-book-data" {
metadata {
name = "plotting-book-data"
namespace = kubernetes_namespace.plotting-book.metadata[0].name
}
spec {
access_modes = ["ReadWriteOnce"]
storage_class_name = "iscsi-truenas"
resources {
requests = {
storage = "1Gi"
}
}
}
}
resource "kubernetes_deployment" "plotting-book" {
metadata {
name = "plotting-book"
@ -60,6 +76,12 @@ resource "kubernetes_deployment" "plotting-book" {
}
}
spec {
volume {
name = "data"
persistent_volume_claim {
claim_name = kubernetes_persistent_volume_claim.plotting-book-data.metadata[0].name
}
}
container {
image = "ancamilea/book-plotter:latest"
# image = "viktorbarzin/book-plotter:7"
@ -81,6 +103,14 @@ resource "kubernetes_deployment" "plotting-book" {
name = "GOOGLE_CALLBACK_URL"
value = "https://plotting-book.viktorbarzin.me/api/auth/google/callback"
}
env {
name = "DB_PATH"
value = "/data/database.sqlite"
}
volume_mount {
name = "data"
mount_path = "/data"
}
port {
container_port = 3001
}