huawei-cloud-flexus-l-deploy-jiuwenswarm
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImportant Notes:
重要说明:
- All Python files in the directory have implemented all functions. Do not create additional py files.
scripts - Do not modify the script files in the directory.
scripts - Please operate directly according to the provided code and documentation. No need to check Huawei Cloud official API documentation.
- 目录下的所有Python文件已实现全部功能。请勿创建额外的py文件.
scripts - 请勿修改目录下的脚本文件.
scripts - 请直接按照提供的代码和文档操作,无需查阅华为云官方API文档.
security Execution Rules (Highest Priority):
安全执行规则(最高优先级):
- All scripts MUST be executed via skill action=exec, NEVER run directly in shell
- NEVER print script contents or commands containing AK/SK/Token in conversation
- NEVER create temporary script files, prefer inline execution (python -c)
- On execution failure, only return error info, do NOT rewrite scripts or print full commansds
- AK/SK/Token MUST be passed via environment variables, NEVER appear in conversation
- NEVER interactively collect Huawei Cloud credentials from users. Credentials MUST be obtained only through:
- Temporary Security Credentials (STS Token) via environment variables
- Permanent credentials via environment variables
- 所有脚本必须通过skill action=exec执行,绝不允许直接在shell中运行
- 绝不在对话中打印包含AK/SK/Token的脚本内容或命令
- 绝不创建临时脚本文件,优先使用内联执行方式(python -c)
- 执行失败时,仅返回错误信息,不得重写脚本或打印完整命令
- AK/SK/Token必须通过环境变量传递,绝不能出现在对话中
- 绝不以交互方式向用户收集华为云凭证。凭证仅能通过以下方式获取:
- 通过环境变量获取临时安全凭证(STS Token)
- 通过环境变量获取永久凭证
JiuwenSwarm Deployment Skill for Huawei Cloud Flexus L Instance
华为云Flexus L实例的JiuwenSwarm部署Skill
Overview
概述
This skill provides a complete automated deployment solution for the JiuwenSwarm (JiuwenClaw) multi-Agent collaboration platform on Huawei Cloud Flexus L instances. It implements full-process automation from environment preparation to message channel configuration through phased scripts.
本Skill为在华为云Flexus L实例上部署JiuwenSwarm(JiuwenClaw)多Agent协作平台提供完整的自动化部署方案。它通过分阶段脚本实现从环境准备到消息渠道配置的全流程自动化。
Prerequisites
前提条件
Before using this skill, the following prerequisites must be met:
使用本Skill前,必须满足以下前提条件:
1. Huawei Cloud Account Requirements
1. 华为云账号要求
- A valid Huawei Cloud account with active subscription
- Sufficient balance or billing method configured
- Flexus L instance quota available in the target region (cn-north-4)
- 有效的华为云账号且处于活跃订阅状态
- 账户余额充足或已配置计费方式
- 目标区域(cn-north-4)拥有可用的Flexus L实例配额
2. IAM Credentials
2. IAM凭证
- Huawei Cloud Access Key (AK) and Secret Key (SK) with appropriate permissions
- Temporary Security Credentials (STS Token): Supports temporary security credentials. When environment variable is set along with AK/SK, the skill will use temporary credentials for authentication.
HUAWEICLOUD_SDK_SECURITY_TOKEN - Required IAM permissions:
- - Create Flexus L instances
hcss:lightInstance:create - - Query instance information
hcss:lightInstance:list - - Query resource information
rms:resource:list - - Execute COC scripts
coc:execution:create - - Query COC task status
coc:execution:list - - Get project information
iam:project:list
- 拥有适当权限的华为云访问密钥(AK)和秘密密钥(SK)
- 临时安全凭证(STS Token):支持临时安全凭证。当环境变量与AK/SK一同设置时,Skill将使用临时凭证进行身份验证。
HUAWEICLOUD_SDK_SECURITY_TOKEN - 所需IAM权限:
- - 创建Flexus L实例
hcss:lightInstance:create - - 查询实例信息
hcss:lightInstance:list - - 查询资源信息
rms:resource:list - - 执行COC脚本
coc:execution:create - - 查询COC任务状态
coc:execution:list - - 获取项目信息
iam:project:list
3. Environment Requirements
3. 环境要求
- Python 3.8+ installed with pip
- Required Python packages:
- - HTTP client
requests - - Huawei Cloud SDK core
huaweicloudsdkcore - - COC service SDK
huaweicloudsdkcoc - - RMS service SDK
huaweicloudsdkrms - - IAM service SDK
huaweicloudsdkiam
- 安装Python 3.8+及pip
- 所需Python包:
- - HTTP客户端
requests - - 华为云SDK核心库
huaweicloudsdkcore - - RMS服务SDK
huaweicloudsdkrms - - IAM服务SDK
huaweicloudsdkiam
4. Network Requirements
4. 网络要求
- Internet access to Huawei Cloud APIs
- Security group rules allowing outbound HTTP/HTTPS traffic (ports 80, 443)
- For web access: Port 5173 needs to be opened in security group after deployment
- 能够访问华为云API的互联网连接
- 安全组规则允许出站HTTP/HTTPS流量(端口80、443)
- 若需Web访问:部署后需在安全组中开放端口5173
5. Resource Requirements
5. 资源要求
- Flexus L instance with minimum specifications:
- Flavor: medium (2 vCPUs, 4GB RAM) or higher
- System disk: 40GB or larger
- Network: Public IP required
- Flexus L实例的最低规格:
- 实例规格:medium(2核CPU,4GB内存)或更高
- 系统盘:40GB及以上
- 网络:需要公网IP
6. Configuration Requirements
6. 配置要求
- Model API credentials (API_BASE, API_KEY) for LLM integration (required for Phase 6)
- Message channel credentials (Xiaoyi/Feishu/DingTalk) if channel configuration is needed (required for Phase 7)
- 用于LLM集成的模型API凭证(API_BASE、API_KEY)(第6阶段必需)
- 若需配置消息渠道,需准备对应渠道凭证(小艺/飞书/钉钉)(第7阶段必需)
Architecture Diagram
架构图
This skill is built on multiple Huawei Cloud services, involving the following cloud services and components:
User/Agent ──────▶│ Flexus L Instance │──────▶│ JiuwenSwarm App │──────▶│ Model Config │ ──────▶│ Channel Config │
(Skill caller) (Target Host) (Multi-Agent Platform) (API_BASE/KEY) (Xiaoyi/Feishu/Dingtalk) Component Description:
- User/Agent: Skill caller that triggers JiuwenSwarm deployment operations via natural language or API
- Flexus L Instance: Huawei Cloud Elastic Cloud Server, serving as the target host for JiuwenSwarm deployment
- JiuwenSwarm App: Multi-agent collaboration platform running on the Flexus L instance
- Model Config: Configuration for external LLM services (API_BASE, API_KEY, MODEL_NAME, MODEL_PROVIDER)
- Channel Config: Messaging channel configuration (Huawei Xiaoyi, Feishu, Dingtalk)
本Skill基于多个华为云服务构建,涉及以下云服务和组件:
User/Agent ──────▶│ Flexus L Instance │──────▶│ JiuwenSwarm App │──────▶│ Model Config │ ──────▶│ Channel Config │
(Skill caller) (Target Host) (Multi-Agent Platform) (API_BASE/KEY) (Xiaoyi/Feishu/Dingtalk) 组件描述:
- User/Agent:通过自然语言或API触发JiuwenSwarm部署操作的Skill调用者
- Flexus L Instance:华为云弹性云服务器,作为JiuwenSwarm部署的目标主机
- JiuwenSwarm App:运行在Flexus L实例上的多Agent协作平台
- Model Config:外部LLM服务的配置(API_BASE、API_KEY、MODEL_NAME、MODEL_PROVIDER)
- Channel Config:消息渠道配置(华为小艺、飞书、钉钉)
Skill Responsibilities
Skill职责
Core Functions
核心功能
- Flexus L Instance Creation - Call Flexus L API to create instances, supporting parameters like instance name, flavor (medium/large), image version, etc.
- Instance Status Query - Query instance status, public IP, instance ID via RMS API
- COC Remote Deployment - Use Huawei Cloud COC (Cloud Operations Center) to remotely execute deployment scripts on instances
- COC Task Status Query - Query deployment task execution status and results via COC API
- System Service Configuration - Configure systemd service for auto-start on boot
- Model Configuration - Configure API_BASE, API_KEY, MODEL_NAME, MODEL_PROVIDER
- Message Channel Configuration - Support three message channels: Xiaoyi, Feishu, DingTalk
- Flexus L实例创建 - 调用Flexus L API创建实例,支持实例名称、规格(medium/large)、镜像版本等参数
- 实例状态查询 - 通过RMS API查询实例状态、公网IP、实例ID
- COC远程部署 - 使用华为云COC(Cloud Operations Center)在实例上远程执行部署脚本
- COC任务状态查询 - 通过COC API查询部署任务的执行状态和结果
- 系统服务配置 - 配置systemd服务实现开机自启
- 模型配置 - 配置API_BASE、API_KEY、MODEL_NAME、MODEL_PROVIDER
- 消息渠道配置 - 支持三种消息渠道:小艺、飞书、钉钉
Execution Flow
执行流程
Phase 1: Environment Preparation → Phase 2: Create Instance → Phase 3: Install Dependencies → COC Status Query → Phase 4: Deploy Service → COC Status Query → Phase 5: Verify Deployment → Phase 6: Model Configuration → Phase 7: Message Channel ConfigurationPhase 1: Environment Preparation → Phase 2: Create Instance → Phase 3: Install Dependencies → COC Status Query → Phase 4: Deploy Service → COC Status Query → Phase 5: Verify Deployment → Phase 6: Model Configuration → Phase 7: Message Channel ConfigurationTypical Use Cases
典型用例
User may say:
English Examples:
- "Help me deploy JiuwenSwarm to Huawei Cloud"
- "I want to install JiuwenClaw on Flexus L instance"
- "How to add Feishu bot to my JiuwenSwarm?"
- "I want to configure JiuwenSwarm to use custom model"
- "Help me deploy JiuwenSwarm with one click and configure Xiaoyi channel"
用户可能会说:
英文示例:
- "Help me deploy JiuwenSwarm to Huawei Cloud"
- "I want to install JiuwenClaw on Flexus L instance"
- "How to add Feishu bot to my JiuwenSwarm?"
- "I want to configure JiuwenSwarm to use custom model"
- "Help me deploy JiuwenSwarm with one click and configure Xiaoyi channel"
⚠️ Important: Customer Confirmation Required
⚠️ 重要提示:需获得客户确认
Before executing any cloud resource creation operations, explicit customer consent must be obtained!
在执行任何云资源创建操作前,必须获得客户的明确同意!
Scenarios Requiring Confirmation
需要确认的场景
| Operation | Confirmation Required |
|---|---|
| Create new Flexus L instance | Required |
| Deploy application on existing instance | Required |
| Modify cloud resource configuration | Required |
| 操作 | 是否需要确认 |
|---|---|
| 创建新的Flexus L实例 | 是 |
| 在现有实例上部署应用 | 是 |
| 修改云资源配置 | 是 |
Confirmation Template
确认模板
============================================================
⚠️ Cloud Resource Creation Confirmation
============================================================
Operation to be executed: Create new Flexus L instance
Instance Specifications:
- Name: {instance_name}
- Flavor: {flavor}
- Region: {region}
- Estimated Cost: ~100 RMB/month (actual price subject to Huawei Cloud pricing)
Resources will be created immediately after confirmation.
Please reply "confirm" or "agree" to continue.
========================================================================================================================
⚠️ Cloud Resource Creation Confirmation
============================================================
Operation to be executed: Create new Flexus L instance
Instance Specifications:
- Name: {instance_name}
- Flavor: {flavor}
- Region: {region}
- Estimated Cost: ~100 RMB/month (actual price subject to Huawei Cloud pricing)
Resources will be created immediately after confirmation.
Please reply "confirm" or "agree" to continue.
============================================================Execution Steps
执行步骤
Phase 1: Environment Preparation
阶段1:环境准备
1. Verify Huawei Cloud credentials (AK/SK)
2. Set environment variable: PYTHONIOENCODING=utf-8
3. Check dependency modules: requests, huaweicloudsdkcore, huaweicloudsdkcoc, huaweicloudsdkrms
4. Validate credential validity (via IAM API)1. Verify Huawei Cloud credentials (AK/SK)
2. Set environment variable: PYTHONIOENCODING=utf-8
3. Check dependency modules: requests, huaweicloudsdkcore, huaweicloudsdkcoc, huaweicloudsdkrms
4. Validate credential validity (via IAM API)Phase 2: Create Flexus L Instance
阶段2:创建Flexus L实例
⚠️ The following steps can only be executed after obtaining customer confirmation!
1. Display instance configuration information to customer (name, flavor, region, estimated cost)
2. Wait for customer confirmation (reply "confirm" or "agree")
3. After confirmation, execute:
- Get Project ID (via IAM API)
- Call Flexus L create API
- Save order_id for subsequent queries
- Wait for instance creation to complete (poll RMS API)
- Get instance information: instance_id, public_ip, ecs_instance_id⚠️ The following steps can only be executed after obtaining customer confirmation!
1. Display instance configuration information to customer (name, flavor, region, estimated cost)
2. Wait for customer confirmation (reply "confirm" or "agree")
3. After confirmation, execute:
- Get Project ID (via IAM API)
- Call Flexus L create API
- Save order_id for subsequent queries
- Wait for instance creation to complete (poll RMS API)
- Get instance information: instance_id, public_ip, ecs_instance_idPhase 3: COC Remote Dependency Installation
阶段3:COC远程依赖安装
Based on instance information from Phase 2: instance_id, public_ip, ecs_instance_id, execute:
1. Execute dependency installation script via COC
2. Install base tools: git, curl, vim, wget, net-tools, etc.
3. Check Python and Node.js environment
4. Wait for deployment to complete. Note: script execution takes approximately 8 minutes. Please be patient. Only retry if script execution errors occur.Based on instance information from Phase 2: instance_id, public_ip, ecs_instance_id, execute:
1. Execute dependency installation script via COC
2. Install base tools: git, curl, vim, wget, net-tools, etc.
3. Check Python and Node.js environment
4. Wait for deployment to complete. Note: script execution takes approximately 8 minutes. Please be patient. Only retry if script execution errors occur.Phase 4: COC Remote JiuwenSwarm Service Deployment
阶段4:COC远程JiuwenSwarm服务部署
1. Read deployment script template (assets/deploy_script_template.sh)
2. Execute complete deployment script on instance via COC
3. Install JiuwenSwarm and related dependencies
4. Configure systemd service
5. Start JiuwenSwarm service
6. Wait for deployment to complete. Note: script execution takes approximately 15 minutes. Please be patient. Only retry if script execution errors occur.1. Read deployment script template (assets/deploy_script_template.sh)
2. Execute complete deployment script on instance via COC
3. Install JiuwenSwarm and related dependencies
4. Configure systemd service
5. Start JiuwenSwarm service
6. Wait for deployment to complete. Note: script execution takes approximately 15 minutes. Please be patient. Only retry if script execution errors occur.Phase 5: Verify Deployment Result
阶段5:验证部署结果
1. Query COC deployment task status
2. Verify port 5173 listening
3. Check service health status
4. Output web access URL1. Query COC deployment task status
2. Verify port 5173 listening
3. Check service health status
4. Output web access URLPhase 6: Model Configuration
阶段6:模型配置
1. Interactively collect model configuration information:
- API_BASE: Model API URL
- API_KEY: Model API key
- MODEL_NAME: Model name
- MODEL_PROVIDER: Model provider
2. Generate configuration script (COC remote execution):
- Backup original .env file
- Update only four core parameters (API_BASE, API_KEY, MODEL_NAME, MODEL_PROVIDER)
- Keep other configuration parameters unchanged
- Set file permission to 600
3. Restart JiuwenSwarm service1. Interactively collect model configuration information:
- API_BASE: Model API URL
- API_KEY: Model API key
- MODEL_NAME: Model name
- MODEL_PROVIDER: Model provider
2. Generate configuration script (COC remote execution):
- Backup original .env file
- Update only four core parameters (API_BASE, API_KEY, MODEL_NAME, MODEL_PROVIDER)
- Keep other configuration parameters unchanged
- Set file permission to 600
3. Restart JiuwenSwarm servicePhase 7: Message Channel Configuration
阶段7:消息渠道配置
1. Select channel type: xiaoyi / feishu / dingtalk
2. Collect configuration information based on channel type:
- xiaoyi: AK, SK, Agent ID
- feishu: App ID, App Secret
- dingtalk: Client ID, Client Secret, Allow From
3. Generate configuration script (COC remote execution):
- Backup original config.yaml file
- Update only key configuration fields for specified channel, keep other configurations unchanged
- Xiaoyi: Update only ak, sk, agent_id, enabled
- Feishu: Update only app_id, app_secret, enabled
- DingTalk: Update only client_id, client_secret, allow_from, enabled
- Set file permission to 644
4. Restart JiuwenSwarm service1. Select channel type: xiaoyi / feishu / dingtalk
2. Collect configuration information based on channel type:
- xiaoyi: AK, SK, Agent ID
- feishu: App ID, App Secret
- dingtalk: Client ID, Client Secret, Allow From
3. Generate configuration script (COC remote execution):
- Backup original config.yaml file
- Update only key configuration fields for specified channel, keep other configurations unchanged
- Xiaoyi: Update only ak, sk, agent_id, enabled
- Feishu: Update only app_id, app_secret, enabled
- DingTalk: Update only client_id, client_secret, allow_from, enabled
- Set file permission to 644
4. Restart JiuwenSwarm serviceCOC Remote Script Execution Status Query
COC远程脚本执行状态查询
1. Query task status by COC execution UUID
2. Support three query methods:
- Direct query: python query_coc_status.py --uuid <execute_uuid>
- Detailed output: python query_coc_status.py --uuid <execute_uuid> --verbose
- Wait for completion: pythonquery_coc_status.py --uuid <execute_uuid> --wait
3. Load UUID from JSON file:
- python query_coc_status.py --from-file new_instance_info.json
4. Return task status, duration, output results, etc.1. Query task status by COC execution UUID
2. Support three query methods:
- Direct query: python query_coc_status.py --uuid <execute_uuid>
- Detailed output: python query_coc_status.py --uuid <execute_uuid> --verbose
- Wait for completion: pythonquery_coc_status.py --uuid <execute_uuid> --wait
3. Load UUID from JSON file:
- python query_coc_status.py --from-file new_instance_info.json
4. Return task status, duration, output results, etc.COC Task Status Query
COC任务状态查询
COC task status query supports the following features:
1. Single query - Query current status of specified UUID task
2. Detailed output - Display script execution output
3. Wait for completion - Continuous polling until task completes or timeout
4. File loading - Read UUID from JSON file saved during deployment
Script location: scripts/query_coc_status.py
Usage examples:
# Query single task status
python query_coc_status.py --uuid SCT20250101000000000000000
# Query with detailed output
python query_coc_status.py --uuid SCT20250101000000000000000 --verbose
# Wait for task completion
python query_coc_status.py --uuid SCT20250101000000000000000 --wait
# Custom wait time and polling interval
python query_coc_status.py --uuid SCT20250101000000000000000 --wait --timeout 3600 --interval 30
# Load UUID from JSON file
python query_coc_status.py --from-file new_instance_info.json
COC Task Status Description:
| Status | Description |
|--------|-------------|
| READY | Ready |
| PROCESSING | Running, waiting required |
| FINISHED | Completed successfully |
| ABNORMAL | Execution abnormal, failed |
| CANCELED | Canceled |COC task status query supports the following features:
1. Single query - Query current status of specified UUID task
2. Detailed output - Display script execution output
3. Wait for completion - Continuous polling until task completes or timeout
4. File loading - Read UUID from JSON file saved during deployment
Script location: scripts/query_coc_status.py
Usage examples:
# Query single task status
python query_coc_status.py --uuid SCT20250101000000000000000
# Query with detailed output
python query_coc_status.py --uuid SCT20250101000000000000000 --verbose
# Wait for task completion
python query_coc_status.py --uuid SCT20250101000000000000000 --wait
# Custom wait time and polling interval
python query_coc_status.py --uuid SCT20250101000000000000000 --wait --timeout 3600 --interval 30
# Load UUID from JSON file
python query_coc_status.py --from-file new_instance_info.json
COC Task Status Description:
| Status | Description |
|--------|-------------|
| READY | Ready |
| PROCESSING | Running, waiting required |
| FINISHED | Completed successfully |
| ABNORMAL | Execution abnormal, failed |
| CANCELED | Canceled |Output Standards
输出标准
Success Output Template
成功输出模板
============================================================
JiuwenSwarm COC Deployment - Complete
============================================================
Target Instance:
Name: {instance_name}
ID: {instance_id}
IP: {public_ip}
COC Execution:
Execute UUID: {execute_uuid}
Status: FINISHED
Deployment Result:
Web Access: http://{public_ip}:5173
Submit Time: {submit_time}
============================================================
[SUCCESS] Deployment task completed!
========================================================================================================================
JiuwenSwarm COC Deployment - Complete
============================================================
Target Instance:
Name: {instance_name}
ID: {instance_id}
IP: {public_ip}
COC Execution:
Execute UUID: {execute_uuid}
Status: FINISHED
Deployment Result:
Web Access: http://{public_ip}:5173
Submit Time: {submit_time}
============================================================
[SUCCESS] Deployment task completed!
============================================================Error Output Template
错误输出模板
============================================================
[ERROR] Deployment Failed
============================================================
Error: {error_message}
Suggestions:
1. Check Huawei Cloud credentials
2. Verify instance status
3. Check deployment logs
========================================================================================================================
[ERROR] Deployment Failed
============================================================
Error: {error_message}
Suggestions:
1. Check Huawei Cloud credentials
2. Verify instance status
3. Check deployment logs
============================================================COC Task Status Description
COC任务状态说明
| Status | Description |
|---|---|
| PROCESSING | Running, waiting required |
| FINISHED | Completed successfully |
| ABNORMAL | Execution abnormal, failed |
| CANCELED | Canceled |
| 状态 | 描述 |
|---|---|
| PROCESSING | 运行中,需等待 |
| FINISHED | 执行成功 |
| ABNORMAL | 执行异常,失败 |
| CANCELED | 已取消 |
Directory Structure
目录结构
huawei-cloud-flexus-l-deploy-jiuwenSwarm/
├── SKILL.md # Skill documentation
├── requirements.txt # Python dependency list
├── scripts/ # Phased deployment scripts
│ ├── utils.py # Utility functions
│ ├── prepare_env.py # Environment preparation
│ ├── create_instance.py # Create Flexus L instance
│ ├── install_deps.py # COC remote dependency installation
│ ├── deploy_service.py # COC remote service deployment
│ ├── verify_deployment.py # Verify deployment result
│ ├── config_model.py # Model configuration
│ ├── config_channel.py # Message channel configuration
│ └── query_coc_status.py # COC task status query
├── assets/ # Template files
│ ├── deploy_script_template.sh # Deployment script template
│ ├── jiuwenswarm.service.template # systemd service template
│ ├── config_template.yaml # Configuration template
│ └── env.template # Environment variable template
└── references/ # Reference documents
├── api_specs.md # API specifications
├── deployment_checklist.md # Deployment checklist
├── iam_policies.md # IAM policies
└── troubleshooting.md # Troubleshooting guidehuawei-cloud-flexus-l-deploy-jiuwenSwarm/
├── SKILL.md # Skill documentation
├── requirements.txt # Python dependency list
├── scripts/ # Phased deployment scripts
│ ├── utils.py # Utility functions
│ ├── prepare_env.py # Environment preparation
│ ├── create_instance.py # Create Flexus L instance
│ ├── install_deps.py # COC remote dependency installation
│ ├── deploy_service.py # COC remote service deployment
│ ├── verify_deployment.py # Verify deployment result
│ ├── config_model.py # Model configuration
│ ├── config_channel.py # Message channel configuration
│ └── query_coc_status.py # COC task status query
├── assets/ # Template files
│ ├── deploy_script_template.sh # Deployment script template
│ ├── jiuwenswarm.service.template # systemd service template
│ ├── config_template.yaml # Configuration template
│ └── env.template # Environment variable template
└── references/ # Reference documents
├── api_specs.md # API specifications
├── deployment_checklist.md # Deployment checklist
├── iam_policies.md # IAM policies
└── troubleshooting.md # Troubleshooting guideInstallation and Usage
安装与使用
Environment Preparation
环境准备
bash
undefinedbash
undefinedInstall dependencies
Install dependencies
pip install -r requirements.txt
pip install -r requirements.txt
Configure Huawei Cloud credentials (Recommended: temporary security credentials - STS Token)
Configure Huawei Cloud credentials (Recommended: temporary security credentials - STS Token)
export HUAWEICLOUD_SDK_AK=<your-temp-access-key>
export HUAWEICLOUD_SDK_AK=<your-temp-access-key>
export HUAWEICLOUD_SDK_SK=<your-temp-secret-key>
export HUAWEICLOUD_SDK_SK=<your-temp-secret-key>
export HUAWEICLOUD_SDK_SECURITY_TOKEN=<your-security-token>
export HUAWEICLOUD_SDK_SECURITY_TOKEN=<your-security-token>
export HUAWEICLOUD_REGION="cn-north-4"
export HUAWEICLOUD_REGION="cn-north-4"
OR use permanent credentials (not recommended)
OR use permanent credentials (not recommended)
export HUAWEICLOUD_SDK_AK=<your-access-key>
export HUAWEICLOUD_SDK_AK=<your-access-key>
export HUAWEICLOUD_SDK_SK=<your-secret-key>
export HUAWEICLOUD_SDK_SK=<your-secret-key>
export HUAWEICLOUD_REGION="cn-north-4"
export HUAWEICLOUD_REGION="cn-north-4"
undefinedundefinedQuick Deployment Flow
快速部署流程
bash
undefinedbash
undefined1. Environment preparation
1. Environment preparation
python scripts/prepare_env.py
python scripts/prepare_env.py
2. Create instance (interactive confirmation)
2. Create instance (interactive confirmation)
python scripts/create_instance.py --name jiuwenSwarm-<timestamp> --flavor medium --wait
python scripts/create_instance.py --name jiuwenSwarm-<timestamp> --flavor medium --wait
3. Install dependencies
3. Install dependencies
python scripts/install_deps.py --ip <public_ip>
python scripts/install_deps.py --ip <public_ip>
4. Deploy service
4. Deploy service
python scripts/deploy_service.py --ip <public_ip>
python scripts/deploy_service.py --ip <public_ip>
5. Verify deployment
5. Verify deployment
python scripts/verify_deployment.py --ip <public_ip>
python scripts/verify_deployment.py --ip <public_ip>
6. Configure model
6. Configure model
python scripts/config_model.py --ip <public_ip> --interactive
python scripts/config_model.py --ip <public_ip> --interactive
7. Configure message channel
7. Configure message channel
python scripts/config_channel.py --channel xiaoyi --ip <public_ip> --interactive
python scripts/config_channel.py --channel xiaoyi --ip <public_ip> --interactive
8. Query COC task status
8. Query COC task status
python scripts/query_coc_status.py --uuid <execute_uuid> --verbose
---python scripts/query_coc_status.py --uuid <execute_uuid> --verbose
---Web UI Access
Web UI访问
Web UI access requires manual security group configuration in Huawei Cloud Console:
- Login to Huawei Cloud Flexus Application Server L Instance Console
- 🔗 Console URL: https://console.huaweicloud.com/smb/?/resource/list
- Find your JiuwenSwarm instance in the instance list
- Click instance name to enter details page
- Find "Security" or "Network" options in left menu
- Configure security group rules to open port 5173
Access URL: Security Warning: After opening the port, JiuwenSwarm Web interface will be accessible. Please evaluate security risks before enabling. It is recommended to open temporarily only when needed and close after use.
http://<instance_public_ip>:5173
Web UI访问需要在华为云控制台手动配置安全组:
- 登录华为云Flexus应用服务器L实例控制台
- 在实例列表中找到你的JiuwenSwarm实例
- 点击实例名称进入详情页
- 在左侧菜单中找到“安全”或“网络”选项
- 配置安全组规则开放端口5173
访问地址:安全警告:开放端口后,JiuwenSwarm Web界面将可被访问。请在启用前评估安全风险,建议仅在需要时临时开放,使用后关闭。
http://<instance_public_ip>:5173
Script Parameter Description
脚本参数说明
create_instance.py
create_instance.py
| Parameter | Description | Default Value |
|---|---|---|
| --name | Instance name | jiuwenSwarm-{timestamp} |
| --flavor | Instance flavor | medium |
| --region | Region (cn-north-4 only) | cn-north-4 |
| --wait | Wait for creation completion | False |
| --timeout | Timeout in seconds | 600 |
| --confirm | Skip confirmation prompt | False |
| 参数 | 描述 | 默认值 |
|---|---|---|
| --name | 实例名称 | jiuwenSwarm-{timestamp} |
| --flavor | 实例规格 | medium |
| --region | 区域(仅支持cn-north-4) | cn-north-4 |
| --wait | 等待实例创建完成 | False |
| --timeout | 超时时间(秒) | 600 |
| --confirm | 跳过确认提示 | False |
deploy_service.py
deploy_service.py
| Parameter | Description | Default Value |
|---|---|---|
| --ip | Instance public IP | Required |
| --wait | Wait for deployment completion | True |
| --timeout | Timeout in seconds | 1800 |
| 参数 | 描述 | 默认值 |
|---|---|---|
| --ip | 实例公网IP | 必填 |
| --wait | 等待部署完成 | True |
| --timeout | 超时时间(秒) | 1800 |
config_model.py
config_model.py
| Parameter | Description |
|---|---|
| --api-base | Model API URL |
| --api-key | Model API key |
| --model-name | Model name |
| --model-provider | Model provider |
| --ip | Instance public IP |
| --interactive | Interactive configuration |
| 参数 | 描述 |
|---|---|
| --api-base | 模型API地址 |
| --api-key | 模型API密钥 |
| --model-name | 模型名称 |
| --model-provider | 模型提供商 |
| --ip | 实例公网IP |
| --interactive | 交互式配置 |
config_channel.py
config_channel.py
| Parameter | Description |
|---|---|
| --channel | Channel type (xiaoyi/feishu/dingtalk) |
| --ip | Instance public IP |
| --interactive | Interactive configuration |
| 参数 | 描述 |
|---|---|
| --channel | 渠道类型(xiaoyi/feishu/dingtalk) |
| --ip | 实例公网IP |
| --interactive | 交互式配置 |
query_coc_status.py
query_coc_status.py
| Parameter | Description | Default Value |
|---|---|---|
| --uuid, -u | COC execution UUID | Required |
| --from-file, -f | Read UUID from JSON file | - |
| --key, -k | UUID key name in JSON file | execute_uuid |
| --verbose, -v | Show detailed output | False |
| --wait, -w | Wait for task completion | False |
| --timeout, -t | Wait timeout in seconds | 1800 |
| --interval, -i | Polling interval in seconds | 60 |
| 参数 | 描述 | 默认值 |
|---|---|---|
| --uuid, -u | COC执行UUID | 必填 |
| --from-file, -f | 从JSON文件读取UUID | - |
| --key, -k | JSON文件中的UUID键名 | execute_uuid |
| --verbose, -v | 显示详细输出 | False |
| --wait, -w | 等待任务完成 | False |
| --timeout, -t | 等待超时时间(秒) | 1800 |
| --interval, -i | 轮询间隔(秒) | 60 |
Huawei Cloud Credential Configuration
华为云凭证配置
Recommended: Use temporary security credentials (STS Token) by default. Please use this method first.
推荐:默认使用临时安全凭证(STS Token)。请优先使用此方式。
Temporary Security Credentials (STS Token) - Recommended (Default)
临时安全凭证(STS Token)- 推荐(默认)
The skill supports temporary security credentials. Temporary credentials require an additional environment variable.
HUAWEICLOUD_SDK_SECURITY_TOKEN| Environment Variable | Description | Required |
|---|---|---|
| Temporary Access Key | Yes |
| Temporary Secret Key | Yes |
| Security Token | Yes |
| Huawei Cloud Region (default: cn-north-4) | Yes |
本Skill支持临时安全凭证。临时凭证需要额外设置环境变量。
HUAWEICLOUD_SDK_SECURITY_TOKEN| 环境变量 | 描述 | 是否必填 |
|---|---|---|
| 临时访问密钥 | 是 |
| 临时秘密密钥 | 是 |
| 安全令牌 | 是 |
| 华为云区域(默认:cn-north-4) | 是 |
Permanent Credentials
永久凭证
Credentials must be set via environment variables before running the skill.
| Environment Variable | Description | Required |
|---|---|---|
| Huawei Cloud Access Key | Yes |
| Huawei Cloud Secret Key | Yes |
| Huawei Cloud Region (default: cn-north-4) | Yes |
Credential Concept:
- Temporary credentials (Default): AK + SK + SECURITY_TOKEN + REGION (STS token is added to permanent credentials)
- Permanent credentials: AK + SK + REGION
运行Skill前必须通过环境变量设置凭证。
| 环境变量 | 描述 | 是否必填 |
|---|---|---|
| 华为云访问密钥 | 是 |
| 华为云秘密密钥 | 是 |
| 华为云区域(默认:cn-north-4) | 是 |
凭证概念:
- 临时凭证(默认): AK + SK + SECURITY_TOKEN + REGION(在永久凭证基础上添加STS令牌)
- 永久凭证: AK + SK + REGION
Key API Endpoints
核心API端点
| Service | Endpoint | Purpose |
|---|---|---|
| Flexus L | https://hcss.{region}.myhuaweicloud.com/v1/light-instances | Create/query instances |
| IAM | https://iam.{region}.myhuaweicloud.com/v3/projects | Get Project ID |
| RMS | https://rms.{region}.myhuaweicloud.com/v1/resource-manager/domains/{domain_id}/resources | Query resources |
| COC | https://coc.{region}.myhuaweicloud.com | Remote script execution |
Supported Region: cn-north-4 only (China North 4)
System Image: Ubuntu 24.04 LTS only
支持区域: 仅cn-north-4(中国-华北4)
系统镜像: 仅Ubuntu 24.04 LTS
Troubleshooting
故障排查
Instance Creation Failed
实例创建失败
- Check if AK/SK are correct
- Confirm sufficient account quota
- Ensure using cn-north-4 region
- 检查AK/SK是否正确
- 确认账户配额充足
- 确保使用cn-north-4区域
COC Deployment Unresponsive
COC部署无响应
- Check if execute_uuid is correct
- Confirm instance status is RUNNING
- Verify COC service permissions
- 检查execute_uuid是否正确
- 确认实例状态为RUNNING
- 验证COC服务权限
Web Service Unaccessible
Web服务无法访问
- Check security group rules (port 5173 open)
- Confirm service is started:
systemctl status jiuwenswarm - View logs:
journalctl -u jiuwenswarm -f
- 检查安全组规则(端口5173是否开放)
- 确认服务已启动:
systemctl status jiuwenswarm - 查看日志:
journalctl -u jiuwenswarm -f