Reality123b commited on
Commit
c656994
·
verified ·
1 Parent(s): 1c9f7a4

Update entrypoint.sh

Browse files
Files changed (1) hide show
  1. entrypoint.sh +24 -10
entrypoint.sh CHANGED
@@ -1,20 +1,34 @@
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
 
 
1
  #!/bin/bash
2
 
3
+ # Start MongoDB in the background
4
+ echo "Starting MongoDB..."
5
+ mongod --dbpath /data/db &
 
 
 
6
 
7
+ # Function to check if a port is open
8
+ check_port() {
9
+ timeout 3 bash -c "</dev/tcp/127.0.0.1/$1" 2>/dev/null
10
+ }
11
+
12
+ # Wait for MongoDB to start
13
+ until check_port 27017; do
14
+ echo "Waiting for MongoDB to start on port 27017..."
15
+ sleep 5
16
+ done
17
+
18
+ # Start text-generation-inference server in the background
19
+ echo "Starting text-generation-inference server..."
20
+ text-generation-launcher --model-id ${MODEL_NAME} --num-shard 1 --port 8080 --disable-custom-kernels &
21
 
22
  # Wait for text-generation-inference to start
23
+ until check_port 8080; do
24
+ echo "Waiting for text-generation-inference to start on port 8080..."
25
+ sleep 5
26
+ done
27
 
28
  # Start the chat-ui process
29
+ echo "Starting Chat UI..."
30
+ dotenv -e /app/.env -c -- node /app/build/index.js -- --host 0.0.0.0 --port ${PORT}
31
+
32
  # Wait for any process to exit
33
  wait -n
34