Spaces:
Sleeping
Sleeping
Update start.sh
Browse files
start.sh
CHANGED
|
@@ -3,32 +3,28 @@ set -e
|
|
| 3 |
|
| 4 |
echo "==== Server Initialization ===="
|
| 5 |
|
| 6 |
-
# ---
|
| 7 |
-
echo ">>
|
| 8 |
-
|
| 9 |
-
python3 download_world.py || echo "⚠️ Using default world"
|
| 10 |
-
fi
|
| 11 |
-
|
| 12 |
-
# --- Server Configuration ---
|
| 13 |
-
echo ">> Setting up server environment..."
|
| 14 |
-
echo "eula=true" > eula.txt
|
| 15 |
|
| 16 |
-
if [ ! -f "server.properties" ]; then
|
| 17 |
-
echo "
|
| 18 |
-
echo "
|
|
|
|
| 19 |
else
|
| 20 |
-
sed -i "s/^server-port=.*/server-port=25565/"
|
| 21 |
-
sed -i "s/^query.port=.*/query.port=25565/"
|
| 22 |
fi
|
| 23 |
|
| 24 |
chmod -R 777 /app 2>/dev/null || true
|
| 25 |
|
| 26 |
-
#
|
|
|
|
|
|
|
|
|
|
| 27 |
echo "=========================================================="
|
| 28 |
-
echo ">> Starting
|
| 29 |
-
echo "
|
| 30 |
-
echo ">> Open the Hugging Face Space URL in your browser to access the Console and File Manager!"
|
| 31 |
echo "=========================================================="
|
| 32 |
|
| 33 |
-
|
| 34 |
-
exec python3 panel.py
|
|
|
|
| 3 |
|
| 4 |
echo "==== Server Initialization ===="
|
| 5 |
|
| 6 |
+
# --- Server Configuration (runs instantly, no download here) ---
|
| 7 |
+
echo ">> Writing eula.txt and server.properties..."
|
| 8 |
+
echo "eula=true" > /app/eula.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
if [ ! -f "/app/server.properties" ]; then
|
| 11 |
+
echo "server-port=25565" > /app/server.properties
|
| 12 |
+
echo "query.port=25565" >> /app/server.properties
|
| 13 |
+
echo "online-mode=false" >> /app/server.properties
|
| 14 |
else
|
| 15 |
+
sed -i "s/^server-port=.*/server-port=25565/" /app/server.properties
|
| 16 |
+
sed -i "s/^query\.port=.*/query.port=25565/" /app/server.properties
|
| 17 |
fi
|
| 18 |
|
| 19 |
chmod -R 777 /app 2>/dev/null || true
|
| 20 |
|
| 21 |
+
# KEY FIX: Start the web panel FIRST so HuggingFace health-check passes.
|
| 22 |
+
# World download + Minecraft boot now happen as background async tasks
|
| 23 |
+
# inside panel.py's lifespan — the HTTP server is ready on port 7860
|
| 24 |
+
# before any slow download begins.
|
| 25 |
echo "=========================================================="
|
| 26 |
+
echo ">> Starting Panel on port 7860 (world download will run"
|
| 27 |
+
echo " in background after the server is already listening)."
|
|
|
|
| 28 |
echo "=========================================================="
|
| 29 |
|
| 30 |
+
exec python3 /app/panel.py
|
|
|