fix(deploy): corregir 5 problemas bloqueantes para despliegue Debian
- install.sh/build.sh: actualizar Go 1.23 → 1.25 (requerido por rss-ingestor-go) - install.sh/build.sh: nombrar binario qdrant como qdrant_worker para coincidir con rss2-qdrant-worker.service (ExecStart) - install.sh/build.sh: GOTOOLCHAIN=local en ingestor para evitar descarga automatica de toolchain Go superior - rss2-backend.service: sobreescribir hostnames Docker (libretranslate, ollama, spacy) por 127.0.0.1 para despliegue nativo - env.example: agregar TRANSLATION_URL, OLLAMA_URL, SPACY_URL con nota explicativa sobre uso en endpoints admin - DEPLOY_DEBIAN.md: corregir comando conversion NLLB-200 a CTranslate2 usando OpusMTConverter Python API en lugar de CLI incorrecto Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
00c0254e6c
commit
ab3b0b53c5
5 changed files with 41 additions and 23 deletions
|
|
@ -71,25 +71,22 @@ openssl rand -hex 32
|
|||
Este paso se hace **una sola vez** y puede tardar 10-30 minutos dependiendo de la conexión.
|
||||
|
||||
```bash
|
||||
# Instalar dependencias Python primero
|
||||
# Instalar dependencias Python primero (si aun no se hizo)
|
||||
python3 -m venv /opt/rss2/venv
|
||||
/opt/rss2/venv/bin/pip install ctranslate2 transformers sentencepiece
|
||||
|
||||
# Convertir modelo NLLB-200 a formato CTranslate2
|
||||
/opt/rss2/venv/bin/ct2-opus-mt-converter \
|
||||
--model facebook/nllb-200-distilled-600M \
|
||||
--output_dir /opt/rss2/models/nllb-ct2 \
|
||||
--quantization int8
|
||||
|
||||
# Alternativa si el comando anterior falla:
|
||||
/opt/rss2/venv/bin/python -c "
|
||||
import ctranslate2
|
||||
ctranslate2.converters.OpusMTConverter(
|
||||
'facebook/nllb-200-distilled-600M'
|
||||
).convert('/opt/rss2/models/nllb-ct2', quantization='int8')
|
||||
"
|
||||
# Convertir modelo NLLB-200 a formato CTranslate2 (tarda 10-30 min)
|
||||
/opt/rss2/venv/bin/python - <<'EOF'
|
||||
from ctranslate2.converters import OpusMTConverter
|
||||
converter = OpusMTConverter("facebook/nllb-200-distilled-600M")
|
||||
converter.convert("/opt/rss2/models/nllb-ct2", quantization="int8", force=True)
|
||||
print("Modelo convertido OK en /opt/rss2/models/nllb-ct2")
|
||||
EOF
|
||||
```
|
||||
|
||||
> El modelo ocupa ~600 MB convertido. Si la descarga de HuggingFace falla, exporta
|
||||
> `HF_ENDPOINT=https://huggingface.co` o usa un mirror.
|
||||
|
||||
### 4. Ejecutar el instalador
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -22,19 +22,24 @@ if [[ -d "$REPO_ROOT/backend" ]]; then
|
|||
CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -o "$RSS2_HOME/bin/server" ./cmd/server)
|
||||
info " [OK] server"
|
||||
|
||||
for cmd in scraper discovery wiki_worker topics related qdrant; do
|
||||
for cmd in scraper discovery wiki_worker topics related; do
|
||||
[[ -d "$REPO_ROOT/backend/cmd/$cmd" ]] || continue
|
||||
(cd "$REPO_ROOT/backend" && \
|
||||
CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -o "$RSS2_HOME/bin/$cmd" "./cmd/$cmd")
|
||||
info " [OK] $cmd"
|
||||
done
|
||||
# qdrant worker: nombre del binario debe coincidir con el service
|
||||
[[ -d "$REPO_ROOT/backend/cmd/qdrant" ]] && \
|
||||
(cd "$REPO_ROOT/backend" && \
|
||||
CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -o "$RSS2_HOME/bin/qdrant_worker" "./cmd/qdrant")
|
||||
info " [OK] qdrant_worker"
|
||||
fi
|
||||
|
||||
# --- Ingestor Go ---
|
||||
if [[ -d "$REPO_ROOT/rss-ingestor-go" ]]; then
|
||||
info "Compilando ingestor Go..."
|
||||
(cd "$REPO_ROOT/rss-ingestor-go" && \
|
||||
CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -o "$RSS2_HOME/bin/ingestor" .)
|
||||
GOTOOLCHAIN=local CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -o "$RSS2_HOME/bin/ingestor" .)
|
||||
info " [OK] ingestor"
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,13 @@ TZ=Europe/Madrid
|
|||
# --- HuggingFace cache (modelos ML) ---
|
||||
HF_HOME=/opt/rss2/hf_cache
|
||||
|
||||
# --- Endpoints ML opcionales (solo si corres Ollama o LibreTranslate por separado) ---
|
||||
# Los workers Python van directo a BD; estos endpoints solo los usa el backend para
|
||||
# llamadas on-demand desde el panel admin (NER, traduccion manual, etc.)
|
||||
TRANSLATION_URL=http://127.0.0.1:7790
|
||||
OLLAMA_URL=http://127.0.0.1:11434
|
||||
SPACY_URL=http://127.0.0.1:8000
|
||||
|
||||
# --- Qdrant (local, sin Docker) ---
|
||||
QDRANT_HOST=127.0.0.1
|
||||
QDRANT_PORT=6333
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@ apt-get install -y --no-install-recommends \
|
|||
ca-certificates tzdata \
|
||||
libpq-dev
|
||||
|
||||
# Go (si no esta instalado o version < 1.22)
|
||||
if ! command -v go &>/dev/null || [[ "$(go version | awk '{print $3}' | tr -d 'go')" < "1.22" ]]; then
|
||||
info "Instalando Go 1.23..."
|
||||
GO_VERSION="1.23.4"
|
||||
# Go (rss-ingestor-go requiere Go 1.25)
|
||||
if ! command -v go &>/dev/null || [[ "$(go version | awk '{print $3}' | tr -d 'go')" < "1.25" ]]; then
|
||||
info "Instalando Go 1.25..."
|
||||
GO_VERSION="1.25.0"
|
||||
ARCH=$(dpkg --print-architecture)
|
||||
case "$ARCH" in
|
||||
amd64) GO_ARCH="amd64" ;;
|
||||
|
|
@ -186,18 +186,23 @@ if [[ -d "$REPO_ROOT/backend" ]]; then
|
|||
(cd "$REPO_ROOT/backend" && \
|
||||
CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -o "$RSS2_HOME/bin/server" ./cmd/server && \
|
||||
info " [OK] server") || warn " [FAIL] server"
|
||||
for cmd in scraper discovery wiki_worker topics related qdrant; do
|
||||
for cmd in scraper discovery wiki_worker topics related; do
|
||||
[[ -d "$REPO_ROOT/backend/cmd/$cmd" ]] || continue
|
||||
(cd "$REPO_ROOT/backend" && \
|
||||
CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -o "$RSS2_HOME/bin/$cmd" "./cmd/$cmd" && \
|
||||
info " [OK] $cmd") || warn " [FAIL] $cmd"
|
||||
done
|
||||
# qdrant worker: output como qdrant_worker para coincidir con el service
|
||||
[[ -d "$REPO_ROOT/backend/cmd/qdrant" ]] && \
|
||||
(cd "$REPO_ROOT/backend" && \
|
||||
CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -o "$RSS2_HOME/bin/qdrant_worker" "./cmd/qdrant" && \
|
||||
info " [OK] qdrant_worker") || warn " [FAIL] qdrant_worker"
|
||||
fi
|
||||
|
||||
# RSS Ingestor Go (repo separado)
|
||||
# RSS Ingestor Go (repo separado, requiere Go 1.25)
|
||||
if [[ -d "$REPO_ROOT/rss-ingestor-go" ]]; then
|
||||
(cd "$REPO_ROOT/rss-ingestor-go" && \
|
||||
CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -o "$RSS2_HOME/bin/ingestor" . && \
|
||||
GOTOOLCHAIN=local CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -o "$RSS2_HOME/bin/ingestor" . && \
|
||||
info " [OK] ingestor") || warn " [FAIL] ingestor"
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@ User=rss2
|
|||
Group=rss2
|
||||
WorkingDirectory=/opt/rss2
|
||||
EnvironmentFile=/opt/rss2/.env
|
||||
# Sobreescribir hostnames Docker por localhost (los workers Python van directo a DB)
|
||||
Environment=TRANSLATION_URL=http://127.0.0.1:7790
|
||||
Environment=OLLAMA_URL=http://127.0.0.1:11434
|
||||
Environment=SPACY_URL=http://127.0.0.1:8000
|
||||
ExecStart=/opt/rss2/bin/server
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue