Compare commits

...

4 Commits

Author SHA1 Message Date
xiaoxia-agent 643183ecb0 debug(web): use docker run instead of docker create
Debug: Web container crash diag / Web Crash Diagnostics (push) Successful in 54s
2026-09-11 10:16:05 +08:00
xiaoxia-agent 3e7273b8cd debug(web): deeper diag of nginx entrypoint crash
Debug: Web container crash diag / Web Crash Diagnostics (push) Successful in 49s
2026-09-11 10:12:15 +08:00
xiaoxia-agent 5659fddc97 debug(web): fix runs-on + add web diag script
Debug: Web container crash diag / Web Crash Diagnostics (push) Successful in 19s
2026-09-11 10:07:21 +08:00
xiaoxia-agent 59095f2f79 debug(web): nginx crash diag
Debug: Web container crash diag / web-diag (push) Failing after 3s
2026-09-11 10:02:47 +08:00
2 changed files with 61 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
name: "Debug: Web container crash diag"
on:
push:
branches:
- 'debug/web-crash-diag'
workflow_dispatch:
jobs:
web-diag:
name: Web Crash Diagnostics
runs-on: runtime-builder
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Setup SSH
shell: bash
env:
STAGING_SSH_KEY: ${{ secrets.PREVIEW_SSH_KEY }}
run: |
set -euo pipefail
which ssh || (apt-get update -qq && apt-get install -y -qq openssh-client)
mkdir -p ~/.ssh && chmod 700 ~/.ssh
printf "%s" "$STAGING_SSH_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
H=47.98.113.167; P=22222
ssh-keyscan -p $P -H $H >> ~/.ssh/known_hosts 2>/dev/null
ssh -p $P -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no root@$H "echo SSH_OK; hostname; date"
- name: Run web diag
shell: bash
run: |
set -euo pipefail
H=47.98.113.167; P=22222
scp -P $P -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no \
infra/scripts/server-web-diag.sh root@$H:/tmp/server-web-diag.sh
ssh -p $P -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no root@$H \
"bash /tmp/server-web-diag.sh 2>&1"
+24
View File
@@ -0,0 +1,24 @@
#!/bin/bash
set +e
echo "=== 1. Check base nginx image conf.d ==="
docker run --rm --entrypoint sh git.xiaoxiajianji.com/xiaoxia/base/nginx:alpine -c \
"ls -la /etc/nginx/conf.d/ 2>&1; echo '---'; file /etc/nginx/conf.d/default.conf 2>&1; echo '---'; ls -la /etc/nginx/nginx*.conf 2>&1"
echo ""
echo "=== 2. Check staging web image (currently running) ==="
WEB_IMG=$(docker inspect xiaoxia-web-staging --format '{{.Config.Image}}' 2>/dev/null)
echo "Staging web image: $WEB_IMG"
docker run --rm --entrypoint sh "$WEB_IMG" -c \
"ls -la /etc/nginx/conf.d/ 2>&1; echo '---'; cat /docker-entrypoint.sh 2>&1; echo '---'; ls -la /etc/nginx/nginx-*.conf 2>&1"
echo ""
echo "=== 3. Run entrypoint with APP_ENV=staging to reproduce ==="
docker run --rm -e APP_ENV=staging --entrypoint sh "$WEB_IMG" -c \
"set -x; sh -x /docker-entrypoint.sh 2>&1 | head -30"
echo ""
echo "=== 4. What if we rm -f default.conf first then ln? ==="
docker run --rm -e APP_ENV=staging --entrypoint sh "$WEB_IMG" -c \
"rm -f /etc/nginx/conf.d/default.conf && ln -sf /etc/nginx/nginx-staging.conf /etc/nginx/conf.d/default.conf && ls -la /etc/nginx/conf.d/default.conf && echo OK"
echo ""
echo "=== 5. Check running web logs for crash reason ==="
docker logs xiaoxia-web-staging 2>&1 | tail -30
echo ""
echo "=== Done ==="