boffire commited on
Commit
ada402f
·
verified ·
1 Parent(s): 69d03c5

Update start.sh

Browse files
Files changed (1) hide show
  1. start.sh +7 -5
start.sh CHANGED
@@ -1,17 +1,18 @@
1
  #!/bin/bash
2
  set -e
3
 
4
- # 1. Start LibreTranslate internally (not reachable from outside)
5
  /app/venv/bin/libretranslate &
6
  LT_PID=$!
7
 
8
  # 2. Wait until it responds
9
- echo "Waiting for LibreTranslate..."
10
  for i in {1..30}; do
11
  if curl -s http://127.0.0.1:5000/ >/dev/null 2>&1; then
12
- echo "LibreTranslate ready on port 5000"
13
  break
14
  fi
 
15
  sleep 2
16
  done
17
 
@@ -23,5 +24,6 @@ done
23
  done
24
  ) &
25
 
26
- # 4. Public-facing proxy on HF Spaces port 7860
27
- cd /app && exec /app/venv/bin/uvicorn proxy:app --host 0.0.0.0 --port 7860
 
 
1
  #!/bin/bash
2
  set -e
3
 
4
+ # 1. Start LibreTranslate internally (env vars LT_HOST/LT_PORT are already set)
5
  /app/venv/bin/libretranslate &
6
  LT_PID=$!
7
 
8
  # 2. Wait until it responds
9
+ echo "Waiting for LibreTranslate on 127.0.0.1:5000..."
10
  for i in {1..30}; do
11
  if curl -s http://127.0.0.1:5000/ >/dev/null 2>&1; then
12
+ echo "LibreTranslate ready"
13
  break
14
  fi
15
+ echo " ... retry $i/30"
16
  sleep 2
17
  done
18
 
 
24
  done
25
  ) &
26
 
27
+ # 4. Start the public-facing proxy (this is the foreground process)
28
+ cd /app
29
+ exec /app/venv/bin/uvicorn proxy:app --host 0.0.0.0 --port 7860