Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

支持web多副本

chen huic7d540972c0e
diff --git a/deploy/enterprise/.env.example b/deploy/enterprise/.env.example
index 8952a7c6e4..0b20a65aad 100644
--- a/deploy/enterprise/.env.example
+++ b/deploy/enterprise/.env.example
@@ -360,6 +360,9 @@ WS_ALLOWED_ORIGINS=""
# 不设置就自动寻找空闲端口,如需要设置,请确保该端口的唯一性(范围: 30000-32767)
WEB_NODE_PORT=
+# Web 副本实例数量,控制部署运行的 Pod 个数
+WEB_REPLICAS=1
+
# 企业级 Web:聊天界面工具结果展示的最大字符数(经 Gateway 注入;0 表示不截断,默认 500)
TOOL_RESULT_DISPLAY_MAX_CHARS=500
diff --git a/deploy/enterprise/README.md b/deploy/enterprise/README.md
index 8f541e4830..b6c6054fbb 100644
--- a/deploy/enterprise/README.md
+++ b/deploy/enterprise/README.md
@@ -617,6 +617,13 @@ Web 为 JiuwenSwarm 企业版面向终端用户的对话可视化前端,用于
```
+注意:Web 支持多副本部署模式,可增加副本数水平扩容,多副本流量经由同命名空间下的 Service 自动负载均衡。启动前可在配置文件 `.env.custom` 中确认如下参数:
+
+```
+# Web 副本实例数量,控制部署运行的 Pod 个数
+WEB_REPLICAS=1
+```
+
## 5 服务异常排查
系统服务运行异常时,可按以下步骤逐层定位故障根因:
diff --git a/deploy/enterprise/global_vars.sh b/deploy/enterprise/global_vars.sh
index 0808a21c34..02eae6c5c1 100755
--- a/deploy/enterprise/global_vars.sh
+++ b/deploy/enterprise/global_vars.sh
@@ -228,6 +228,7 @@ declare -A DEPLOY_VARS=(
["VECTOR_IMAGE"]="timberio/vector:0.40.0-alpine"
["VAR_LIB_DOCKER_PATH"]="/var/lib/containerd"
["WEB_NAME"]="jiuwenclaw-web"
+ ["WEB_REPLICAS"]="1"
["WEB_WS_PORT"]="19000"
["WEB_HTTP_PORT"]="5173"
["AGENT_RUNTIME_NAME"]="jiuwenclaw-agent-runtime"
diff --git a/deploy/enterprise/templates/runtime.template.yaml b/deploy/enterprise/templates/runtime.template.yaml
index aff35398e8..095e0ef7c0 100644
--- a/deploy/enterprise/templates/runtime.template.yaml
+++ b/deploy/enterprise/templates/runtime.template.yaml
@@ -1,4 +1,3 @@
-# ServiceAccount
apiVersion: v1
kind: ServiceAccount
metadata:
@@ -6,7 +5,7 @@ metadata:
namespace: <<NAMESPACE>>
---
-# RBAC:agent-runtime 需要 CRUD AgentServer Pod(与 gateway 的 agentserver-creator 同面)
+
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
@@ -35,7 +34,6 @@ roleRef:
apiGroup: rbac.authorization.k8s.io
---
-# Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
@@ -105,8 +103,6 @@ spec:
- name: OPENJIUWEN_SERVICE_PORT
value: "<<AGENT_RUNTIME_PORT>>"
- name: OPENJIUWEN_SERVICE_REDIS_URL
- # AgentServer checkpointer 用此 URL 连接 Redis(与 gateway 的 redis client 独立)
- # 由 runtime_handler.sh 按 REDIS_MODE 计算:cluster -> redis+cluster://host:port / standalone -> redis://host:port/db
value: "<<OPENJIUWEN_SERVICE_REDIS_URL>>"
- name: OPENJIUWEN_SERVICE_REQUEST_TIMEOUT_SECONDS
value: "<<AGENT_RUNTIME_REQUEST_TIMEOUT>>"
@@ -124,10 +120,6 @@ spec:
value: "1"
- name: AGENT_RUNTIME_KUBECONFIG
value: ""
- # runtime 自身 ns(downward API):模板 namespace 为空时 AgentServer
- # 落同名 ns;代码另有 SA 文件兜底,注入仅为显式化。
- # AGENT_RUNTIME_DEFAULT_NAMESPACE/SCOPE_FULL_TIMEOUT 已随代码删除
- # (2026-09-17 cyz2 实录:旧注入被新代码忽略→落 "default"→403)
- name: POD_NAMESPACE
valueFrom:
fieldRef:
diff --git a/deploy/enterprise/templates/web.template.yaml b/deploy/enterprise/templates/web.template.yaml
index fc7a822c52..e2c2a618b9 100644
--- a/deploy/enterprise/templates/web.template.yaml
+++ b/deploy/enterprise/templates/web.template.yaml
@@ -6,7 +6,7 @@ metadata:
labels:
app: <<WEB_NAME>>
spec:
- replicas: 1
+ replicas: <<WEB_REPLICAS>>
selector:
matchLabels:
app: <<WEB_NAME>>