Spaces:
Sleeping
Sleeping
File size: 1,418 Bytes
8571508 c2efb27 8571508 f11b983 8571508 c2efb27 8571508 5352cc8 c2efb27 8571508 5352cc8 f11b983 5352cc8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
#!/bin/bash
echo "π Starting multi-service system..."
export PYTHONPATH="/app"
# DOC SERVICE
uvicorn src.doc_service.app:app --host 0.0.0.0 --port 9001 &
# EMBED SERVICE
uvicorn src.embed_service.app:app --host 0.0.0.0 --port 9002 &
# SEARCH SERVICE
uvicorn src.search_service.app:app --host 0.0.0.0 --port 9003 &
# EXPLAIN SERVICE
uvicorn src.explain_service.app:app --host 0.0.0.0 --port 9004 &
# API GATEWAY
uvicorn src.api_gateway.app:app --host 0.0.0.0 --port 8000 &
# Wait for all services to boot
sleep 8
echo "β
All microservices running!"
# --------------------------
# AUTO INITIALIZE PIPELINE
# --------------------------
echo "π Running auto-initialize (load β embed β build index)..."
MAX_TRIES=5
DELAY=4
i=1
while [ $i -le $MAX_TRIES ]; do
echo "Attempt $i / $MAX_TRIES ..."
STATUS=$(curl -s -o /tmp/init_output.json -w "%{http_code}" -X POST http://localhost:8000/initialize)
if [ "$STATUS" = "200" ]; then
echo "β
Auto-initialize complete."
cat /tmp/init_output.json
break
fi
echo "β Initialization failed (status $STATUS). Retrying in $DELAY seconds..."
sleep $DELAY
i=$((i+1))
done
if [ $i -gt $MAX_TRIES ]; then
echo "β Auto-initialize failed after $MAX_TRIES attempts."
fi
# --------------------------
# Start Streamlit UI
# --------------------------
streamlit run src/ui/streamlit_app.py \
--server.port=7860 \
--server.address=0.0.0.0
|