Skip to main content
Glama
system-health-check.sh•10.3 kB
#!/bin/bash # EuConquisto Composer MCP - System Health Check # Version: 1.0.0 # Purpose: Comprehensive system validation # Usage: ./scripts/system-health-check.sh set -e # Exit on any error # Configuration PROJECT_ROOT="/Users/ricardokawasaki/Desktop/euconquisto-composer-mcp-poc" # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' BLUE='\033[0;34m' NC='\033[0m' # No Color # Counters TOTAL_CHECKS=0 PASSED_CHECKS=0 FAILED_CHECKS=0 # Logging functions log() { echo -e "${BLUE}[HEALTH-CHECK]${NC} $1" } success() { echo -e "${GREEN}[PASS]${NC} $1" ((PASSED_CHECKS++)) } failure() { echo -e "${RED}[FAIL]${NC} $1" ((FAILED_CHECKS++)) } warning() { echo -e "${YELLOW}[WARN]${NC} $1" } # Check function wrapper check() { ((TOTAL_CHECKS++)) "$@" } # Check Node.js environment check_nodejs() { log "Checking Node.js environment" if command -v node >/dev/null 2>&1; then local node_version=$(node --version) success "Node.js available: $node_version" # Check version is 18 or higher local major_version=$(echo "$node_version" | sed 's/v//' | cut -d. -f1) if [ "$major_version" -ge 18 ]; then success "Node.js version is compatible (>=18)" else failure "Node.js version too old: $node_version (requires >=18)" fi else failure "Node.js not found" fi if command -v npm >/dev/null 2>&1; then local npm_version=$(npm --version) success "npm available: $npm_version" else failure "npm not found" fi } # Check Playwright check_playwright() { log "Checking Playwright installation" if command -v npx >/dev/null 2>&1; then if npx playwright --version >/dev/null 2>&1; then local playwright_version=$(npx playwright --version) success "Playwright available: $playwright_version" else failure "Playwright not installed" fi else failure "npx not available (npm issue)" fi } # Check project files check_project_files() { log "Checking project files" # Check package.json if [ -f "$PROJECT_ROOT/package.json" ]; then success "package.json exists" # Check if it's valid JSON if jq empty "$PROJECT_ROOT/package.json" 2>/dev/null; then success "package.json is valid JSON" else failure "package.json is invalid JSON" fi else failure "package.json missing" fi # Check node_modules if [ -d "$PROJECT_ROOT/node_modules" ]; then success "node_modules directory exists" else failure "node_modules directory missing (run npm install)" fi } # Check v4.0.3 system check_v403_system() { log "Checking v4.0.3 system files" local v403_file="$PROJECT_ROOT/dist/browser-automation-api-direct-save-v4.0.3.js" if [ -f "$v403_file" ]; then success "v4.0.3 main file exists" # Check file size (should be substantial) local file_size=$(wc -c < "$v403_file") if [ "$file_size" -gt 10000 ]; then success "v4.0.3 file size appears normal ($file_size bytes)" else failure "v4.0.3 file suspiciously small ($file_size bytes)" fi # Check syntax if node -c "$v403_file" 2>/dev/null; then success "v4.0.3 file syntax is valid" else failure "v4.0.3 file has syntax errors" fi else failure "v4.0.3 main file missing" fi } # Check JWT token check_jwt_token() { log "Checking JWT token" local jwt_file="$PROJECT_ROOT/archive/authentication/correct-jwt-new.txt" if [ -f "$jwt_file" ]; then success "JWT token file exists" # Check token length local token_length=$(wc -c < "$jwt_file") if [ "$token_length" -eq 3276 ]; then success "JWT token length correct (3276 characters)" else failure "JWT token length incorrect ($token_length characters, expected 3276)" fi # Check token content (should not be empty or contain only whitespace) if [ -s "$jwt_file" ] && [ "$(tr -d '[:space:]' < "$jwt_file")" ]; then success "JWT token contains content" else failure "JWT token is empty or contains only whitespace" fi else failure "JWT token file missing" fi } # Check JWT redirect server check_jwt_server() { log "Checking JWT redirect server" local jwt_server_file="$PROJECT_ROOT/tools/servers/jwt-redirect-server-v1.0.2.js" if [ -f "$jwt_server_file" ]; then success "JWT redirect server file exists" # Check syntax if node -c "$jwt_server_file" 2>/dev/null; then success "JWT redirect server syntax is valid" else failure "JWT redirect server has syntax errors" fi # Check if server is running if lsof -ti :8080 >/dev/null 2>&1; then success "JWT redirect server is running on port 8080" # Test server response if curl -s "http://localhost:8080" >/dev/null; then success "JWT redirect server responding to requests" else failure "JWT redirect server not responding" fi else warning "JWT redirect server not running (this may be expected)" fi else failure "JWT redirect server file missing" fi } # Check modular infrastructure check_modular_infrastructure() { log "Checking modular infrastructure" local infra_dir="$PROJECT_ROOT/src/infrastructure" if [ -d "$infra_dir" ]; then success "Infrastructure directory exists" # Check each module local modules=("browser-automation.js" "authentication.js" "api-client.js" "workflow-orchestrator.js" "index.js") for module in "${modules[@]}"; do local module_path="$infra_dir/$module" if [ -f "$module_path" ]; then success "Module exists: $module" # Check syntax if node -c "$module_path" 2>/dev/null; then success "Module syntax valid: $module" else failure "Module syntax error: $module" fi else failure "Module missing: $module" fi done else warning "Modular infrastructure not found (may not be implemented yet)" fi } # Check external services check_external_services() { log "Checking external service connectivity" # Check EuConquisto platform if curl -s --max-time 10 "https://composer.euconquisto.com" >/dev/null; then success "EuConquisto platform reachable" else failure "EuConquisto platform not reachable" fi # Check Digital Pages API if curl -s --max-time 10 "https://api.digitalpages.com.br" >/dev/null; then success "Digital Pages API reachable" else failure "Digital Pages API not reachable" fi } # Check backup system check_backup_system() { log "Checking backup system" local backup_script="$PROJECT_ROOT/scripts/backup-system.sh" if [ -f "$backup_script" ]; then success "Backup script exists" # Check if executable if [ -x "$backup_script" ]; then success "Backup script is executable" else warning "Backup script not executable (run: chmod +x $backup_script)" fi else warning "Backup script not found" fi # Check for existing backups local backup_dir="$PROJECT_ROOT/backups/migration-safety" if [ -d "$backup_dir" ]; then local backup_count=$(find "$backup_dir" -name "backup_*" -type d | wc -l) if [ "$backup_count" -gt 0 ]; then success "Found $backup_count backup(s)" else warning "No backups found" fi else warning "Backup directory not found" fi } # Generate summary report generate_summary() { echo "" echo "========================================" echo " HEALTH CHECK SUMMARY" echo "========================================" echo "" local pass_rate=$((PASSED_CHECKS * 100 / TOTAL_CHECKS)) echo "Total Checks: $TOTAL_CHECKS" echo "Passed: $PASSED_CHECKS" echo "Failed: $FAILED_CHECKS" echo "Pass Rate: $pass_rate%" echo "" if [ "$FAILED_CHECKS" -eq 0 ]; then success "šŸŽ‰ ALL HEALTH CHECKS PASSED" echo "" echo "System Status: āœ… HEALTHY" echo "Ready for: āœ… Migration, āœ… Development, āœ… Production" elif [ "$pass_rate" -ge 80 ]; then warning "āš ļø SYSTEM MOSTLY HEALTHY" echo "" echo "System Status: āš ļø WARNING" echo "Action Required: Review failed checks and fix issues" else failure "āŒ SYSTEM UNHEALTHY" echo "" echo "System Status: āŒ CRITICAL" echo "Action Required: Fix critical issues before proceeding" fi echo "" echo "Next Steps:" if [ "$FAILED_CHECKS" -eq 0 ]; then echo " • System is ready for normal operation" echo " • Consider running backup before major changes" echo " • Monitor system performance during development" else echo " • Address failed checks listed above" echo " • Run health check again after fixes" echo " • Consider rollback if system is broken" fi } # Main execution main() { echo "========================================" echo " EuConquisto Composer MCP Health Check" echo "========================================" echo "" log "Starting comprehensive system health check" echo "" check check_nodejs check check_playwright check check_project_files check check_v403_system check check_jwt_token check check_jwt_server check check_modular_infrastructure check check_external_services check check_backup_system generate_summary } # Execute main function main "$@"

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rkm097git/euconquisto-composer-mcp-poc'

If you have feedback or need assistance with the MCP directory API, please join our Discord server