debug(web): nginx crash diag
Debug: Web container crash diag / web-diag (push) Failing after 3s

This commit is contained in:
xiaoxia-agent
2026-09-11 10:02:47 +08:00
parent 29ca51da9c
commit 59095f2f79
+57
View File
@@ -0,0 +1,57 @@
name: "Debug: Web container crash diag"
on:
push:
branches:
- 'debug/web-crash-diag'
workflow_dispatch:
jobs:
web-diag:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Write diag script
run: |
cat > /tmp/web-diag.sh <<'SCRIPT'
set +e
echo "=== docker ps all ==="
docker ps -a --filter "name=xiaoxia-web-staging" --format "{{.ID}} {{.Image}} {{.Status}}"
echo ""
echo "=== web container logs ==="
WEB_CID=$(docker ps -aq --filter "name=xiaoxia-web-staging" | head -1)
echo "WEB_CID=$WEB_CID"
docker logs "$WEB_CID" 2>&1 | tail -50
echo ""
echo "=== web container inspect state ==="
docker inspect "$WEB_CID" --format '{{.State.Status}} {{.State.ExitCode}} {{.State.Error}}'
echo ""
echo "=== nginx -t inside web ==="
if docker exec "$WEB_CID" nginx -t 2>&1; then
echo "nginx config OK"
else
echo "nginx config FAIL (container may be stopped)"
# try on the image
echo "=== try nginx -t from image ==="
IMG=$(docker inspect "$WEB_CID" --format '{{.Config.Image}}')
echo "Image: $IMG"
fi
echo "=== files in /etc/nginx/conf.d/ ==="
for f in /etc/nginx/conf.d/*; do
if docker exec "$WEB_CID" ls -la "$f" 2>/dev/null; then
echo "--- $f ---"
docker exec "$WEB_CID" head -5 "$f" 2>/dev/null
fi
done
SCRIPT
chmod +x /tmp/web-diag.sh
- name: SSH diag
run: |
mkdir -p ~/.ssh
echo "${{ secrets.PREVIEW_SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -p 22222 -t rsa 47.98.113.167 >> ~/.ssh/known_hosts 2>/dev/null
scp -P 22222 -o StrictHostKeyChecking=no /tmp/web-diag.sh root@47.98.113.167:/tmp/web-diag.sh
ssh -p 22222 -o StrictHostKeyChecking=no root@47.98.113.167 "bash /tmp/web-diag.sh"