Initial commit

This commit is contained in:
2026-03-07 11:07:45 -03:00
commit 9d523f8b6a
65 changed files with 17311 additions and 0 deletions

83
infra/setup.sh Executable file
View File

@@ -0,0 +1,83 @@
#!/usr/bin/env bash
set -e
BOLD="\033[1m"
GREEN="\033[0;32m"
YELLOW="\033[1;33m"
RED="\033[0;31m"
RESET="\033[0m"
echo -e "${BOLD}SupplementEvidence Engine — Setup${RESET}"
echo "======================================"
# ── 1. Check Docker ─────────────────────────────────────────────────────────
echo -e "\n${BOLD}[1/4] Verificando Docker...${RESET}"
if ! command -v docker &>/dev/null; then
echo -e "${RED}✗ Docker no está instalado. Instálalo desde https://www.docker.com${RESET}"
exit 1
fi
echo -e "${GREEN}✓ Docker disponible${RESET}"
# ── 2. Start Memgraph + Qdrant ───────────────────────────────────────────────
echo -e "\n${BOLD}[2/4] Levantando Memgraph y Qdrant...${RESET}"
cd "$(dirname "$0")/.."
docker compose up -d
echo -e "${GREEN}✓ Memgraph corriendo en bolt://localhost:7687${RESET}"
echo -e "${GREEN}✓ Memgraph Lab UI en http://localhost:3000${RESET}"
echo -e "${GREEN}✓ Qdrant corriendo en http://localhost:6333${RESET}"
# Wait for Memgraph to be ready
echo -e "\n Esperando a Memgraph..."
for i in {1..20}; do
if docker exec suplementos-memgraph mg_client --username "" --password "" --execute "RETURN 1" &>/dev/null 2>&1; then
echo -e "${GREEN}✓ Memgraph listo${RESET}"
break
fi
sleep 2
if [ $i -eq 20 ]; then
echo -e "${YELLOW}⚠ Memgraph tardando en iniciar — continúa, se conectará cuando esté listo${RESET}"
fi
done
# ── 3. Check Ollama ──────────────────────────────────────────────────────────
echo -e "\n${BOLD}[3/4] Verificando Ollama...${RESET}"
if ! command -v ollama &>/dev/null; then
echo -e "${RED}✗ Ollama no está instalado.${RESET}"
echo -e " Instálalo desde: ${BOLD}https://ollama.ai${RESET}"
exit 1
fi
if ! curl -s http://192.168.68.67:11434/api/tags &>/dev/null; then
echo -e "${YELLOW}⚠ Ollama no está corriendo. Iniciando...${RESET}"
ollama serve &>/dev/null &
sleep 3
fi
echo -e "${GREEN}✓ Ollama disponible en http://192.168.68.67:11434${RESET}"
# ── 4. Pull Ollama models ────────────────────────────────────────────────────
echo -e "\n${BOLD}[4/4] Descargando modelos de Ollama...${RESET}"
pull_model() {
local model=$1
echo -e "\n Verificando ${BOLD}${model}${RESET}..."
if ollama list 2>/dev/null | grep -q "^${model}"; then
echo -e "${GREEN}${model} ya está disponible${RESET}"
else
echo -e "${YELLOW} ↓ Descargando ${model} (puede tardar varios minutos)...${RESET}"
ollama pull "$model"
echo -e "${GREEN}${model} descargado${RESET}"
fi
}
pull_model "mxbai-embed-large"
pull_model "qwen3:8b"
# ── Done ─────────────────────────────────────────────────────────────────────
echo -e "\n${GREEN}${BOLD}✓ Infraestructura lista${RESET}"
echo ""
echo -e " Memgraph Lab: ${BOLD}http://localhost:3000${RESET}"
echo -e " Qdrant UI: ${BOLD}http://localhost:6333/dashboard${RESET}"
echo -e " Ollama: ${BOLD}http://localhost:11434${RESET}"
echo ""
echo -e " Siguiente: ${BOLD}cd dashboard && npm run dev${RESET}"