diff --git a/deploy/self-hosting/.env.example b/deploy/self-hosting/.env.example index c420dfd3c..26f6945e1 100644 --- a/deploy/self-hosting/.env.example +++ b/deploy/self-hosting/.env.example @@ -79,12 +79,12 @@ FLUXER_DISCOVERY_ENABLED=true #FLUXER_GATEWAY_MEMORY_LIMIT=1gb #FLUXER_MEILISEARCH_MEMORY_LIMIT=768mb -# The Node heap ceiling must stay below the container limit above, with room to -# spare: V8 adds roughly 200 MB of semi-space on top of the value set here, and -# buffers live outside the heap entirely. Around 70 percent of the container limit -# is a safe ratio. If the heap ceiling exceeds the container limit, the kernel -# OOM-kills the container (exit 137, no diagnostics) instead of Node reporting a -# JavaScript heap out of memory error you can act on. +# Node sizes its own heap from the container memory limit by default, at roughly +# 55 percent of it, which always leaves room for the buffers and stacks that live +# outside the heap. Leave these unset unless you have a reason to pin the value. +# Any value set here must stay well below the container limit above: a heap ceiling +# above the container limit makes the kernel OOM-kill the container (exit 137, no +# diagnostics) instead of Node reporting a JavaScript heap out of memory error. #FLUXER_API_NODE_HEAP_MB=1792 #FLUXER_WORKER_NODE_HEAP_MB=1792 diff --git a/deploy/self-hosting/docker-compose.yml b/deploy/self-hosting/docker-compose.yml index 4737401c3..9656d0c26 100644 --- a/deploy/self-hosting/docker-compose.yml +++ b/deploy/self-hosting/docker-compose.yml @@ -293,7 +293,7 @@ services: environment: <<: *fluxer-env FLUXER_API_PORT: "8080" - NODE_OPTIONS: --max-old-space-size=${FLUXER_API_NODE_HEAP_MB:-1792} --enable-source-maps + NODE_OPTIONS: --enable-source-maps${FLUXER_API_NODE_HEAP_MB:+ --max-old-space-size=$FLUXER_API_NODE_HEAP_MB} FLUXER_API_PRESIGNED_ATTACHMENT_UPLOADS_ENABLED: "true" FLUXER_POSTGRES_MAX_CONNECTIONS: "25" healthcheck: @@ -331,7 +331,7 @@ services: command: ["node", "dist/WorkerEntrypoint.js"] environment: <<: *fluxer-env - NODE_OPTIONS: --max-old-space-size=${FLUXER_WORKER_NODE_HEAP_MB:-1792} --enable-source-maps + NODE_OPTIONS: --enable-source-maps${FLUXER_WORKER_NODE_HEAP_MB:+ --max-old-space-size=$FLUXER_WORKER_NODE_HEAP_MB} FLUXER_API_WORKER_MODE: all_lanes FLUXER_API_WORKER_ENABLE_CRON_SCHEDULER: "true" FLUXER_API_WORKER_ENABLE_VOICE_RECONCILIATION: "true" diff --git a/fluxer_api/Dockerfile b/fluxer_api/Dockerfile index 177fc2ad5..a435636ea 100644 --- a/fluxer_api/Dockerfile +++ b/fluxer_api/Dockerfile @@ -59,7 +59,7 @@ RUN rm -rf pkgs && \ ENV HOME=/usr/src/app ENV COREPACK_HOME=/usr/src/app/.cache/corepack ENV NODE_ENV=production -ENV NODE_OPTIONS="--max-old-space-size=2048 --enable-source-maps" +ENV NODE_OPTIONS="--enable-source-maps" ENV NODE_EXTRA_CA_CERTS=/etc/ssl/certs/ca-certificates.crt ENV BUILD_VERSION=${BUILD_VERSION}