workspace/projects/trading-platform/scripts/check-ports.sh
rckrdmrd ea1879f4ad feat: Initial workspace structure with multi-level Git configuration
- Configure workspace Git repository with comprehensive .gitignore
- Add Odoo as submodule for ERP reference code
- Include documentation: SETUP.md, GIT-STRUCTURE.md
- Add gitignore templates for projects (backend, frontend, database)
- Structure supports independent repos per project/subproject level

Workspace includes:
- core/ - Reusable patterns, modules, orchestration system
- projects/ - Active projects (erp-suite, gamilit, trading-platform, etc.)
- knowledge-base/ - Reference code and patterns (includes Odoo submodule)
- devtools/ - Development tools and templates
- customers/ - Client implementations template

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-08 10:44:23 -06:00

180 lines
8.7 KiB
Bash
Executable File

#!/bin/bash
################################################################################
# OrbiQuant IA Trading Platform - Port Status Checker
################################################################################
# Script para verificar el estado de todos los puertos de servicios
# Uso: ./scripts/check-ports.sh
################################################################################
set -e
echo "================================================================================"
echo " ORBIQUANT IA TRADING PLATFORM - PORT STATUS CHECK"
echo "================================================================================"
echo ""
echo "Fecha: $(date '+%Y-%m-%d %H:%M:%S')"
echo ""
# Colores para output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
################################################################################
# FUNCIÓN: Verificar si un puerto está en uso
################################################################################
check_port() {
local service_name=$1
local port=$2
local category=$3
if ss -tuln | grep -q ":$port "; then
printf "${GREEN}${NC} %-25s Port %-6s ${GREEN}RUNNING${NC}\n" "$service_name" "$port"
return 0
else
printf "${RED}${NC} %-25s Port %-6s ${RED}NOT RUNNING${NC}\n" "$service_name" "$port"
return 1
fi
}
################################################################################
# SERVICIOS PRINCIPALES
################################################################################
echo "─────────────────────────────────────────────────────────────────────────────"
echo " FRONTEND SERVICES"
echo "─────────────────────────────────────────────────────────────────────────────"
check_port "Frontend Web (React)" "3100" "frontend"
check_port "Frontend Admin" "3101" "frontend"
check_port "Frontend Preview" "4173" "frontend"
echo ""
echo "─────────────────────────────────────────────────────────────────────────────"
echo " BACKEND SERVICES (Node.js)"
echo "─────────────────────────────────────────────────────────────────────────────"
check_port "Backend API (Express)" "4000" "backend"
check_port "Backend WebSocket" "4001" "backend"
check_port "Backend Webhooks" "4002" "backend"
echo ""
echo "─────────────────────────────────────────────────────────────────────────────"
echo " PYTHON SERVICES"
echo "─────────────────────────────────────────────────────────────────────────────"
check_port "ML Engine (FastAPI)" "5000" "python"
check_port "Data Service" "5001" "python"
check_port "LLM Agent" "5002" "python"
check_port "Portfolio Manager" "5003" "python"
echo ""
echo "─────────────────────────────────────────────────────────────────────────────"
echo " INFRASTRUCTURE"
echo "─────────────────────────────────────────────────────────────────────────────"
check_port "PostgreSQL" "5432" "database"
check_port "PostgreSQL Test" "5433" "database"
check_port "Redis" "6379" "cache"
check_port "MySQL (Legacy)" "3306" "database"
echo ""
echo "─────────────────────────────────────────────────────────────────────────────"
echo " DEVELOPMENT TOOLS (Optional)"
echo "─────────────────────────────────────────────────────────────────────────────"
check_port "PgAdmin" "5050" "tools"
check_port "Mailhog SMTP" "1025" "tools"
check_port "Mailhog Web" "8025" "tools"
check_port "Jenkins" "8080" "cicd"
echo ""
################################################################################
# VERIFICACIÓN DE PROCESOS
################################################################################
echo "─────────────────────────────────────────────────────────────────────────────"
echo " PROCESSES DETAILS"
echo "─────────────────────────────────────────────────────────────────────────────"
# Función para mostrar detalles del proceso en un puerto
show_process_details() {
local port=$1
local service_name=$2
if ss -tuln | grep -q ":$port "; then
echo ""
echo "Port $port ($service_name):"
# Mostrar proceso escuchando en el puerto
if command -v lsof &> /dev/null; then
lsof -i :$port | tail -n +2 | awk '{printf " PID: %-7s Command: %s\n", $2, $1}'
else
ss -tulnp | grep ":$port " | awk '{print " " $0}'
fi
fi
}
# Mostrar detalles de servicios activos
show_process_details "3100" "Frontend Web"
show_process_details "4000" "Backend API"
show_process_details "4001" "Backend WS"
show_process_details "5000" "ML Engine"
show_process_details "5001" "Data Service"
show_process_details "5432" "PostgreSQL"
show_process_details "6379" "Redis"
echo ""
################################################################################
# DOCKER CONTAINERS
################################################################################
if command -v docker &> /dev/null; then
echo "─────────────────────────────────────────────────────────────────────────────"
echo " DOCKER CONTAINERS"
echo "─────────────────────────────────────────────────────────────────────────────"
if docker ps --filter "name=orbiquant" --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}" | grep -q orbiquant; then
docker ps --filter "name=orbiquant" --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
else
echo "No OrbiQuant containers running"
fi
echo ""
fi
################################################################################
# RESUMEN
################################################################################
echo "================================================================================"
echo " SUMMARY"
echo "================================================================================"
# Contar servicios activos
TOTAL_SERVICES=14
RUNNING_SERVICES=0
for port in 3100 4000 4001 5000 5001 5432 6379; do
if ss -tuln | grep -q ":$port "; then
((RUNNING_SERVICES++))
fi
done
echo "Critical Services Running: $RUNNING_SERVICES / 7"
echo ""
# Recomendaciones
if [ $RUNNING_SERVICES -eq 0 ]; then
echo "${RED}WARNING:${NC} No critical services are running!"
echo "Run: docker-compose up -d"
elif [ $RUNNING_SERVICES -lt 7 ]; then
echo "${YELLOW}NOTICE:${NC} Some services are not running."
echo "Check individual service logs for details."
else
echo "${GREEN}SUCCESS:${NC} All critical services are running!"
fi
echo ""
echo "For detailed logs, use:"
echo " - Docker: docker-compose logs -f [service-name]"
echo " - System: journalctl -u [service-name] -f"
echo ""
echo "Port configuration file: .env.ports"
echo "Full documentation: docs/95-guias-desarrollo/PUERTOS-SERVICIOS.md"
echo ""
echo "================================================================================"