From 035238c08dc2178246de21aae184e8eaeac1c10c Mon Sep 17 00:00:00 2001 From: pablinux Date: Mon, 19 Oct 2026 23:55:21 -0500 Subject: [PATCH] feat: completar despliegue en produccion CT 132 con supervision de SIAX Monitor y reinicio atomico --- .agente/objetivos.md | 1 + .agente/proyecto_memoria.md | 3 +++ .agente/tareas.md | 6 +++--- desplegar.sh | 17 ++++++++++++----- init.sh | 21 +++++++++++++++++---- 5 files changed, 36 insertions(+), 12 deletions(-) diff --git a/.agente/objetivos.md b/.agente/objetivos.md index 8aa6bbd..8f16020 100644 --- a/.agente/objetivos.md +++ b/.agente/objetivos.md @@ -40,3 +40,4 @@ | 2026-10-17 | Registro oficial en MCP Infraestructura (ID 34) | Ficha técnica completa registrada en MariaDB bajo categoría application | | 2026-10-17 | Registro en centro de comunicaciones de agentes (sigma-robot) | Identidad `Agente drop.sigmac.app` registrada vía REST; credenciales en `.env` | | 2026-10-17 | Sincronización de normas y archivos base del ecosistema | Creación de `id_agente.md`, `reglas.md`, `tareas.md` y espejo de `infraestructura.md` | +| 2026-10-19 | Despliegue en producción en CT 132 con SIAX Monitor (:8080) | Servicio `siax-app-DROP_SIGMAC_APP.service` operativo en puerto 2006 | diff --git a/.agente/proyecto_memoria.md b/.agente/proyecto_memoria.md index c40d021..002dabe 100644 --- a/.agente/proyecto_memoria.md +++ b/.agente/proyecto_memoria.md @@ -17,6 +17,7 @@ | 2026-10-13 | Soporte doble de login: WebControl corporativo + Google OAuth | Brinda flexibilidad tanto para colaboradores del ecosistema Telcotronics (vía `api.siax-system.net`) como para usuarios externos con Google. | | 2026-10-14 | Adopción de la marca y dominio `drop.sigmac.app` | Nombre conciso, memorable y alineado con los servicios y subdominios del ecosistema SIGMA (sigmac.app). | | 2026-10-17 | Registro oficial en MCP Infraestructura (ID 34) e identidad de agente | Se vinculó el proyecto al inventario central MariaDB vía API REST (:3007), asignando ID 34 bajo categoría application, y se creó `id_agente.md` según el estándar de identidad del ecosistema. | +| 2026-10-19 | Despliegue en producción en CT 132 con supervisión SIAX Monitor | Se desplegó en `server-webapps` (puerto 2006). Registrado en SIAX Monitor (:8080) como `siax-app-DROP_SIGMAC_APP.service`, habilitando reinicio atómico vía API sin sudo. | --- @@ -29,6 +30,7 @@ Versión funcional completa y validada: - Purga automática cada 10 minutos para archivos guest > 24h (test automatizado superado en `main_test.go`). - Cuentas registradas con almacenamiento permanente y panel `/mis-archivos`. - Registrado oficialmente en el MCP de Infraestructura (ID 34) y sincronizado con espejo local `.agente/infraestructura.md`. +- Desplegado y ejecutándose activamente en producción (CT 132 puerto 2006) supervisado por SIAX Monitor. --- @@ -45,6 +47,7 @@ Versión funcional completa y validada: - [x] Integrar servicio systemd para SIAX Monitor (`siax-app-DROP_SIGMAC_APP.service`) - [x] Soporte para proxy reverso dinámico Apache (`X-Forwarded-Proto`, `Host`) en puerto 2006 - [x] Registrar proyecto en MCP de Infraestructura (ID 34) y crear `id_agente.md` oficial +- [x] Desplegar en producción en `server-webapps` (CT 132, :2006) y registrar en SIAX Monitor (:8080) --- diff --git a/.agente/tareas.md b/.agente/tareas.md index 58e94e0..f458581 100644 --- a/.agente/tareas.md +++ b/.agente/tareas.md @@ -21,14 +21,14 @@ - [x] **Espejo de Infraestructura:** Sincronizado `.agente/infraestructura.md` con `/home/pablinux/Projects/infraestructura.md`. - [x] **Identidad del Agente:** Creación de `id_agente.md` en la raíz del repositorio. - [x] **Centro de Comunicaciones sigma-robot:** Autorizado formalmente por Pablinux como **Agente ID 86** (`Agente drop.sigmac.app`). Token definitivo resguardado en `.env` (modo 600). +- [x] **Despliegue a Producción (CT 132 server-webapps):** Desplegado y ejecutándose activamente como `siax-app-DROP_SIGMAC_APP.service` supervisado por SIAX Monitor (`:8080`), escuchando en puerto interno `2006`. Subida atómica y reinicio automático operativo. --- ## 🚀 En Progreso / Inmediatas -- [ ] **Despliegue inicial a producción:** - - Ejecutar `./desplegar.sh` hacia `server-webapps` CT 132 (`192.168.10.160`). - - Verificar respuesta pública en `https://drop.sigmac.app` y estado en SIAX Monitor (`:8080`). +- [ ] **Ajuste de Proxy Reverso Apache (SSL port 443 en CT 150):** + - Asegurar que el VirtualHost SSL (``) para `drop.sigmac.app` tenga configurado `ProxyPass / http://192.168.10.160:2006/` y `ProxyPassReverse / http://192.168.10.160:2006/` (actualmente en puerto 443 responde el VirtualHost por defecto de Marketing SIGMA). - [ ] **Creación del Repositorio Git Remoto:** - Crear repo en `git.telcotronics.net/pablinux/app_compartir.git`. - Configurar `git remote add origin ...` y realizar primer push. diff --git a/desplegar.sh b/desplegar.sh index b9c4d3b..97791d6 100755 --- a/desplegar.sh +++ b/desplegar.sh @@ -63,10 +63,12 @@ subir() { preparar_remoto echo "" - echo "🚀 Subiendo binario, plantillas y scripts al servidor..." - copy "$SCRIPT_DIR/app_compartir" "$SCRIPT_DIR/init.sh" "$SCRIPT_DIR/.env.example" "$SCRIPT_DIR/siax-app-DROP_SIGMAC_APP.service" "$SERVIDOR:$REMOTE_DIR/" + echo "🚀 Subiendo binario (atómico), plantillas y scripts al servidor..." + copy "$SCRIPT_DIR/app_compartir" "$SERVIDOR:$REMOTE_DIR/app_compartir.tmp" + remote "mv -f '$REMOTE_DIR/app_compartir.tmp' '$REMOTE_DIR/app_compartir' && chmod 0755 '$REMOTE_DIR/app_compartir'" + copy "$SCRIPT_DIR/init.sh" "$SCRIPT_DIR/.env.example" "$SCRIPT_DIR/siax-app-DROP_SIGMAC_APP.service" "$SERVIDOR:$REMOTE_DIR/" copy "$SCRIPT_DIR/web/templates/"*.html "$SERVIDOR:$REMOTE_DIR/web/templates/" - remote "chmod 0755 '$REMOTE_DIR/app_compartir' '$REMOTE_DIR/init.sh'" + remote "chmod 0755 '$REMOTE_DIR/init.sh'" echo "✅ Archivos sincronizados en $REMOTE_DIR" } @@ -94,15 +96,20 @@ estado() { echo "" echo "📊 Estado del servidor en $SERVIDOR:" remote " + if curl -sI http://localhost:8080/api/apps 2>/dev/null | grep -q '200 OK'; then + echo '==> Estado en SIAX Monitor (:8080):' + curl -s http://localhost:8080/api/apps | grep -o '{\"name\":\"DROP_SIGMAC_APP\"[^}]*}' || true + echo '' + fi if systemctl is-active --quiet siax-app-DROP_SIGMAC_APP.service 2>/dev/null; then echo '==> Servicio systemd siax-app-DROP_SIGMAC_APP (SIAX Monitor) activo:' - systemctl status siax-app-DROP_SIGMAC_APP.service --no-pager + journalctl -u siax-app-DROP_SIGMAC_APP.service -n 12 --no-pager -q elif tmux has-session -t drop-sigmac-app 2>/dev/null; then echo '==> Sesión tmux drop-sigmac-app activa:' tmux capture-pane -pt drop-sigmac-app | tail -n 25 elif systemctl is-active --quiet drop-sigmac-app.service 2>/dev/null; then echo '==> Servicio systemd drop-sigmac-app activo:' - systemctl status drop-sigmac-app.service --no-pager + journalctl -u drop-sigmac-app.service -n 12 --no-pager -q else echo '⚠️ No se detectó proceso activo en tmux ni systemd.' fi diff --git a/init.sh b/init.sh index b1aac27..dda1e8f 100755 --- a/init.sh +++ b/init.sh @@ -27,7 +27,17 @@ mkdir -p "$SCRIPT_DIR/data/uploads" # 3. Permisos de ejecución al binario chmod +x "$SCRIPT_DIR/app_compartir" -# 4. Modo de arranque: Si existe servicio systemd de SIAX Monitor o estándar, usarlo; de lo contrario, tmux +# 4. Modo de arranque: SIAX Monitor API, systemd o tmux +if curl -sI http://localhost:8080/api/apps 2>/dev/null | grep -q "200 OK"; then + echo "==> Reiniciando DROP_SIGMAC_APP vía API de SIAX Monitor (:8080)..." + RESP=$(curl -s -X POST http://localhost:8080/api/apps/DROP_SIGMAC_APP/restart) + echo " Respuesta: $RESP" + if echo "$RESP" | grep -q '"success":true'; then + echo "✅ Servicio reiniciado exitosamente por SIAX Monitor." + exit 0 + fi +fi + SERVICE_NAME="" if systemctl is-active --quiet siax-app-DROP_SIGMAC_APP.service 2>/dev/null || [ -f /etc/systemd/system/siax-app-DROP_SIGMAC_APP.service ]; then SERVICE_NAME="siax-app-DROP_SIGMAC_APP.service" @@ -36,9 +46,12 @@ elif systemctl is-active --quiet drop-sigmac-app.service 2>/dev/null || [ -f /et fi if [[ -n "$SERVICE_NAME" ]]; then - echo "==> Reiniciando servicio systemd '$SERVICE_NAME' (SIAX Monitor)..." - sudo systemctl restart "$SERVICE_NAME" - sudo systemctl status "$SERVICE_NAME" --no-pager + echo "==> Reiniciando servicio systemd '$SERVICE_NAME'..." + if sudo -n true 2>/dev/null; then + sudo systemctl restart "$SERVICE_NAME" + else + systemctl restart "$SERVICE_NAME" 2>/dev/null || true + fi exit 0 fi