# PLAN DE CORRECCION DE PUERTOS **Fecha:** 2025-12-08 **Generado por:** Architecture-Analyst **Estado:** PENDIENTE APROBACION **Version:** 1.0.0 --- ## OBJETIVO Resolver los conflictos de puertos detectados en el workspace, alineando todos los proyectos con el estandar definido (gamilit como referencia). --- ## RESUMEN DE CAMBIOS | Tipo | Cantidad | |------|----------| | Archivos a modificar | 12 | | Puertos a cambiar | 8 | | Archivos .env.ports a crear | 4 | --- ## FASE 1: CORRECCION DE CONFLICTOS P0 (CRITICOS) ### 1.1 Resolver CONFLICT-001: Puerto 3000 **Orden de ejecucion:** Uno por uno, verificando que no haya dependencias. #### 1.1.1 ERP-CORE ```bash # Archivos a modificar: # - projects/erp-suite/apps/erp-core/.env # - projects/erp-suite/apps/erp-core/.env.example # - projects/erp-suite/apps/erp-core/backend/.env.example # Cambio: PORT=3000 -> PORT=3106 ``` **Checklist:** - [ ] Modificar .env - [ ] Modificar .env.example - [ ] Modificar backend/.env.example - [ ] Verificar docker-compose.yml (si tiene) - [ ] Actualizar CORS si aplica - [ ] Test: npm run dev y verificar puerto --- #### 1.1.2 MECANICAS-DIESEL ```bash # Archivos a modificar: # - projects/erp-suite/apps/verticales/mecanicas-diesel/.env.example # - projects/erp-suite/apps/verticales/mecanicas-diesel/docker-compose.yml # Cambio: APP_PORT=3000 -> APP_PORT=3166 ``` **Checklist:** - [ ] Modificar .env.example - [ ] Modificar docker-compose.yml (backend service port) - [ ] Actualizar frontend VITE_API_URL si aplica - [ ] Test: docker-compose up y verificar puerto --- #### 1.1.3 POS-MICRO ```bash # Archivos a modificar: # - projects/erp-suite/apps/products/pos-micro/backend/.env.example # - projects/erp-suite/apps/products/pos-micro/docker-compose.yml # - projects/erp-suite/apps/products/pos-micro/frontend/.env.example (VITE_API_URL) # Cambio: PORT=3000 -> PORT=3226 VITE_API_URL=http://localhost:3000/api/v1 -> http://localhost:3226/api/v1 ``` **Checklist:** - [ ] Modificar backend/.env.example - [ ] Modificar docker-compose.yml - [ ] Modificar frontend/.env.example (VITE_API_URL) - [ ] Test: docker-compose up y verificar conectividad --- #### 1.1.4 PLATFORM MARKETING CONTENT ```bash # Archivos a modificar: # - projects/platform_marketing_content/apps/backend/.env.example # Cambio: PORT=3000 -> PORT=3606 ``` **Checklist:** - [ ] Modificar apps/backend/.env.example - [ ] Crear .env.ports centralizado - [ ] Test: npm run dev y verificar puerto --- ## FASE 2: CORRECCION DE CONFLICTOS P1 (IMPORTANTES) ### 2.1 Resolver CONFLICT-003: Vidrio-Templado ```bash # Archivos a modificar: # - projects/erp-suite/apps/verticales/vidrio-templado/.env.example # Cambio: APP_PORT=3200 -> APP_PORT=3146 ``` **Checklist:** - [ ] Modificar .env.example - [ ] Actualizar frontend si tiene referencia al backend - [ ] Test: Levantar servicio y verificar --- ### 2.2 Revisar Otros Puertos Fuera de Rango #### 2.2.1 RETAIL ```bash # Archivos a modificar: # - projects/erp-suite/apps/verticales/retail/.env.example # Cambio (OPCIONAL - Revisar con equipo): APP_PORT=3400 -> APP_PORT=3186 ``` **Nota:** El puerto 3400 esta fuera del rango de ERP-suite (3100-3299), pero puede mantenerse si se documenta como excepcion. --- #### 2.2.2 CLINICAS ```bash # Archivos a modificar: # - projects/erp-suite/apps/verticales/clinicas/.env.example # Cambio (OPCIONAL - Revisar con equipo): APP_PORT=3500 -> APP_PORT=3206 ``` **Nota:** Similar a retail, puede documentarse como excepcion si es necesario. --- ## FASE 3: CREAR ARCHIVOS .env.ports FALTANTES (P2) ### 3.1 Template Base ```bash # ============================================================================= # {PROYECTO} - PORT ASSIGNMENTS # ============================================================================= # Archivo centralizado de asignacion de puertos # Gestionado por: DevEnv Agent # Fecha: 2025-12-08 # Rango asignado: {RANGO} # ============================================================================= # FRONTEND FRONTEND_PORT={BASE+5} FRONTEND_ADMIN_PORT={BASE+7} # BACKEND BACKEND_API_PORT={BASE+6} BACKEND_WS_PORT={BASE+8} # DATABASES POSTGRES_PORT={PUERTO_DB} REDIS_PORT={PUERTO_REDIS} # ============================================================================= ``` ### 3.2 Crear en Proyectos - [ ] `projects/erp-suite/.env.ports` - [ ] `projects/betting-analytics/.env.ports` - [ ] `projects/inmobiliaria-analytics/.env.ports` - [ ] `projects/platform_marketing_content/.env.ports` --- ## FASE 4: VALIDACION POST-IMPLEMENTACION ### 4.1 Verificacion de Puertos ```bash # Script de validacion for port in 3106 3166 3226 3606 3146; do echo "Verificando puerto $port..." lsof -i :$port || echo "Puerto $port disponible" done ``` ### 4.2 Verificacion de Conectividad ```bash # Para cada proyecto modificado curl -s http://localhost:{PUERTO}/health || echo "Servicio no responde" ``` ### 4.3 Checklist Final - [ ] Todos los conflictos P0 resueltos - [ ] Todos los conflictos P1 resueltos - [ ] Archivos .env.ports creados - [ ] DEVENV-PORTS-INVENTORY.yml actualizado - [ ] Ningun servicio roto - [ ] Documentacion actualizada --- ## ORDEN DE IMPLEMENTACION RECOMENDADO ``` 1. ERP-CORE (3000 -> 3106) | 2. MECANICAS-DIESEL (3000 -> 3166) | 3. POS-MICRO (3000 -> 3226) | 4. PMC (3000 -> 3606) | 5. VIDRIO-TEMPLADO (3200 -> 3146) | 6. Crear .env.ports faltantes | 7. Validacion completa | 8. Actualizar inventario final ``` --- ## ROLLBACK PLAN Si algo falla, revertir cambios en orden inverso: ```bash # Git puede ayudar git diff projects/erp-suite/apps/erp-core/.env git checkout -- projects/erp-suite/apps/erp-core/.env ``` --- ## ESTIMACION DE ESFUERZO | Fase | Archivos | Complejidad | Tiempo Estimado | |------|----------|-------------|-----------------| | Fase 1.1.1 (erp-core) | 3 | Baja | 15 min | | Fase 1.1.2 (mecanicas) | 2 | Baja | 15 min | | Fase 1.1.3 (pos-micro) | 3 | Media | 20 min | | Fase 1.1.4 (pmc) | 1 | Baja | 10 min | | Fase 2 (vidrio-templado) | 1 | Baja | 10 min | | Fase 3 (.env.ports) | 4 | Baja | 20 min | | Fase 4 (validacion) | - | Media | 30 min | | **TOTAL** | **14** | - | **~2 horas** | --- ## APROBACION REQUERIDA Este plan requiere aprobacion antes de implementar: - [ ] Tech-Leader / Orquestador - [ ] Responsable de cada proyecto afectado --- ## ARCHIVOS RELACIONADOS - `DEVENV-PORTS-INVENTORY.yml` - Inventario completo - `ANALISIS-PUERTOS-WORKSPACE.md` - Analisis detallado - `DEVENV-PORT-STANDARDS.md` - Estandar de asignacion - `PERFIL-DEVENV.md` - Perfil del agente DevEnv - `PERFIL-ARCHITECTURE-ANALYST.md` - Perfil del orquestador --- **Version:** 1.0.0 | **Estado:** PENDIENTE APROBACION | **Generado por:** Architecture-Analyst