Semnykcz commited on
Commit
d21c4cd
·
verified ·
1 Parent(s): 01bc58a

Create start.sh

Browse files
Files changed (1) hide show
  1. start.sh +23 -0
start.sh ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ echo "[start] MODELS_DIR=${MODELS_DIR:-/grpc-models}"
5
+ echo "[start] MODEL_URLS length: ${#MODEL_URLS}"
6
+
7
+ # 1) Optional: download models listed in env MODEL_URLS
8
+ /srv/model_download.sh || true
9
+
10
+ # 2) Start the Draw Things gRPC server (non-blocking)
11
+ /usr/local/bin/gRPCServerCLI "${MODELS_DIR}" &
12
+ SERVER_PID=$!
13
+ echo "[start] gRPCServerCLI started (pid=${SERVER_PID}) on 127.0.0.1:${GRPC_PORT}"
14
+
15
+ # 3) Forward Hugging Face public $PORT -> local ${GRPC_PORT}
16
+ if [[ -z "${PORT:-}" ]]; then
17
+ echo "[start][warn] \$PORT not set by runtime. Defaulting to 7860."
18
+ PORT=7860
19
+ fi
20
+
21
+ echo "[start] Forwarding public :${PORT} -> 127.0.0.1:${GRPC_PORT}"
22
+ # -socat- will keep running in foreground as PID 1
23
+ exec socat TCP-LISTEN:${PORT},fork,reuseaddr TCP:127.0.0.1:${GRPC_PORT}