From ef8a7858b232934827a6b35c7e8a06756daedabb Mon Sep 17 00:00:00 2001 From: Daniel Arroyo Date: Tue, 24 Mar 2026 23:02:14 -0300 Subject: [PATCH 1/3] fix: Only run prisma db push if database doesn't exist to avoid OOM --- docker-entrypoint.sh | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 590a487..7223c2d 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -9,22 +9,13 @@ echo "Checking database..." mkdir -p /app/data chmod 777 /app/data -# Create a dummy file to test write access -touch /app/data/.write_test 2>/dev/null && rm /app/data/.write_test || { - echo "Warning: Cannot write to /app/data, trying to fix permissions..." - chmod -R 777 /app/data -} - -# Use local prisma version from node_modules (skip generate - already built) -./node_modules/prisma/build/index.js db push --skip-generate || { - echo "Warning: db push failed, checking if database exists..." - if [ -f /app/data/dev.db ]; then - echo "Database file exists, continuing..." - else - echo "Database file does not exist and could not be created" - exit 1 - fi -} +# Only run db push if database file doesn't exist +if [ ! -f /app/data/dev.db ]; then + echo "Database not found, creating..." + ./node_modules/prisma/build/index.js db push --skip-generate +else + echo "Database already exists, skipping db push..." +fi echo "Starting application..." exec "$@" -- 2.49.1 From de1de1d3bc61e7d58647cc7fcd7c8b71cee69972 Mon Sep 17 00:00:00 2001 From: Daniel Arroyo Date: Tue, 24 Mar 2026 23:04:26 -0300 Subject: [PATCH 2/3] fix: Run prisma db push but continue if OOM and DB exists --- docker-entrypoint.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 7223c2d..d5b8500 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -9,13 +9,17 @@ echo "Checking database..." mkdir -p /app/data chmod 777 /app/data -# Only run db push if database file doesn't exist -if [ ! -f /app/data/dev.db ]; then - echo "Database not found, creating..." - ./node_modules/prisma/build/index.js db push --skip-generate -else - echo "Database already exists, skipping db push..." -fi +# Run db push (creates/updates database schema) +# If it fails due to OOM but DB exists, continue anyway +./node_modules/prisma/build/index.js db push --skip-generate || { + exit_code=$? + if [ -f /app/data/dev.db ]; then + echo "db push failed (code $exit_code) but database exists, continuing..." + else + echo "db push failed and database does not exist" + exit $exit_code + fi +} echo "Starting application..." exec "$@" -- 2.49.1 From 85bbe7b61f323cda846e749c80c064e8d3a29aee Mon Sep 17 00:00:00 2001 From: Daniel Arroyo Date: Tue, 24 Mar 2026 23:07:10 -0300 Subject: [PATCH 3/3] fix: Increase memory limit to 512MB for Prisma db push --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index aacfadf..c411119 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -90,8 +90,8 @@ services: - ./data:/app/data networks: - homelab-net - mem_limit: 32m - mem_reservation: 16m + mem_limit: 512m + mem_reservation: 256m restart: unless-stopped networks: homelab-net: -- 2.49.1