mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
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:
@@ -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
|
||||
|
||||
@@ -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:"
|
||||
|
||||
Reference in New Issue
Block a user