Spaces:
Runtime error
Runtime error
Update entrypoint.sh
Browse files- entrypoint.sh +9 -24
entrypoint.sh
CHANGED
|
@@ -1,37 +1,22 @@
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
-
#
|
| 4 |
mkdir -p /data/db
|
| 5 |
-
# If app crashed,
|
| 6 |
-
find /data/db -name "*.lock" -type f -exec rm -f {} \;
|
| 7 |
-
|
| 8 |
# Start the local Mongo database
|
| 9 |
mongod &
|
| 10 |
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
echo "Waiting for MongoDB to start..."
|
| 14 |
-
sleep 2
|
| 15 |
-
done
|
| 16 |
-
|
| 17 |
-
# Set the Hugging Face API URL and Token
|
| 18 |
-
HF_API_URL="https://api-inference.huggingface.co/models/${MODEL_NAME}"
|
| 19 |
-
HF_TOKEN=${HF_TOKEN}
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
|
| 23 |
-
echo "Error: HF_TOKEN is not set. Exiting."
|
| 24 |
-
exit 1
|
| 25 |
-
fi
|
| 26 |
-
|
| 27 |
-
# Configure Chat-UI to use the Hugging Face Inference API
|
| 28 |
-
export HF_API_URL HF_TOKEN
|
| 29 |
|
| 30 |
# Start the chat-ui process
|
| 31 |
dotenv -e /app/.env -c -- node /app/build/index.js -- --host 0.0.0.0 --port 3000
|
| 32 |
-
|
| 33 |
# Wait for any process to exit
|
| 34 |
wait -n
|
| 35 |
|
| 36 |
-
# Exit with
|
| 37 |
-
exit $?
|
|
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
+
# Make sure `/data/db` directory exists even with persistent storage
|
| 4 |
mkdir -p /data/db
|
| 5 |
+
# If app crashed, mongo didn't stop gracefully. Remove all the old *.lock files
|
| 6 |
+
find /data/db -name "*.lock" -type f -exec rm -f {} \;
|
|
|
|
| 7 |
# Start the local Mongo database
|
| 8 |
mongod &
|
| 9 |
|
| 10 |
+
# Start the text-generation-inference process
|
| 11 |
+
text-generation-launcher --model-id ${MODEL_NAME} --num-shard 1 --port 8080 --trust-remote-code &
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
+
# Wait for text-generation-inference to start
|
| 14 |
+
curl --retry 60 --retry-delay 10 --retry-connrefused http://127.0.0.1:8080/health
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
# Start the chat-ui process
|
| 17 |
dotenv -e /app/.env -c -- node /app/build/index.js -- --host 0.0.0.0 --port 3000
|
|
|
|
| 18 |
# Wait for any process to exit
|
| 19 |
wait -n
|
| 20 |
|
| 21 |
+
# Exit with status of process that exited first
|
| 22 |
+
exit $?
|