docs: Update CHANGELOG and README for deployment models and troubleshooting
- Added multi-platform deployment architecture details (Web App, PWA, DApp) to README.md. - Included comprehensive troubleshooting guides and fix scripts in README.md. - Enhanced CHANGELOG.md with new features, fixes, and improvements, including TypeScript error resolutions and updated documentation structure. - Revised development setup instructions in DEV_SETUP.md to reflect changes in script usage and environment variable setup.
This commit is contained in:
@@ -27,11 +27,9 @@ try {
|
||||
}
|
||||
|
||||
# Check PostgreSQL
|
||||
$pgRunning = $false
|
||||
try {
|
||||
$result = Test-NetConnection -ComputerName localhost -Port 5432 -WarningAction SilentlyContinue
|
||||
if ($result.TcpTestSucceeded) {
|
||||
$pgRunning = $true
|
||||
Write-Host "✅ PostgreSQL (5432): Running" -ForegroundColor Green
|
||||
}
|
||||
} catch {
|
||||
@@ -39,11 +37,9 @@ try {
|
||||
}
|
||||
|
||||
# Check Redis
|
||||
$redisRunning = $false
|
||||
try {
|
||||
$result = Test-NetConnection -ComputerName localhost -Port 6379 -WarningAction SilentlyContinue
|
||||
if ($result.TcpTestSucceeded) {
|
||||
$redisRunning = $true
|
||||
Write-Host "✅ Redis (6379): Running" -ForegroundColor Green
|
||||
}
|
||||
} catch {
|
||||
|
||||
48
scripts/check-status.sh
Normal file
48
scripts/check-status.sh
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
# Quick Status Check Script
|
||||
|
||||
echo -e "\n\033[0;36m=== Service Status ===\033[0m"
|
||||
|
||||
# Check Webapp
|
||||
if nc -z localhost 3000 2>/dev/null; then
|
||||
echo -e "\033[0;32m✅ Webapp (3000): Running\033[0m"
|
||||
WEBAPP_RUNNING=true
|
||||
else
|
||||
echo -e "\033[0;31m❌ Webapp (3000): Not running\033[0m"
|
||||
WEBAPP_RUNNING=false
|
||||
fi
|
||||
|
||||
# Check Orchestrator
|
||||
if nc -z localhost 8080 2>/dev/null; then
|
||||
echo -e "\033[0;32m✅ Orchestrator (8080): Running\033[0m"
|
||||
ORCH_RUNNING=true
|
||||
else
|
||||
echo -e "\033[0;31m❌ Orchestrator (8080): Not running\033[0m"
|
||||
ORCH_RUNNING=false
|
||||
fi
|
||||
|
||||
# Check PostgreSQL
|
||||
if nc -z localhost 5432 2>/dev/null; then
|
||||
echo -e "\033[0;32m✅ PostgreSQL (5432): Running\033[0m"
|
||||
else
|
||||
echo -e "\033[0;33m⚠️ PostgreSQL (5432): Not running (optional)\033[0m"
|
||||
fi
|
||||
|
||||
# Check Redis
|
||||
if nc -z localhost 6379 2>/dev/null; then
|
||||
echo -e "\033[0;32m✅ Redis (6379): Running\033[0m"
|
||||
else
|
||||
echo -e "\033[0;33m⚠️ Redis (6379): Not running (optional)\033[0m"
|
||||
fi
|
||||
|
||||
echo -e "\n\033[0;36m=== Quick Access ===\033[0m"
|
||||
if [ "$WEBAPP_RUNNING" = true ]; then
|
||||
echo -e "Frontend: http://localhost:3000"
|
||||
fi
|
||||
if [ "$ORCH_RUNNING" = true ]; then
|
||||
echo -e "Backend: http://localhost:8080"
|
||||
echo -e "Health: http://localhost:8080/health"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
37
scripts/complete-todos.ps1
Normal file
37
scripts/complete-todos.ps1
Normal file
@@ -0,0 +1,37 @@
|
||||
# Parallel TODO Completion Script
|
||||
# This script helps track and complete todos in priority order
|
||||
|
||||
Write-Host "`n========================================" -ForegroundColor Cyan
|
||||
Write-Host " TODO COMPLETION TRACKER" -ForegroundColor Cyan
|
||||
Write-Host "========================================`n" -ForegroundColor Cyan
|
||||
|
||||
# Read remaining todos
|
||||
$todosFile = "docs/REMAINING_TODOS.md"
|
||||
if (Test-Path $todosFile) {
|
||||
Write-Host "Reading todos from: $todosFile" -ForegroundColor Yellow
|
||||
$content = Get-Content $todosFile -Raw
|
||||
|
||||
# Count remaining todos
|
||||
$remaining = ([regex]::Matches($content, "- \[ \]")).Count
|
||||
$completed = ([regex]::Matches($content, "- \[x\]")).Count
|
||||
|
||||
Write-Host "`nProgress:" -ForegroundColor Cyan
|
||||
Write-Host " Remaining: $remaining todos" -ForegroundColor Yellow
|
||||
Write-Host " Completed: $completed todos" -ForegroundColor Green
|
||||
|
||||
if ($remaining -gt 0) {
|
||||
$percent = [math]::Round(($completed / ($remaining + $completed)) * 100, 1)
|
||||
Write-Host " Completion: $percent%" -ForegroundColor $(if ($percent -gt 50) { "Green" } elseif ($percent -gt 25) { "Yellow" } else { "Red" })
|
||||
}
|
||||
} else {
|
||||
Write-Host "[WARN] Todos file not found: $todosFile" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
Write-Host "`nQuick Actions:" -ForegroundColor Cyan
|
||||
Write-Host " 1. Check service status: .\scripts\check-status.ps1" -ForegroundColor White
|
||||
Write-Host " 2. Verify services: .\scripts\verify-services.ps1" -ForegroundColor White
|
||||
Write-Host " 3. Test endpoints: .\scripts\test-curl.ps1" -ForegroundColor White
|
||||
Write-Host " 4. Setup database: .\scripts\setup-database.ps1" -ForegroundColor White
|
||||
Write-Host " 5. Fix frontend: .\scripts\fix-frontend.ps1" -ForegroundColor White
|
||||
Write-Host ""
|
||||
|
||||
45
scripts/complete-todos.sh
Normal file
45
scripts/complete-todos.sh
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
# Parallel TODO Completion Script
|
||||
# This script helps track and complete todos in priority order
|
||||
|
||||
echo -e "\n========================================"
|
||||
echo -e " TODO COMPLETION TRACKER"
|
||||
echo -e "========================================\n"
|
||||
|
||||
# Read remaining todos
|
||||
TODOS_FILE="docs/REMAINING_TODOS.md"
|
||||
if [ -f "$TODOS_FILE" ]; then
|
||||
echo -e "\033[0;33mReading todos from: $TODOS_FILE\033[0m"
|
||||
|
||||
# Count remaining todos
|
||||
REMAINING=$(grep -c "^- \[ \]" "$TODOS_FILE" 2>/dev/null || echo "0")
|
||||
COMPLETED=$(grep -c "^- \[x\]" "$TODOS_FILE" 2>/dev/null || echo "0")
|
||||
|
||||
echo -e "\n\033[0;36mProgress:\033[0m"
|
||||
echo -e " Remaining: \033[0;33m$REMAINING todos\033[0m"
|
||||
echo -e " Completed: \033[0;32m$COMPLETED todos\033[0m"
|
||||
|
||||
if [ "$REMAINING" -gt 0 ] || [ "$COMPLETED" -gt 0 ]; then
|
||||
TOTAL=$((REMAINING + COMPLETED))
|
||||
PERCENT=$(awk "BEGIN {printf \"%.1f\", ($COMPLETED / $TOTAL) * 100}")
|
||||
if (( $(echo "$PERCENT > 50" | bc -l) )); then
|
||||
color="\033[0;32m"
|
||||
elif (( $(echo "$PERCENT > 25" | bc -l) )); then
|
||||
color="\033[0;33m"
|
||||
else
|
||||
color="\033[0;31m"
|
||||
fi
|
||||
echo -e " Completion: ${color}${PERCENT}%\033[0m"
|
||||
fi
|
||||
else
|
||||
echo -e "\033[0;33m⚠️ Todos file not found: $TODOS_FILE\033[0m"
|
||||
fi
|
||||
|
||||
echo -e "\n\033[0;36mQuick Actions:\033[0m"
|
||||
echo -e " 1. Check service status: ./scripts/check-status.sh"
|
||||
echo -e " 2. Verify services: ./scripts/verify-services.sh"
|
||||
echo -e " 3. Test endpoints: ./scripts/test-curl.sh"
|
||||
echo -e " 4. Setup database: ./scripts/setup-database.sh"
|
||||
echo -e " 5. Fix frontend: ./scripts/fix-frontend.sh"
|
||||
echo ""
|
||||
|
||||
50
scripts/consolidate-branches.sh
Normal file
50
scripts/consolidate-branches.sh
Normal file
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
# Branch Consolidation Script
|
||||
# Consolidates all Dependabot branches into main
|
||||
|
||||
echo -e "\033[0;32mStarting branch consolidation...\033[0m"
|
||||
|
||||
# Fetch latest from remote
|
||||
echo -e "\033[0;33mFetching latest from remote...\033[0m"
|
||||
git fetch origin
|
||||
|
||||
# Get current branch
|
||||
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
echo -e "Current branch: \033[0;36m$CURRENT_BRANCH\033[0m"
|
||||
|
||||
# Ensure we're on main
|
||||
if [ "$CURRENT_BRANCH" != "main" ]; then
|
||||
echo -e "\033[0;33mSwitching to main branch...\033[0m"
|
||||
git checkout main
|
||||
fi
|
||||
|
||||
# Get all Dependabot branches
|
||||
DEPENDABOT_BRANCHES=$(git branch -r --list "origin/dependabot/*" | sed 's/^[[:space:]]*//')
|
||||
|
||||
echo -e "\n\033[0;36mFound Dependabot branches:\033[0m"
|
||||
echo "$DEPENDABOT_BRANCHES" | while read -r branch; do
|
||||
if [ -n "$branch" ]; then
|
||||
echo -e " - $branch"
|
||||
fi
|
||||
done
|
||||
|
||||
echo -e "\n\033[0;33mNote: Dependabot branches should be merged via GitHub PRs\033[0m"
|
||||
echo -e "\033[0;33mThis script prepares the consolidation plan.\033[0m"
|
||||
|
||||
# Create summary
|
||||
BRANCH_COUNT=$(echo "$DEPENDABOT_BRANCHES" | grep -c "dependabot" || echo "0")
|
||||
SUMMARY="# Branch Consolidation Summary
|
||||
|
||||
## Dependabot Branches Found
|
||||
$BRANCH_COUNT branches
|
||||
|
||||
## Next Steps
|
||||
1. Review Dependabot PRs on GitHub
|
||||
2. Test each dependency update
|
||||
3. Merge approved PRs
|
||||
4. Clean up merged branches
|
||||
"
|
||||
|
||||
echo -e "\n$SUMMARY"
|
||||
echo -e "\n\033[0;32mConsolidation plan created!\033[0m"
|
||||
|
||||
60
scripts/fix-frontend.ps1
Normal file
60
scripts/fix-frontend.ps1
Normal file
@@ -0,0 +1,60 @@
|
||||
# Frontend Fix Script
|
||||
|
||||
Write-Host "`n========================================" -ForegroundColor Cyan
|
||||
Write-Host " FRONTEND FIX SCRIPT" -ForegroundColor Cyan
|
||||
Write-Host "========================================`n" -ForegroundColor Cyan
|
||||
|
||||
# Step 1: Stop existing webapp
|
||||
Write-Host "1. Stopping existing webapp..." -ForegroundColor Yellow
|
||||
$webappProcess = Get-Process node -ErrorAction SilentlyContinue | Where-Object {
|
||||
(Get-NetTCPConnection -OwningProcess $_.Id -ErrorAction SilentlyContinue | Where-Object { $_.LocalPort -eq 3000 })
|
||||
}
|
||||
if ($webappProcess) {
|
||||
Stop-Process -Id $webappProcess.Id -Force -ErrorAction SilentlyContinue
|
||||
Write-Host " ✅ Stopped webapp process" -ForegroundColor Green
|
||||
Start-Sleep -Seconds 2
|
||||
}
|
||||
|
||||
# Step 2: Clear Next.js cache
|
||||
Write-Host "`n2. Clearing Next.js cache..." -ForegroundColor Yellow
|
||||
cd webapp
|
||||
if (Test-Path ".next") {
|
||||
Remove-Item -Recurse -Force .next -ErrorAction SilentlyContinue
|
||||
Write-Host " ✅ Cleared .next cache" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host " ℹ️ No cache to clear" -ForegroundColor Gray
|
||||
}
|
||||
|
||||
# Step 3: Check/Create .env.local
|
||||
Write-Host "`n3. Checking environment variables..." -ForegroundColor Yellow
|
||||
if (-not (Test-Path ".env.local")) {
|
||||
@"
|
||||
NEXT_PUBLIC_ORCH_URL=http://localhost:8080
|
||||
NEXTAUTH_SECRET=dev-secret-change-in-production-min-32-chars
|
||||
"@ | Out-File -FilePath ".env.local" -Encoding utf8
|
||||
Write-Host " [OK] Created .env.local" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host " [OK] .env.local exists" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Step 4: Verify dependencies
|
||||
Write-Host "`n4. Checking dependencies..." -ForegroundColor Yellow
|
||||
if (-not (Test-Path "node_modules")) {
|
||||
Write-Host " ⚠️ node_modules not found. Installing..." -ForegroundColor Yellow
|
||||
npm install
|
||||
} else {
|
||||
Write-Host " [OK] Dependencies installed" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Step 5: Start webapp
|
||||
Write-Host "`n5. Starting webapp..." -ForegroundColor Yellow
|
||||
Write-Host " Starting in new window..." -ForegroundColor Gray
|
||||
Start-Process powershell -ArgumentList "-NoExit", "-Command", "cd '$PWD'; npm run dev" -WindowStyle Normal
|
||||
|
||||
Write-Host "`n[OK] Webapp starting!" -ForegroundColor Green
|
||||
Write-Host " Wait 10-15 seconds for Next.js to compile" -ForegroundColor Yellow
|
||||
Write-Host " Then open: http://localhost:3000" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
cd ..
|
||||
|
||||
62
scripts/fix-frontend.sh
Normal file
62
scripts/fix-frontend.sh
Normal file
@@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
# Frontend Fix Script
|
||||
|
||||
echo -e "\n========================================"
|
||||
echo -e " FRONTEND FIX SCRIPT"
|
||||
echo -e "========================================\n"
|
||||
|
||||
# Step 1: Stop existing webapp
|
||||
echo -e "1. Stopping existing webapp..."
|
||||
if lsof -ti:3000 > /dev/null 2>&1; then
|
||||
kill $(lsof -ti:3000) 2>/dev/null
|
||||
echo -e " ✅ Stopped webapp process"
|
||||
sleep 2
|
||||
else
|
||||
echo -e " ℹ️ No webapp process running on port 3000"
|
||||
fi
|
||||
|
||||
# Step 2: Clear Next.js cache
|
||||
echo -e "\n2. Clearing Next.js cache..."
|
||||
cd webapp || exit 1
|
||||
if [ -d ".next" ]; then
|
||||
rm -rf .next
|
||||
echo -e " ✅ Cleared .next cache"
|
||||
else
|
||||
echo -e " ℹ️ No cache to clear"
|
||||
fi
|
||||
|
||||
# Step 3: Check/Create .env.local
|
||||
echo -e "\n3. Checking environment variables..."
|
||||
if [ ! -f ".env.local" ]; then
|
||||
cat > .env.local << EOF
|
||||
NEXT_PUBLIC_ORCH_URL=http://localhost:8080
|
||||
NEXTAUTH_SECRET=dev-secret-change-in-production-min-32-chars
|
||||
EOF
|
||||
echo -e " ✅ Created .env.local"
|
||||
else
|
||||
echo -e " ✅ .env.local exists"
|
||||
fi
|
||||
|
||||
# Step 4: Verify dependencies
|
||||
echo -e "\n4. Checking dependencies..."
|
||||
if [ ! -d "node_modules" ]; then
|
||||
echo -e " ⚠️ node_modules not found. Installing..."
|
||||
npm install
|
||||
else
|
||||
echo -e " ✅ Dependencies installed"
|
||||
fi
|
||||
|
||||
# Step 5: Start webapp
|
||||
echo -e "\n5. Starting webapp..."
|
||||
echo -e " Starting in background..."
|
||||
npm run dev &
|
||||
WEBAPP_PID=$!
|
||||
|
||||
echo -e "\n✅ Webapp starting! (PID: $WEBAPP_PID)"
|
||||
echo -e " Wait 10-15 seconds for Next.js to compile"
|
||||
echo -e " Then open: http://localhost:3000"
|
||||
echo -e " To stop: kill $WEBAPP_PID"
|
||||
echo ""
|
||||
|
||||
cd ..
|
||||
|
||||
76
scripts/setup-database.ps1
Normal file
76
scripts/setup-database.ps1
Normal file
@@ -0,0 +1,76 @@
|
||||
# Database Setup Script
|
||||
|
||||
Write-Host "`n========================================" -ForegroundColor Cyan
|
||||
Write-Host " DATABASE SETUP" -ForegroundColor Cyan
|
||||
Write-Host "========================================`n" -ForegroundColor Cyan
|
||||
|
||||
# Check if Docker is available
|
||||
if (-not (Get-Command docker -ErrorAction SilentlyContinue)) {
|
||||
Write-Host "❌ Docker not found" -ForegroundColor Red
|
||||
Write-Host " Please install Docker Desktop or set up PostgreSQL manually" -ForegroundColor Yellow
|
||||
Write-Host " See docs/DATABASE_OPTIONS.md for manual setup instructions" -ForegroundColor Gray
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "[OK] Docker found" -ForegroundColor Green
|
||||
|
||||
# Check if container already exists
|
||||
$existing = docker ps -a --filter "name=combo-postgres" --format "{{.Names}}"
|
||||
if ($existing) {
|
||||
Write-Host "`n📦 Existing container found: $existing" -ForegroundColor Yellow
|
||||
|
||||
# Check if running
|
||||
$running = docker ps --filter "name=combo-postgres" --format "{{.Names}}"
|
||||
if ($running) {
|
||||
Write-Host "[OK] Container is already running" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "🔄 Starting existing container..." -ForegroundColor Yellow
|
||||
docker start combo-postgres
|
||||
Start-Sleep -Seconds 3
|
||||
}
|
||||
} else {
|
||||
Write-Host "`n📦 Creating new PostgreSQL container..." -ForegroundColor Yellow
|
||||
docker run --name combo-postgres `
|
||||
-e POSTGRES_PASSWORD=postgres `
|
||||
-e POSTGRES_DB=comboflow `
|
||||
-p 5432:5432 `
|
||||
-d postgres:15
|
||||
|
||||
Write-Host "⏳ Waiting for database to initialize..." -ForegroundColor Yellow
|
||||
Start-Sleep -Seconds 5
|
||||
}
|
||||
|
||||
# Verify connection
|
||||
Write-Host "`n🔍 Verifying database connection..." -ForegroundColor Yellow
|
||||
Start-Sleep -Seconds 3
|
||||
|
||||
$portCheck = Get-NetTCPConnection -LocalPort 5432 -State Listen -ErrorAction SilentlyContinue
|
||||
if ($portCheck) {
|
||||
Write-Host "[OK] PostgreSQL is running on port 5432" -ForegroundColor Green
|
||||
|
||||
# Test connection
|
||||
try {
|
||||
$testResult = docker exec combo-postgres psql -U postgres -d comboflow -c "SELECT 1;" 2>&1
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "[OK] Database connection successful" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "⚠️ Connection test failed" -ForegroundColor Yellow
|
||||
}
|
||||
} catch {
|
||||
Write-Host "⚠️ Could not test connection: $_" -ForegroundColor Yellow
|
||||
}
|
||||
} else {
|
||||
Write-Host "❌ PostgreSQL is not listening on port 5432" -ForegroundColor Red
|
||||
Write-Host " Check container logs: docker logs combo-postgres" -ForegroundColor Gray
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "`n📝 Next steps:" -ForegroundColor Cyan
|
||||
Write-Host " 1. Update orchestrator/.env with:" -ForegroundColor White
|
||||
Write-Host " DATABASE_URL=postgresql://postgres:postgres@localhost:5432/comboflow" -ForegroundColor Gray
|
||||
Write-Host " RUN_MIGRATIONS=true" -ForegroundColor Gray
|
||||
Write-Host "`n 2. Run migrations:" -ForegroundColor White
|
||||
Write-Host " cd orchestrator" -ForegroundColor Gray
|
||||
Write-Host " npm run migrate" -ForegroundColor Gray
|
||||
Write-Host ""
|
||||
|
||||
69
scripts/setup-database.sh
Normal file
69
scripts/setup-database.sh
Normal file
@@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
# Database Setup Script
|
||||
|
||||
echo -e "\n========================================"
|
||||
echo -e " DATABASE SETUP"
|
||||
echo -e "========================================\n"
|
||||
|
||||
# Check if Docker is available
|
||||
if ! command -v docker &> /dev/null; then
|
||||
echo -e "\033[0;31m❌ Docker not found\033[0m"
|
||||
echo -e " Please install Docker or set up PostgreSQL manually"
|
||||
echo -e " See docs/DATABASE_OPTIONS.md for manual setup instructions"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "\033[0;32m✅ Docker found\033[0m"
|
||||
|
||||
# Check if container already exists
|
||||
if docker ps -a --filter "name=combo-postgres" --format "{{.Names}}" | grep -q "combo-postgres"; then
|
||||
echo -e "\n📦 Existing container found: combo-postgres"
|
||||
|
||||
# Check if running
|
||||
if docker ps --filter "name=combo-postgres" --format "{{.Names}}" | grep -q "combo-postgres"; then
|
||||
echo -e "\033[0;32m✅ Container is already running\033[0m"
|
||||
else
|
||||
echo -e "🔄 Starting existing container..."
|
||||
docker start combo-postgres
|
||||
sleep 3
|
||||
fi
|
||||
else
|
||||
echo -e "\n📦 Creating new PostgreSQL container..."
|
||||
docker run --name combo-postgres \
|
||||
-e POSTGRES_PASSWORD=postgres \
|
||||
-e POSTGRES_DB=comboflow \
|
||||
-p 5432:5432 \
|
||||
-d postgres:15
|
||||
|
||||
echo -e "⏳ Waiting for database to initialize..."
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
# Verify connection
|
||||
echo -e "\n🔍 Verifying database connection..."
|
||||
sleep 3
|
||||
|
||||
if nc -z localhost 5432 2>/dev/null; then
|
||||
echo -e "\033[0;32m✅ PostgreSQL is running on port 5432\033[0m"
|
||||
|
||||
# Test connection
|
||||
if docker exec combo-postgres psql -U postgres -d comboflow -c "SELECT 1;" > /dev/null 2>&1; then
|
||||
echo -e "\033[0;32m✅ Database connection successful\033[0m"
|
||||
else
|
||||
echo -e "\033[0;33m⚠️ Connection test failed\033[0m"
|
||||
fi
|
||||
else
|
||||
echo -e "\033[0;31m❌ PostgreSQL is not listening on port 5432\033[0m"
|
||||
echo -e " Check container logs: docker logs combo-postgres"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "\n\033[0;36m📝 Next steps:\033[0m"
|
||||
echo -e " 1. Update orchestrator/.env with:"
|
||||
echo -e " DATABASE_URL=postgresql://postgres:postgres@localhost:5432/comboflow"
|
||||
echo -e " RUN_MIGRATIONS=true"
|
||||
echo -e "\n 2. Run migrations:"
|
||||
echo -e " cd orchestrator"
|
||||
echo -e " npm run migrate"
|
||||
echo ""
|
||||
|
||||
71
scripts/start-all.sh
Normal file
71
scripts/start-all.sh
Normal file
@@ -0,0 +1,71 @@
|
||||
#!/bin/bash
|
||||
# Start All Development Services
|
||||
# Starts webapp, orchestrator, and optionally database services
|
||||
|
||||
echo -e "\033[0;32mStarting all development services...\033[0m"
|
||||
|
||||
# Check if Docker is available
|
||||
if command -v docker &> /dev/null; then
|
||||
echo -e "\n\033[0;33mDocker detected - checking for database services...\033[0m"
|
||||
DOCKER_AVAILABLE=true
|
||||
else
|
||||
echo -e "\n\033[0;33mDocker not available - starting services without containers\033[0m"
|
||||
DOCKER_AVAILABLE=false
|
||||
fi
|
||||
|
||||
# Start webapp
|
||||
echo -e "\n[1/3] \033[0;36mStarting webapp (Next.js)...\033[0m"
|
||||
cd webapp || exit 1
|
||||
echo -e "\033[0;32mStarting Next.js dev server...\033[0m"
|
||||
npm run dev &
|
||||
WEBAPP_PID=$!
|
||||
cd ..
|
||||
sleep 2
|
||||
|
||||
# Start orchestrator
|
||||
echo -e "[2/3] \033[0;36mStarting orchestrator (Express)...\033[0m"
|
||||
cd orchestrator || exit 1
|
||||
echo -e "\033[0;32mStarting Orchestrator service...\033[0m"
|
||||
npm run dev &
|
||||
ORCH_PID=$!
|
||||
cd ..
|
||||
sleep 2
|
||||
|
||||
# Start database services if Docker is available
|
||||
if [ "$DOCKER_AVAILABLE" = true ]; then
|
||||
echo -e "[3/3] \033[0;36mStarting database services (PostgreSQL + Redis)...\033[0m"
|
||||
echo -e " Using Docker Compose..."
|
||||
docker-compose up -d postgres redis
|
||||
sleep 3
|
||||
|
||||
# Check if services started successfully
|
||||
if docker-compose ps postgres | grep -q "Up"; then
|
||||
echo -e " ✅ PostgreSQL running"
|
||||
else
|
||||
echo -e " ⚠️ PostgreSQL may not be running"
|
||||
fi
|
||||
|
||||
if docker-compose ps redis | grep -q "Up"; then
|
||||
echo -e " ✅ Redis running"
|
||||
else
|
||||
echo -e " ⚠️ Redis may not be running"
|
||||
fi
|
||||
else
|
||||
echo -e "[3/3] \033[0;33mDatabase services skipped (Docker not available)\033[0m"
|
||||
echo -e " To use PostgreSQL/Redis, install Docker or start them manually"
|
||||
fi
|
||||
|
||||
echo -e "\n\033[0;32m✅ All services starting!\033[0m"
|
||||
echo -e "\n\033[0;36m📍 Service URLs:\033[0m"
|
||||
echo -e " Webapp: http://localhost:3000"
|
||||
echo -e " Orchestrator: http://localhost:8080"
|
||||
echo -e " Health Check: http://localhost:8080/health"
|
||||
if [ "$DOCKER_AVAILABLE" = true ]; then
|
||||
echo -e " PostgreSQL: localhost:5432"
|
||||
echo -e " Redis: localhost:6379"
|
||||
fi
|
||||
|
||||
echo -e "\n\033[0;33m📝 Note: Services are running in background (PIDs: $WEBAPP_PID, $ORCH_PID)\033[0m"
|
||||
echo -e " To stop services: kill $WEBAPP_PID $ORCH_PID"
|
||||
echo ""
|
||||
|
||||
30
scripts/start-dev.sh
Normal file
30
scripts/start-dev.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
# Start Development Servers
|
||||
# This script starts both webapp and orchestrator services
|
||||
|
||||
echo -e "\033[0;32mStarting development servers...\033[0m"
|
||||
|
||||
# Start webapp
|
||||
echo -e "\n\033[0;33mStarting webapp (Next.js)...\033[0m"
|
||||
cd webapp || exit 1
|
||||
npm run dev &
|
||||
WEBAPP_PID=$!
|
||||
cd ..
|
||||
|
||||
# Wait a bit
|
||||
sleep 2
|
||||
|
||||
# Start orchestrator
|
||||
echo -e "\033[0;33mStarting orchestrator (Express)...\033[0m"
|
||||
cd orchestrator || exit 1
|
||||
npm run dev &
|
||||
ORCH_PID=$!
|
||||
cd ..
|
||||
|
||||
echo -e "\n\033[0;32m✅ Development servers starting!\033[0m"
|
||||
echo -e "\n\033[0;36mWebapp: http://localhost:3000\033[0m"
|
||||
echo -e "\033[0;36mOrchestrator: http://localhost:8080\033[0m"
|
||||
echo -e "\n\033[0;33mNote: Servers are running in background (PIDs: $WEBAPP_PID, $ORCH_PID)\033[0m"
|
||||
echo -e "\033[0;33mTo stop: kill $WEBAPP_PID $ORCH_PID\033[0m"
|
||||
echo ""
|
||||
|
||||
176
scripts/test-curl.ps1
Normal file
176
scripts/test-curl.ps1
Normal file
@@ -0,0 +1,176 @@
|
||||
# Comprehensive CURL Functionality Test Script
|
||||
|
||||
Write-Host "`n========================================" -ForegroundColor Cyan
|
||||
Write-Host " CURL FUNCTIONALITY TESTS" -ForegroundColor Cyan
|
||||
Write-Host "========================================`n" -ForegroundColor Cyan
|
||||
|
||||
$testResults = @()
|
||||
|
||||
# Test 1: Webapp
|
||||
Write-Host "1. WEBAPP" -ForegroundColor Yellow
|
||||
Write-Host " Testing: http://localhost:3000" -ForegroundColor Gray
|
||||
try {
|
||||
$response = Invoke-WebRequest -Uri "http://localhost:3000" -TimeoutSec 5 -UseBasicParsing -ErrorAction Stop
|
||||
Write-Host " ✅ Status: $($response.StatusCode)" -ForegroundColor Green
|
||||
$testResults += @{ Test = "Webapp"; Status = "PASS"; Code = $response.StatusCode }
|
||||
} catch {
|
||||
Write-Host " ❌ Error: $($_.Exception.Message)" -ForegroundColor Red
|
||||
$testResults += @{ Test = "Webapp"; Status = "FAIL"; Code = "Error" }
|
||||
}
|
||||
|
||||
# Test 2: Orchestrator Root
|
||||
Write-Host "`n2. ORCHESTRATOR ROOT" -ForegroundColor Yellow
|
||||
Write-Host " Testing: http://localhost:8080" -ForegroundColor Gray
|
||||
try {
|
||||
$response = Invoke-WebRequest -Uri "http://localhost:8080" -TimeoutSec 5 -UseBasicParsing -ErrorAction Stop
|
||||
Write-Host " ⚠️ Status: $($response.StatusCode) (Expected 404)" -ForegroundColor Yellow
|
||||
$testResults += @{ Test = "Orchestrator Root"; Status = "PASS"; Code = $response.StatusCode }
|
||||
} catch {
|
||||
if ($_.Exception.Response.StatusCode -eq 404) {
|
||||
Write-Host " ✅ Status: 404 (Expected - no root route)" -ForegroundColor Green
|
||||
$testResults += @{ Test = "Orchestrator Root"; Status = "PASS"; Code = 404 }
|
||||
} else {
|
||||
Write-Host " ❌ Error: $($_.Exception.Message)" -ForegroundColor Red
|
||||
$testResults += @{ Test = "Orchestrator Root"; Status = "FAIL"; Code = "Error" }
|
||||
}
|
||||
}
|
||||
|
||||
# Test 3: Health Check
|
||||
Write-Host "`n3. HEALTH CHECK" -ForegroundColor Yellow
|
||||
Write-Host " Testing: http://localhost:8080/health" -ForegroundColor Gray
|
||||
try {
|
||||
$response = Invoke-WebRequest -Uri "http://localhost:8080/health" -TimeoutSec 5 -UseBasicParsing -ErrorAction Stop
|
||||
$health = $response.Content | ConvertFrom-Json
|
||||
Write-Host " ✅ Status: $($response.StatusCode)" -ForegroundColor Green
|
||||
Write-Host " Status: $($health.status)" -ForegroundColor $(if ($health.status -eq "healthy") { "Green" } else { "Yellow" })
|
||||
Write-Host " Database: $($health.checks.database)" -ForegroundColor $(if ($health.checks.database -eq "up") { "Green" } else { "Yellow" })
|
||||
Write-Host " Memory: $($health.checks.memory)" -ForegroundColor $(if ($health.checks.memory -eq "ok") { "Green" } else { "Yellow" })
|
||||
$testResults += @{ Test = "Health Check"; Status = "PASS"; Code = $response.StatusCode }
|
||||
} catch {
|
||||
if ($_.Exception.Response.StatusCode -eq 503) {
|
||||
Write-Host " ⚠️ Status: 503 (Service initializing or database not connected)" -ForegroundColor Yellow
|
||||
$testResults += @{ Test = "Health Check"; Status = "PARTIAL"; Code = 503 }
|
||||
} else {
|
||||
Write-Host " ❌ Error: $($_.Exception.Message)" -ForegroundColor Red
|
||||
$testResults += @{ Test = "Health Check"; Status = "FAIL"; Code = "Error" }
|
||||
}
|
||||
}
|
||||
|
||||
# Test 4: Metrics
|
||||
Write-Host "`n4. METRICS" -ForegroundColor Yellow
|
||||
Write-Host " Testing: http://localhost:8080/metrics" -ForegroundColor Gray
|
||||
try {
|
||||
$response = Invoke-WebRequest -Uri "http://localhost:8080/metrics" -TimeoutSec 5 -UseBasicParsing -ErrorAction Stop
|
||||
Write-Host " ✅ Status: $($response.StatusCode)" -ForegroundColor Green
|
||||
$metricLines = ($response.Content -split "`n" | Where-Object { $_ -match "^[^#]" -and $_.Trim() -ne "" }).Count
|
||||
Write-Host " Metrics: $metricLines lines" -ForegroundColor White
|
||||
$testResults += @{ Test = "Metrics"; Status = "PASS"; Code = $response.StatusCode }
|
||||
} catch {
|
||||
Write-Host " ❌ Error: $($_.Exception.Message)" -ForegroundColor Red
|
||||
$testResults += @{ Test = "Metrics"; Status = "FAIL"; Code = "Error" }
|
||||
}
|
||||
|
||||
# Test 5: Readiness
|
||||
Write-Host "`n5. READINESS" -ForegroundColor Yellow
|
||||
Write-Host " Testing: http://localhost:8080/ready" -ForegroundColor Gray
|
||||
try {
|
||||
$response = Invoke-WebRequest -Uri "http://localhost:8080/ready" -TimeoutSec 5 -UseBasicParsing -ErrorAction Stop
|
||||
$ready = $response.Content | ConvertFrom-Json
|
||||
Write-Host " ✅ Status: $($response.StatusCode)" -ForegroundColor Green
|
||||
Write-Host " Ready: $($ready.ready)" -ForegroundColor $(if ($ready.ready) { "Green" } else { "Yellow" })
|
||||
$testResults += @{ Test = "Readiness"; Status = "PASS"; Code = $response.StatusCode }
|
||||
} catch {
|
||||
Write-Host " ⚠️ Status: $($_.Exception.Response.StatusCode) (May be expected)" -ForegroundColor Yellow
|
||||
$testResults += @{ Test = "Readiness"; Status = "PARTIAL"; Code = $_.Exception.Response.StatusCode }
|
||||
}
|
||||
|
||||
# Test 6: Liveness
|
||||
Write-Host "`n6. LIVENESS" -ForegroundColor Yellow
|
||||
Write-Host " Testing: http://localhost:8080/live" -ForegroundColor Gray
|
||||
try {
|
||||
$response = Invoke-WebRequest -Uri "http://localhost:8080/live" -TimeoutSec 5 -UseBasicParsing -ErrorAction Stop
|
||||
$live = $response.Content | ConvertFrom-Json
|
||||
Write-Host " ✅ Status: $($response.StatusCode)" -ForegroundColor Green
|
||||
Write-Host " Alive: $($live.alive)" -ForegroundColor Green
|
||||
$testResults += @{ Test = "Liveness"; Status = "PASS"; Code = $response.StatusCode }
|
||||
} catch {
|
||||
Write-Host " ❌ Error: $($_.Exception.Message)" -ForegroundColor Red
|
||||
$testResults += @{ Test = "Liveness"; Status = "FAIL"; Code = "Error" }
|
||||
}
|
||||
|
||||
# Test 7: CORS Headers
|
||||
Write-Host "`n7. CORS HEADERS" -ForegroundColor Yellow
|
||||
Write-Host " Testing: http://localhost:8080/health" -ForegroundColor Gray
|
||||
try {
|
||||
$response = Invoke-WebRequest -Uri "http://localhost:8080/health" -TimeoutSec 5 -UseBasicParsing -ErrorAction Stop
|
||||
if ($response.Headers["Access-Control-Allow-Origin"]) {
|
||||
Write-Host " ✅ CORS headers present" -ForegroundColor Green
|
||||
Write-Host " Access-Control-Allow-Origin: $($response.Headers['Access-Control-Allow-Origin'])" -ForegroundColor White
|
||||
$testResults += @{ Test = "CORS Headers"; Status = "PASS"; Code = "Present" }
|
||||
} else {
|
||||
Write-Host " ⚠️ CORS headers not found" -ForegroundColor Yellow
|
||||
$testResults += @{ Test = "CORS Headers"; Status = "PARTIAL"; Code = "Missing" }
|
||||
}
|
||||
} catch {
|
||||
Write-Host " ❌ Error: $($_.Exception.Message)" -ForegroundColor Red
|
||||
$testResults += @{ Test = "CORS Headers"; Status = "FAIL"; Code = "Error" }
|
||||
}
|
||||
|
||||
# Test 8: Error Handling
|
||||
Write-Host "`n8. ERROR HANDLING" -ForegroundColor Yellow
|
||||
Write-Host " Testing: http://localhost:8080/api/nonexistent" -ForegroundColor Gray
|
||||
try {
|
||||
$response = Invoke-WebRequest -Uri "http://localhost:8080/api/nonexistent" -TimeoutSec 5 -UseBasicParsing -ErrorAction Stop
|
||||
Write-Host " ⚠️ Unexpected status: $($response.StatusCode)" -ForegroundColor Yellow
|
||||
$testResults += @{ Test = "Error Handling"; Status = "PARTIAL"; Code = $response.StatusCode }
|
||||
} catch {
|
||||
if ($_.Exception.Response.StatusCode -eq 404) {
|
||||
Write-Host " ✅ Status: 404 (Proper error handling)" -ForegroundColor Green
|
||||
$testResults += @{ Test = "Error Handling"; Status = "PASS"; Code = 404 }
|
||||
} else {
|
||||
Write-Host " ⚠️ Status: $($_.Exception.Response.StatusCode)" -ForegroundColor Yellow
|
||||
$testResults += @{ Test = "Error Handling"; Status = "PARTIAL"; Code = $_.Exception.Response.StatusCode }
|
||||
}
|
||||
}
|
||||
|
||||
# Test 9: Response Times
|
||||
Write-Host "`n9. RESPONSE TIMES" -ForegroundColor Yellow
|
||||
$endpoints = @(
|
||||
@{ Name = "Webapp"; URL = "http://localhost:3000" },
|
||||
@{ Name = "Health"; URL = "http://localhost:8080/health" },
|
||||
@{ Name = "Metrics"; URL = "http://localhost:8080/metrics" }
|
||||
)
|
||||
foreach ($endpoint in $endpoints) {
|
||||
try {
|
||||
$stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
|
||||
$response = Invoke-WebRequest -Uri $endpoint.URL -TimeoutSec 5 -UseBasicParsing -ErrorAction Stop
|
||||
$stopwatch.Stop()
|
||||
$ms = $stopwatch.ElapsedMilliseconds
|
||||
$color = if ($ms -lt 100) { "Green" } elseif ($ms -lt 500) { "Yellow" } else { "Red" }
|
||||
Write-Host " $($endpoint.Name): $ms ms" -ForegroundColor $color
|
||||
} catch {
|
||||
Write-Host " $($endpoint.Name): Error" -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
|
||||
# Summary
|
||||
Write-Host "`n========================================" -ForegroundColor Cyan
|
||||
Write-Host " TEST SUMMARY" -ForegroundColor Cyan
|
||||
Write-Host "========================================`n" -ForegroundColor Cyan
|
||||
|
||||
$passed = ($testResults | Where-Object { $_.Status -eq "PASS" }).Count
|
||||
$partial = ($testResults | Where-Object { $_.Status -eq "PARTIAL" }).Count
|
||||
$failed = ($testResults | Where-Object { $_.Status -eq "FAIL" }).Count
|
||||
|
||||
foreach ($result in $testResults) {
|
||||
$color = switch ($result.Status) {
|
||||
"PASS" { "Green" }
|
||||
"PARTIAL" { "Yellow" }
|
||||
"FAIL" { "Red" }
|
||||
}
|
||||
Write-Host "$($result.Test): $($result.Status) (Code: $($result.Code))" -ForegroundColor $color
|
||||
}
|
||||
|
||||
Write-Host "`nTotal: $passed Passed, $partial Partial, $failed Failed" -ForegroundColor White
|
||||
Write-Host ""
|
||||
|
||||
194
scripts/test-curl.sh
Normal file
194
scripts/test-curl.sh
Normal file
@@ -0,0 +1,194 @@
|
||||
#!/bin/bash
|
||||
# Comprehensive CURL Functionality Test Script
|
||||
|
||||
echo -e "\n========================================"
|
||||
echo -e " CURL FUNCTIONALITY TESTS"
|
||||
echo -e "========================================\n"
|
||||
|
||||
PASSED=0
|
||||
PARTIAL=0
|
||||
FAILED=0
|
||||
|
||||
# Test 1: Webapp
|
||||
echo -e "1. WEBAPP"
|
||||
echo -e " Testing: http://localhost:3000"
|
||||
if response=$(curl -s -w "\n%{http_code}" -o /tmp/webapp_response.txt http://localhost:3000 --max-time 5 2>&1); then
|
||||
http_code=$(echo "$response" | tail -n1)
|
||||
if [ "$http_code" = "200" ]; then
|
||||
echo -e " \033[0;32m✅ Status: $http_code\033[0m"
|
||||
((PASSED++))
|
||||
else
|
||||
echo -e " \033[0;33m⚠️ Status: $http_code\033[0m"
|
||||
((PARTIAL++))
|
||||
fi
|
||||
else
|
||||
echo -e " \033[0;31m❌ Error: Connection failed\033[0m"
|
||||
((FAILED++))
|
||||
fi
|
||||
|
||||
# Test 2: Orchestrator Root
|
||||
echo -e "\n2. ORCHESTRATOR ROOT"
|
||||
echo -e " Testing: http://localhost:8080"
|
||||
if response=$(curl -s -w "\n%{http_code}" -o /tmp/orch_root.txt http://localhost:8080 --max-time 5 2>&1); then
|
||||
http_code=$(echo "$response" | tail -n1)
|
||||
if [ "$http_code" = "404" ]; then
|
||||
echo -e " \033[0;32m✅ Status: 404 (Expected - no root route)\033[0m"
|
||||
((PASSED++))
|
||||
else
|
||||
echo -e " \033[0;33m⚠️ Status: $http_code (Expected 404)\033[0m"
|
||||
((PARTIAL++))
|
||||
fi
|
||||
else
|
||||
echo -e " \033[0;31m❌ Error: Connection failed\033[0m"
|
||||
((FAILED++))
|
||||
fi
|
||||
|
||||
# Test 3: Health Check
|
||||
echo -e "\n3. HEALTH CHECK"
|
||||
echo -e " Testing: http://localhost:8080/health"
|
||||
if response=$(curl -s -w "\n%{http_code}" -o /tmp/health.json http://localhost:8080/health --max-time 5 2>&1); then
|
||||
http_code=$(echo "$response" | tail -n1)
|
||||
if [ "$http_code" = "200" ]; then
|
||||
echo -e " \033[0;32m✅ Status: $http_code\033[0m"
|
||||
if command -v jq &> /dev/null; then
|
||||
status=$(jq -r '.status' /tmp/health.json 2>/dev/null)
|
||||
db=$(jq -r '.checks.database' /tmp/health.json 2>/dev/null)
|
||||
memory=$(jq -r '.checks.memory' /tmp/health.json 2>/dev/null)
|
||||
echo -e " Status: $status"
|
||||
echo -e " Database: $db"
|
||||
echo -e " Memory: $memory"
|
||||
fi
|
||||
((PASSED++))
|
||||
elif [ "$http_code" = "503" ]; then
|
||||
echo -e " \033[0;33m⚠️ Status: 503 (Service initializing or database not connected)\033[0m"
|
||||
((PARTIAL++))
|
||||
else
|
||||
echo -e " \033[0;33m⚠️ Status: $http_code\033[0m"
|
||||
((PARTIAL++))
|
||||
fi
|
||||
else
|
||||
echo -e " \033[0;31m❌ Error: Connection failed\033[0m"
|
||||
((FAILED++))
|
||||
fi
|
||||
|
||||
# Test 4: Metrics
|
||||
echo -e "\n4. METRICS"
|
||||
echo -e " Testing: http://localhost:8080/metrics"
|
||||
if response=$(curl -s -w "\n%{http_code}" -o /tmp/metrics.txt http://localhost:8080/metrics --max-time 5 2>&1); then
|
||||
http_code=$(echo "$response" | tail -n1)
|
||||
if [ "$http_code" = "200" ]; then
|
||||
echo -e " \033[0;32m✅ Status: $http_code\033[0m"
|
||||
metric_lines=$(grep -v "^#" /tmp/metrics.txt | grep -v "^$" | wc -l)
|
||||
echo -e " Metrics: $metric_lines lines"
|
||||
((PASSED++))
|
||||
else
|
||||
echo -e " \033[0;33m⚠️ Status: $http_code\033[0m"
|
||||
((PARTIAL++))
|
||||
fi
|
||||
else
|
||||
echo -e " \033[0;31m❌ Error: Connection failed\033[0m"
|
||||
((FAILED++))
|
||||
fi
|
||||
|
||||
# Test 5: Readiness
|
||||
echo -e "\n5. READINESS"
|
||||
echo -e " Testing: http://localhost:8080/ready"
|
||||
if response=$(curl -s -w "\n%{http_code}" -o /tmp/ready.json http://localhost:8080/ready --max-time 5 2>&1); then
|
||||
http_code=$(echo "$response" | tail -n1)
|
||||
if [ "$http_code" = "200" ]; then
|
||||
echo -e " \033[0;32m✅ Status: $http_code\033[0m"
|
||||
if command -v jq &> /dev/null; then
|
||||
ready=$(jq -r '.ready' /tmp/ready.json 2>/dev/null)
|
||||
echo -e " Ready: $ready"
|
||||
fi
|
||||
((PASSED++))
|
||||
else
|
||||
echo -e " \033[0;33m⚠️ Status: $http_code (May be expected)\033[0m"
|
||||
((PARTIAL++))
|
||||
fi
|
||||
else
|
||||
echo -e " \033[0;33m⚠️ Connection failed (May be expected)\033[0m"
|
||||
((PARTIAL++))
|
||||
fi
|
||||
|
||||
# Test 6: Liveness
|
||||
echo -e "\n6. LIVENESS"
|
||||
echo -e " Testing: http://localhost:8080/live"
|
||||
if response=$(curl -s -w "\n%{http_code}" -o /tmp/live.json http://localhost:8080/live --max-time 5 2>&1); then
|
||||
http_code=$(echo "$response" | tail -n1)
|
||||
if [ "$http_code" = "200" ]; then
|
||||
echo -e " \033[0;32m✅ Status: $http_code\033[0m"
|
||||
if command -v jq &> /dev/null; then
|
||||
alive=$(jq -r '.alive' /tmp/live.json 2>/dev/null)
|
||||
echo -e " Alive: $alive"
|
||||
fi
|
||||
((PASSED++))
|
||||
else
|
||||
echo -e " \033[0;33m⚠️ Status: $http_code\033[0m"
|
||||
((PARTIAL++))
|
||||
fi
|
||||
else
|
||||
echo -e " \033[0;31m❌ Error: Connection failed\033[0m"
|
||||
((FAILED++))
|
||||
fi
|
||||
|
||||
# Test 7: CORS Headers
|
||||
echo -e "\n7. CORS HEADERS"
|
||||
echo -e " Testing: http://localhost:8080/health"
|
||||
if cors_header=$(curl -s -I http://localhost:8080/health --max-time 5 2>&1 | grep -i "access-control-allow-origin"); then
|
||||
echo -e " \033[0;32m✅ CORS headers present\033[0m"
|
||||
echo -e " $cors_header"
|
||||
((PASSED++))
|
||||
else
|
||||
echo -e " \033[0;33m⚠️ CORS headers not found\033[0m"
|
||||
((PARTIAL++))
|
||||
fi
|
||||
|
||||
# Test 8: Error Handling
|
||||
echo -e "\n8. ERROR HANDLING"
|
||||
echo -e " Testing: http://localhost:8080/api/nonexistent"
|
||||
if response=$(curl -s -w "\n%{http_code}" -o /tmp/error.txt http://localhost:8080/api/nonexistent --max-time 5 2>&1); then
|
||||
http_code=$(echo "$response" | tail -n1)
|
||||
if [ "$http_code" = "404" ]; then
|
||||
echo -e " \033[0;32m✅ Status: 404 (Proper error handling)\033[0m"
|
||||
((PASSED++))
|
||||
else
|
||||
echo -e " \033[0;33m⚠️ Status: $http_code\033[0m"
|
||||
((PARTIAL++))
|
||||
fi
|
||||
else
|
||||
echo -e " \033[0;33m⚠️ Connection failed\033[0m"
|
||||
((PARTIAL++))
|
||||
fi
|
||||
|
||||
# Test 9: Response Times
|
||||
echo -e "\n9. RESPONSE TIMES"
|
||||
endpoints=("http://localhost:3000:Webapp" "http://localhost:8080/health:Health" "http://localhost:8080/metrics:Metrics")
|
||||
for endpoint_pair in "${endpoints[@]}"; do
|
||||
url="${endpoint_pair%%:*}"
|
||||
name="${endpoint_pair##*:}"
|
||||
start_time=$(date +%s%N)
|
||||
if curl -s -o /dev/null "$url" --max-time 5 2>&1; then
|
||||
end_time=$(date +%s%N)
|
||||
ms=$(( (end_time - start_time) / 1000000 ))
|
||||
if [ $ms -lt 100 ]; then
|
||||
color="\033[0;32m"
|
||||
elif [ $ms -lt 500 ]; then
|
||||
color="\033[0;33m"
|
||||
else
|
||||
color="\033[0;31m"
|
||||
fi
|
||||
echo -e " $name: ${color}${ms} ms\033[0m"
|
||||
else
|
||||
echo -e " $name: \033[0;31mError\033[0m"
|
||||
fi
|
||||
done
|
||||
|
||||
# Summary
|
||||
echo -e "\n========================================"
|
||||
echo -e " TEST SUMMARY"
|
||||
echo -e "========================================\n"
|
||||
|
||||
echo -e "Total: \033[0;32m$PASSED Passed\033[0m, \033[0;33m$PARTIAL Partial\033[0m, \033[0;31m$FAILED Failed\033[0m"
|
||||
echo ""
|
||||
|
||||
94
scripts/verify-services.ps1
Normal file
94
scripts/verify-services.ps1
Normal file
@@ -0,0 +1,94 @@
|
||||
# Service Verification Script
|
||||
|
||||
Write-Host "`n========================================" -ForegroundColor Cyan
|
||||
Write-Host " SERVICE VERIFICATION" -ForegroundColor Cyan
|
||||
Write-Host "========================================`n" -ForegroundColor Cyan
|
||||
|
||||
$allPassed = $true
|
||||
|
||||
# Test 1: Orchestrator Health
|
||||
Write-Host "1. Orchestrator Health Check" -ForegroundColor Yellow
|
||||
try {
|
||||
$health = Invoke-WebRequest -Uri "http://localhost:8080/health" -TimeoutSec 5 -UseBasicParsing
|
||||
$data = $health.Content | ConvertFrom-Json
|
||||
Write-Host " [OK] Status: $($data.status)" -ForegroundColor Green
|
||||
Write-Host " Database: $($data.checks.database)" -ForegroundColor $(if ($data.checks.database -eq "up") { "Green" } else { "Yellow" })
|
||||
} catch {
|
||||
Write-Host " [FAIL] $($_.Exception.Message)" -ForegroundColor Red
|
||||
$allPassed = $false
|
||||
}
|
||||
|
||||
# Test 2: Orchestrator Metrics
|
||||
Write-Host "`n2. Orchestrator Metrics" -ForegroundColor Yellow
|
||||
try {
|
||||
$metrics = Invoke-WebRequest -Uri "http://localhost:8080/metrics" -TimeoutSec 5 -UseBasicParsing
|
||||
if ($metrics.StatusCode -eq 200) {
|
||||
Write-Host " [OK] Metrics endpoint working" -ForegroundColor Green
|
||||
}
|
||||
} catch {
|
||||
Write-Host " [FAIL] $($_.Exception.Message)" -ForegroundColor Red
|
||||
$allPassed = $false
|
||||
}
|
||||
|
||||
# Test 3: Orchestrator Liveness
|
||||
Write-Host "`n3. Orchestrator Liveness" -ForegroundColor Yellow
|
||||
try {
|
||||
$live = Invoke-WebRequest -Uri "http://localhost:8080/live" -TimeoutSec 5 -UseBasicParsing
|
||||
$data = $live.Content | ConvertFrom-Json
|
||||
if ($data.alive) {
|
||||
Write-Host " [OK] Service is alive" -ForegroundColor Green
|
||||
}
|
||||
} catch {
|
||||
Write-Host " [FAIL] $($_.Exception.Message)" -ForegroundColor Red
|
||||
$allPassed = $false
|
||||
}
|
||||
|
||||
# Test 4: Webapp Status
|
||||
Write-Host "`n4. Webapp Status" -ForegroundColor Yellow
|
||||
try {
|
||||
$webapp = Invoke-WebRequest -Uri "http://localhost:3000" -TimeoutSec 10 -UseBasicParsing
|
||||
if ($webapp.StatusCode -eq 200 -and $webapp.Content.Length -gt 1000) {
|
||||
Write-Host " [OK] Webapp is serving content ($($webapp.Content.Length) bytes)" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host " [WARN] Webapp responded but content may be incomplete" -ForegroundColor Yellow
|
||||
}
|
||||
} catch {
|
||||
Write-Host " [WARN] Webapp timeout (may still be compiling): $($_.Exception.Message)" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
# Test 5: API Endpoints
|
||||
Write-Host "`n5. API Endpoints" -ForegroundColor Yellow
|
||||
$endpoints = @(
|
||||
@{ Name = "Root"; URL = "http://localhost:8080"; Expected = 404 },
|
||||
@{ Name = "Health"; URL = "http://localhost:8080/health"; Expected = 200 },
|
||||
@{ Name = "Metrics"; URL = "http://localhost:8080/metrics"; Expected = 200 },
|
||||
@{ Name = "Live"; URL = "http://localhost:8080/live"; Expected = 200 }
|
||||
)
|
||||
|
||||
foreach ($endpoint in $endpoints) {
|
||||
try {
|
||||
$response = Invoke-WebRequest -Uri $endpoint.URL -TimeoutSec 3 -UseBasicParsing
|
||||
if ($response.StatusCode -eq $endpoint.Expected -or ($endpoint.Expected -eq 404 -and $response.StatusCode -eq 404)) {
|
||||
Write-Host " [OK] $($endpoint.Name): $($response.StatusCode)" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host " [WARN] $($endpoint.Name): $($response.StatusCode) (expected $($endpoint.Expected))" -ForegroundColor Yellow
|
||||
}
|
||||
} catch {
|
||||
if ($_.Exception.Response.StatusCode -eq $endpoint.Expected) {
|
||||
Write-Host " [OK] $($endpoint.Name): $($endpoint.Expected)" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host " [FAIL] $($endpoint.Name): $($_.Exception.Message)" -ForegroundColor Red
|
||||
$allPassed = $false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Summary
|
||||
Write-Host "`n========================================" -ForegroundColor Cyan
|
||||
if ($allPassed) {
|
||||
Write-Host " [OK] All critical services verified" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host " [WARN] Some services need attention" -ForegroundColor Yellow
|
||||
}
|
||||
Write-Host "========================================`n" -ForegroundColor Cyan
|
||||
|
||||
103
scripts/verify-services.sh
Normal file
103
scripts/verify-services.sh
Normal file
@@ -0,0 +1,103 @@
|
||||
#!/bin/bash
|
||||
# Service Verification Script
|
||||
|
||||
echo -e "\n========================================"
|
||||
echo -e " SERVICE VERIFICATION"
|
||||
echo -e "========================================\n"
|
||||
|
||||
ALL_PASSED=true
|
||||
|
||||
# Test 1: Orchestrator Health
|
||||
echo -e "1. Orchestrator Health Check"
|
||||
if health=$(curl -s http://localhost:8080/health --max-time 5 2>&1); then
|
||||
if command -v jq &> /dev/null; then
|
||||
status=$(echo "$health" | jq -r '.status' 2>/dev/null)
|
||||
db=$(echo "$health" | jq -r '.checks.database' 2>/dev/null)
|
||||
echo -e " \033[0;32m✅ Status: $status\033[0m"
|
||||
if [ "$db" = "up" ]; then
|
||||
echo -e " Database: \033[0;32m$db\033[0m"
|
||||
else
|
||||
echo -e " Database: \033[0;33m$db\033[0m"
|
||||
fi
|
||||
else
|
||||
echo -e " \033[0;32m✅ Health endpoint responding\033[0m"
|
||||
fi
|
||||
else
|
||||
echo -e " \033[0;31m❌ $health\033[0m"
|
||||
ALL_PASSED=false
|
||||
fi
|
||||
|
||||
# Test 2: Orchestrator Metrics
|
||||
echo -e "\n2. Orchestrator Metrics"
|
||||
if metrics=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/metrics --max-time 5 2>&1); then
|
||||
if [ "$metrics" = "200" ]; then
|
||||
echo -e " \033[0;32m✅ Metrics endpoint working\033[0m"
|
||||
else
|
||||
echo -e " \033[0;33m⚠️ Status: $metrics\033[0m"
|
||||
fi
|
||||
else
|
||||
echo -e " \033[0;31m❌ Connection failed\033[0m"
|
||||
ALL_PASSED=false
|
||||
fi
|
||||
|
||||
# Test 3: Orchestrator Liveness
|
||||
echo -e "\n3. Orchestrator Liveness"
|
||||
if live=$(curl -s http://localhost:8080/live --max-time 5 2>&1); then
|
||||
if command -v jq &> /dev/null; then
|
||||
alive=$(echo "$live" | jq -r '.alive' 2>/dev/null)
|
||||
if [ "$alive" = "true" ]; then
|
||||
echo -e " \033[0;32m✅ Service is alive\033[0m"
|
||||
else
|
||||
echo -e " \033[0;33m⚠️ Service may not be ready\033[0m"
|
||||
fi
|
||||
else
|
||||
echo -e " \033[0;32m✅ Liveness endpoint responding\033[0m"
|
||||
fi
|
||||
else
|
||||
echo -e " \033[0;31m❌ Connection failed\033[0m"
|
||||
ALL_PASSED=false
|
||||
fi
|
||||
|
||||
# Test 4: Webapp Status
|
||||
echo -e "\n4. Webapp Status"
|
||||
if webapp=$(curl -s http://localhost:3000 --max-time 10 2>&1); then
|
||||
content_length=${#webapp}
|
||||
if [ "$content_length" -gt 1000 ]; then
|
||||
echo -e " \033[0;32m✅ Webapp is serving content ($content_length bytes)\033[0m"
|
||||
else
|
||||
echo -e " \033[0;33m⚠️ Webapp responded but content may be incomplete\033[0m"
|
||||
fi
|
||||
else
|
||||
echo -e " \033[0;33m⚠️ Webapp timeout (may still be compiling): $webapp\033[0m"
|
||||
fi
|
||||
|
||||
# Test 5: API Endpoints
|
||||
echo -e "\n5. API Endpoints"
|
||||
endpoints=("http://localhost:8080:Root:404" "http://localhost:8080/health:Health:200" "http://localhost:8080/metrics:Metrics:200" "http://localhost:8080/live:Live:200")
|
||||
for endpoint_pair in "${endpoints[@]}"; do
|
||||
IFS=':' read -r url name expected <<< "$endpoint_pair"
|
||||
if response=$(curl -s -o /dev/null -w "%{http_code}" "$url" --max-time 3 2>&1); then
|
||||
if [ "$response" = "$expected" ] || ([ "$expected" = "404" ] && [ "$response" = "404" ]); then
|
||||
echo -e " \033[0;32m✅ $name: $response\033[0m"
|
||||
else
|
||||
echo -e " \033[0;33m⚠️ $name: $response (expected $expected)\033[0m"
|
||||
fi
|
||||
else
|
||||
if [ "$expected" = "404" ] && echo "$response" | grep -q "404"; then
|
||||
echo -e " \033[0;32m✅ $name: $expected\033[0m"
|
||||
else
|
||||
echo -e " \033[0;31m❌ $name: Connection failed\033[0m"
|
||||
ALL_PASSED=false
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Summary
|
||||
echo -e "\n========================================"
|
||||
if [ "$ALL_PASSED" = true ]; then
|
||||
echo -e " \033[0;32m✅ All critical services verified\033[0m"
|
||||
else
|
||||
echo -e " \033[0;33m⚠️ Some services need attention\033[0m"
|
||||
fi
|
||||
echo -e "========================================\n"
|
||||
|
||||
Reference in New Issue
Block a user