Browse Source

Add more stack and heap to Node.js at all WeKan platforms.

Thanks to xet7 !

Related #3585
Lauri Ojansivu 3 years ago
parent
commit
ff13571c71

+ 20 - 1
.devcontainer/Dockerfile

@@ -132,7 +132,16 @@ ENV \
     SAML_IDENTIFIER_FORMAT="" \
     SAML_LOCAL_PROFILE_MATCH_ATTRIBUTE="" \
     SAML_ATTRIBUTES="" \
-    DEFAULT_WAIT_SPINNER=""
+    DEFAULT_WAIT_SPINNER="" \
+    NODE_OPTIONS="--max_old_space_size=4096"
+
+#---------------------------------------------------------------------
+# https://github.com/wekan/wekan/issues/3585#issuecomment-1021522132
+# Add more Node heap:
+#   NODE_OPTIONS="--max_old_space_size=4096"
+# Add more stack:
+#   bash -c "ulimit -s 65500; exec node --stack-size=65500 main.js"
+#---------------------------------------------------------------------
 
 # Install OS
 RUN set -o xtrace \
@@ -248,4 +257,14 @@ ENV PORT=3000
 EXPOSE $PORT
 WORKDIR /home/wekan/app
 
+#---------------------------------------------------------------------
+# https://github.com/wekan/wekan/issues/3585#issuecomment-1021522132
+# Add more Node heap:
+#   NODE_OPTIONS="--max_old_space_size=4096"
+# Add more stack:
+#   bash -c "ulimit -s 65500; exec node --stack-size=65500 main.js"
+#---------------------------------------------------------------------
+#TODO:
+#CMD ["bash", "-c", "ulimit -s 65500; exec node --stack-size=65500 /build/main.js"]
+
 CMD ["/home/wekan/.meteor/meteor", "run", "--verbose", "--settings", "settings.json"]

+ 21 - 2
Dockerfile

@@ -140,7 +140,16 @@ ENV BUILD_DEPS="apt-utils libarchive-tools gnupg gosu wget curl bzip2 g++ build-
     SAML_LOCAL_PROFILE_MATCH_ATTRIBUTE="" \
     SAML_ATTRIBUTES="" \
     ORACLE_OIM_ENABLED=false \
-    WAIT_SPINNER=""
+    WAIT_SPINNER="" \
+    NODE_OPTIONS="--max_old_space_size=4096"
+
+#---------------------------------------------------------------------
+# https://github.com/wekan/wekan/issues/3585#issuecomment-1021522132
+# Add more Node heap:
+#   NODE_OPTIONS="--max_old_space_size=4096"
+# Add more stack:
+#   bash -c "ulimit -s 65500; exec node --stack-size=65500 main.js"
+#---------------------------------------------------------------------
 
 # Copy the app to the image
 COPY ${SRC_PATH} /home/wekan/app
@@ -323,4 +332,14 @@ ENV PORT=8080
 EXPOSE $PORT
 USER wekan
 
-CMD ["node", "/build/main.js"]
+#---------------------------------------------------------------------
+# https://github.com/wekan/wekan/issues/3585#issuecomment-1021522132
+# Add more Node heap:
+#   NODE_OPTIONS="--max_old_space_size=4096"
+# Add more stack:
+#   bash -c "ulimit -s 65500; exec node --stack-size=65500 main.js"
+#---------------------------------------------------------------------
+#
+# CMD ["node", "/build/main.js"]
+
+CMD ["bash", "-c", "ulimit -s 65500; exec node --stack-size=65500 /build/main.js"]

+ 22 - 2
Dockerfile.arm64v8

@@ -6,7 +6,16 @@ ENV QEMU_VERSION=v4.2.0-6 \
     NODE_ARCHITECTURE=linux-arm64 \
     NODE_VERSION=v12.22.9 \
     WEKAN_VERSION=latest  \
-    WEKAN_ARCHITECTURE=arm64
+    WEKAN_ARCHITECTURE=arm64 \
+    NODE_OPTIONS="--max_old_space_size=4096"
+
+#---------------------------------------------------------------------
+# https://github.com/wekan/wekan/issues/3585#issuecomment-1021522132
+# Add more Node heap:
+#   NODE_OPTIONS="--max_old_space_size=4096"
+# Add more stack:
+#   bash -c "ulimit -s 65500; exec node --stack-size=65500 main.js"
+#---------------------------------------------------------------------
 
     # Install dependencies
 RUN apk update && apk add ca-certificates outils-sha1 && \
@@ -74,4 +83,15 @@ RUN \
 EXPOSE $PORT
 USER wekan
 
-CMD ["node", "/home/wekan/bundle/main.js"]
+#---------------------------------------------------------------------
+# https://github.com/wekan/wekan/issues/3585#issuecomment-1021522132
+# Add more Node heap:
+#   NODE_OPTIONS="--max_old_space_size=4096"
+# Add more stack:
+#   bash -c "ulimit -s 65500; exec node --stack-size=65500 main.js"
+#---------------------------------------------------------------------
+#
+#CMD ["node", "/home/wekan/bundle/main.js"]
+
+CMD ["bash", "-c", "ulimit -s 65500; exec node --stack-size=65500 /home/wekan/bundle/main.js"]
+

