From c83e7b245fb3b9242d33fe2440c49ee173031ee9 Mon Sep 17 00:00:00 2001 From: filesite Date: Sun, 24 Aug 2025 22:37:37 +0800 Subject: [PATCH] fix cloud start and spider watcher scripts --- .env_hero | 9 +++++++++ spider_watcher.sh | 15 +++++---------- start_cloud_in_container.sh | 7 ++++++- 3 files changed, 20 insertions(+), 11 deletions(-) create mode 100644 .env_hero diff --git a/.env_hero b/.env_hero new file mode 100644 index 0000000..9d9f32e --- /dev/null +++ b/.env_hero @@ -0,0 +1,9 @@ +## Hero +ULX_DATA_DIR=/.ulixee +## Chrome Settings +ULX_DISABLE_MITM=# disable the MITM on all requests +ULX_SHOW_CHROME=# always show chrome +ULX_NO_CHROME_SANDBOX=yes# don't force the chrome sandbox +ULX_DISABLE_GPU=# disable the gpu setting on chrome + +ULX_ENABLE_SQLITE_WAL=true# enable write ahead log for sqlite \ No newline at end of file diff --git a/spider_watcher.sh b/spider_watcher.sh index 44c355e..665d311 100755 --- a/spider_watcher.sh +++ b/spider_watcher.sh @@ -16,22 +16,17 @@ watcher() echo "Spider is down, try to restart it." echo "Checking ulixee cloud" - cloud_num=`docker ps | grep 'ulixee_cloud' | grep -v grep | wc -l` + cloud_num=`docker ps | grep 'ulixee_cloud' | grep 'Up ' | grep -v grep | wc -l` if [ $cloud_num -ge 1 ]; then echo "ulixee cloud is alive, start spider" cd $script_root npm start -- config_custom.json else echo "ulixee cloud is down, try to restart it" - cloud_installed=`docker ps -a | grep 'ulixee_cloud' | grep -v grep | wc -l` - if [ $cloud_installed -e 1 ]; then - docker start ulixee_cloud - else - docker stop ulixee_cloud - docker rm ulixee_cloud - cd $script_root - ./start_cloud_in_container.sh - fi + docker stop ulixee_cloud + docker rm ulixee_cloud + cd $script_root + ./start_cloud_in_container.sh sleep 10 fi diff --git a/start_cloud_in_container.sh b/start_cloud_in_container.sh index 8fc364c..4cee548 100755 --- a/start_cloud_in_container.sh +++ b/start_cloud_in_container.sh @@ -38,4 +38,9 @@ docker run -itd --init \ -e DEBUG=$DEBUG \ -e DISPLAY=:99 \ ulixee/ulixee-cloud:latest \ - xvfb-run npx @ulixee/cloud start --port=${port} \ No newline at end of file + xvfb-run npx @ulixee/cloud start --port=${port} + + +# replace hero-core/.env.defaults to disable chrome's sandbox +docker cp .env_hero ulixee_cloud:/app/ulixee/node_modules/@ulixee/hero-core/.env.defaults +docker restart ulixee_cloud \ No newline at end of file