fix(oom): increase Docker heap to 1024MB + wire OMNIROUTE_MEMORY_MB override

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.
This commit is contained in:
soyelmismo
2026-05-30 21:05:05 -05:00
parent 2fd12711bb
commit 2f707e08e0
2 changed files with 9 additions and 1 deletions

View File

@@ -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

View File

@@ -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:"