mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-15 05:25:53 +08:00
feat(api): better entrypoint logging
This commit is contained in:
parent
3d5aa7b474
commit
dbeab6ff78
@ -3,32 +3,33 @@
|
||||
if [ "$UID" -eq 0 ]; then
|
||||
set +e # disable failing on errror
|
||||
ulimit -n 65535
|
||||
echo "NEW ULIMIT: $(ulimit -n)"
|
||||
echo "ENTRYPOINT: NEW ULIMIT: $(ulimit -n)"
|
||||
set -e # enable failing on error
|
||||
else
|
||||
echo ENTRYPOINT DID NOT RUN AS ROOT
|
||||
echo "ENTRYPOINT: DID NOT RUN AS ROOT"
|
||||
fi
|
||||
|
||||
if [ "$FLY_PROCESS_GROUP" = "app" ]; then
|
||||
echo "RUNNING app"
|
||||
echo "ENTRYPOINT: RUNNING app"
|
||||
exec node --max-old-space-size=6144 dist/src/index.js &
|
||||
elif [ "$FLY_PROCESS_GROUP" = "worker" ]; then
|
||||
echo "RUNNING worker"
|
||||
echo "ENTRYPOINT: RUNNING worker"
|
||||
exec node --max-old-space-size=3072 dist/src/services/queue-worker.js &
|
||||
elif [ "$FLY_PROCESS_GROUP" = "index-worker" ]; then
|
||||
echo "RUNNING index worker"
|
||||
echo "ENTRYPOINT: RUNNING index worker"
|
||||
exec node --max-old-space-size=3072 dist/src/services/indexing/index-worker.js &
|
||||
else
|
||||
echo "NO FLY PROCESS GROUP"
|
||||
echo "ENTRYPOINT: NO FLY PROCESS GROUP"
|
||||
exec node --max-old-space-size=8192 dist/src/index.js &
|
||||
fi
|
||||
|
||||
FC_PID=$!
|
||||
echo "ENTRYPOINT: Background process PID: $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
|
||||
trap 'echo "ENTRYPOINT: SIGTERM received. Forwarding to PID $FC_PID..."; kill -SIGTERM $FC_PID; echo "ENTRYPOINT: Waiting for PID $FC_PID to exit after SIGTERM..."; wait $FC_PID; echo "ENTRYPOINT: PID $FC_PID exited after SIGTERM."' SIGTERM
|
||||
trap 'echo "ENTRYPOINT: SIGINT received. Forwarding to PID $FC_PID..."; kill -SIGINT $FC_PID; echo "ENTRYPOINT: Waiting for PID $FC_PID to exit after SIGINT..."; wait $FC_PID; echo "ENTRYPOINT: PID $FC_PID exited after SIGINT."' SIGINT
|
||||
|
||||
echo "ENTRYPOINT: Main script waiting for PID $FC_PID..."
|
||||
wait $FC_PID
|
||||
|
||||
echo "ALL PROCESSES TERMINATED"
|
||||
echo "ENTRYPOINT: All processes terminated. Script exiting."
|
||||
|
Loading…
x
Reference in New Issue
Block a user