**影响**:新建独立仓 ipass-sso 作为 ipass-all 的 SSO-only 精简发行版—— 剔除了 domain / llm / apix / cache / waf 5 个插件及对应的 nginx location 与 LLM/域名数据面 server,PLUGINS 数组只剩 sso + core,单 .so 体积与编 译时间同步下降。镜像名沿用 ssw188/nginx(同 repo 加 tag),新 tag `ipass-sso-v0.6.0`,K8s 部署在 wuguirong ns NodePort 30082,与生产 ipass-all-v0.5.2 (30083/30084/30085) 并存互不干扰。 **改动**: - `rust/Cargo.toml` + `rust/gateway/Cargo.toml`:删 5 个 plugin path 依赖, package/lib 重命名为 `ipass-sso-gateway` / `libipass_sso_gateway` - `rust/gateway/src/lib.rs`:PLUGINS 只剩 `&SsoPlugin` + `&CorePlugin`; GatewayExt 4 个方法改为 no-op / 返回默认值(无 domain/llm 装饰); ModuleConfig 只剩 api + iap 两个开关;NGX_HTTP_COMMANDS 数组 11→4 条; init_process / exit_process 删 llm audit / stats persist 调用; state_zone_init 删 domain/upstreams/apix 的预装载 - `rust/gateway/src/api.rs`:删除(h_admin_trend 依赖 llm + apix) - `deploy/nginx.conf`:删 server 498 (LLM) + server 565 (域名); 主 server 删 `/apix/` `/apixp/` `/_apix_probe/` 等 7 个 location; 删 6 条 `proxy_cache_path` 与 8 个 cache location;删 `ipass_audit_dir` 指令 - `deploy/Dockerfile`:删 5 个 plugin named context 的 COPY 块; .so 文件名改 `libipass_sso_gateway.so` - `deploy/build.sh`:TAG 默认 `ipass-sso-v0.6.0`; 5 个 plugin build-context 删除;删 collect-legacy.sh 调用 - `data-seed/plugin-config.json`:只保留 `sso` 一个 plugin - `scripts/collect-plugin-dist.sh`:PLUGINS 默认值改 `sso` - `scripts/container-entrypoint.sh`:删 cache/audit 目录预创建 - `deploy/legacy/` `tests/` `docs/` `deploy/custom/` `deploy/compose.yml`: 精简版不需要,删除 - `deploy/k8s/ipass-sso.yaml`:新建精简版 K8s manifest (NodePort 30082 单端口;replicas=1;同 10106 准入 + nginx-data PVC sso/ subPath; 探针用 `/admin/` try_files 兜底,与 ipass-all 同款止血方案) **设计**:保留 ipass-core("core 是网关身份底座,永不跳过")+ ipass-plugin-sso, 其余插件整链剥离;不再维护 ssow/ssw 时代的多插件装配文档。剔除 ipass_audit_dir 是因为精简版没有 LLM 对话审计,剔除 proxy_cache_path 同理。K8s 部署沿用 nginx-data PVC + subPath 隔离模式(sso/ 与 ipass-all/ 互不干扰)。 **已知约束**:精简版仍是单进程共享内存,pod 重启使所有管理员/用户会话失效 (与 ipass-all 同款代价)。精简版不带单元/E2E 测试,老管理台 iframe 集成 也未引入。 Co-Authored-By: Claude Code <[email protected]>
82 lines
3.6 KiB
Bash
82 lines
3.6 KiB
Bash
#!/usr/bin/env bash
|
||
# ============================================================================
|
||
# collect-plugin-dist.sh —— 收集管理台前端产物到可部署目录
|
||
#
|
||
# 形状与 ipass-sso / ipass-ssw 的同名脚本一致(Ruling 16/19):
|
||
# - 核心壳来自 ipass-core/www/dist(SPA:index.html + assets)
|
||
# - 插件管理页是 UMD 产物,壳按 /static/plugins/<name>/dist/<name>-admin.umd.js
|
||
# 动态加载(寻址约定见 ipass-core www loader.ts;<name> = Plugin::name() 短名)
|
||
#
|
||
# Docker 构建上下文只覆盖本仓,COPY 不到兄弟仓库,故先把产物聚合进
|
||
# deploy/,再由 Dockerfile COPY 进镜像。
|
||
#
|
||
# 输出布局:
|
||
# deploy/shell/ ← ../ipass-core/www/dist
|
||
# deploy/static-plugins/<name>/dist/ ← ../ipass-plugin-<name>/www/dist
|
||
#
|
||
# 插件清单 = 本仓装配的全部插件(精简版只装 sso;其他插件仓不存在时自动跳过并告警)。
|
||
# 用法:bash scripts/collect-plugin-dist.sh # → deploy/
|
||
# ============================================================================
|
||
set -euo pipefail
|
||
|
||
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||
ROOT="$(cd "$HERE/.." && pwd)"
|
||
IPASS_DIR="${IPASS_DIR:-$(cd "$ROOT/.." && pwd)}"
|
||
ASSEMBLY_DIR="${ASSEMBLY_DIR:-deploy}"
|
||
|
||
case "$ASSEMBLY_DIR" in
|
||
/*) OUT="$ASSEMBLY_DIR" ;;
|
||
*) OUT="$ROOT/$ASSEMBLY_DIR" ;;
|
||
esac
|
||
|
||
SHELL_SUB="${SHELL_SUB:-shell}"
|
||
PLUGINS_SUB="${PLUGINS_SUB:-static-plugins}"
|
||
|
||
# 本仓 gateway 装配的插件短名(顺序无关;缺 dist 自动跳过并告警)
|
||
PLUGINS="${PLUGINS:-sso}"
|
||
|
||
# ---------------------------------------------------------------------------
|
||
# 1) 核心壳(默认 ipass-core www dist;**装配仓可用自己的 shell/dist 覆写**——
|
||
# 2026-09-26 架构定案第 2 条:各装配默认用 core 框架,也可整体重写壳)
|
||
# ---------------------------------------------------------------------------
|
||
SHELL_SRC="$IPASS_DIR/ipass-core/www/dist"
|
||
if [ -d "$ROOT/shell/dist" ] && [ -f "$ROOT/shell/dist/index.html" ]; then
|
||
SHELL_SRC="$ROOT/shell/dist"
|
||
echo "装配仓自带壳,覆盖 core 默认:$SHELL_SRC"
|
||
fi
|
||
SHELL_OUT="$OUT/$SHELL_SUB"
|
||
[ -d "$SHELL_SRC" ] || { echo "!! core shell dist 缺失:$SHELL_SRC(先在 ipass-core/www 跑 npm run build)" >&2; exit 1; }
|
||
mkdir -p "$SHELL_OUT"
|
||
rsync -a --delete --exclude .gitkeep "$SHELL_SRC/" "$SHELL_OUT/"
|
||
echo "shell : $SHELL_SRC → $SHELL_OUT"
|
||
|
||
# ---------------------------------------------------------------------------
|
||
# 2) 各插件的管理页 dist
|
||
# ---------------------------------------------------------------------------
|
||
PLUGINS_OUT="$OUT/$PLUGINS_SUB"
|
||
mkdir -p "$PLUGINS_OUT"
|
||
# 清空旧收集产物但保留 .gitkeep(Dockerfile COPY 依赖目录存在)
|
||
find "$PLUGINS_OUT" -mindepth 1 -maxdepth 1 ! -name .gitkeep -exec rm -rf {} +
|
||
|
||
count=0
|
||
for short in $PLUGINS; do
|
||
src="$IPASS_DIR/ipass-plugin-${short}/www/dist"
|
||
if [ ! -d "$src" ]; then
|
||
echo "!! ${short}:$src 缺失(先在 ipass-plugin-${short}/www 跑 npm run build),跳过" >&2
|
||
continue
|
||
fi
|
||
mkdir -p "$PLUGINS_OUT/$short/dist"
|
||
rsync -a --delete "$src/" "$PLUGINS_OUT/$short/dist/"
|
||
# 产物原文件名是 plugin-<短名>-admin.umd.js;壳按短名请求
|
||
# /static/plugins/<短名>/dist/<短名>-admin.umd.js → 补一份短名别名
|
||
if [ ! -f "$PLUGINS_OUT/$short/dist/${short}-admin.umd.js" ] \
|
||
&& [ -f "$PLUGINS_OUT/$short/dist/plugin-${short}-admin.umd.js" ]; then
|
||
cp "$PLUGINS_OUT/$short/dist/plugin-${short}-admin.umd.js" \
|
||
"$PLUGINS_OUT/$short/dist/${short}-admin.umd.js"
|
||
fi
|
||
echo "plugin: $src → $PLUGINS_OUT/$short/dist"
|
||
count=$((count + 1))
|
||
done
|
||
|
||
echo "完成:shell + ${count} 个插件 → $OUT"
|