#! /bin/bash ##################################### # Start text2vec-transformers and # # Weaviate DB to run asynchronously # # and wait. # ##################################### exec &> /app/startup.log echo "#### before nvidia-smi: "; nvidia-smi #echo "#### pip3 list"; pip3 list stdbuf -o0 echo "#### startup.sh entered." #stdbuf -o0 echo "### ps -ef 1"; ps -ef # Is startup.sh already running? #stdbuf -o0 echo " " #stdbuf -o0 echo "### before ps and grep startup.sh" #stdbuf -o0 ps -ef | grep -i startup.sh #cnt=$(ps -ef | grep -i startup.sh | wc -l) #stdbuf -o0 echo "### cnt: $cnt" #if [ $cnt -gt 1 ];then # stdbuf -o0 echo "#### startup.sh already running. Exiting." # exit 0 #fi # Make sure Weaviate DB directory exists. stdbuf -o0 echo "### Before mkdir -p ~/data/var/lib/weaviate" weaviateDir=~/data/var/lib/weaviate mkdir -p $weaviateDir chmod -R 777 $weaviateDir # TEMP TEST #ls -l /usr/bin | grep -i python; ls -l /usr/local/bin | grep -i python || test '1 .gt 0' #ln -s /usr/local/bin/python /usr/bin/python3.11 #ls -l /usr/local/bin | grep -i python|| test '1 .gt 0' # Start tex2vec-transformers stdbuf -o0 echo "#### Before /app/text2vec-transformers" ls -l /usr/local/bin/python3.11 || ls -l /usr/local/bin || test '1 .gt 0' cd /app/text2vec-transformers #stdbuf -o0 echo "####### ls of /app/text2vec-transformers/bin"; ls -l /app/text2vec-transformers/bin; ls -l /app/text2vec-transformers /app/text2vec-transformers/bin/uvicorn app:app --host 0.0.0.0 --port 8081 --log-level warning --timeout-keep-alive 1440 & stdbuf -o0 echo "### After text2vec start. RC=$?" cd /app # Start the weaviate vector database server. stdbuf -o0 echo "#### Before /app/weaviate" export AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED=true \ PERSISTENCE_DATA_PATH=$weaviateDir \ DEFAULT_VECTORIZER_MODULE=text2vec-transformers \ ENABLE_MODULES=text2vec-transformers \ TRANSFORMERS_INFERENCE_API=http://127.0.0.1:8081 \ LOG_LEVEL=warning \ MODULES_CLIENT_TIMEOUT=600s #echo "### Before sleep 10 before starting Weaviate." sleep 10 /app/weaviate/weaviate --host 127.0.0.1 --port 8080 --scheme http --write-timeout 600s & stdbuf -o0 echo "### After Weaviate DB start. RC=$?" #echo "### Before sleep 120" #sleep 120 stdbuf -o0 echo "### ps -ef 2: "; ps -ef wait