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

fix(deploy): configure identity bootstrap passwords

whqxbs7ba3337b71a8
diff --git a/deploy/enterprise/.env.example b/deploy/enterprise/.env.example
index 2e151287d6..a4e3c3be36 100644
--- a/deploy/enterprise/.env.example
+++ b/deploy/enterprise/.env.example
@@ -364,6 +364,14 @@ WEB_CPU_LIMIT=500m
# WEB 服务的容器最大可用 内存:1Gi,超过会被 K8s OOM kill 杀死重启
WEB_MEMORY_LIMIT=1Gi
+# ====================== Manager / Identity 预置账号 ======================
+# 仅首次创建账号时生效;已有账号的密码不会因修改这些变量而改变。
+# 留空或不配置时,使用 global_vars.sh 中的默认值 admin / user1。
+# IDENTITY_SEED_ADMIN=true
+# IDENTITY_SEED_USER1=true
+# IDENTITY_ADMIN_PASSWORD=""
+# IDENTITY_USER1_PASSWORD=""
+
# ====================== Agent Runtime 服务配置 ======================
# Agent Runtime 服务镜像地址
AGENT_RUNTIME_IMAGE=""
diff --git a/deploy/enterprise/deploy.sh b/deploy/enterprise/deploy.sh
index fb9cfe025c..ea2133829b 100755
--- a/deploy/enterprise/deploy.sh
+++ b/deploy/enterprise/deploy.sh
@@ -95,7 +95,11 @@ process_restart() {
# ==================== Main function ====================
main() {
+ local default_admin_password="${DEPLOY_VARS[IDENTITY_ADMIN_PASSWORD]}"
+ local default_user1_password="${DEPLOY_VARS[IDENTITY_USER1_PASSWORD]}"
read_env_from_file "${CUSTOM_ENV_FILE}" "DEPLOY_VARS"
+ DEPLOY_VARS[IDENTITY_ADMIN_PASSWORD]="${DEPLOY_VARS[IDENTITY_ADMIN_PASSWORD]:-$default_admin_password}"
+ DEPLOY_VARS[IDENTITY_USER1_PASSWORD]="${DEPLOY_VARS[IDENTITY_USER1_PASSWORD]:-$default_user1_password}"
parse_args "$@"
link_mtls_check
detect_os
diff --git a/deploy/enterprise/gen_env_custom.sh b/deploy/enterprise/gen_env_custom.sh
index 246cf76037..4513eeb516 100755
--- a/deploy/enterprise/gen_env_custom.sh
+++ b/deploy/enterprise/gen_env_custom.sh
@@ -119,6 +119,9 @@ if [[ "${TYPE}" == "dev" ]]; then
cat <<EOF
# MANAGER_SERVER_NODE_PORT=30086
# MANAGER_WEB_NODE_PORT=30273
+# 首次创建 Identity 账号时的密码;不配置则使用默认值 admin / user1
+# IDENTITY_ADMIN_PASSWORD=""
+# IDENTITY_USER1_PASSWORD=""
EOF
fi
diff --git a/deploy/enterprise/global_vars.sh b/deploy/enterprise/global_vars.sh
index d829d58832..e93c3c25b4 100755
--- a/deploy/enterprise/global_vars.sh
+++ b/deploy/enterprise/global_vars.sh
@@ -152,6 +152,8 @@ declare -A DEPLOY_VARS=(
["IDENTITY_REST_PORT"]="8770"
["IDENTITY_SEED_ADMIN"]="true"
["IDENTITY_SEED_USER1"]="true"
+ ["IDENTITY_ADMIN_PASSWORD"]="admin"
+ ["IDENTITY_USER1_PASSWORD"]="user1"
["IDENTITY_FEDERATION_DEMO_ENABLED"]="false"
["IDENTITY_FEDERATION_PUBLIC_PATH_PREFIX"]="/idp"
["IDENTITY_FEDERATION_REQUEST_TTL"]="300"
diff --git a/deploy/enterprise/manager_handler.sh b/deploy/enterprise/manager_handler.sh
index 04968e6b78..1327d5176c 100755
--- a/deploy/enterprise/manager_handler.sh
+++ b/deploy/enterprise/manager_handler.sh
@@ -28,6 +28,14 @@ gen_identity_file() {
render_config_template "${template_file}" "${file}" "DEPLOY_VARS"
enable_dev_mode_if_needed ${file} identity
+ # yq quotes arbitrary password characters correctly in the generated YAML.
+ IDENTITY_ADMIN_PASSWORD="${DEPLOY_VARS[IDENTITY_ADMIN_PASSWORD]}" \
+ IDENTITY_USER1_PASSWORD="${DEPLOY_VARS[IDENTITY_USER1_PASSWORD]}" \
+ yq eval '(. | select(.kind == "Deployment") | .spec.template.spec.containers[0].env) += [
+ {"name": "IDENTITY_ADMIN_PASSWORD", "value": strenv(IDENTITY_ADMIN_PASSWORD)},
+ {"name": "IDENTITY_USER1_PASSWORD", "value": strenv(IDENTITY_USER1_PASSWORD)}
+ ]' -i "${file}"
+
if [ "${DEPLOY_VARS["DB_TYPE"]}" == "postgresql" ]; then
yq eval '
select(.kind == "Deployment").spec.template.spec.containers[0].env += [