livekit añadido

This commit is contained in:
2025-11-10 16:16:34 +01:00
parent d13ab16256
commit 20501ab8bc
12 changed files with 446 additions and 18 deletions
+54 -7
View File
@@ -12,6 +12,10 @@ YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
LIVEKIT_COMPOSE_FILE="docker-compose.livekit.yml"
LIVEKIT_CONFIG_FILE="configs/livekit/livekit.yaml"
LIVEKIT_CONFIG_TEMPLATE="configs/livekit/livekit.example.yaml"
# Verificar Docker
if ! command -v docker &> /dev/null; then
echo -e "${RED}❌ Docker no está instalado${NC}"
@@ -50,6 +54,33 @@ fi
echo -e "${BLUE}📁 Creando directorios...${NC}"
mkdir -p synapse_data/appservices
mkdir -p backups
mkdir -p configs/livekit
# Crear volúmenes externos requeridos por docker-compose si no existen
for volume in matrix_postgres_data; do
if ! docker volume ls --format '{{.Name}}' | grep -qx "$volume"; then
echo -e "${BLUE}🗄️ Creando volumen Docker $volume...${NC}"
docker volume create "$volume" >/dev/null
echo -e "${GREEN}✅ Volumen $volume creado${NC}"
else
echo -e "${YELLOW}️ Volumen $volume ya existe${NC}"
fi
done
# Verificar configuración de LiveKit
if [ ! -f "${LIVEKIT_CONFIG_FILE}" ]; then
if [ -f "${LIVEKIT_CONFIG_TEMPLATE}" ]; then
cp "${LIVEKIT_CONFIG_TEMPLATE}" "${LIVEKIT_CONFIG_FILE}"
fi
echo -e "${RED}❌ No se encontró ${LIVEKIT_CONFIG_FILE}${NC}"
echo -e "${YELLOW} Se creó una plantilla base, edítala antes de continuar.${NC}"
exit 1
fi
if [ ! -f "${LIVEKIT_COMPOSE_FILE}" ]; then
echo -e "${RED}❌ Falta ${LIVEKIT_COMPOSE_FILE}. No se puede iniciar LiveKit.${NC}"
exit 1
fi
# Generar configuración de Synapse si no existe
if [ ! -f synapse_data/homeserver.yaml ]; then
@@ -74,6 +105,8 @@ fi
echo -e "${BLUE}🐳 Iniciando contenedores...${NC}"
docker-compose up -d
echo -e "${BLUE}📡 Iniciando LiveKit + lk-jwt...${NC}"
docker-compose -f "${LIVEKIT_COMPOSE_FILE}" up -d
echo -e "${BLUE}⏳ Esperando que los servicios estén listos...${NC}"
sleep 20
@@ -81,15 +114,29 @@ sleep 20
# Verificar que todos los servicios estén funcionando
echo -e "${BLUE}🔍 Verificando servicios...${NC}"
services=("postgres:5432" "synapse:8008" "element:8081" "synapse-admin:8082")
services=(
"postgres:5432:tcp"
"synapse:8008:http"
"element:8081:http"
"synapse-admin:8082:http"
"livekit:${LIVEKIT_HTTP_PORT:-7880}:http"
"livekit-jwt:${LIVEKIT_JWT_PORT:-6080}:http"
)
for service in "${services[@]}"; do
name=${service%:*}
port=${service#*:}
IFS=":" read -r name port proto <<<"$service"
if curl -s http://localhost:$port > /dev/null 2>&1; then
echo -e "${GREEN}$name (puerto $port) - OK${NC}"
if [ "$proto" = "http" ]; then
if curl -s --max-time 5 "http://localhost:$port" > /dev/null 2>&1; then
echo -e "${GREEN}$name (puerto $port) - OK${NC}"
else
echo -e "${RED}$name (puerto $port) - ERROR${NC}"
fi
else
echo -e "${RED}$name (puerto $port) - ERROR${NC}"
if timeout 5 bash -c "cat < /dev/null > /dev/tcp/localhost/$port" > /dev/null 2>&1; then
echo -e "${GREEN}$name (puerto $port) - OK${NC}"
else
echo -e "${RED}$name (puerto $port) - ERROR${NC}"
fi
fi
done
@@ -118,4 +165,4 @@ echo -e "${BLUE}🔐 Credenciales de administrador:${NC}"
echo -e " • Usuario: ${GREEN}${ADMIN_USERNAME}${NC}"
echo -e " • Contraseña: ${GREEN}${ADMIN_PASSWORD}${NC}"
echo
echo -e "${YELLOW}💡 Para crear más usuarios usa: ./scripts/create-user.sh${NC}"
echo -e "${YELLOW}💡 Para crear más usuarios usa: ./scripts/create-user.sh${NC}"