+ 6 - 0
docker-compose.yml

@@ -174,6 +174,12 @@ services:
       #- MAIL_SERVICE_USER=firstname.lastname@hotmail.com
       #- MAIL_SERVICE_PASSWORD=SecretPassword
       #---------------------------------------------------------------
+      # https://github.com/wekan/wekan/issues/3585#issuecomment-1021522132
+      # Add more Node heap, this is done by default at Dockerfile:
+      #   - NODE_OPTIONS="--max_old_space_size=4096"
+      # Add more stack, this is done at Dockerfile:
+      #   bash -c "ulimit -s 65500; exec node --stack-size=65500 main.js"
+      #---------------------------------------------------------------
       # ==== OPTIONAL: MONGO OPLOG SETTINGS =====
       # https://github.com/wekan/wekan-mongodb/issues/2#issuecomment-378343587
       # We've fixed our CPU usage problem today with an environment

+ 3 - 3
rebuild-wekan.sh

@@ -110,14 +110,14 @@ do
 		;;
 
     "Run Meteor for dev on http://localhost:4000")
-		WITH_API=true RICHER_CARD_COMMENT_EDITOR=false ROOT_URL=http://localhost:4000 meteor run --exclude-archs web.browser.legacy,web.cordova --port 4000
+		NODE_OPTIONS="--max_old_space_size=4096" WITH_API=true RICHER_CARD_COMMENT_EDITOR=false ROOT_URL=http://localhost:4000 meteor run --exclude-archs web.browser.legacy,web.cordova --port 4000 --stack-size=65500
 		break
 		;;
 
     "Run Meteor for dev on http://CURRENT-IP-ADDRESS:4000")
 		IPADDRESS=$(ip a | grep 'noprefixroute' | grep 'inet ' | cut -d: -f2 | awk '{ print $2}' | cut -d '/' -f 1)
 		echo "Your IP address is $IPADDRESS"
-		WITH_API=true RICHER_CARD_COMMENT_EDITOR=false ROOT_URL=http://$IPADDRESS:4000 meteor run --exclude-archs web.browser.legacy,web.cordova --port 4000
+		NODE_OPTIONS="--max_old_space_size=4096" WITH_API=true RICHER_CARD_COMMENT_EDITOR=false ROOT_URL=http://$IPADDRESS:4000 meteor run --exclude-archs web.browser.legacy,web.cordova --port 4000 --stack-size=65500
 		break
 		;;
 
@@ -128,7 +128,7 @@ do
 		echo "On what port you would like to run Wekan?"
 		read PORT
 		echo "ROOT_URL=http://$IPADDRESS:$PORT"
-		WITH_API=true RICHER_CARD_COMMENT_EDITOR=false ROOT_URL=http://$IPADDRESS:$PORT meteor run --exclude-archs web.browser.legacy,web.cordova --port $PORT
+		NODE_OPTIONS="--max_old_space_size=4096" WITH_API=true RICHER_CARD_COMMENT_EDITOR=false ROOT_URL=http://$IPADDRESS:$PORT meteor run --exclude-archs web.browser.legacy,web.cordova --port $PORT --stack-size=65500
 		break
 		;;
 

+ 10 - 1
sandstorm-pkgdef.capnp

