Demo-API / entrypoint.sh
Reality123b's picture
Update entrypoint.sh
46fd051 verified
raw
history blame
985 Bytes
#!/bin/bash
# Start MongoDB in the background
echo "Starting MongoDB..."
mongod --dbpath /data/db &
# Function to check if a port is open
check_port() {
timeout 3 bash -c "</dev/tcp/127.0.0.1/$1" 2>/dev/null
}
# Wait for MongoDB to start
until check_port 27017; do
echo "Waiting for MongoDB to start on port 27017..."
sleep 5
done
# Start text-generation-inference server in the background
echo "Starting text-generation-inference server..."
text-generation-launcher --model-id ${MODEL_NAME} --num-shard 1 --port 8080 --disable-custom-kernels --max-batch-prefill-tokens 4096 &
# Wait for text-generation-inference to start
until check_port 8080; do
echo "Waiting for text-generation-inference to start on port 8080..."
sleep 5
done
# Start the chat-ui process
echo "Starting Chat UI..."
dotenv -e /app/.env -c -- node /app/build/index.js -- --host 0.0.0.0 --port ${PORT}
# Wait for any process to exit
wait -n
# Exit with status of process that exited first
exit $?