From 2f707e08e0e8ef9b171f586e14bc65d03b0c3c80 Mon Sep 17 00:00:00 2001 From: soyelmismo Date: Sat, 30 May 2026 21:05:05 -0500 Subject: [PATCH] fix(oom): increase Docker heap to 1024MB + wire OMNIROUTE_MEMORY_MB override MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dockerfile: OMNIROUTE_MEMORY_MB=1024 (was hardcoded 256MB). NODE_OPTIONS now references OMNIROUTE_MEMORY_MB so users can override via docker run -e OMNIROUTE_MEMORY_MB=2048. check-permissions.sh: entrypoint reads OMNIROUTE_MEMORY_MB and builds NODE_OPTIONS dynamically. This was documented in .env.example but never actually implemented — the entrypoint just did exec without processing the variable. Combined with the first commit's cache eviction fixes, this should prevent the OOM crashes that killed the process within 5 minutes of intensive use. --- Dockerfile | 3 ++- scripts/check-permissions.sh | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3e3331a5df..135c6abceb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -57,7 +57,8 @@ LABEL org.opencontainers.image.title="omniroute" \ ENV NODE_ENV=production ENV PORT=20128 ENV HOSTNAME=0.0.0.0 -ENV NODE_OPTIONS="--max-old-space-size=256" +ENV OMNIROUTE_MEMORY_MB=1024 +ENV NODE_OPTIONS="--max-old-space-size=${OMNIROUTE_MEMORY_MB}" # Data directory inside Docker — must match the volume mount in docker-compose.yml ENV DATA_DIR=/app/data diff --git a/scripts/check-permissions.sh b/scripts/check-permissions.sh index 13eedf45b0..45846806ca 100755 --- a/scripts/check-permissions.sh +++ b/scripts/check-permissions.sh @@ -1,6 +1,13 @@ #!/bin/sh set -e +# ── Memory limit override ────────────────────────────────────────────── +# If OMNIROUTE_MEMORY_MB is set, build NODE_OPTIONS dynamically so the +# user can tune heap size via environment without editing the Dockerfile. +if [ -n "$OMNIROUTE_MEMORY_MB" ]; then + export NODE_OPTIONS="--max-old-space-size=${OMNIROUTE_MEMORY_MB} ${NODE_OPTIONS:-}" +fi + if [ -d "/app/data" ] && [ ! -w "/app/data" ]; then echo "WARNING: /app/data is not writable by the current user (UID $(id -u))." echo "Run this on the Docker host to fix:"