ttup / start.sh
Phoe2004's picture
Upload 5 files
3a9972f verified
raw
history blame contribute delete
945 Bytes
#!/bin/bash
# ── Recap Studio startup script (Webhook mode β€” HuggingFace Spaces) ──
echo "===== Application Startup at $(date '+%Y-%m-%d %H:%M:%S') ====="
echo "πŸš€ Starting Recap Studio..."
PORT=${PORT:-7860}
WORKERS=1
THREADS=8
# Kill any stale bot processes (leftover from polling era)
echo "πŸ”ͺ Killing stale bot processes..."
pkill -f "python.*bot.py" 2>/dev/null || true
pkill -f "python.*run_bot.py" 2>/dev/null || true
sleep 2
# NOTE: Webhook registration is handled inside app.py (_start_ptb thread).
# No curl calls to api.telegram.org needed here β€” HuggingFace blocks
# outbound connections to Telegram at startup anyway.
echo "🌐 Starting Gunicorn on port $PORT..."
exec gunicorn app:app \
--bind "0.0.0.0:$PORT" \
--workers $WORKERS \
--threads $THREADS \
--worker-class gthread \
--timeout 120 \
--keep-alive 5 \
--log-level info \
--access-logfile - \
--error-logfile -