f5d6745ed0
Full-stack IPTV management system with Xtream Codes API compatibility, multi-account provider fan-out, Jellyfin local library integration, real-time dashboard, EPG support, and A/V-sync-safe stream recovery.
47 lines
1.0 KiB
Bash
47 lines
1.0 KiB
Bash
#!/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
|