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:
parent
4374e78869
commit
193f2e2dc5
1 changed files with 30 additions and 0 deletions
|
|
@ -32,6 +32,22 @@ module "tls_secret" {
|
||||||
tls_secret_name = var.tls_secret_name
|
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" {
|
resource "kubernetes_deployment" "plotting-book" {
|
||||||
metadata {
|
metadata {
|
||||||
name = "plotting-book"
|
name = "plotting-book"
|
||||||
|
|
@ -60,6 +76,12 @@ resource "kubernetes_deployment" "plotting-book" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
spec {
|
spec {
|
||||||
|
volume {
|
||||||
|
name = "data"
|
||||||
|
persistent_volume_claim {
|
||||||
|
claim_name = kubernetes_persistent_volume_claim.plotting-book-data.metadata[0].name
|
||||||
|
}
|
||||||
|
}
|
||||||
container {
|
container {
|
||||||
image = "ancamilea/book-plotter:latest"
|
image = "ancamilea/book-plotter:latest"
|
||||||
# image = "viktorbarzin/book-plotter:7"
|
# image = "viktorbarzin/book-plotter:7"
|
||||||
|
|
@ -81,6 +103,14 @@ resource "kubernetes_deployment" "plotting-book" {
|
||||||
name = "GOOGLE_CALLBACK_URL"
|
name = "GOOGLE_CALLBACK_URL"
|
||||||
value = "https://plotting-book.viktorbarzin.me/api/auth/google/callback"
|
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 {
|
port {
|
||||||
container_port = 3001
|
container_port = 3001
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue