Spaces:
Sleeping
Sleeping
Create start.sh
Browse files
start.sh
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
set -e
|
| 3 |
+
|
| 4 |
+
echo "===== Application Startup ====="
|
| 5 |
+
echo "Starting Elasticsearch..."
|
| 6 |
+
|
| 7 |
+
# Start Elasticsearch in the background
|
| 8 |
+
/usr/share/elasticsearch/bin/elasticsearch > /tmp/es.log 2>&1 &
|
| 9 |
+
|
| 10 |
+
# Wait until Elasticsearch is ready
|
| 11 |
+
echo "Waiting for Elasticsearch to be ready..."
|
| 12 |
+
until curl -s http://localhost:9200 >/dev/null 2>&1; do
|
| 13 |
+
sleep 2
|
| 14 |
+
done
|
| 15 |
+
echo "✅ Elasticsearch is up!"
|
| 16 |
+
|
| 17 |
+
# Optional: show Elasticsearch logs (for debugging)
|
| 18 |
+
tail -n 20 /tmp/es.log
|
| 19 |
+
|
| 20 |
+
# Start FastAPI app
|
| 21 |
+
echo "Starting FastAPI app..."
|
| 22 |
+
exec uvicorn main:app --host 0.0.0.0 --port 7860
|