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

support to start indentity module for deploy tool

chen-hui-zhe-xif52dac41ce2e
diff --git a/deploy/enterprise/.env.example b/deploy/enterprise/.env.example
index 40ab595555..78e6b3873d 100644
--- a/deploy/enterprise/.env.example
+++ b/deploy/enterprise/.env.example
@@ -77,9 +77,9 @@ DB_HOST="" # 外部数据服务的连接地址, 不设置则使用本工具内
DB_PORT="" # 数据服务的连接端口(本工具内置部署的数据库服务时设置端口,外部数据库服务填写对应端口)
MANAGER_DB_NAME="" # Manager 业务模块对应的数据库实例名称,未设置则使用默认值"manager"
GATEWAY_DB_NAME="" # Gateway 网关服务对应的数据库实例名称,未设置则使用默认值"gateway"
+IDENTITY_DB_NAME="" # Identity 服务对应的数据库实例名称,未设置则使用默认值"identity
WEB_DB_NAME="" # 企业 Web 会话历史库名称,未设置则使用默认值"web"
-
# 仅 DB_TYPE 取值为 postgresql / mysql 且使用外部独立数据库服务时,本段账号配置生效,账号权限区分规则:
# 1. 分库独立账号配置:分别定义 MANAGER_DB_USER / MANAGER_DB_PASSWORD、GATEWAY_DB_USER / GATEWAY_DB_PASSWORD、WEB_DB_USER / WEB_DB_PASSWORD
# 2. 全局统一账号配置:仅配置 DB_USER、DB_PASSWORD,Manager、Gateway、Web 共用同一套数据库访问凭证
@@ -92,6 +92,8 @@ GATEWAY_DB_USER=""
GATEWAY_DB_PASSWORD=""
MANAGER_DB_USER=""
MANAGER_DB_PASSWORD=""
+IDENTITY_DB_USER=""
+IDENTITY_DB_PASSWORD=""
WEB_DB_USER=""
WEB_DB_PASSWORD=""
@@ -309,18 +311,12 @@ LOG_MASK_ENABLED=true
# false:业务进程仅输出日志至标准输出,想要持久化,可通过 FluentBit+Vector 采集后统一落盘到宿主机上
LOG_TO_FILE_ENABLED=true
-# AgentServer 客户端通信模式配置, 支持如下可选客户端类型:
-# jiuwen - jiuwen_runtime编排管理客户端,由 AgentServerClientExtension 组件提供
-AGENT_RUNTIME="jiuwen"
-
-# Gateway 产品形态(写入 gateway.edition,影响 Gateway 存储选型)
-# personal - 本地文件 + 进程内存(个人版默认)
-# enterprise - Gateway DB + Redis(企业版部署请保持此值)
-GATEWAY_EDITION="enterprise"
-
# Gateway Pod 调度限制开关,开启后仅能调度到带有 gateway=enable 标签的节点
GATEWAY_SCHED_LABEL_ENABLED="false"
+# Gateway 副本实例数量,控制部署运行的 Pod 个数
+GATEWAY_REPLICAS=1
+
# ====================== AgentServer 配置 ======================
# AgentServer 服务镜像地址
AGENT_SERVER_IMAGE=""
@@ -430,6 +426,9 @@ WEB_MEMORY_LIMIT=1Gi
# Manager 服务端模块容器镜像地址
MANAGER_SERVER_IMAGE=""
+# Manager 服务端副本实例数量,控制部署运行的 Pod 个数
+MANAGER_SERVER_REPLICAS=1
+
# Manager REST API 对外暴露的主机端口
# 不设置就自动寻找空闲端口,如需要设置,请确保该端口的唯一性(范围: 30000-32767)
MANAGER_SERVER_NODE_PORT=
@@ -470,6 +469,17 @@ MANAGER_WEB_CPU_LIMIT=500m
MANAGER_WEB_MEMORY_LIMIT=1Gi
+
+# Identity(身份中心 / idp) 镜像地址
+IDENTITY_IMAGE=""
+
+# 是否启动时种入默认账号
+IDENTITY_SEED_ADMIN=true
+IDENTITY_SEED_USER1=true
+
+
+
+
# ====================== 大模型接口配置 ======================
# 模型厂商标识(如:OpenAI等)
MODEL_PROVIDER=""
diff --git a/deploy/enterprise/check_handler.sh b/deploy/enterprise/check_handler.sh
index 4c1f0379b4..9bb8012a09 100755
--- a/deploy/enterprise/check_handler.sh
+++ b/deploy/enterprise/check_handler.sh
@@ -141,10 +141,12 @@ check_if_mysql_up() {
info "Use built-in MySQL server"
DEPLOY_VARS["DB_HOST"]="${name}-headless.default"
DEPLOY_VARS["DB_PORT"]="3306"
- DEPLOY_VARS["MANAGER_DB_USER"]="root"
- DEPLOY_VARS["MANAGER_DB_PASSWORD"]=${DEPLOY_VARS["MYSQL_ROOT_PASSWORD"]}
- DEPLOY_VARS["GATEWAY_DB_USER"]="root"
- DEPLOY_VARS["GATEWAY_DB_PASSWORD"]=${DEPLOY_VARS["MYSQL_ROOT_PASSWORD"]}
+
+ for module in MANAGER GATEWAY IDENTITY
+ do
+ DEPLOY_VARS["${module}_DB_USER"]="root"
+ DEPLOY_VARS["${module}_DB_PASSWORD"]=${DEPLOY_VARS["MYSQL_ROOT_PASSWORD"]}
+ done
}
check_if_postgresql_up() {
@@ -172,10 +174,12 @@ check_if_postgresql_up() {
info "Use built-in PostgreSQL server"
DEPLOY_VARS["DB_HOST"]="${name}-headless.default"
DEPLOY_VARS["DB_PORT"]="5432"
- DEPLOY_VARS["MANAGER_DB_USER"]="postgres"
- DEPLOY_VARS["MANAGER_DB_PASSWORD"]=${DEPLOY_VARS["POSTGRES_PASSWORD"]}
- DEPLOY_VARS["GATEWAY_DB_USER"]="postgres"
- DEPLOY_VARS["GATEWAY_DB_PASSWORD"]=${DEPLOY_VARS["POSTGRES_PASSWORD"]}
+
+ for module in MANAGER GATEWAY IDENTITY
+ do
+ DEPLOY_VARS["${module}_DB_USER"]="postgres"
+ DEPLOY_VARS["${module}_DB_PASSWORD"]=${DEPLOY_VARS["POSTGRES_PASSWORD"]}
+ done
}
@@ -188,48 +192,24 @@ check_if_db_up() {
check_if_${db_type}_up
if [[ "${DEPLOY_VARS["ENABLE_EXTERNAL_MYSQL"]}" == "true" || "${DEPLOY_VARS["ENABLE_EXTERNAL_POSTGRES"]}" == "true" ]]; then
- if [ -z "${DEPLOY_VARS["MANAGER_DB_USER"]:-}" ]; then
- DEPLOY_VARS["MANAGER_DB_USER"]=${DEPLOY_VARS["DB_USER"]}
- fi
-
- if [ -z "${DEPLOY_VARS["MANAGER_DB_USER"]:-}" ]; then
- error "Please set up MANAGER_DB_USER or DB_USER."
- fi
-
- if [ -z "${DEPLOY_VARS["MANAGER_DB_PASSWORD"]:-}" ]; then
- DEPLOY_VARS["MANAGER_DB_PASSWORD"]=${DEPLOY_VARS["DB_PASSWORD"]}
- fi
- if [ -z "${DEPLOY_VARS["MANAGER_DB_PASSWORD"]:-}" ]; then
- error "Please set up MANAGER_DB_PASSWORD or DB_PASSWORD."
- fi
+ for module in MANAGER GATEWAY IDENTITY WEB
+ do
+ if [ -z "${DEPLOY_VARS["${module}_DB_USER"]:-}" ]; then
+ DEPLOY_VARS["${module}_DB_USER"]=${DEPLOY_VARS["DB_USER"]}
+ fi
- if [ -z "${DEPLOY_VARS["GATEWAY_DB_USER"]:-}" ]; then
- DEPLOY_VARS["GATEWAY_DB_USER"]=${DEPLOY_VARS["DB_USER"]}
- fi
- if [ -z "${DEPLOY_VARS["GATEWAY_DB_USER"]:-}" ]; then
- error "Please set up GATEWAY_DB_USER or DB_USER."
- fi
+ if [ -z "${DEPLOY_VARS["${module}_DB_USER"]:-}" ]; then
+ error "Please set up ${module}_DB_USER or DB_USER."
+ fi
- if [ -z "${DEPLOY_VARS["GATEWAY_DB_PASSWORD"]:-}" ]; then
- DEPLOY_VARS["GATEWAY_DB_PASSWORD"]=${DEPLOY_VARS["DB_PASSWORD"]}
- fi
- if [ -z "${DEPLOY_VARS["GATEWAY_DB_PASSWORD"]:-}" ]; then
- error "Please set up GATEWAY_DB_PASSWORD or DB_PASSWORD."
- fi
+ if [ -z "${DEPLOY_VARS["${module}_DB_PASSWORD"]:-}" ]; then
+ DEPLOY_VARS["${module}_DB_PASSWORD"]=${DEPLOY_VARS["DB_PASSWORD"]}
+ fi
- if [ -z "${DEPLOY_VARS["WEB_DB_USER"]:-}" ]; then
- DEPLOY_VARS["WEB_DB_USER"]=${DEPLOY_VARS["DB_USER"]}
- fi
- if [ -z "${DEPLOY_VARS["WEB_DB_USER"]:-}" ]; then
- error "Please set up WEB_DB_USER or DB_USER."
- fi
-
- if [ -z "${DEPLOY_VARS["WEB_DB_PASSWORD"]:-}" ]; then
- DEPLOY_VARS["WEB_DB_PASSWORD"]=${DEPLOY_VARS["DB_PASSWORD"]}
- fi
- if [ -z "${DEPLOY_VARS["WEB_DB_PASSWORD"]:-}" ]; then
- error "Please set up WEB_DB_PASSWORD or DB_PASSWORD."
- fi
+ if [ -z "${DEPLOY_VARS["${module}_DB_PASSWORD"]:-}" ]; then
+ error "Please set up ${module}_DB_PASSWORD or DB_PASSWORD."
+ fi
+ done
fi
}
diff --git a/deploy/enterprise/configmap_secret_handler.sh b/deploy/enterprise/configmap_secret_handler.sh
index f58ce95a15..f2ed30b5a0 100755
--- a/deploy/enterprise/configmap_secret_handler.sh
+++ b/deploy/enterprise/configmap_secret_handler.sh
@@ -15,6 +15,7 @@ render_secret_configmap() {
local secret_keys=(
"GATEWAY_DB_PASSWORD"
"MANAGER_DB_PASSWORD"
+ "IDENTITY_DB_PASSWORD"
"WEB_DB_PASSWORD"
"REDIS_PASSWORD"
"OBS_SECRET_KEY"
diff --git a/deploy/enterprise/example/gateway-env.configmap.yaml b/deploy/enterprise/example/gateway-env.configmap.yaml
index 6f0c76fc34..f8c2c40c85 100644
--- a/deploy/enterprise/example/gateway-env.configmap.yaml
+++ b/deploy/enterprise/example/gateway-env.configmap.yaml
@@ -49,7 +49,7 @@ data:
GATEWAY_SQLITE_PATH: gateway.db
HEARTBEAT_ENABLED: "FALSE"
JINA_READER_ENDPOINT: https://r.jinaai.cn
- JIUWENBOX_CODE_POD_PATH: /usr/local/lib/python3.11/site-packages/jiuwenbox
+ JIUWENBOX_POD_PKG_PATH: /usr/local/lib/python3.11/site-packages/jiuwenbox
JIUWENBOX_CONTAINER_NAME: jiuwenbox
JIUWENBOX_ENABLED: "true"
JIUWENBOX_IMAGE: <<JIUWENBOX_IMAGE>>
diff --git a/deploy/enterprise/example/web.yaml b/deploy/enterprise/example/web.yaml
index 05d8c526c2..491aac0b16 100644
--- a/deploy/enterprise/example/web.yaml
+++ b/deploy/enterprise/example/web.yaml
@@ -36,7 +36,7 @@ spec:
value: "5173"
- name: ENTERPRISE_WEB_WS_HOST
value: "0.0.0.0"
- - name: ENTERPRISE_WEB_WS_PORT
+ - name: WEB_WS_PORT
value: "19000"
- name: WS_ORIGIN_CHECK_ENABLED
value: "false"
diff --git a/deploy/enterprise/gateway_handler.sh b/deploy/enterprise/gateway_handler.sh
index 06b7836498..039952e575 100755
--- a/deploy/enterprise/gateway_handler.sh
+++ b/deploy/enterprise/gateway_handler.sh
@@ -196,10 +196,7 @@ uninstall_gateway() {
info "Deleting remaining Gateway resources (ServiceAccount, Role, Service, ...)"
exec_cmd kubectl delete -f "${gateway_file}" --ignore-not-found=true
delete_k8s_resource "configmap" "${conf_name}" "${namespace}"
-
- if [ "${DEPLOY_VARS["AGENT_RUNTIME"]}" == "jiuwen" ]; then
- delete_k8s_resource "configmap" "${envfile_name}" "${namespace}"
- fi
+ delete_k8s_resource "configmap" "${envfile_name}" "${namespace}"
if [[ "${mount_type}" == "pvc" && -z "${DEPLOY_VARS["CLAW_PVC"]:-}" ]]; then
exec_cmd kubectl delete -f ${pvc_file} --ignore-not-found=true
diff --git a/deploy/enterprise/global_vars.sh b/deploy/enterprise/global_vars.sh
index b8af21e197..ff58f7c363 100755
--- a/deploy/enterprise/global_vars.sh
+++ b/deploy/enterprise/global_vars.sh
@@ -56,6 +56,9 @@ declare -A CONFIG=(
["MANAGER_WEB_TEMPLATE_FILE"]="${TEMPLATE_DIR}/manager-web.template.yaml"
["MANAGER_WEB_FILE"]="${CONFIG_DIR}/manager-web.yaml"
+ ["IDENTITY_TEMPLATE_FILE"]="${TEMPLATE_DIR}/identity.template.yaml"
+ ["IDENTITY_FILE"]="${CONFIG_DIR}/identity.yaml"
+
["START_PORT"]="30000"
["END_PORT"]="32767"
@@ -89,21 +92,22 @@ declare -A DEPLOY_VARS=(
["RUNTIME_POD_CODE_PATH"]="/app/agent-runtime"
["RUNTIME_POD_PKG_PATH"]="/usr/local/lib/python3.11/site-packages/openjiuwen_runtime"
["CORE_POD_PKG_PATH"]="/usr/local/lib/python3.11/site-packages/openjiuwen"
+ ["JIUWENBOX_POD_PKG_PATH"]="/usr/local/lib/python3.11/site-packages/jiuwenbox"
+ ["AGENT_BOT_ID_GROUP_NUM"]="0"
["AGENT_SERVER_HOME"]="/home/app"
["AGENT_SERVER_POD_NAME"]="jiuwenclaw-agentserver"
["AGENT_SERVER_SERVICE_CONCURRENCY"]="10"
["AGENT_SERVER_SESSION_CONCURRENCY"]="10"
["AGENT_SERVER_SESSION_TTL"]="60"
- ["AGENT_BOT_ID_GROUP_NUM"]="0"
["AGENT_SERVER_REACT_MAX_ITER"]="10"
["CLAW_MOUNT_TYPE"]="pvc"
["CLAW_STORAGE_SIZE"]="1Gi"
["COLLECT_LOG_MASK_ENABLED"]="false"
["DB_TYPE"]="sqlite"
["DEPLOYMENT_MODE"]="standalone"
- ["GATEWAY_EDITION"]="enterprise"
- ["ENTERPRISE_WEB_WS_PORT"]="19000"
+ ["GATEWAY_HTTP_PORT"]="19001"
+ ["GATEWAY_WS_PORT"]="19000"
["ENABLE_EXTERNAL_OBS"]="false"
["ENABLE_EXTERNAL_MYSQL"]="false"
["ENABLE_EXTERNAL_NFS"]="false"
@@ -134,7 +138,11 @@ declare -A DEPLOY_VARS=(
["GATEWAY_SERVICE_ACCOUNT"]="jiuwenclaw-gateway-sa"
["GATEWAY_SQLITE_PATH"]="gateway.db"
["IS_UP_MANAGER_WEB"]="true"
- ["JIUWENBOX_CODE_POD_PATH"]="/usr/local/lib/python3.11/site-packages/jiuwenbox"
+ ["IDENTITY_NAME"]="jiuwenclaw-identity"
+ ["IDENTITY_REST_PORT"]="8770"
+ ["IDENTITY_DB_NAME"]="identity"
+ ["IDENTITY_SEED_ADMIN"]="true"
+ ["IDENTITY_SEED_USER1"]="true"
["JINA_NAME"]="jina"
["JINA_CACHE_IMAGE"]="nginx:alpine"
["JINA_READER_IMAGE"]="ghcr.1ms.run/jina-ai/reader:latest"
@@ -145,6 +153,7 @@ declare -A DEPLOY_VARS=(
["MANAGER_PG_SCHEMA"]="public"
["MANAGER_REST_PORT"]="8765"
["MANAGER_SERVER_NAME"]="jiuwenclaw-manager-server"
+ ["MANAGER_SERVER_REPLICAS"]="1"
["MANAGER_SQLITE_PATH"]="manager.db"
["MANAGER_WEB_NAME"]="jiuwenclaw-manager-web"
["MANAGER_WEB_PORT"]="5273"
@@ -202,6 +211,8 @@ declare -A DEPLOY_VARS=(
["VECTOR_IMAGE"]="timberio/vector:0.40.0-alpine"
["VAR_LIB_DOCKER_PATH"]="/var/lib/containerd"
["WEB_NAME"]="jiuwenclaw-web"
+ ["WEB_WS_PORT"]="19000"
+ ["WEB_HTTP_PORT"]="5173"
["WS_ALLOWED_ORIGINS"]=""
["WS_ORIGIN_CHECK_ENABLED"]="false"
)
diff --git a/deploy/enterprise/manager_handler.sh b/deploy/enterprise/manager_handler.sh
index efb469f47c..a7a6b7544d 100755
--- a/deploy/enterprise/manager_handler.sh
+++ b/deploy/enterprise/manager_handler.sh
@@ -21,12 +21,33 @@ gen_manager_server_file() {
add_resource_if_set "MANAGER_SERVER" "${file}"
}
+gen_identity_file() {
+ local template_file="${CONFIG["IDENTITY_TEMPLATE_FILE"]}"
+ local file="${CONFIG["IDENTITY_FILE"]}"
+
+ render_config_template "${template_file}" "${file}" "DEPLOY_VARS"
+ enable_dev_mode_if_needed ${file} identity
+
+ if [ "${DEPLOY_VARS["DB_TYPE"]}" == "postgresql" ]; then
+ yq eval '
+ select(.kind == "Deployment").spec.template.spec.containers[0].env += [
+ {
+ "name": "IDENTITY_PG_SCHEMA",
+ "value": "'"${DEPLOY_VARS["MANAGER_PG_SCHEMA"]}"'"
+ }
+ ]' -i "${file}"
+ fi
+
+ add_resource_if_set "IDENTITY" "${file}"
+}
+
render_manager_files() {
local is_up_web="${DEPLOY_VARS["IS_UP_MANAGER_WEB"]}"
render_secret_configmap
ensure_available_port "MANAGER_SERVER_NODE_PORT" "MANAGER_WEB_NODE_PORT"
gen_manager_server_file
+ gen_identity_file
if [ "${is_up_web}" == "true" ]; then
local manager_web_template_file="${CONFIG["MANAGER_WEB_TEMPLATE_FILE"]}"
@@ -40,15 +61,25 @@ render_manager_files() {
deploy_manager() {
local namespace="${DEPLOY_VARS["NAMESPACE"]}"
- local manager_server_name="${DEPLOY_VARS["MANAGER_SERVER_NAME"]}"
- local manager_server_file="${CONFIG["MANAGER_SERVER_FILE"]}"
local is_up_web="${DEPLOY_VARS["IS_UP_MANAGER_WEB"]}"
ensure_secret_configmap
+
+ # manager-server
+ local manager_server_name="${DEPLOY_VARS["MANAGER_SERVER_NAME"]}"
+ local manager_server_file="${CONFIG["MANAGER_SERVER_FILE"]}"
exec_cmd kubectl apply -f ${manager_server_file}
wait_k8s_resource_ready "deployment" "${manager_server_name}" "${namespace}"
success "MANAGER_SERVER_NODE_PORT: ${DEPLOY_VARS["MANAGER_SERVER_NODE_PORT"]}"
+ # identity(manager-web 的 /idp 反代到此)
+ local identity_name="${DEPLOY_VARS["IDENTITY_NAME"]}"
+ local identity_file="${CONFIG["IDENTITY_FILE"]}"
+ exec_cmd kubectl apply -f ${identity_file}
+ wait_k8s_resource_ready "deployment" "${identity_name}" "${namespace}"
+ success "IDENTITY_REST_PORT: ${DEPLOY_VARS["IDENTITY_REST_PORT"]}"
+
+ # manager-web
if [ "${is_up_web}" == "true" ]; then
local manager_web_name="${DEPLOY_VARS["MANAGER_WEB_NAME"]}"
local manager_web_file="${CONFIG["MANAGER_WEB_FILE"]}"
@@ -61,17 +92,25 @@ deploy_manager() {
uninstall_manager() {
local namespace="${DEPLOY_VARS["NAMESPACE"]}"
- local manager_server_name="${DEPLOY_VARS["MANAGER_SERVER_NAME"]}"
- local manager_server_file="${CONFIG["MANAGER_SERVER_FILE"]}"
local is_up_web="${DEPLOY_VARS["IS_UP_MANAGER_WEB"]}"
+ # 反序:manager-web → identity → manager-server
if [ "${is_up_web}" == "true" ]; then
local manager_web_name="${DEPLOY_VARS["MANAGER_WEB_NAME"]}"
local manager_web_file="${CONFIG["MANAGER_WEB_FILE"]}"
exec_cmd kubectl delete -f ${manager_web_file} --ignore-not-found=true
wait_pod_terminated "${manager_web_name}" "${namespace}"
fi
+
+ local identity_name="${DEPLOY_VARS["IDENTITY_NAME"]}"
+ local identity_file="${CONFIG["IDENTITY_FILE"]}"
+ exec_cmd kubectl delete -f ${identity_file} --ignore-not-found=true
+ wait_pod_terminated "${identity_name}" "${namespace}"
+
+ local manager_server_name="${DEPLOY_VARS["MANAGER_SERVER_NAME"]}"
+ local manager_server_file="${CONFIG["MANAGER_SERVER_FILE"]}"
exec_cmd kubectl delete -f ${manager_server_file} --ignore-not-found=true
wait_pod_terminated "${manager_server_name}" "${namespace}"
+
uninstall_secret_configmap
}
diff --git a/deploy/enterprise/template_handler.sh b/deploy/enterprise/template_handler.sh
index 85d5c9d8db..4bb334e24f 100755
--- a/deploy/enterprise/template_handler.sh
+++ b/deploy/enterprise/template_handler.sh
@@ -126,12 +126,12 @@ run_frontend_dev() {
web)
[ -z "${DEPLOY_VARS["CLAW_POD_CODE_PATH"]:-}" ] && return
workdir="${DEPLOY_VARS["CLAW_POD_CODE_PATH"]}/jiuwenswarm/channels/web/frontend"
- port="5173"
+ port="${DEPLOY_VARS["WEB_HTTP_PORT"]}"
;;
manager-web)
[ -z "${DEPLOY_VARS["RUNTIME_CODE_PATH"]:-}" ] && return
workdir="${DEPLOY_VARS["RUNTIME_POD_CODE_PATH"]}/applications/manager/manager_web"
- port="5273"
+ port="${DEPLOY_VARS["MANAGER_WEB_PORT"]}"
;;
*)
warning "run_frontend_dev: unknown component '${comp}', skipping"
@@ -163,6 +163,9 @@ enable_dev_mode_if_needed() {
manager-server)
mount_runtime_code "${file}"
;;
+ identity)
+ mount_runtime_code "${file}"
+ ;;
manager-web)
[ "${DEPLOY_VARS["IS_MOUNT_MANAGER_WEB_CODE"]}" != "true" ] && return
mount_runtime_code "${file}"
diff --git a/deploy/enterprise/templates/configmap-secret.template.yaml b/deploy/enterprise/templates/configmap-secret.template.yaml
index f03cdea78d..fbab0887fb 100644
--- a/deploy/enterprise/templates/configmap-secret.template.yaml
+++ b/deploy/enterprise/templates/configmap-secret.template.yaml
@@ -7,6 +7,7 @@ type: Opaque
data:
GATEWAY_DB_PASSWORD: "<<GATEWAY_DB_PASSWORD_ENCODED>>"
MANAGER_DB_PASSWORD: "<<MANAGER_DB_PASSWORD_ENCODED>>"
+ IDENTITY_DB_PASSWORD: "<<IDENTITY_DB_PASSWORD_ENCODED>>"
WEB_DB_PASSWORD: "<<WEB_DB_PASSWORD_ENCODED>>"
REDIS_PASSWORD: "<<REDIS_PASSWORD_ENCODED>>"
JIUWENCLAW_MINIO_SECRET_KEY: "<<OBS_SECRET_KEY_ENCODED>>"
diff --git a/deploy/enterprise/templates/gateway.template.env b/deploy/enterprise/templates/gateway.template.env
index 6f857b7560..8058149c03 100644
--- a/deploy/enterprise/templates/gateway.template.env
+++ b/deploy/enterprise/templates/gateway.template.env
@@ -3,8 +3,8 @@ LOG_ROOT_PATH=/root/.logs
EXTENSION_DIRS=<<CLAW_POD_CODE_PATH>>/packages/jiuwenclaw-ee/gateway/extensions
PIP_EXTRA_ARGS=<<PIP_EXTRA_ARGS>>
NAMESPACE=<<NAMESPACE>>
-AGENT_RUNTIME=<<AGENT_RUNTIME>>
-GATEWAY_EDITION=<<GATEWAY_EDITION>>
+AGENT_RUNTIME=jiuwen
+GATEWAY_EDITION="enterprise"
TZ=<<TIMEZONE>>
JINA_READER_ENDPOINT=<<JINA_READER_ENDPOINT>>
HTTP_PROXY=<<HTTP_PROXY>>
@@ -57,7 +57,7 @@ AGENT_BOT_ID_GROUP_NUM=<<AGENT_BOT_ID_GROUP_NUM>>
MODE=<<MODE>>
CLAW_CODE_PATH=<<CLAW_CODE_PATH>>
CLAW_POD_CODE_PATH=<<CLAW_POD_CODE_PATH>>
-JIUWENBOX_CODE_POD_PATH=<<JIUWENBOX_CODE_POD_PATH>>
+JIUWENBOX_POD_PKG_PATH=<<JIUWENBOX_POD_PKG_PATH>>
RUNTIME_CODE_PATH=<<RUNTIME_CODE_PATH>>
RUNTIME_POD_PKG_PATH=<<RUNTIME_POD_PKG_PATH>>
CORE_CODE_PATH=<<CORE_CODE_PATH>>
@@ -95,10 +95,13 @@ GATEWAY_CLAW_WS_PING_TIMEOUT=<<GATEWAY_CLAW_WS_PING_TIMEOUT>>
# Websocket Configuration
WEB_HOST=0.0.0.0
+WEB_PORT=<<GATEWAY_WS_PORT>>
+GATEWAY_HOST=0.0.0.0
+GATEWAY_PORT=<<GATEWAY_HTTP_PORT>>
# Enterprise Web: browser WS on app_enterprise_web; Gateway WS client to /gateway
ENTERPRISE_WEB_ENABLED=true
-ENTERPRISE_WEB_GATEWAY_URL=ws://<<WEB_NAME>>:<<ENTERPRISE_WEB_WS_PORT>>/gateway
+ENTERPRISE_WEB_GATEWAY_URL=ws://<<WEB_NAME>>:<<WEB_WS_PORT>>/gateway
# Enterprise Web: max chars for tool results in chat UI (0 = no truncation)
TOOL_RESULT_DISPLAY_MAX_CHARS=<<TOOL_RESULT_DISPLAY_MAX_CHARS>>
@@ -144,7 +147,7 @@ JIUWENBOX_FALLBACK_ON_FAILURE=<<JIUWENBOX_FALLBACK_ON_FAILURE>>
# Jiuwenbox sidecar options
JIUWENBOX_LISTEN=http://0.0.0.0:8321
-JIUWENBOX_POLICY_PATH=<<JIUWENBOX_CODE_POD_PATH>>/configs/enterprise-policy.yaml
+JIUWENBOX_POLICY_PATH=<<JIUWENBOX_POD_PKG_PATH>>/configs/enterprise-policy.yaml
JIUWENBOX_MOUNT_CGROUP=true
# K8s Resource Configuration
diff --git a/deploy/enterprise/templates/gateway.template.yaml b/deploy/enterprise/templates/gateway.template.yaml
index e3f8552734..446016b27c 100644
--- a/deploy/enterprise/templates/gateway.template.yaml
+++ b/deploy/enterprise/templates/gateway.template.yaml
@@ -96,7 +96,6 @@ spec:
mountPath: /root/.jiuwenswarm/config/config.yaml
subPath: config.yaml
readOnly: true
- # 用渲染后的 gateway.env 覆盖镜像里烘焙的空 EXTENSION_DIRS .env
- name: gateway-env-file
mountPath: /root/.jiuwenswarm/config/.env
subPath: .env
@@ -108,7 +107,6 @@ spec:
items:
- key: config.yaml
path: config.yaml
- # 持有渲染后 conf/gateway.env 整个文件(单 key=.env)的 configmap
- name: gateway-env-file
configMap:
name: <<GATEWAY_ENV_FILE_CM_NAME>>
@@ -116,3 +114,22 @@ spec:
- key: .env
path: .env
serviceAccountName: <<GATEWAY_SERVICE_ACCOUNT>>
+
+---
+# Service:提供稳定 DNS 域名, 供集群内部访问
+apiVersion: v1
+kind: Service
+metadata:
+ name: <<GATEWAY_NAME>>
+ namespace: <<NAMESPACE>>
+spec:
+ selector:
+ app: <<GATEWAY_NAME>>
+ ports:
+ - name: web-ws
+ port: <<GATEWAY_WS_PORT>>
+ targetPort: <<GATEWAY_WS_PORT>>
+ - name: http
+ port: <<GATEWAY_HTTP_PORT>>
+ targetPort: <<GATEWAY_HTTP_PORT>>
+ type: ClusterIP # 集群内部访问,不需要外网
\ No newline at end of file
diff --git a/deploy/enterprise/templates/identity.template.yaml b/deploy/enterprise/templates/identity.template.yaml
new file mode 100644
index 0000000000..7c5f9e38a8
--- /dev/null
+++ b/deploy/enterprise/templates/identity.template.yaml
@@ -0,0 +1,62 @@
+# Service:提供稳定 DNS 域名, 供集群内部访问(manager-web 的 /idp 反代到此)
+apiVersion: v1
+kind: Service
+metadata:
+ name: <<IDENTITY_NAME>>
+ namespace: <<NAMESPACE>>
+spec:
+ selector:
+ app: <<IDENTITY_NAME>>
+ ports:
+ - name: rest
+ port: <<IDENTITY_REST_PORT>>
+ targetPort: <<IDENTITY_REST_PORT>>
+ type: ClusterIP # 集群内部访问,不需要外网
+
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: <<IDENTITY_NAME>>
+ namespace: <<NAMESPACE>>
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: <<IDENTITY_NAME>>
+ template:
+ metadata:
+ labels:
+ app: <<IDENTITY_NAME>>
+ spec:
+ containers:
+ - name: <<IDENTITY_NAME>>
+ image: <<IDENTITY_IMAGE>>
+ imagePullPolicy: IfNotPresent
+ ports:
+ - name: rest
+ containerPort: <<IDENTITY_REST_PORT>>
+ envFrom:
+ - secretRef:
+ name: <<SECRET_CM_NAME>>
+ env:
+ - name: IDENTITY_REST_HOST
+ value: "0.0.0.0"
+ - name: IDENTITY_REST_PORT
+ value: "<<IDENTITY_REST_PORT>>"
+ - name: IDENTITY_DB_TYPE
+ value: "<<DB_TYPE>>"
+ - name: IDENTITY_DB_HOST
+ value: "<<DB_HOST>>"
+ - name: IDENTITY_DB_PORT
+ value: "<<DB_PORT>>"
+ - name: IDENTITY_DB_USER
+ value: "<<IDENTITY_DB_USER>>"
+ - name: IDENTITY_DB_NAME
+ value: "<<IDENTITY_DB_NAME>>"
+ - name: IDENTITY_SEED_ADMIN
+ value: "<<IDENTITY_SEED_ADMIN>>"
+ - name: IDENTITY_SEED_USER1
+ value: "<<IDENTITY_SEED_USER1>>"
+ - name: TZ
+ value: "<<TIMEZONE>>"
diff --git a/deploy/enterprise/templates/manager-web.template.yaml b/deploy/enterprise/templates/manager-web.template.yaml
index 1b2769ca64..2ca962adac 100644
--- a/deploy/enterprise/templates/manager-web.template.yaml
+++ b/deploy/enterprise/templates/manager-web.template.yaml
@@ -30,6 +30,14 @@ spec:
value: "<<MANAGER_WEB_PORT>>"
- name: MANAGER_WEB_PROXY_TARGET
value: "http://<<MANAGER_SERVER_NAME>>:<<MANAGER_REST_PORT>>"
+ - name: MANAGER_WEB_IDP_TARGET
+ value: "http://<<IDENTITY_NAME>>:<<IDENTITY_REST_PORT>>"
+ - name: MANAGER_WEB_GATEWAY_SSE
+ value: "http://<<GATEWAY_NAME>>:<<GATEWAY_HTTP_PORT>>/web/invoke"
+ - name: MANAGER_WEB_USER_SERVER_TARGET
+ value: "http://<<WEB_NAME>>:<<WEB_WS_PORT>>"
+ - name: IDENTITY_PUBLIC_KEY_URL
+ value: "http://<<IDENTITY_NAME>>:<<IDENTITY_REST_PORT>>/v1/auth/public_key"
- name: TZ
value: "<<TIMEZONE>>"
diff --git a/deploy/enterprise/templates/web.template.yaml b/deploy/enterprise/templates/web.template.yaml
index 81ecb79e98..a44537bcda 100644
--- a/deploy/enterprise/templates/web.template.yaml
+++ b/deploy/enterprise/templates/web.template.yaml
@@ -21,10 +21,10 @@ spec:
imagePullPolicy: IfNotPresent
ports:
- name: http
- containerPort: 5173
+ containerPort: <<WEB_HTTP_PORT>>
protocol: TCP
- name: websocket
- containerPort: <<ENTERPRISE_WEB_WS_PORT>>
+ containerPort: <<WEB_WS_PORT>>
protocol: TCP
envFrom:
- secretRef:
@@ -32,12 +32,12 @@ spec:
env:
- name: JIUWENCLAW_WEB_HOST
value: "0.0.0.0"
- - name: JIUWENCLAW_WEB_PORT
- value: "5173"
+ - name: FRONTEND_PORT
+ value: "<<WEB_HTTP_PORT>>"
- name: ENTERPRISE_WEB_WS_HOST
value: "0.0.0.0"
- name: ENTERPRISE_WEB_WS_PORT
- value: "<<ENTERPRISE_WEB_WS_PORT>>"
+ value: "<<WEB_WS_PORT>>"
- name: WS_ORIGIN_CHECK_ENABLED
value: "<<WS_ORIGIN_CHECK_ENABLED>>"
- name: WS_ALLOWED_ORIGINS
@@ -67,8 +67,8 @@ spec:
app: <<WEB_NAME>>
ports:
- name: websocket
- port: <<ENTERPRISE_WEB_WS_PORT>> # Service 端口
- targetPort: <<ENTERPRISE_WEB_WS_PORT>> # 容器端口
+ port: <<WEB_WS_PORT>> # Service 端口
+ targetPort: <<WEB_WS_PORT>> # 容器端口
type: ClusterIP # 集群内部访问,不需要外网
---
@@ -81,8 +81,8 @@ metadata:
spec:
type: NodePort
ports:
- - port: 5173 # 集群内部端口
- targetPort: 5173 # 容器端口
+ - port: <<WEB_HTTP_PORT>> # 集群内部端口
+ targetPort: <<WEB_HTTP_PORT>> # 容器端口
nodePort: <<WEB_NODE_PORT>> # 外部访问端口(30000-32767)
selector:
app: <<WEB_NAME>>
diff --git a/packages/jiuwenclaw-ee/gateway/extensions/runtime_management_extension/runtime_management_client.py b/packages/jiuwenclaw-ee/gateway/extensions/runtime_management_extension/runtime_management_client.py
index e78b188958..df1cb80153 100644
--- a/packages/jiuwenclaw-ee/gateway/extensions/runtime_management_extension/runtime_management_client.py
+++ b/packages/jiuwenclaw-ee/gateway/extensions/runtime_management_extension/runtime_management_client.py
@@ -582,7 +582,7 @@ class RuntimeManagementAgentClient(AgentServerClient):
)
)
if mode == "dev":
- jiuwenbox_code_pod_path = os.getenv("JIUWENBOX_CODE_POD_PATH")
+ jiuwenbox_code_pod_path = os.getenv("JIUWENBOX_POD_PKG_PATH")
if claw_code_path and jiuwenbox_code_pod_path:
jiuwenbox_host_mounts.append(
HostPathMount(