feat: add quick health fix and test scripts
Some checks failed
CI/CD Pipeline (Using Gitea Variables & Secrets) / production (push) Failing after 10m29s
Test Gitea Variables and Secrets / test-variables (push) Successful in 3s

- Add quick-health-fix.sh for immediate diagnosis
- Add test-app.sh for comprehensive testing
- Fix localhost connection issues
- Improve health check reliability
This commit is contained in:
2025-10-19 22:39:58 +02:00
parent 1ef7f88b0a
commit 498bec6edf
2 changed files with 233 additions and 0 deletions

100
scripts/test-app.sh Executable file
View File

@@ -0,0 +1,100 @@
#!/bin/bash
# Simple Application Test Script
# This script tests if the application is working correctly
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
log() {
echo -e "${BLUE}[$(date +'%Y-%m-%d %H:%M:%S')]${NC} $1"
}
success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
error() {
echo -e "${RED}[ERROR]${NC} $1" >&2
}
log "🧪 Testing application functionality..."
# Test 1: Health endpoint from inside container
log "Test 1: Health endpoint from inside container"
if docker exec portfolio-app curl -s http://localhost:3000/api/health | grep -q '"status":"healthy"'; then
success "✅ Health endpoint working from inside container"
else
error "❌ Health endpoint not working from inside container"
exit 1
fi
# Test 2: Health endpoint from outside container
log "Test 2: Health endpoint from outside container"
if curl -s http://localhost:3000/api/health | grep -q '"status":"healthy"'; then
success "✅ Health endpoint working from outside container"
else
warning "⚠️ Health endpoint not accessible from outside container"
log "This is the issue causing the health check failure"
fi
# Test 3: Main page from inside container
log "Test 3: Main page from inside container"
if docker exec portfolio-app curl -s http://localhost:3000/ | grep -q "Dennis Konkol"; then
success "✅ Main page working from inside container"
else
error "❌ Main page not working from inside container"
fi
# Test 4: Main page from outside container
log "Test 4: Main page from outside container"
if curl -s http://localhost:3000/ | grep -q "Dennis Konkol"; then
success "✅ Main page working from outside container"
else
warning "⚠️ Main page not accessible from outside container"
fi
# Test 5: Admin page from inside container
log "Test 5: Admin page from inside container"
if docker exec portfolio-app curl -s http://localhost:3000/manage | grep -q "Admin\|Login"; then
success "✅ Admin page working from inside container"
else
error "❌ Admin page not working from inside container"
fi
# Test 6: Admin page from outside container
log "Test 6: Admin page from outside container"
if curl -s http://localhost:3000/manage | grep -q "Admin\|Login"; then
success "✅ Admin page working from outside container"
else
warning "⚠️ Admin page not accessible from outside container"
fi
# Summary
log "📊 Test Summary:"
log "The application is working correctly from inside the container"
log "The issue is with external accessibility"
if curl -f http://localhost:3000/api/health > /dev/null 2>&1; then
success "🎉 Application is fully accessible!"
log "Your application is working correctly at:"
log " - Main site: http://localhost:3000/"
log " - Admin panel: http://localhost:3000/manage"
log " - Health check: http://localhost:3000/api/health"
else
warning "⚠️ Application is not accessible from outside"
log "This is likely due to:"
log " 1. Network configuration issues"
log " 2. Firewall blocking port 3000"
log " 3. Application binding to wrong interface"
log " 4. Running behind a reverse proxy"
log "To fix this, run:"
log " ./scripts/quick-health-fix.sh"
fi