Mejoras de estabilidad de stream IPTV y nuevo registro de fallos
- restream.py: eliminar -reconnect_streamed de ffmpeg para evitar rebobinados al reconectar (el proveedor re-enviaba desde keyframe anterior causando PTS backward). El loop de Python gestiona las reconexiones con conexión fresca. - restream.py: eliminar _drain_queue del loop de reconexión para que el buffer de la cola cubra el tiempo de reconexión sin pantalla negra en el player. - restream.py: añadir buffer_server_bytes/secs/capacity a stats() y método _log_stream_event() para persistir eventos de caída y recuperación en BD. - models/stream_event.py: nuevo modelo StreamEvent para registro de fallos. - database.py: registrar StreamEvent en init_db. - api/admin/logs.py: nuevos endpoints GET/DELETE /logs/events. - Dashboard.tsx: mostrar reserva de buffer del servidor (capacidad + estado). - Logs.tsx: añadir pestaña "Fallos de stream" con tabla de eventos persistidos. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Executable
+46
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
# KiraStream installation/startup script for PCT 117 (kiraIPTV)
|
||||
set -e
|
||||
|
||||
APP_DIR=/opt/kirastream
|
||||
VENV="$APP_DIR/venv"
|
||||
PYTHON="$VENV/bin/python"
|
||||
UV="$VENV/bin/uvicorn"
|
||||
|
||||
echo "=== KiraStream startup ==="
|
||||
|
||||
# Fix locale for Redis
|
||||
export LANG=C
|
||||
export LC_ALL=C
|
||||
|
||||
# --- PostgreSQL ---
|
||||
if ! pg_ctlcluster 17 main status &>/dev/null; then
|
||||
echo "Starting PostgreSQL..."
|
||||
pg_ctlcluster 17 main start
|
||||
fi
|
||||
|
||||
# Ensure DB exists
|
||||
su - postgres -s /bin/bash -c "createdb -O kirastream kirastream 2>/dev/null || true"
|
||||
|
||||
# --- Redis ---
|
||||
if ! redis-cli ping &>/dev/null; then
|
||||
echo "Starting Redis..."
|
||||
LANG=C LC_ALL=C redis-server \
|
||||
--port 6379 \
|
||||
--bind 127.0.0.1 \
|
||||
--daemonize yes \
|
||||
--logfile /var/log/redis/kirastream-redis.log \
|
||||
--dir /var/lib/redis/
|
||||
sleep 1
|
||||
fi
|
||||
|
||||
# --- Backend ---
|
||||
echo "Starting KiraStream backend..."
|
||||
cd "$APP_DIR"
|
||||
exec "$UV" backend.main:app \
|
||||
--host 0.0.0.0 \
|
||||
--port 8000 \
|
||||
--workers 4 \
|
||||
--loop uvloop \
|
||||
--log-level info \
|
||||
--access-log
|
||||
Reference in New Issue
Block a user