Spaces:
Paused
Paused
File size: 928 Bytes
5eb4857 5df0bfe 5eb4857 cc4d4a7 5eb4857 | 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 | #!/bin/bash
# Production Entrypoint for Hugging Face Spaces
# This script runs both the FastAPI API and the Arq Worker in the same container.
echo "--- NEXUS PRODUCTION BOOTSTRAP ---"
# Start Local Redis for Caching (Ephemeral)
echo "[0/3] Starting Local Redis..."
redis-server --daemonize yes --port 6379
# Start Arq Worker in the background
echo "[1/2] Starting Nexus AI Worker (arq)..."
# Persistence Mapping: Use the /data mount if available
if [ -d "/data" ]; then
echo "--- PERSISTENT STORAGE DETECTED (/data) ---"
mkdir -p /data/uploads /data/logs
export UPLOAD_DIR="/data/uploads"
export LOG_DIR="/data/logs"
fi
arq nexus_worker.WorkerSettings &
# Start FastAPI API in the foreground
APP_PORT=${PORT:-7860}
echo "[2/2] Starting Nexus Master API (uvicorn) on port ${APP_PORT}..."
uvicorn main:app --host 0.0.0.0 --port ${APP_PORT} --log-level info
# Wait for all processes to exit
wait -n
exit $?
|