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:
SITO 2026-03-30 21:11:56 +02:00
parent 00c0254e6c
commit ab3b0b53c5
5 changed files with 41 additions and 23 deletions

View file

@ -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. Este paso se hace **una sola vez** y puede tardar 10-30 minutos dependiendo de la conexión.
```bash ```bash
# Instalar dependencias Python primero # Instalar dependencias Python primero (si aun no se hizo)
python3 -m venv /opt/rss2/venv python3 -m venv /opt/rss2/venv
/opt/rss2/venv/bin/pip install ctranslate2 transformers sentencepiece /opt/rss2/venv/bin/pip install ctranslate2 transformers sentencepiece
# Convertir modelo NLLB-200 a formato CTranslate2 # Convertir modelo NLLB-200 a formato CTranslate2 (tarda 10-30 min)
/opt/rss2/venv/bin/ct2-opus-mt-converter \ /opt/rss2/venv/bin/python - <<'EOF'
--model facebook/nllb-200-distilled-600M \ from ctranslate2.converters import OpusMTConverter
--output_dir /opt/rss2/models/nllb-ct2 \ converter = OpusMTConverter("facebook/nllb-200-distilled-600M")
--quantization int8 converter.convert("/opt/rss2/models/nllb-ct2", quantization="int8", force=True)
print("Modelo convertido OK en /opt/rss2/models/nllb-ct2")
# Alternativa si el comando anterior falla: EOF
/opt/rss2/venv/bin/python -c "
import ctranslate2
ctranslate2.converters.OpusMTConverter(
'facebook/nllb-200-distilled-600M'
).convert('/opt/rss2/models/nllb-ct2', quantization='int8')
"
``` ```
> 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 ### 4. Ejecutar el instalador
```bash ```bash

View file

@ -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) CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -o "$RSS2_HOME/bin/server" ./cmd/server)
info " [OK] 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 [[ -d "$REPO_ROOT/backend/cmd/$cmd" ]] || continue
(cd "$REPO_ROOT/backend" && \ (cd "$REPO_ROOT/backend" && \
CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -o "$RSS2_HOME/bin/$cmd" "./cmd/$cmd") CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -o "$RSS2_HOME/bin/$cmd" "./cmd/$cmd")
info " [OK] $cmd" info " [OK] $cmd"
done 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 fi
# --- Ingestor Go --- # --- Ingestor Go ---
if [[ -d "$REPO_ROOT/rss-ingestor-go" ]]; then if [[ -d "$REPO_ROOT/rss-ingestor-go" ]]; then
info "Compilando ingestor Go..." info "Compilando ingestor Go..."
(cd "$REPO_ROOT/rss-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" info " [OK] ingestor"
fi fi

View file

@ -34,6 +34,13 @@ TZ=Europe/Madrid
# --- HuggingFace cache (modelos ML) --- # --- HuggingFace cache (modelos ML) ---
HF_HOME=/opt/rss2/hf_cache 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 (local, sin Docker) ---
QDRANT_HOST=127.0.0.1 QDRANT_HOST=127.0.0.1
QDRANT_PORT=6333 QDRANT_PORT=6333

View file

@ -32,10 +32,10 @@ apt-get install -y --no-install-recommends \
ca-certificates tzdata \ ca-certificates tzdata \
libpq-dev libpq-dev
# Go (si no esta instalado o version < 1.22) # Go (rss-ingestor-go requiere Go 1.25)
if ! command -v go &>/dev/null || [[ "$(go version | awk '{print $3}' | tr -d 'go')" < "1.22" ]]; then if ! command -v go &>/dev/null || [[ "$(go version | awk '{print $3}' | tr -d 'go')" < "1.25" ]]; then
info "Instalando Go 1.23..." info "Instalando Go 1.25..."
GO_VERSION="1.23.4" GO_VERSION="1.25.0"
ARCH=$(dpkg --print-architecture) ARCH=$(dpkg --print-architecture)
case "$ARCH" in case "$ARCH" in
amd64) GO_ARCH="amd64" ;; amd64) GO_ARCH="amd64" ;;
@ -186,18 +186,23 @@ if [[ -d "$REPO_ROOT/backend" ]]; then
(cd "$REPO_ROOT/backend" && \ (cd "$REPO_ROOT/backend" && \
CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -o "$RSS2_HOME/bin/server" ./cmd/server && \ CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -o "$RSS2_HOME/bin/server" ./cmd/server && \
info " [OK] server") || warn " [FAIL] 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 [[ -d "$REPO_ROOT/backend/cmd/$cmd" ]] || continue
(cd "$REPO_ROOT/backend" && \ (cd "$REPO_ROOT/backend" && \
CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -o "$RSS2_HOME/bin/$cmd" "./cmd/$cmd" && \ CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -o "$RSS2_HOME/bin/$cmd" "./cmd/$cmd" && \
info " [OK] $cmd") || warn " [FAIL] $cmd" info " [OK] $cmd") || warn " [FAIL] $cmd"
done 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 fi
# RSS Ingestor Go (repo separado) # RSS Ingestor Go (repo separado, requiere Go 1.25)
if [[ -d "$REPO_ROOT/rss-ingestor-go" ]]; then if [[ -d "$REPO_ROOT/rss-ingestor-go" ]]; then
(cd "$REPO_ROOT/rss-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") || warn " [FAIL] ingestor" info " [OK] ingestor") || warn " [FAIL] ingestor"
fi fi

View file

@ -9,6 +9,10 @@ User=rss2
Group=rss2 Group=rss2
WorkingDirectory=/opt/rss2 WorkingDirectory=/opt/rss2
EnvironmentFile=/opt/rss2/.env 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 ExecStart=/opt/rss2/bin/server
Restart=always Restart=always
RestartSec=5 RestartSec=5