-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·32 lines (28 loc) · 1.2 KB
/
Copy pathstart.sh
File metadata and controls
executable file
·32 lines (28 loc) · 1.2 KB
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
#!/usr/bin/env bash
# ─────────────────────────────────────────────────────────────
# start.sh — Runs FastAPI backend + Streamlit frontend
# in a single Render web service.
#
# • FastAPI → localhost:8000 (internal, not exposed)
# • Streamlit → $PORT (Render exposes this)
# ─────────────────────────────────────────────────────────────
set -e
echo "🚀 Starting SafeSpace..."
# 1) Launch FastAPI backend in the background on port 8000
echo " ↳ Starting FastAPI backend on :8000 ..."
gunicorn main:app \
-k uvicorn.workers.UvicornWorker \
--bind 0.0.0.0:8000 \
--workers 2 \
--timeout 120 \
--access-logfile - \
&
# Give the backend a moment to bind
sleep 3
# 2) Launch Streamlit frontend on $PORT (foreground)
echo " ↳ Starting Streamlit frontend on :${PORT} ..."
exec streamlit run streamlit_app.py \
--server.port="${PORT}" \
--server.address=0.0.0.0 \
--server.headless=true \
--browser.gatherUsageStats=false