1Egyb commited on
Commit
1f4a4db
·
verified ·
1 Parent(s): afe3401

Update entrypoint.sh

Browse files
Files changed (1) hide show
  1. entrypoint.sh +37 -14
entrypoint.sh CHANGED
@@ -1,22 +1,45 @@
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 $?
 
1
  #!/bin/bash
2
+ set -e
3
 
4
+ # الانتقال إلى مجلد التطبيق
5
+ cd /app
6
+
7
+ # إنشاء مجلدات البيانات
8
  mkdir -p /data/db
 
 
 
 
9
 
10
+ # تنظيف ملفات القفل القديمة
11
+ find /data/db -name "*.lock" -type f -delete 2>/dev/null || true
12
 
13
+ # بدء MongoDB في الخلفية
14
+ echo "بدء MongoDB..."
15
+ mongod --bind_ip_all --dbpath /data/db --fork --logpath /data/mongod.log
16
 
17
+ # بدء TGI
18
+ echo "بدء نموذج الذكاء الاصطناعي..."
19
+ text-generation-launcher \
20
+ --model-id ${MODEL_NAME:-"mistralai/Mistral-7B-Instruct-v0.1"} \
21
+ --num-shard 1 \
22
+ --port 8080 \
23
+ --trust-remote-code &
24
+
25
+ # الانتظار حتى يبدأ TGI
26
+ echo "الانتظار حتى يبدأ نموذج الذكاء الاصطناعي..."
27
+ sleep 15
28
+
29
+ # التحقق من صحة TGI
30
+ echo "التحقق من صحة النموذج..."
31
+ curl -f --retry 10 --retry-delay 5 --retry-connrefused \
32
+ http://127.0.0.1:8080/health || echo "تحذير: فشل التحقق من صحة النموذج"
33
 
34
+ # نسخ .env.local إلى .env إذا لزم الأمر
35
+ if [ -f .env.local ] && [ ! -f .env ]; then
36
+ cp .env.local .env
37
+ fi
38
+
39
+ # بدء Chat UI
40
+ echo "بدء واجهة المحادثة..."
41
+ dotenv -e .env -c -- node build/index.js --host 0.0.0.0 --port 3000
42
+
43
+ # انتظار العمليات
44
+ wait -n
45
  exit $?