feat: Add LTI launch, lesson preview, course progress, bookmarks, and asset management features.
This commit is contained in:
+42
-42
@@ -11,22 +11,22 @@
|
||||
set -e
|
||||
|
||||
echo "===================================================="
|
||||
echo " 🚀 Welcome to the OpenCCB Installer"
|
||||
echo " 🚀 Bienvenido al Instalador de OpenCCB"
|
||||
echo "===================================================="
|
||||
echo ""
|
||||
|
||||
# 1. Detection & Cloning
|
||||
# 1. Detección y Clonación
|
||||
if [ -f "Cargo.toml" ] && [ -d "services" ] && [ -d "web" ]; then
|
||||
echo "✅ Project detected in current directory."
|
||||
echo "✅ Proyecto detectado en el directorio actual."
|
||||
PROJECT_ROOT=$(pwd)
|
||||
else
|
||||
# Simplification: assume we are in the project root if the script is running
|
||||
# Simplificación: assume we are in the project root if the script is running
|
||||
# but let's keep a basic check
|
||||
if [ -d "openccb" ]; then
|
||||
cd openccb
|
||||
PROJECT_ROOT=$(pwd)
|
||||
else
|
||||
echo "⚠️ Please run this script from the root of the OpenCCB repository."
|
||||
echo "⚠️ Por favor, ejecuta este script desde la raíz del repositorio de OpenCCB."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
@@ -34,10 +34,10 @@ fi
|
||||
# 2. Prerequisite Installation
|
||||
install_pkg() {
|
||||
if ! command -v "$1" &> /dev/null; then
|
||||
echo "🔧 Installing $1..."
|
||||
echo "🔧 Instalando $1..."
|
||||
sudo apt-get update && sudo apt-get install -y "$1"
|
||||
else
|
||||
echo "✅ $1 is already installed."
|
||||
echo "✅ $1 ya está instalado."
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -55,13 +55,13 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
fi
|
||||
|
||||
if ! command -v cargo &> /dev/null; then
|
||||
echo "🔧 Installing Rust..."
|
||||
echo "🔧 Instalando Rust..."
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||
source $HOME/.cargo/env
|
||||
fi
|
||||
|
||||
if ! command -v node &> /dev/null; then
|
||||
echo "🔧 Installing Node.js via NVM..."
|
||||
echo "🔧 Instalando Node.js vía NVM..."
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||
@@ -69,7 +69,7 @@ if ! command -v node &> /dev/null; then
|
||||
fi
|
||||
|
||||
if ! command -v sqlx &> /dev/null; then
|
||||
echo "🔧 Installing sqlx-cli..."
|
||||
echo "🔧 Instalando sqlx-cli..."
|
||||
cargo install sqlx-cli --no-default-features --features postgres
|
||||
fi
|
||||
|
||||
@@ -93,14 +93,14 @@ update_env() {
|
||||
fi
|
||||
}
|
||||
|
||||
# 5. Remote AI Configuration
|
||||
# 5. Configuración de IA Remota
|
||||
echo ""
|
||||
echo "🔍 Configuring Remote AI Services..."
|
||||
read -p "Enter Remote Ollama URL [http://t-800:11434]: " REMOTE_OLLAMA_URL
|
||||
echo "🔍 Configurando Servicios de IA Remota..."
|
||||
read -p "Ingrese la URL de Ollama Remoto [http://t-800:11434]: " REMOTE_OLLAMA_URL
|
||||
REMOTE_OLLAMA_URL=${REMOTE_OLLAMA_URL:-http://t-800:11434}
|
||||
read -p "Enter Remote Whisper URL [http://t-800:9000]: " REMOTE_WHISPER_URL
|
||||
read -p "Ingrese la URL de Whisper Remoto [http://t-800:9000]: " REMOTE_WHISPER_URL
|
||||
REMOTE_WHISPER_URL=${REMOTE_WHISPER_URL:-http://t-800:9000}
|
||||
read -p "Enter Model name (on remote server) [llama3.2:3b]: " LLM_MODEL
|
||||
read -p "Ingrese el nombre del Modelo (en el servidor remoto) [llama3.2:3b]: " LLM_MODEL
|
||||
LLM_MODEL=${LLM_MODEL:-llama3.2:3b}
|
||||
|
||||
update_env "AI_PROVIDER" "local"
|
||||
@@ -110,9 +110,9 @@ update_env "LOCAL_LLM_MODEL" "$LLM_MODEL"
|
||||
|
||||
# AI setup is now purely remote. Skipping local container configuration.
|
||||
|
||||
# Ask for DB credentials if not set
|
||||
# Solicitar credenciales de DB si no están configuradas
|
||||
if ! grep -q "DATABASE_URL=" .env || [[ $(grep "DATABASE_URL=" .env | cut -d'=' -f2) == "" ]]; then
|
||||
read -p "Enter Database Password [password]: " DB_PASS
|
||||
read -p "Ingrese la Contraseña de la Base de Datos [password]: " DB_PASS
|
||||
DB_PASS=${DB_PASS:-password}
|
||||
update_env "DATABASE_URL" "postgresql://user:${DB_PASS}@localhost:5432/openccb?sslmode=disable"
|
||||
update_env "CMS_DATABASE_URL" "postgresql://user:${DB_PASS}@localhost:5432/openccb_cms?sslmode=disable"
|
||||
@@ -122,21 +122,21 @@ if ! grep -q "DATABASE_URL=" .env || [[ $(grep "DATABASE_URL=" .env | cut -d'='
|
||||
update_env "NEXT_PUBLIC_LMS_API_URL" "http://localhost:3002"
|
||||
fi
|
||||
|
||||
# 5. AI Stack Setup (Skipped - using remote)
|
||||
echo "🌐 Using remote AI services at $REMOTE_OLLAMA_URL and $REMOTE_WHISPER_URL"
|
||||
# 5. Configuración de Pila de IA (Omitido - usando remoto)
|
||||
echo "🌐 Usando servicios de IA remotos en $REMOTE_OLLAMA_URL y $REMOTE_WHISPER_URL"
|
||||
|
||||
# 6. Database Initialization (Integrated db-mgmt.sh)
|
||||
# 6. Inicialización de la Base de Datos
|
||||
echo ""
|
||||
read -p "Do you want a CLEAN installation? (This will DELETE all existing data) [y/N]: " CLEAN_INSTALL
|
||||
read -p "¿Desea una instalación LIMPIA? (Esto ELIMINARÁ todos los datos existentes) [y/N]: " CLEAN_INSTALL
|
||||
if [[ "$CLEAN_INSTALL" =~ ^[Yy]$ ]]; then
|
||||
echo "🐘 Resetting database for a clean installation..."
|
||||
echo "🐘 Reseteando la base de datos para una instalación limpia..."
|
||||
sudo docker compose down -v || true
|
||||
fi
|
||||
|
||||
echo "🐘 Starting database with Docker..."
|
||||
echo "🐘 Iniciando base de datos con Docker..."
|
||||
sudo docker compose up -d db
|
||||
|
||||
echo "⏳ Waiting for database to be ready (container)..."
|
||||
echo "⏳ Esperando a que la base de datos esté lista (contenedor)..."
|
||||
RETRIES=30
|
||||
until sudo docker exec openccb-db-1 pg_isready -U user &> /dev/null || [ $RETRIES -eq 0 ]; do
|
||||
echo -n "."
|
||||
@@ -145,7 +145,7 @@ until sudo docker exec openccb-db-1 pg_isready -U user &> /dev/null || [ $RETRIE
|
||||
done
|
||||
echo ""
|
||||
|
||||
echo "⏳ Waiting for database port (host)..."
|
||||
echo "⏳ Esperando al puerto de la base de datos (host)..."
|
||||
RETRIES=10
|
||||
until curl -s localhost:5432 &> /dev/null || [ $RETRIES -eq 0 ]; do
|
||||
echo -n "+"
|
||||
@@ -155,7 +155,7 @@ done
|
||||
echo ""
|
||||
|
||||
if [ $RETRIES -eq 0 ]; then
|
||||
echo "⚠️ Wait for host port timed out, but continuing..."
|
||||
echo "⚠️ Tiempo de espera agotado para el puerto del host, pero continuando..."
|
||||
fi
|
||||
|
||||
# Extra buffer for PostgreSQL initialization
|
||||
@@ -164,7 +164,7 @@ sleep 2
|
||||
CMS_URL=$(grep "CMS_DATABASE_URL=" .env | cut -d'=' -f2-)
|
||||
LMS_URL=$(grep "LMS_DATABASE_URL=" .env | cut -d'=' -f2-)
|
||||
|
||||
echo "🏗️ Creating databases and running migrations..."
|
||||
echo "🏗️ Creando bases de datos y ejecutando migraciones..."
|
||||
DATABASE_URL=$CMS_URL sqlx database create || true
|
||||
DATABASE_URL=$LMS_URL sqlx database create || true
|
||||
DATABASE_URL=$CMS_URL sqlx migrate run --source services/cms-service/migrations
|
||||
@@ -172,27 +172,27 @@ DATABASE_URL=$LMS_URL sqlx migrate run --source services/lms-service/migrations
|
||||
|
||||
# 7. System Initialization (Integrated init-system.sh)
|
||||
echo ""
|
||||
echo "🔍 Checking for existing administrator..."
|
||||
echo "🔍 Buscando administrador existente..."
|
||||
ADMIN_EXISTS=$(sudo docker exec openccb-db-1 psql -U user -d openccb_cms -t -c "SELECT EXISTS (SELECT 1 FROM users WHERE role = 'admin');" | xargs 2>/dev/null || echo "f")
|
||||
|
||||
if [ "$ADMIN_EXISTS" != "t" ]; then
|
||||
echo "👤 Configure Initial Administrator"
|
||||
read -p "Full Name [System Admin]: " ADMIN_NAME
|
||||
ADMIN_NAME=${ADMIN_NAME:-System Admin}
|
||||
read -p "Admin Email [admin@example.com]: " ADMIN_EMAIL
|
||||
echo "👤 Configurar Administrador Inicial"
|
||||
read -p "Nombre Completo [Administrador del Sistema]: " ADMIN_NAME
|
||||
ADMIN_NAME=${ADMIN_NAME:-Administrador del Sistema}
|
||||
read -p "Email del Administrador [admin@example.com]: " ADMIN_EMAIL
|
||||
ADMIN_EMAIL=${ADMIN_EMAIL:-admin@example.com}
|
||||
read -s -p "Admin Password [password123]: " ADMIN_PASS
|
||||
read -s -p "Contraseña del Administrador [password123]: " ADMIN_PASS
|
||||
ADMIN_PASS=${ADMIN_PASS:-password123}
|
||||
echo ""
|
||||
ORG_NAME="Default Organization"
|
||||
ORG_NAME="Organización por Defecto"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "🚀 Starting all services..."
|
||||
echo "🚀 Iniciando todos los servicios..."
|
||||
sudo docker compose up -d --build
|
||||
|
||||
if [ "$ADMIN_EXISTS" != "t" ]; then
|
||||
echo "⏳ Waiting for CMS API to be ready..."
|
||||
echo "⏳ Esperando a que el API CMS esté listo..."
|
||||
API_URL="http://localhost:3001"
|
||||
START_WAIT=$SECONDS
|
||||
PAYLOAD=$(cat <<EOF
|
||||
@@ -209,20 +209,20 @@ EOF
|
||||
RESPONSE=$(curl -s -X POST "$API_URL/auth/register" -H "Content-Type: application/json" -d "$PAYLOAD")
|
||||
|
||||
if echo "$RESPONSE" | grep -q "token"; then
|
||||
echo "✅ Success! Administrator created."
|
||||
echo "✅ ¡Éxito! Administrador creado."
|
||||
# Generate and show initial API Key
|
||||
API_KEY=$(sudo docker exec openccb-db-1 psql -U user -d openccb_cms -t -c "SELECT api_key FROM organizations WHERE name = 'Default Organization' LIMIT 1;" | xargs)
|
||||
echo "🔑 Initial API Key: $API_KEY"
|
||||
API_KEY=$(sudo docker exec openccb-db-1 psql -U user -d openccb_cms -t -c "SELECT api_key FROM organizations WHERE name = 'Organización por Defecto' LIMIT 1;" | xargs)
|
||||
echo "🔑 API Key Inicial: $API_KEY"
|
||||
else
|
||||
echo "⚠️ Failed to create administrator."
|
||||
echo "⚠️ Fallo al crear el administrador."
|
||||
fi
|
||||
else
|
||||
echo "✅ Administrator already exists. Skipping registration."
|
||||
echo "✅ El administrador ya existe. Saltando registro."
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "===================================================="
|
||||
echo " ✨ OpenCCB Installation Complete!"
|
||||
echo " ✨ ¡Instalación de OpenCCB Completa!"
|
||||
echo "===================================================="
|
||||
echo "Studio (Admin/CMS): http://localhost:3000"
|
||||
echo "Experience (LMS): http://localhost:3003"
|
||||
|
||||
Reference in New Issue
Block a user