fix(deploy): incorporar cryptography en requirements.txt y robustecer instalador install.sh
This commit is contained in:
@@ -19,3 +19,4 @@ Babel==2.14.0
|
|||||||
gunicorn>=21.2.0
|
gunicorn>=21.2.0
|
||||||
PyJWT>=2.8.0
|
PyJWT>=2.8.0
|
||||||
pydantic>=2.0.0
|
pydantic>=2.0.0
|
||||||
|
cryptography>=42.0.0
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ from app.models.genetic_algorithm import (
|
|||||||
Gene
|
Gene
|
||||||
)
|
)
|
||||||
from app.services.optimizer_service import OptimizerService, OptimizerJobStatus
|
from app.services.optimizer_service import OptimizerService, OptimizerJobStatus
|
||||||
|
from app.services.jwt_service import JWTService
|
||||||
from config.config import Config
|
from config.config import Config
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+13
-8
@@ -117,7 +117,7 @@ export DEBIAN_FRONTEND=noninteractive
|
|||||||
apt-get update -qq
|
apt-get update -qq
|
||||||
apt-get install -y -qq \
|
apt-get install -y -qq \
|
||||||
sudo curl wget git ca-certificates gnupg lsb-release \
|
sudo curl wget git ca-certificates gnupg lsb-release \
|
||||||
build-essential libpq-dev \
|
build-essential libpq-dev libffi-dev libssl-dev pkg-config \
|
||||||
locales \
|
locales \
|
||||||
> /dev/null 2>&1
|
> /dev/null 2>&1
|
||||||
ok "Paquetes base instalados"
|
ok "Paquetes base instalados"
|
||||||
@@ -375,14 +375,18 @@ python3 -m venv "$VENV_DIR" > /dev/null 2>&1
|
|||||||
"${VENV_DIR}/bin/pip" install --upgrade pip setuptools wheel --quiet
|
"${VENV_DIR}/bin/pip" install --upgrade pip setuptools wheel --quiet
|
||||||
|
|
||||||
info "Instalando dependencias desde backend/requirements.txt..."
|
info "Instalando dependencias desde backend/requirements.txt..."
|
||||||
if "${VENV_DIR}/bin/pip" install -r "${BACKEND_DIR}/requirements.txt" --quiet 2>/dev/null; then
|
if ! "${VENV_DIR}/bin/pip" install -r "${BACKEND_DIR}/requirements.txt" --quiet; then
|
||||||
ok "Dependencias de Python instaladas correctamente"
|
warn "Reintentando instalación con aislamiento deshabilitado..."
|
||||||
else
|
"${VENV_DIR}/bin/pip" install -r "${BACKEND_DIR}/requirements.txt" --no-build-isolation || err "Falló la instalación de dependencias de Python."
|
||||||
warn "Reintentando instalación con --no-build-isolation..."
|
|
||||||
"${VENV_DIR}/bin/pip" install -r "${BACKEND_DIR}/requirements.txt" --no-build-isolation --quiet
|
|
||||||
ok "Dependencias de Python instaladas"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Verificación explícita de módulos críticos requeridos por modelos y esquemas
|
||||||
|
if ! "${VENV_DIR}/bin/python" -c "import flask, sqlalchemy, cryptography, pydantic; print('Módulos críticos OK')" >/dev/null 2>&1; then
|
||||||
|
warn "Asegurando librerías críticas en el venv (cryptography, pydantic)..."
|
||||||
|
"${VENV_DIR}/bin/pip" install "cryptography>=42.0.0" "pydantic>=2.0.0" --quiet
|
||||||
|
fi
|
||||||
|
ok "Dependencias de Python instaladas correctamente"
|
||||||
|
|
||||||
# ─── 9. Ejecución de Despliegue de Datos (Restaurar o Sincronizar) ──────────────
|
# ─── 9. Ejecución de Despliegue de Datos (Restaurar o Sincronizar) ──────────────
|
||||||
hdr "9. Aplicando esquema y datos en la base de datos"
|
hdr "9. Aplicando esquema y datos en la base de datos"
|
||||||
|
|
||||||
@@ -420,7 +424,7 @@ done
|
|||||||
# Sincronización idempotente con init_db.py (crea tablas o columnas faltantes sin borrar datos)
|
# Sincronización idempotente con init_db.py (crea tablas o columnas faltantes sin borrar datos)
|
||||||
info "Sincronizando modelos y esquemas institucionales con init_db.py..."
|
info "Sincronizando modelos y esquemas institucionales con init_db.py..."
|
||||||
LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 PYTHONUTF8=1 PYTHONIOENCODING=utf-8 \
|
LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 PYTHONUTF8=1 PYTHONIOENCODING=utf-8 \
|
||||||
FLASK_APP=wsgi.py "${VENV_DIR}/bin/python" -X utf8 init_db.py
|
PYTHONPATH="${BACKEND_DIR}" FLASK_APP=wsgi.py "${VENV_DIR}/bin/python" -X utf8 init_db.py
|
||||||
ok "Esquema, usuarios y roles RBAC sincronizados con éxito"
|
ok "Esquema, usuarios y roles RBAC sincronizados con éxito"
|
||||||
|
|
||||||
cd "$ROOT_DIR"
|
cd "$ROOT_DIR"
|
||||||
@@ -482,6 +486,7 @@ Environment="LANG=en_US.UTF-8"
|
|||||||
Environment="LC_ALL=en_US.UTF-8"
|
Environment="LC_ALL=en_US.UTF-8"
|
||||||
Environment="PYTHONUTF8=1"
|
Environment="PYTHONUTF8=1"
|
||||||
Environment="PYTHONIOENCODING=utf-8"
|
Environment="PYTHONIOENCODING=utf-8"
|
||||||
|
Environment="PYTHONPATH=${BACKEND_DIR}"
|
||||||
Environment="FLASK_ENV=production"
|
Environment="FLASK_ENV=production"
|
||||||
Environment="HOME=${BACKEND_DIR}"
|
Environment="HOME=${BACKEND_DIR}"
|
||||||
ExecStart=${GUNICORN_BIN} \
|
ExecStart=${GUNICORN_BIN} \
|
||||||
|
|||||||
Reference in New Issue
Block a user