deploy
This commit is contained in:
parent
2881b4a5a6
commit
0b2cd193a9
1 changed files with 92 additions and 5 deletions
|
|
@ -447,14 +447,101 @@ jobs:
|
|||
if sudo nginx -t 2>/dev/null; then
|
||||
sudo systemctl reload nginx
|
||||
echo "✅ nginx reloaded successfully"
|
||||
sleep 2
|
||||
|
||||
# Quick verification
|
||||
if curl -I --max-time 5 https://mnemo-cards.online/ 2>/dev/null | grep -q "200\|301\|302"; then
|
||||
echo "✅ mnemo-cards.online is serving correctly"
|
||||
# Wait for services to stabilize after reload
|
||||
echo "⏳ Waiting for services to stabilize..."
|
||||
sleep 5
|
||||
|
||||
# Check all services status
|
||||
echo "📊 Checking service statuses after nginx reload..."
|
||||
|
||||
# Check nginx
|
||||
if sudo systemctl is-active --quiet nginx; then
|
||||
echo "✅ nginx: running"
|
||||
else
|
||||
echo "⚠️ mnemo-cards.online verification failed"
|
||||
echo "❌ nginx: not running"
|
||||
sudo systemctl status nginx --no-pager || true
|
||||
fi
|
||||
|
||||
# Check backend
|
||||
if sudo systemctl is-active --quiet mnemo_cards_server; then
|
||||
echo "✅ backend: running"
|
||||
else
|
||||
echo "❌ backend: not running"
|
||||
sudo systemctl status mnemo_cards_server --no-pager || true
|
||||
# Try to start it if it's stopped
|
||||
echo "🚀 Attempting to start backend..."
|
||||
sudo systemctl start mnemo_cards_server || true
|
||||
sleep 2
|
||||
if sudo systemctl is-active --quiet mnemo_cards_server; then
|
||||
echo "✅ backend: started successfully"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check forgejo (if exists)
|
||||
if sudo systemctl is-active --quiet forgejo 2>/dev/null; then
|
||||
echo "✅ forgejo: running"
|
||||
elif pgrep -f forgejo >/dev/null 2>&1; then
|
||||
echo "✅ forgejo: running (not as service)"
|
||||
else
|
||||
echo "⚠️ forgejo: not found or not running"
|
||||
# Check if forgejo process exists but not responding
|
||||
if pgrep -f "forgejo" >/dev/null 2>&1; then
|
||||
echo "🔍 Found forgejo process, but may be unresponsive"
|
||||
ps aux | grep forgejo | grep -v grep || true
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check for orphaned processes
|
||||
echo "🔍 Checking for orphaned processes..."
|
||||
# Kill any remaining flutter/dart processes that might interfere
|
||||
pkill -f "flutter\|dart" || true
|
||||
# Kill any remaining act processes
|
||||
pkill -f "act" || true
|
||||
sleep 1
|
||||
|
||||
# Check system resources
|
||||
echo "📊 System resources after cleanup:"
|
||||
free -h || true
|
||||
df -h / || true
|
||||
|
||||
# Check network connectivity to upstream services
|
||||
echo "🌐 Checking upstream connectivity..."
|
||||
if nc -z 127.0.0.1 3000 2>/dev/null; then
|
||||
echo "✅ Forgejo (port 3000): reachable"
|
||||
else
|
||||
echo "⚠️ Forgejo (port 3000): not reachable"
|
||||
fi
|
||||
|
||||
if nc -z 127.0.0.1 8081 2>/dev/null; then
|
||||
echo "✅ Backend (port 8081): reachable"
|
||||
else
|
||||
echo "⚠️ Backend (port 8081): not reachable"
|
||||
fi
|
||||
|
||||
# Wait a bit more before testing sites
|
||||
sleep 3
|
||||
|
||||
# Test site accessibility with retries
|
||||
echo "🌐 Testing site accessibility..."
|
||||
for site in "https://mnemo-cards.online/" "https://code.mnemo-cards.online/" "https://vscode.mnemo-cards.online/"; do
|
||||
for attempt in {1..3}; do
|
||||
if curl -I --max-time 10 "$site" 2>/dev/null | grep -q "200\|301\|302"; then
|
||||
echo "✅ $site accessible (attempt $attempt)"
|
||||
break
|
||||
else
|
||||
if [ $attempt -eq 3 ]; then
|
||||
echo "❌ $site not accessible after 3 attempts"
|
||||
curl -I --max-time 5 "$site" || true
|
||||
else
|
||||
echo "⏳ $site attempt $attempt failed, retrying..."
|
||||
sleep 2
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "✅ Web app deployment completed"
|
||||
else
|
||||
echo "❌ nginx configuration test failed!"
|
||||
sudo nginx -t || true
|
||||
|
|
|
|||
Loading…
Reference in a new issue