Spaces:
Runtime error
Runtime error
Switch to plain FastAPI debug Space
Browse files
scripts/start_minimal_space.sh
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env sh
|
| 2 |
+
set -eu
|
| 3 |
+
|
| 4 |
+
log() {
|
| 5 |
+
line="[$(date '+%Y-%m-%dT%H:%M:%S%z')] $*"
|
| 6 |
+
echo "$line" | tee -a /tmp/minimal-space.log >&2
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
log "start_minimal_space.sh begin"
|
| 10 |
+
log "python version check begin"
|
| 11 |
+
python --version 2>&1 | tee -a /tmp/minimal-space.log >&2
|
| 12 |
+
log "python version check end"
|
| 13 |
+
log "import check begin"
|
| 14 |
+
python - <<'PY' 2>&1 | tee -a /tmp/minimal-space.log >&2
|
| 15 |
+
import fastapi
|
| 16 |
+
import uvicorn
|
| 17 |
+
print(f"fastapi={fastapi.__version__}")
|
| 18 |
+
print(f"uvicorn={uvicorn.__version__}")
|
| 19 |
+
PY
|
| 20 |
+
log "import check end"
|
| 21 |
+
log "starting heartbeat loop"
|
| 22 |
+
(
|
| 23 |
+
while true; do
|
| 24 |
+
log "heartbeat"
|
| 25 |
+
sleep 5
|
| 26 |
+
done
|
| 27 |
+
) &
|
| 28 |
+
log "launching uvicorn"
|
| 29 |
+
exec python -m uvicorn minimal_static_app:app --host 0.0.0.0 --port 8000 --log-level debug --access-log
|