From 3d5aa7b4742459da51a1c317e8ce494c7155b626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20M=C3=B3ricz?= Date: Thu, 29 May 2025 19:16:29 +0200 Subject: [PATCH] feat(api): fix entrypoint signal forwarding --- apps/api/docker-entrypoint.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/apps/api/docker-entrypoint.sh b/apps/api/docker-entrypoint.sh index 6b09e705..d6a72593 100755 --- a/apps/api/docker-entrypoint.sh +++ b/apps/api/docker-entrypoint.sh @@ -11,14 +11,24 @@ fi if [ "$FLY_PROCESS_GROUP" = "app" ]; then echo "RUNNING app" - node --max-old-space-size=8192 dist/src/index.js + exec node --max-old-space-size=6144 dist/src/index.js & elif [ "$FLY_PROCESS_GROUP" = "worker" ]; then echo "RUNNING worker" - node --max-old-space-size=8192 dist/src/services/queue-worker.js + exec node --max-old-space-size=3072 dist/src/services/queue-worker.js & elif [ "$FLY_PROCESS_GROUP" = "index-worker" ]; then echo "RUNNING index worker" - node --max-old-space-size=8192 dist/src/services/indexing/index-worker.js + exec node --max-old-space-size=3072 dist/src/services/indexing/index-worker.js & else echo "NO FLY PROCESS GROUP" - node --max-old-space-size=8192 dist/src/index.js + exec node --max-old-space-size=8192 dist/src/index.js & fi + +FC_PID=$! + +trap 'kill -SIGTERM $FC_PID; wait $FC_PID' SIGTERM +trap 'kill -SIGINT $FC_PID; wait $FC_PID' SIGINT +trap 'kill -SIGKILL $FC_PID; wait $FC_PID' SIGKILL + +wait $FC_PID + +echo "ALL PROCESSES TERMINATED"