From af3ba0306c8eda93ee7cd726e65a79d6fbc2ae41 Mon Sep 17 00:00:00 2001 From: Viktor Barzin Date: Sun, 15 Mar 2026 02:03:19 +0000 Subject: [PATCH] fix calibre slow startup: bake calibre binaries into image, skip chown on NFS Custom Docker image pre-installs the universal-calibre mod at build time, eliminating ~10 min apt-get on every container start. Added NO_CHOWN=true to skip recursive chown that hangs on NFS mounts. Tightened startup probe since pod now starts in ~2 min instead of 15-20 min. --- stacks/calibre/Dockerfile | 7 +++++++ stacks/calibre/main.tf | 15 +++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 stacks/calibre/Dockerfile diff --git a/stacks/calibre/Dockerfile b/stacks/calibre/Dockerfile new file mode 100644 index 00000000..66f82020 --- /dev/null +++ b/stacks/calibre/Dockerfile @@ -0,0 +1,7 @@ +FROM crocodilestick/calibre-web-automated:latest + +# Pre-install the universal-calibre mod at build time (avoids apt-get on every container start) +ENV DOCKER_MODS=linuxserver/mods:universal-calibre +RUN /docker-mods || true +# Clear the env so it doesn't re-run at startup +ENV DOCKER_MODS= diff --git a/stacks/calibre/main.tf b/stacks/calibre/main.tf index 64a94d64..94bd713f 100644 --- a/stacks/calibre/main.tf +++ b/stacks/calibre/main.tf @@ -138,7 +138,7 @@ module "nfs_stacks_config" { # } resource "kubernetes_deployment" "calibre-web-automated" { - wait_for_rollout = false # DOCKER_MODS install takes 10+ min on every container start + wait_for_rollout = true metadata { name = "calibre-web-automated" namespace = kubernetes_namespace.calibre.metadata[0].name @@ -173,7 +173,7 @@ resource "kubernetes_deployment" "calibre-web-automated" { } spec { container { - image = "crocodilestick/calibre-web-automated:latest" + image = "viktorbarzin/calibre-web-automated:latest" name = "calibre-web-automated" env { name = "PUID" @@ -184,8 +184,8 @@ resource "kubernetes_deployment" "calibre-web-automated" { value = 1000 } env { - name = "DOCKER_MODS" - value = "linuxserver/mods:universal-calibre" + name = "NO_CHOWN" + value = "true" } env { # If your library is on a network share (e.g., NFS/SMB), disable WAL to reduce locking issues @@ -200,16 +200,15 @@ resource "kubernetes_deployment" "calibre-web-automated" { port { container_port = 8083 } - # Startup probe: allow up to 10 min for calibre binary install on first boot startup_probe { http_get { path = "/" port = 8083 } - initial_delay_seconds = 120 + initial_delay_seconds = 10 timeout_seconds = 5 - period_seconds = 15 - failure_threshold = 56 + period_seconds = 5 + failure_threshold = 24 } liveness_probe { http_get {