fix(im_llm): 代理绕过Docker内部hostname

This commit is contained in:
QihuAI Design committed 2026-07-31 08:51:15 +08:00
1 parent 96aabc31f6
commit 9a43ee244d
24 files changed
+898 -129

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
# qihuaiflow CI gate - run bug-audit after deployment
# Usage: bash scripts/ci_bug_audit.sh [--block-on-fail]
set -uo pipefail
CONTAINER="qihu-aiflow"
BLOCK=${1:-}
AUDIT_URL="http://localhost:18080/app/api/health/bug-audit"
if ! docker ps --format '{{.Names}}' | grep -qx "$CONTAINER"; then
echo "[CI aud] ERROR: container $CONTAINER not running"
exit 2
fi
AUDIT=$(curl -s --max-time 20 "$AUDIT_URL" 2>/dev/null)
if [ -z "$AUDIT" ]; then
echo "[CI aud] ERROR: bug-audit endpoint unreachable"
[ "$BLOCK" = "--block-on-fail" ] && exit 1 || exit 0
fi
HEALTHY=$(echo "$AUDIT" | python3 -c "import json,sys;d=json.load(sys.stdin);print(d.get('data',d).get('healthy',''))" 2>/dev/null)
CHECKS=$(echo "$AUDIT" | python3 -c "import json,sys;d=json.load(sys.stdin);print(d.get('data',d).get('summary',{}).get('total_checks',0))" 2>/dev/null)
ISSUES=$(echo "$AUDIT" | python3 -c "import json,sys;d=json.load(sys.stdin);print(len(d.get('data',d).get('issues',[])))" 2>/dev/null)
echo "[CI aud] Healthy=$HEALTHY Checks=$CHECKS Issues=$ISSUES"
if [ "$HEALTHY" != "True" ]; then
echo "$AUDIT" | python3 -c "
import json,sys; d=json.load(sys.stdin)
dd=d.get('data',d)
for i in dd.get('issues',[]): print(f' ISSUE: {i}')
for w in dd.get('warnings',[]): print(f' WARN: {w}')
" 2>/dev/null
if [ "$BLOCK" = "--block-on-fail" ]; then
echo "[CI aud] audit failed (--block-on-fail mode)"
exit 1
fi
fi
echo "[CI aud] PASSED"
exit 0
+25 -50
View File
@@ -1,58 +1,33 @@
#!/bin/bash
# MuMuAINovel Deployment Script
# Run when Docker Hub / GitHub are accessible
# ============================================
set -e
echo "=== MuMuAINovel Deploy (SSO + Billing) ==="
echo "=== MuMuAINovel Deployment ==="
# Step 1: Start MumuAINovel
echo "[1/5] Starting MuMuAINovel..."
docker rm -f qihu-aiflow-mumuainovel 2>/dev/null || true
docker run -d --name qihu-aiflow-mumuainovel --network qihuaiflow_aiflow-network --restart unless-stopped -e DATABASE_URL=postgresql+asyncpg://aiflow:pwd2026@qihu-aiflow-pg18:5432/mumuainovel -e DB_HOST=qihu-aiflow-pg18 -e DB_PORT=5432 -e POSTGRES_USER=aiflow -e POSTGRES_DB=mumuainovel -e POSTGRES_PASSWORD=pwd2026 -e OPENAI_BASE_URL=http://qihu-aiflow-litellm:4000/v1 -e OPENAI_API_KEY=sk-tvL0o8huXZI9dklXx6t3Mg -e DEFAULT_AI_PROVIDER=openai -e DEFAULT_MODEL=deepseek-v4-flash -e LOCAL_AUTH_ENABLED=true -e LOCAL_AUTH_USERNAME=mumu_admin -e LOCAL_AUTH_PASSWORD=mumu_admin_2026 -e LINUXDO_AUTH_ENABLED=false -e PLATFORM_SSO_ENABLED=true -e PLATFORM_AUTH_HEADER=X-User-Id -p 18002:8000 mumujie/mumuainovel:latest
# Step 1: Database
echo "[1/4] Creating mumuainovel database..."
docker exec qihu-aiflow-pg18 psql -U aiflow -d aiflow -c "CREATE DATABASE mumuainovel OWNER aiflow;" 2>/dev/null || echo " Database already exists"
# Step 2: Start OIDC sidecar
echo "[2/5] Starting OIDC sidecar..."
docker rm -f qihu-aiflow-mumuainovel-oidc 2>/dev/null || true
docker run -d --name qihu-aiflow-mumuainovel-oidc --network qihuaiflow_aiflow-network --restart unless-stopped -v /www/wwwroot/qihuaiflow/config/nginx/mumuainovel-oidc.conf:/etc/nginx/conf.d/default.conf -p 4180:4180 nginx:alpine
# Step 2: Pull image
echo "[2/4] Pulling MuMuAINovel image..."
# Try Docker Hub direct first, then proxies
docker pull mumujie/mumuainovel:latest 2>/dev/null || {
echo " Docker Hub failed, trying mirror..."
docker pull docker.1ms.run/mumujie/mumuainovel:latest 2>/dev/null || {
echo " Mirror failed, building from source..."
cd /tmp && rm -rf MuMuAINovel
git clone --depth 1 https://github.com/xiamuceer-j/MuMuAINovel.git
cd MuMuAINovel && docker build -t mumujie/mumuainovel:latest .
}
}
# Step 3: Start container
echo "[3/4] Starting MuMuAINovel..."
docker stop qihu-aiflow-mumuainovel 2>/dev/null || true
docker rm qihu-aiflow-mumuainovel 2>/dev/null || true
docker run -d \
--name qihu-aiflow-mumuainovel \
--network qihuaiflow_aiflow-network \
--restart unless-stopped \
-e OPENAI_BASE_URL=http://qihu-aiflow-litellm:4000/v1 \
-e OPENAI_API_KEY=sk-litellm-master-key-aiflow-2026 \
-e DEFAULT_AI_PROVIDER=openai \
-e DEFAULT_MODEL=deepseek-v4-flash \
-e POSTGRES_HOST=qihu-aiflow-pg18 \
-e POSTGRES_DB=mumuainovel \
-e POSTGRES_USER=aiflow \
-e POSTGRES_PASSWORD=pwd2026 \
-e LOCAL_AUTH_ENABLED=true \
-e LOCAL_AUTH_USERNAME=mumu_admin \
-e LOCAL_AUTH_PASSWORD=mumu_admin_2026 \
-e LINUXDO_AUTH_ENABLED=false \
mumujie/mumuainovel:latest
# Step 3: Wait for healthy
echo "[3/5] Waiting for startup..."
sleep 20
docker ps --format "{{.Names}} {{.Status}}" | grep mumu
# Step 4: Verify
echo "[4/4] Waiting for startup..."
sleep 15
docker ps --format "{{.Names}} {{.Status}}" | grep mumu
curl -s -o /dev/null -w "HTTP %{http_code}" http://localhost:18001/ && echo " - MuMuAINovel is UP" || echo " - Not ready yet"
echo "[4/5] Verifying..."
curl -sf http://localhost:18002/health && echo " Mumu OK"
curl -sf http://localhost:4180/health && echo " SSO OK (no auth needed for health)"
curl -s -o /dev/null -w "Auth Verify: HTTP %{http_code}" http://localhost:18080/app/api/auth/verify && echo
curl -s -o /dev/null -w "Billing: HTTP %{http_code}" http://localhost:18080/app/api/billing/webhook/health && echo
echo "=== Done ==="
echo "Access: http://210.16.161.218:18001"
echo "Login: mumu_admin / mumu_admin_2026"
echo "AI: powered by LiteLLM gateway (deepseek-v4-flash)"
# Step 5: Summary
echo "[5/5] Done!"
echo "Direct: http://210.16.161.218:18002"
echo "SSO: http://210.16.161.218:4180"
echo "Login: mumu_admin / mumu_admin_2026"
echo "AI: LiteLLM gateway (deepseek-v4-flash)"
echo "Billing: webhook active -> user=mumuainovel-app"
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -uo pipefail
CONTAINER="qihu-aiflow"
RED='\033[0;31m'; GREEN='\033[0;32m'; NC='\033[0m'
fail() { echo -e "${RED}[pre-commit] FAIL: $*${NC}" >&2; exit 1; }
if ! docker ps --format '{{.Names}}' | grep -qx "$CONTAINER"; then
echo "[pre-commit] WARNING: container $CONTAINER not running, skip" >&2; exit 0
fi
AUDIT_JSON=$(curl -s --max-time 15 http://localhost:18080/app/api/health/bug-audit 2>/dev/null)
if [ -z "$AUDIT_JSON" ]; then
echo "[pre-commit] WARNING: bug-audit not reachable, skip" >&2; exit 0
fi
HEALTHY=$(echo "$AUDIT_JSON" | python3 -c "import json,sys;d=json.load(sys.stdin);dd=d.get('data',d);print(dd.get('healthy',''))" 2>/dev/null)
if [ "$HEALTHY" != "True" ]; then
echo "$AUDIT_JSON" | python3 -c "import json,sys;d=json.load(sys.stdin);dd=d.get('data',d);[print(' ISSUE:',i) for i in dd.get('issues',[])]" 2>/dev/null
fail "bug-audit returned unhealthy"
fi
echo "[pre-commit] bug-audit PASSED"; exit 0