WeKnora deployment source with the reviewed wiki identity, summary and recovery fixes
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-weknora) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-weknora) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-weknora) / End-to-end inside dsh (latest, advisory) (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Build & Publish (dsh-weknora) / Publish to npm (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-weknora) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-weknora) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-weknora) / End-to-end inside dsh (latest, advisory) (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Build & Publish (dsh-weknora) / Publish to npm (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
# Only emit whitelisted locale tags to avoid config.js injection from env values.
|
||||
RUNTIME_DEFAULT_LOCALE=""
|
||||
case "${DEFAULT_LOCALE:-}" in
|
||||
zh-CN|en-US|ru-RU|ko-KR) RUNTIME_DEFAULT_LOCALE="${DEFAULT_LOCALE}" ;;
|
||||
esac
|
||||
|
||||
# 生成运行时配置文件,注入环境变量到前端
|
||||
FILE_MB=${MAX_FILE_SIZE_MB:-50}
|
||||
# Keep the browser and nginx in lockstep with the Go application ceiling.
|
||||
# Values above 20 GiB are rejected by the backend and must not produce a
|
||||
# misleadingly larger client-side limit or an oversized nginx request body.
|
||||
case "$FILE_MB" in
|
||||
''|*[!0-9]*) FILE_MB=50 ;;
|
||||
esac
|
||||
if [ "$FILE_MB" -gt 20480 ]; then
|
||||
FILE_MB=20480
|
||||
fi
|
||||
if [ "$FILE_MB" -le 0 ]; then
|
||||
FILE_MB=50
|
||||
fi
|
||||
SKILL_MB=${MAX_SKILL_BUNDLE_SIZE_MB:-256}
|
||||
case "$SKILL_MB" in
|
||||
''|*[!0-9]*) SKILL_MB=256 ;;
|
||||
esac
|
||||
if [ "$SKILL_MB" -lt "$FILE_MB" ] 2>/dev/null; then
|
||||
SKILL_MB=$FILE_MB
|
||||
fi
|
||||
if [ "$SKILL_MB" -gt 512 ] 2>/dev/null; then
|
||||
SKILL_MB=512
|
||||
fi
|
||||
|
||||
cat > /usr/share/nginx/html/config.js << EOF
|
||||
window.__RUNTIME_CONFIG__ = {
|
||||
MAX_FILE_SIZE_MB: ${FILE_MB},
|
||||
MAX_SKILL_BUNDLE_SIZE_MB: ${SKILL_MB},
|
||||
DEFAULT_LOCALE: "${RUNTIME_DEFAULT_LOCALE}"
|
||||
};
|
||||
EOF
|
||||
|
||||
# Rebuild from immutable templates on every start, including restarts with a
|
||||
# changed locale. Inlining removes a blocking request before the app can boot.
|
||||
for PAGE in index.html embed.html; do
|
||||
awk '
|
||||
NR == FNR { config = config $0 "\n"; next }
|
||||
/<script src="\/config.js"><\/script>/ {
|
||||
if (++replaced != 1) exit 1
|
||||
print "<script data-runtime-config>\n" config "</script>"
|
||||
next
|
||||
}
|
||||
{ print }
|
||||
END { if (replaced != 1) exit 1 }
|
||||
' /usr/share/nginx/html/config.js \
|
||||
"/usr/share/nginx/runtime-templates/$PAGE" > "/usr/share/nginx/html/$PAGE.next"
|
||||
mv "/usr/share/nginx/html/$PAGE.next" "/usr/share/nginx/html/$PAGE"
|
||||
done
|
||||
|
||||
# 处理 nginx 配置。
|
||||
# 两个上限分开注入:全站保持知识库的 MAX_FILE_SIZE,只有技能 zip 上传的两条
|
||||
# 集合路由放宽到 MAX_SKILL_BUNDLE_SIZE(不含 /install、PATCH 等子路径)。
|
||||
# 合成一个全站上限会让每个上传端点都能收到技能包那么大的 body。
|
||||
export MAX_FILE_SIZE=${FILE_MB}M
|
||||
export MAX_SKILL_BUNDLE_SIZE=${SKILL_MB}M
|
||||
export APP_HOST=${APP_HOST:-app}
|
||||
export APP_PORT=${APP_PORT:-8080}
|
||||
export APP_SCHEME=${APP_SCHEME:-http}
|
||||
envsubst '${MAX_FILE_SIZE} ${MAX_SKILL_BUNDLE_SIZE} ${APP_HOST} ${APP_PORT} ${APP_SCHEME}' \
|
||||
< /etc/nginx/templates/default.conf.template > /etc/nginx/conf.d/default.conf
|
||||
|
||||
# 启动 nginx
|
||||
exec nginx -g 'daemon off;'
|
||||
Reference in New Issue
Block a user