@@ -233,9 +233,18 @@ const pkgdef :Spk.PackageDefinition = (
 
 const myCommand :Spk.Manifest.Command = (
   # Here we define the command used to start up your server.
-  argv = ["/sandstorm-http-bridge", "4000", "--", "node", "start.js"],
+  #argv = ["/sandstorm-http-bridge", "4000", "--", "node", "start.js"],
+  argv = ["/sandstorm-http-bridge", "4000", "--", "node", "--stack-size=65500", "start.js"],
   environ = [
     # Note that this defines the *entire* environment seen by your app.
+    #---------------------------------------------------------------------
+    # https://github.com/wekan/wekan/issues/3585#issuecomment-1021522132
+    # Add more Node heap:
+    #export NODE_OPTIONS="--max_old_space_size=4096"
+    # Add more stack:
+    #bash -c "ulimit -s 65500; exec node --stack-size=65500 main.js"
+    #---------------------------------------------------------------------
+    (key = "NODE_OPTIONS", value = "--max_old_space_size=4096"),
     (key = "PATH", value = "/usr/local/bin:/usr/bin:/bin"),
     (key = "RESULTS_PER_PAGE", value = ""),
     (key = "WITH_API", value = "true"),

File diff suppressed because it is too large
+ 0 - 0
snap-src/bin/config


+ 9 - 1
snap-src/bin/wekan-control

@@ -20,4 +20,12 @@ echo -e "MONGO_URL=$MONGO_URL"
 APPLICATION_DIRECTORY=$SNAP
 APPLICATION_START=main.js
 cd $APPLICATION_DIRECTORY
-$NODE_PATH/node $APPLICATION_START
+#$NODE_PATH/node $APPLICATION_START
+#---------------------------------------------------------------------
+# https://github.com/wekan/wekan/issues/3585#issuecomment-1021522132
+# Add more Node heap:
+#   export NODE_OPTIONS="--max_old_space_size=4096"
+# Add more stack:
+#   bash -c "ulimit -s 65500; exec node --stack-size=65500 main.js"
+#---------------------------------------------------------------------
+bash -c "ulimit -s 65500; exec $NODE_PATH/node --stack-size=65500 $APPLICATION_START"

+ 6 - 0
snap-src/bin/wekan-help

@@ -101,6 +101,12 @@ echo -e "\t$ snap set $SNAP_NAME accounts-common-login-expiration-in-days='90'"
 echo -e "\t-Restore default:"
 echo -e "\t$ snap unset $SNAP_NAME accounts-common-login-expiration-in-days"
 echo -e "\n"
+echo -e "https://github.com/wekan/wekan/issues/3585#issuecomment-1021522132"
+echo -e "node-options: Add more Node heap. Default:"
+echo -e "\t$ snap set $SNAP_NAME node-options=\"--max_old_space_size=4096\""
+echo -e "\t-Remove node-options:"
+echo -e "\t$ snap unset $SNAP_NAME node-options"
+echo -e "\n"
 echo -e "Rich text editor in card comments. Default: false https://github.com/wekan/wekan/pull/2560"
 echo -e "Enable:"
 echo -e "\t$ snap set $SNAP_NAME richer-card-comment-editor='true'"

+ 8 - 1
stacksmith/user-scripts/run.sh

@@ -17,4 +17,11 @@ done
 
 cd /build
 echo "starting the wekan service..."
-node main.js
+#---------------------------------------------------------------------
+# https://github.com/wekan/wekan/issues/3585#issuecomment-1021522132
+# Add more Node heap:
+export NODE_OPTIONS="--max_old_space_size=4096"
+# Add more stack:
+bash -c "ulimit -s 65500; exec node --stack-size=65500 main.js"
+#---------------------------------------------------------------------
+#node main.js

+ 6 - 2
start-wekan.bat

@@ -19,7 +19,6 @@ REM SET MAIL_SERVICE=Outlook365
 REM SET MAIL_SERVICE_USER=firstname.lastname@hotmail.com
 REM SET MAIL_SERVICE_PASSWORD=SecretPassword
 
-
 REM # ==== NUMBER OF SEARCH RESULTS PER PAGE BY DEFAULT ====
 REM SET RESULTS_PER_PAGE=20
 
@@ -457,4 +456,9 @@ REM SET SAML_ATTRIBUTES=
 REM # Wait spinner to use
 REM SET WAIT_SPINNER=Bounce
 
-node main.js
+REM # https://github.com/wekan/wekan/issues/3585#issuecomment-1021522132
+REM # Add more Node heap:
+SET NODE_OPTIONS="--max_old_space_size=4096"
+REM # Add more stack. ulimit is not at Windows, stack-size is at Windows:
+REM #   bash -c "ulimit -s 65500; exec node --stack-size=65500 main.js"
+node --stack-size=65500 main.js

+ 7 - 1
start-wekan.sh

@@ -501,7 +501,13 @@
       # Wait spinner to use
       #export WAIT_SPINNER=Bounce
       #---------------------------------------------------------------------
-      node main.js
+      # https://github.com/wekan/wekan/issues/3585#issuecomment-1021522132
+      # Add more Node heap:
+      export NODE_OPTIONS="--max_old_space_size=4096"
+      # Add more stack:
+      bash -c "ulimit -s 65500; exec node --stack-size=65500 main.js"
+      #node main.js
+      #---------------------------------------------------------------------
       # & >> ../../wekan.log
       cd ../..
 #done

+ 6 - 0
torodb-postgresql/docker-compose.yml

@@ -182,6 +182,12 @@ services:
       #- MAIL_SERVICE_USER=firstname.lastname@hotmail.com
       #- MAIL_SERVICE_PASSWORD=SecretPassword
       #---------------------------------------------------------------
+      # https://github.com/wekan/wekan/issues/3585#issuecomment-1021522132
+      # Add more Node heap, this is done by default at Dockerfile:
+      #   - NODE_OPTIONS="--max_old_space_size=4096"
+      # Add more stack, this is done at Dockerfile:
+      #   bash -c "ulimit -s 65500; exec node --stack-size=65500 main.js"
+      #---------------------------------------------------------------
       # ==== OPTIONAL: MONGO OPLOG SETTINGS =====
       # https://github.com/wekan/wekan-mongodb/issues/2#issuecomment-378343587
       # We've fixed our CPU usage problem today with an environment

Some files were not shown because too many files changed in this diff