Browse Source

fix cloud start and spider watcher scripts

master
filesite 1 day ago
parent
commit
c83e7b245f
  1. 9
      .env_hero
  2. 15
      spider_watcher.sh
  3. 7
      start_cloud_in_container.sh

9
.env_hero

@ -0,0 +1,9 @@
## Hero
ULX_DATA_DIR=<TMP>/.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

15
spider_watcher.sh

@ -16,22 +16,17 @@ watcher()
echo "Spider is down, try to restart it." echo "Spider is down, try to restart it."
echo "Checking ulixee cloud" 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 if [ $cloud_num -ge 1 ]; then
echo "ulixee cloud is alive, start spider" echo "ulixee cloud is alive, start spider"
cd $script_root cd $script_root
npm start -- config_custom.json npm start -- config_custom.json
else else
echo "ulixee cloud is down, try to restart it" echo "ulixee cloud is down, try to restart it"
cloud_installed=`docker ps -a | grep 'ulixee_cloud' | grep -v grep | wc -l` docker stop ulixee_cloud
if [ $cloud_installed -e 1 ]; then docker rm ulixee_cloud
docker start ulixee_cloud cd $script_root
else ./start_cloud_in_container.sh
docker stop ulixee_cloud
docker rm ulixee_cloud
cd $script_root
./start_cloud_in_container.sh
fi
sleep 10 sleep 10
fi fi

7
start_cloud_in_container.sh

@ -38,4 +38,9 @@ docker run -itd --init \
-e DEBUG=$DEBUG \ -e DEBUG=$DEBUG \
-e DISPLAY=:99 \ -e DISPLAY=:99 \
ulixee/ulixee-cloud:latest \ ulixee/ulixee-cloud:latest \
xvfb-run npx @ulixee/cloud start --port=${port} 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
Loading…
Cancel
Save