feat: manually mirror opencoze's code from bytedance

Change-Id: I09a73aadda978ad9511264a756b2ce51f5761adf
This commit is contained in:
fanlv
2025-07-20 17:36:12 +08:00
commit 890153324f
14811 changed files with 1923430 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

View File

@@ -0,0 +1,24 @@
apiVersion: v2
name: opencoze
description: opencoze is a ai agent platform.
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.0.1
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: '0.0.3'

View File

@@ -0,0 +1,74 @@
{
"index_patterns": ["coze_resource*"],
"template": {
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0,
"analysis": {
"analyzer": {
"text_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": ["lowercase", "stop", "snowball"]
},
"smartcn": {
"type": "smartcn"
}
}
}
},
"mappings": {
"dynamic": false,
"properties": {
"res_type": {
"type": "keyword"
},
"app_id": {
"type": "keyword",
"null_value": "NULL"
},
"res_id": {
"type": "keyword"
},
"res_sub_type": {
"type": "keyword"
},
"name": {
"type": "text",
"analyzer": "smartcn",
"search_analyzer": "smartcn",
"fields": {
"raw": {
"type": "keyword"
}
}
},
"owner_id": {
"type": "keyword"
},
"space_id": {
"type": "keyword"
},
"biz_status": {
"type": "keyword"
},
"publish_status": {
"type": "keyword"
},
"create_time": {
"type": "long"
},
"update_time": {
"type": "long"
},
"publish_time": {
"type": "long"
}
}
}
},
"priority": 200,
"_meta": {
"description": "resource library's index template"
}
}

View File

@@ -0,0 +1,79 @@
{
"index_patterns": ["project_draft*"],
"template": {
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0,
"analysis": {
"analyzer": {
"text_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": ["lowercase", "stop", "snowball"]
},
"smartcn": {
"type": "smartcn"
}
}
}
},
"mappings": {
"dynamic": false,
"properties": {
"create_time": {
"type": "long"
},
"has_published": {
"type": "keyword"
},
"id": {
"type": "keyword"
},
"name": {
"type": "text",
"analyzer": "smartcn",
"search_analyzer": "smartcn",
"fields": {
"raw": {
"type": "keyword"
}
}
},
"owner_id": {
"type": "keyword"
},
"publish_time": {
"type": "long"
},
"space_id": {
"type": "keyword"
},
"status": {
"type": "keyword"
},
"type": {
"type": "keyword"
},
"update_time": {
"type": "long"
},
"fav_time": {
"type": "long"
},
"recently_open_time": {
"type": "long"
},
"is_fav": {
"type": "keyword"
},
"is_recently_open": {
"type": "keyword"
}
}
}
},
"priority": 200,
"_meta": {
"description": "Project draft index template"
}
}

View File

@@ -0,0 +1,836 @@
SET NAMES utf8mb4;
CREATE DATABASE IF NOT EXISTS opencoze COLLATE utf8mb4_unicode_ci;
-- Create "agent_to_database" table
CREATE TABLE IF NOT EXISTS `agent_to_database` (
`id` bigint unsigned NOT NULL COMMENT "ID",
`agent_id` bigint unsigned NOT NULL COMMENT "Agent ID",
`database_id` bigint unsigned NOT NULL COMMENT "ID of database_info",
`is_draft` bool NOT NULL COMMENT "Is draft",
`prompt_disable` bool NOT NULL DEFAULT 0 COMMENT "Support prompt calls: 1 not supported, 0 supported",
PRIMARY KEY (`id`),
UNIQUE INDEX `uniq_agent_db_draft` (`agent_id`, `database_id`, `is_draft`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_general_ci COMMENT "agent_to_database info";
-- Create "agent_tool_draft" table
CREATE TABLE IF NOT EXISTS `agent_tool_draft` (
`id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Primary Key ID",
`agent_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Agent ID",
`plugin_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Plugin ID",
`tool_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Tool ID",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds",
`sub_url` varchar(512) NOT NULL DEFAULT "" COMMENT "Sub URL Path",
`method` varchar(64) NOT NULL DEFAULT "" COMMENT "HTTP Request Method",
`tool_name` varchar(255) NOT NULL DEFAULT "" COMMENT "Tool Name",
`tool_version` varchar(255) NOT NULL DEFAULT "" COMMENT "Tool Version, e.g. v1.0.0",
`operation` json NULL COMMENT "Tool Openapi Operation Schema",
PRIMARY KEY (`id`),
INDEX `idx_agent_plugin_tool` (`agent_id`, `plugin_id`, `tool_id`),
INDEX `idx_agent_tool_bind` (`agent_id`, `created_at`),
UNIQUE INDEX `uniq_idx_agent_tool_id` (`agent_id`, `tool_id`),
UNIQUE INDEX `uniq_idx_agent_tool_name` (`agent_id`, `tool_name`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Draft Agent Tool";
-- Create "agent_tool_version" table
CREATE TABLE IF NOT EXISTS `agent_tool_version` (
`id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Primary Key ID",
`agent_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Agent ID",
`plugin_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Plugin ID",
`tool_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Tool ID",
`agent_version` varchar(255) NOT NULL DEFAULT "" COMMENT "Agent Tool Version",
`tool_name` varchar(255) NOT NULL DEFAULT "" COMMENT "Tool Name",
`tool_version` varchar(255) NOT NULL DEFAULT "" COMMENT "Tool Version, e.g. v1.0.0",
`sub_url` varchar(512) NOT NULL DEFAULT "" COMMENT "Sub URL Path",
`method` varchar(64) NOT NULL DEFAULT "" COMMENT "HTTP Request Method",
`operation` json NULL COMMENT "Tool Openapi Operation Schema",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds",
PRIMARY KEY (`id`),
INDEX `idx_agent_tool_id_created_at` (`agent_id`, `tool_id`, `created_at`),
INDEX `idx_agent_tool_name_created_at` (`agent_id`, `tool_name`, `created_at`),
UNIQUE INDEX `uniq_idx_agent_tool_id_agent_version` (`agent_id`, `tool_id`, `agent_version`),
UNIQUE INDEX `uniq_idx_agent_tool_name_agent_version` (`agent_id`, `tool_name`, `agent_version`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Agent Tool Version";
-- Create "api_key" table
CREATE TABLE IF NOT EXISTS `api_key` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "Primary Key ID",
`api_key` varchar(255) NOT NULL DEFAULT "" COMMENT "API Key hash",
`name` varchar(255) NOT NULL DEFAULT "" COMMENT "API Key Name",
`status` tinyint NOT NULL DEFAULT 0 COMMENT "0 normal, 1 deleted",
`user_id` bigint NOT NULL DEFAULT 0 COMMENT "API Key Owner",
`expired_at` bigint NOT NULL DEFAULT 0 COMMENT "API Key Expired Time",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds",
`last_used_at` bigint NOT NULL DEFAULT 0 COMMENT "Used Time in Milliseconds",
PRIMARY KEY (`id`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "api key table";
-- Create "app_connector_release_ref" table
CREATE TABLE IF NOT EXISTS `app_connector_release_ref` (
`id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Primary Key",
`record_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Publish Record ID",
`connector_id` bigint unsigned NULL COMMENT "Publish Connector ID",
`publish_config` json NULL COMMENT "Publish Configuration",
`publish_status` tinyint NOT NULL DEFAULT 0 COMMENT "Publish Status",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds",
PRIMARY KEY (`id`),
UNIQUE INDEX `uniq_record_connector` (`record_id`, `connector_id`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Connector Release Record Reference";
-- Create "app_draft" table
CREATE TABLE IF NOT EXISTS `app_draft` (
`id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "APP ID",
`space_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Space ID",
`owner_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Owner ID",
`icon_uri` varchar(512) NOT NULL DEFAULT "" COMMENT "Icon URI",
`name` varchar(255) NOT NULL DEFAULT "" COMMENT "Application Name",
`description` text NULL COMMENT "Application Description",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds",
`deleted_at` datetime NULL COMMENT "Delete Time",
PRIMARY KEY (`id`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Draft Application";
-- Create "app_release_record" table
CREATE TABLE IF NOT EXISTS `app_release_record` (
`id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Publish Record ID",
`app_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Application ID",
`space_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Space ID",
`owner_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Owner ID",
`icon_uri` varchar(512) NOT NULL DEFAULT "" COMMENT "Icon URI",
`name` varchar(255) NOT NULL DEFAULT "" COMMENT "Application Name",
`description` text NULL COMMENT "Application Description",
`connector_ids` json NULL COMMENT "Publish Connector IDs",
`extra_info` json NULL COMMENT "Publish Extra Info",
`version` varchar(255) NOT NULL DEFAULT "" COMMENT "Release Version",
`version_desc` text NULL COMMENT "Version Description",
`publish_status` tinyint NOT NULL DEFAULT 0 COMMENT "Publish Status",
`publish_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Publish Time in Milliseconds",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds",
PRIMARY KEY (`id`),
INDEX `idx_app_publish_at` (`app_id`, `publish_at`),
UNIQUE INDEX `uniq_idx_app_version_connector` (`app_id`, `version`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Application Release Record";
-- Create "connector_workflow_version" table
CREATE TABLE IF NOT EXISTS `connector_workflow_version` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "id",
`app_id` bigint unsigned NOT NULL COMMENT "app id",
`connector_id` bigint unsigned NOT NULL COMMENT "connector id",
`workflow_id` bigint unsigned NOT NULL COMMENT "workflow id",
`version` varchar(256) NOT NULL COMMENT "version",
`created_at` bigint unsigned NOT NULL COMMENT "create time in millisecond",
PRIMARY KEY (`id`),
INDEX `idx_connector_id_workflow_id_create_at` (`connector_id`, `workflow_id`, `created_at`),
UNIQUE INDEX `idx_connector_id_workflow_id_version` (`connector_id`, `workflow_id`, `version`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- Create "conversation" table
CREATE TABLE IF NOT EXISTS `conversation` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "主键ID",
`connector_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "业务线 ID",
`agent_id` bigint NOT NULL DEFAULT 0 COMMENT "agent_id",
`scene` tinyint NOT NULL DEFAULT 0 COMMENT "会话场景",
`section_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "最新section_id",
`creator_id` bigint unsigned NULL DEFAULT 0 COMMENT "创建者id",
`ext` text NULL COMMENT "扩展字段",
`status` tinyint NOT NULL DEFAULT 1 COMMENT "status: 1-normal 2-deleted",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "创建时间",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "更新时间",
PRIMARY KEY (`id`),
INDEX `idx_connector_bot_status` (`connector_id`, `agent_id`, `creator_id`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "会话信息表";
-- Create "data_copy_task" table
CREATE TABLE IF NOT EXISTS `data_copy_task` (
`master_task_id` varchar(128) NOT NULL DEFAULT "" COMMENT "复制任务ID",
`origin_data_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "源id",
`target_data_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "目标id",
`origin_space_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "源团队空间",
`target_space_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "目标团队空间",
`origin_user_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "源用户ID",
`target_user_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "目标用户ID",
`origin_app_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "源AppID",
`target_app_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "目标AppID",
`data_type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT "数据类型 1:knowledge, 2:database",
`ext_info` varchar(255) NOT NULL DEFAULT "" COMMENT "存储额外信息",
`start_time` bigint NOT NULL DEFAULT 0 COMMENT "任务开始时间",
`finish_time` bigint NULL COMMENT "任务结束时间",
`status` tinyint NOT NULL DEFAULT 1 COMMENT "1:创建 2:执行中 3:成功 4:失败",
`error_msg` varchar(128) NULL COMMENT "错误信息",
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "ID",
PRIMARY KEY (`id`),
UNIQUE INDEX `uniq_master_task_id_origin_data_id_data_type` (`master_task_id`, `origin_data_id`, `data_type`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_general_ci COMMENT "data方向复制任务记录表";
-- Create "draft_database_info" table
CREATE TABLE IF NOT EXISTS `draft_database_info` (
`id` bigint unsigned NOT NULL COMMENT "ID",
`app_id` bigint unsigned NULL COMMENT "App ID",
`space_id` bigint unsigned NOT NULL COMMENT "Space ID",
`related_online_id` bigint unsigned NOT NULL COMMENT "The primary key ID of online_database_info table",
`is_visible` tinyint NOT NULL DEFAULT 1 COMMENT "Visibility: 0 invisible, 1 visible",
`prompt_disabled` tinyint NOT NULL DEFAULT 0 COMMENT "Support prompt calls: 1 not supported, 0 supported",
`table_name` varchar(255) NOT NULL COMMENT "Table name",
`table_desc` varchar(256) NULL COMMENT "Table description",
`table_field` text NULL COMMENT "Table field info",
`creator_id` bigint NOT NULL DEFAULT 0 COMMENT "Creator ID",
`icon_uri` varchar(255) NOT NULL COMMENT "Icon Uri",
`physical_table_name` varchar(255) NULL COMMENT "The name of the real physical table",
`rw_mode` bigint NOT NULL DEFAULT 1 COMMENT "Read and write permission modes: 1. Limited read and write mode 2. Read-only mode 3. Full read and write mode",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds",
`deleted_at` datetime NULL COMMENT "Delete Time",
PRIMARY KEY (`id`),
INDEX `idx_space_app_creator_deleted` (`space_id`, `app_id`, `creator_id`, `deleted_at`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_general_ci COMMENT "draft database info";
-- Create "knowledge" table
CREATE TABLE IF NOT EXISTS `knowledge` (
`id` bigint unsigned NOT NULL COMMENT "主键ID",
`name` varchar(150) NOT NULL DEFAULT "" COMMENT "名称",
`app_id` bigint NOT NULL DEFAULT 0 COMMENT "项目ID标识该资源是否是项目独有",
`creator_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "ID",
`space_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "空间ID",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds",
`deleted_at` datetime(3) NULL COMMENT "Delete Time in Milliseconds",
`status` tinyint NOT NULL DEFAULT 1 COMMENT "0 初始化, 1 生效 2 失效",
`description` text NULL COMMENT "描述",
`icon_uri` varchar(150) NULL COMMENT "头像uri",
`format_type` tinyint NOT NULL DEFAULT 0 COMMENT "0:文本 1:表格 2:图片",
PRIMARY KEY (`id`),
INDEX `idx_app_id` (`app_id`),
INDEX `idx_creator_id` (`creator_id`),
INDEX `idx_space_id_deleted_at_updated_at` (`space_id`, `deleted_at`, `updated_at`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "知识库表";
-- Create "knowledge_document" table
CREATE TABLE IF NOT EXISTS `knowledge_document` (
`id` bigint unsigned NOT NULL COMMENT "主键ID",
`knowledge_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "所属knowledge的ID",
`name` varchar(150) NOT NULL DEFAULT "" COMMENT "文档名称",
`file_extension` varchar(20) NOT NULL DEFAULT "0" COMMENT "文档类型, txt/pdf/csv/...",
`document_type` int NOT NULL DEFAULT 0 COMMENT "文档类型: 0:文本 1:表格 2:图片",
`uri` text NULL COMMENT "资源uri",
`size` bigint unsigned NOT NULL DEFAULT 0 COMMENT "文档大小",
`slice_count` bigint unsigned NOT NULL DEFAULT 0 COMMENT "分片数量",
`char_count` bigint unsigned NOT NULL DEFAULT 0 COMMENT "字符数",
`creator_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "创建者ID",
`space_id` bigint NOT NULL DEFAULT 0 COMMENT "空间id",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds",
`deleted_at` datetime(3) NULL COMMENT "Delete Time in Milliseconds",
`source_type` int NOT NULL DEFAULT 0 COMMENT "0:本地文件上传, 2:自定义文本",
`status` int NOT NULL DEFAULT 0 COMMENT "状态",
`fail_reason` text NULL COMMENT "失败原因",
`parse_rule` json NULL COMMENT "解析+切片规则",
`table_info` json NULL COMMENT "表格信息",
PRIMARY KEY (`id`),
INDEX `idx_creator_id` (`creator_id`),
INDEX `idx_knowledge_id_deleted_at_updated_at` (`knowledge_id`, `deleted_at`, `updated_at`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "知识库文档表";
-- Create "knowledge_document_review" table
CREATE TABLE IF NOT EXISTS `knowledge_document_review` (
`id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "主键ID",
`knowledge_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "knowledge id",
`space_id` bigint NOT NULL DEFAULT 0 COMMENT "空间id",
`name` varchar(150) NOT NULL DEFAULT "" COMMENT "文档名称",
`type` varchar(10) NOT NULL DEFAULT "0" COMMENT "文档类型",
`uri` text NULL COMMENT "资源标识",
`format_type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT "0 文本, 1 表格, 2 图片",
`status` tinyint unsigned NOT NULL DEFAULT 0 COMMENT "0 处理中1 已完成2 失败3 失效",
`chunk_resp_uri` text NULL COMMENT "预切片tos资源标识",
`deleted_at` datetime(3) NULL COMMENT "Delete Time in Milliseconds",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds",
`creator_id` bigint NOT NULL DEFAULT 0 COMMENT "创建者ID",
PRIMARY KEY (`id`),
INDEX `idx_dataset_id` (`knowledge_id`, `status`, `updated_at`),
INDEX `idx_uri` (`uri` (100))
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "文档审阅表";
-- Create "knowledge_document_slice" table
CREATE TABLE IF NOT EXISTS `knowledge_document_slice` (
`id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "主键ID",
`knowledge_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "knowledge id",
`document_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "document id",
`content` text NULL COMMENT "切片内容",
`sequence` decimal(20,5) NOT NULL COMMENT "切片顺序号, 从1开始",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds",
`deleted_at` datetime(3) NULL COMMENT "Delete Time in Milliseconds",
`creator_id` bigint NOT NULL DEFAULT 0 COMMENT "创建者ID",
`space_id` bigint NOT NULL DEFAULT 0 COMMENT "空间ID",
`status` int NOT NULL DEFAULT 0 COMMENT "状态",
`fail_reason` text NULL COMMENT "失败原因",
`hit` bigint unsigned NOT NULL DEFAULT 0 COMMENT "命中次数",
PRIMARY KEY (`id`),
INDEX `idx_document_id_deleted_at_sequence` (`document_id`, `deleted_at`, `sequence`),
INDEX `idx_knowledge_id_document_id` (`knowledge_id`, `document_id`),
INDEX `idx_sequence` (`sequence`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "知识库文件切片表";
-- Create "message" table
CREATE TABLE IF NOT EXISTS `message` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "主键ID",
`run_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "对应的run_id",
`conversation_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "conversation id",
`user_id` varchar(60) NOT NULL DEFAULT "" COMMENT "user id",
`agent_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "agent_id",
`role` varchar(100) NOT NULL DEFAULT "" COMMENT "角色: user、assistant、system",
`content_type` varchar(100) NOT NULL DEFAULT "" COMMENT "内容类型 1 text",
`content` mediumtext NULL COMMENT "内容",
`message_type` varchar(100) NOT NULL DEFAULT "" COMMENT "消息类型:",
`display_content` text NULL COMMENT "展示内容",
`ext` text NULL COMMENT "message 扩展字段" COLLATE utf8mb4_general_ci,
`section_id` bigint unsigned NULL COMMENT "段落id",
`broken_position` int NULL DEFAULT -1 COMMENT "打断位置",
`status` tinyint unsigned NOT NULL DEFAULT 0 COMMENT "消息状态 1 Available 2 Deleted 3 Replaced 4 Broken 5 Failed 6 Streaming 7 Pending",
`model_content` mediumtext NULL COMMENT "模型输入内容",
`meta_info` text NULL COMMENT "引用、高亮等文本标记信息",
`reasoning_content` text NULL COMMENT "思考内容" COLLATE utf8mb4_general_ci,
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "创建时间",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "更新时间",
PRIMARY KEY (`id`),
INDEX `idx_conversation_id` (`conversation_id`),
INDEX `idx_run_id` (`run_id`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "消息表";
-- Create "model_entity" table
CREATE TABLE IF NOT EXISTS `model_entity` (
`id` bigint unsigned NOT NULL COMMENT "主键ID",
`meta_id` bigint unsigned NOT NULL COMMENT "模型元信息 id",
`name` varchar(128) NOT NULL COMMENT "名称",
`description` text NULL COMMENT "描述",
`default_params` json NULL COMMENT "默认参数",
`scenario` bigint unsigned NOT NULL COMMENT "模型应用场景",
`status` int NOT NULL DEFAULT 1 COMMENT "模型状态",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds",
`deleted_at` bigint unsigned NULL COMMENT "Delete Time in Milliseconds",
PRIMARY KEY (`id`),
INDEX `idx_scenario` (`scenario`),
INDEX `idx_status` (`status`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "模型信息";
-- Create "model_meta" table
CREATE TABLE IF NOT EXISTS `model_meta` (
`id` bigint unsigned NOT NULL COMMENT "主键ID",
`model_name` varchar(128) NOT NULL COMMENT "模型名称",
`protocol` varchar(128) NOT NULL COMMENT "模型协议",
`icon_uri` varchar(255) NOT NULL DEFAULT "" COMMENT "Icon URI",
`capability` json NULL COMMENT "模型能力",
`conn_config` json NULL COMMENT "模型连接配置",
`status` int NOT NULL DEFAULT 1 COMMENT "模型状态",
`description` varchar(2048) NOT NULL DEFAULT "" COMMENT "模型描述",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds",
`deleted_at` bigint unsigned NULL COMMENT "Delete Time in Milliseconds",
`icon_url` varchar(255) NOT NULL DEFAULT "" COMMENT "Icon URL",
PRIMARY KEY (`id`),
INDEX `idx_status` (`status`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "模型元信息";
-- Create "node_execution" table
CREATE TABLE IF NOT EXISTS `node_execution` (
`id` bigint unsigned NOT NULL COMMENT "node execution id",
`execute_id` bigint unsigned NOT NULL COMMENT "the workflow execute id this node execution belongs to",
`node_id` varchar(128) NOT NULL COMMENT "node key" COLLATE utf8mb4_unicode_ci,
`node_name` varchar(128) NOT NULL COMMENT "name of the node" COLLATE utf8mb4_unicode_ci,
`node_type` varchar(128) NOT NULL COMMENT "the type of the node, in string" COLLATE utf8mb4_unicode_ci,
`created_at` bigint unsigned NOT NULL COMMENT "create time in millisecond",
`status` tinyint unsigned NOT NULL COMMENT "1=waiting 2=running 3=success 4=fail",
`duration` bigint unsigned NULL COMMENT "execution duration in millisecond",
`input` mediumtext NULL COMMENT "actual input of the node" COLLATE utf8mb4_unicode_ci,
`output` mediumtext NULL COMMENT "actual output of the node" COLLATE utf8mb4_unicode_ci,
`raw_output` mediumtext NULL COMMENT "the original output of the node" COLLATE utf8mb4_unicode_ci,
`error_info` mediumtext NULL COMMENT "error info" COLLATE utf8mb4_unicode_ci,
`error_level` varchar(32) NULL COMMENT "level of the error" COLLATE utf8mb4_unicode_ci,
`input_tokens` bigint unsigned NULL COMMENT "number of input tokens",
`output_tokens` bigint unsigned NULL COMMENT "number of output tokens",
`updated_at` bigint unsigned NULL COMMENT "update time in millisecond",
`composite_node_index` bigint unsigned NULL COMMENT "loop or batch's execution index",
`composite_node_items` mediumtext NULL COMMENT "the items extracted from parent composite node for this index" COLLATE utf8mb4_unicode_ci,
`parent_node_id` varchar(128) NULL COMMENT "when as inner node for loop or batch, this is the parent node's key" COLLATE utf8mb4_unicode_ci,
`sub_execute_id` bigint unsigned NULL COMMENT "if this node is sub_workflow, the exe id of the sub workflow",
`extra` mediumtext NULL COMMENT "extra info" COLLATE utf8mb4_unicode_ci,
PRIMARY KEY (`id`),
INDEX `idx_execute_id_node_id` (`execute_id`, `node_id`),
INDEX `idx_execute_id_parent_node_id` (`execute_id`, `parent_node_id`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT "node 节点运行记录用于记录每次workflow执行时每个节点的状态信息";
-- Create "online_database_info" table
CREATE TABLE IF NOT EXISTS `online_database_info` (
`id` bigint unsigned NOT NULL COMMENT "ID",
`app_id` bigint unsigned NULL COMMENT "App ID",
`space_id` bigint unsigned NOT NULL COMMENT "Space ID",
`related_draft_id` bigint unsigned NOT NULL COMMENT "The primary key ID of draft_database_info table",
`is_visible` tinyint NOT NULL DEFAULT 1 COMMENT "Visibility: 0 invisible, 1 visible",
`prompt_disabled` tinyint NOT NULL DEFAULT 0 COMMENT "Support prompt calls: 1 not supported, 0 supported",
`table_name` varchar(255) NOT NULL COMMENT "Table name",
`table_desc` varchar(256) NULL COMMENT "Table description",
`table_field` text NULL COMMENT "Table field info",
`creator_id` bigint NOT NULL DEFAULT 0 COMMENT "Creator ID",
`icon_uri` varchar(255) NOT NULL COMMENT "Icon Uri",
`physical_table_name` varchar(255) NULL COMMENT "The name of the real physical table",
`rw_mode` bigint NOT NULL DEFAULT 1 COMMENT "Read and write permission modes: 1. Limited read and write mode 2. Read-only mode 3. Full read and write mode",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds",
`deleted_at` datetime NULL COMMENT "Delete Time",
PRIMARY KEY (`id`),
INDEX `idx_space_app_creator_deleted` (`space_id`, `app_id`, `creator_id`, `deleted_at`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_general_ci COMMENT "online database info";
-- Create "plugin" table
CREATE TABLE IF NOT EXISTS `plugin` (
`id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Plugin ID",
`space_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Space ID",
`developer_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Developer ID",
`app_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Application ID",
`icon_uri` varchar(512) NOT NULL DEFAULT "" COMMENT "Icon URI",
`server_url` varchar(512) NOT NULL DEFAULT "" COMMENT "Server URL",
`plugin_type` tinyint NOT NULL DEFAULT 0 COMMENT "Plugin Type, 1:http, 6:local",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds",
`version` varchar(255) NOT NULL DEFAULT "" COMMENT "Plugin Version, e.g. v1.0.0",
`version_desc` text NULL COMMENT "Plugin Version Description",
`manifest` json NULL COMMENT "Plugin Manifest",
`openapi_doc` json NULL COMMENT "OpenAPI Document, only stores the root",
PRIMARY KEY (`id`),
INDEX `idx_space_created_at` (`space_id`, `created_at`),
INDEX `idx_space_updated_at` (`space_id`, `updated_at`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Latest Plugin";
-- Create "plugin_draft" table
CREATE TABLE IF NOT EXISTS `plugin_draft` (
`id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Plugin ID",
`space_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Space ID",
`developer_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Developer ID",
`app_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Application ID",
`icon_uri` varchar(512) NOT NULL DEFAULT "" COMMENT "Icon URI",
`server_url` varchar(512) NOT NULL DEFAULT "" COMMENT "Server URL",
`plugin_type` tinyint NOT NULL DEFAULT 0 COMMENT "Plugin Type, 1:http, 6:local",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds",
`deleted_at` datetime NULL COMMENT "Delete Time",
`manifest` json NULL COMMENT "Plugin Manifest",
`openapi_doc` json NULL COMMENT "OpenAPI Document, only stores the root",
PRIMARY KEY (`id`),
INDEX `idx_app_id` (`app_id`, `id`),
INDEX `idx_space_app_created_at` (`space_id`, `app_id`, `created_at`),
INDEX `idx_space_app_updated_at` (`space_id`, `app_id`, `updated_at`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Draft Plugin";
-- Create "plugin_oauth_auth" table
CREATE TABLE IF NOT EXISTS `plugin_oauth_auth` (
`id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Primary Key",
`user_id` varchar(255) NOT NULL DEFAULT "" COMMENT "User ID",
`plugin_id` bigint NOT NULL DEFAULT 0 COMMENT "Plugin ID",
`is_draft` bool NOT NULL DEFAULT 0 COMMENT "Is Draft Plugin",
`oauth_config` json NULL COMMENT "Authorization Code OAuth Config",
`access_token` text NOT NULL COMMENT "Access Token",
`refresh_token` text NOT NULL COMMENT "Refresh Token",
`token_expired_at` bigint NULL COMMENT "Token Expired in Milliseconds",
`next_token_refresh_at` bigint NULL COMMENT "Next Token Refresh Time in Milliseconds",
`last_active_at` bigint NULL COMMENT "Last active time in Milliseconds",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds",
PRIMARY KEY (`id`),
INDEX `idx_last_active_at` (`last_active_at`),
INDEX `idx_last_token_expired_at` (`token_expired_at`),
INDEX `idx_next_token_refresh_at` (`next_token_refresh_at`),
UNIQUE INDEX `uniq_idx_user_plugin_is_draft` (`user_id`, `plugin_id`, `is_draft`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Plugin OAuth Authorization Code Info";
-- Create "plugin_version" table
CREATE TABLE IF NOT EXISTS `plugin_version` (
`id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Primary Key ID",
`space_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Space ID",
`developer_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Developer ID",
`plugin_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Plugin ID",
`app_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Application ID",
`icon_uri` varchar(512) NOT NULL DEFAULT "" COMMENT "Icon URI",
`server_url` varchar(512) NOT NULL DEFAULT "" COMMENT "Server URL",
`plugin_type` tinyint NOT NULL DEFAULT 0 COMMENT "Plugin Type, 1:http, 6:local",
`version` varchar(255) NOT NULL DEFAULT "" COMMENT "Plugin Version, e.g. v1.0.0",
`version_desc` text NULL COMMENT "Plugin Version Description",
`manifest` json NULL COMMENT "Plugin Manifest",
`openapi_doc` json NULL COMMENT "OpenAPI Document, only stores the root",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds",
`deleted_at` datetime NULL COMMENT "Delete Time",
PRIMARY KEY (`id`),
UNIQUE INDEX `uniq_idx_plugin_version` (`plugin_id`, `version`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Plugin Version";
-- Create "prompt_resource" table
CREATE TABLE IF NOT EXISTS `prompt_resource` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "主键ID",
`space_id` bigint NOT NULL COMMENT "空间ID",
`name` varchar(255) NOT NULL COMMENT "名称",
`description` varchar(255) NOT NULL COMMENT "描述",
`prompt_text` mediumtext NULL COMMENT "prompt正文",
`status` int NOT NULL COMMENT "状态,0无效,1有效",
`creator_id` bigint NOT NULL COMMENT "创建者ID",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "创建时间",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "更新时间",
PRIMARY KEY (`id`),
INDEX `idx_creator_id` (`creator_id`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT "prompt_resource";
-- Create "run_record" table
CREATE TABLE IF NOT EXISTS `run_record` (
`id` bigint unsigned NOT NULL COMMENT "主键ID",
`conversation_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "会话 ID",
`section_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "section ID",
`agent_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "agent_id",
`user_id` varchar(255) NOT NULL DEFAULT "" COMMENT "user id",
`source` tinyint unsigned NOT NULL DEFAULT 0 COMMENT "执行来源 0 API,",
`status` varchar(255) NOT NULL DEFAULT "" COMMENT "状态,0 Unknown, 1-Created,2-InProgress,3-Completed,4-Failed,5-Expired,6-Cancelled,7-RequiresAction",
`creator_id` bigint NOT NULL DEFAULT 0 COMMENT "创建者标识",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "创建时间",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "更新时间",
`failed_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "失败时间",
`last_error` text NULL COMMENT "error message" COLLATE utf8mb4_general_ci,
`completed_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "结束时间",
`chat_request` text NULL COMMENT "保存原始请求的部分字段" COLLATE utf8mb4_general_ci,
`ext` text NULL COMMENT "扩展字段" COLLATE utf8mb4_general_ci,
`usage` json NULL COMMENT "usage",
PRIMARY KEY (`id`),
INDEX `idx_c_s` (`conversation_id`, `section_id`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "执行记录表";
-- Create "shortcut_command" table
CREATE TABLE IF NOT EXISTS `shortcut_command` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "主键ID",
`object_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "实体ID,该实体可用这个指令",
`command_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "命令ID",
`command_name` varchar(255) NOT NULL DEFAULT "" COMMENT "命令名称",
`shortcut_command` varchar(255) NOT NULL DEFAULT "" COMMENT "快捷指令",
`description` varchar(2000) NOT NULL DEFAULT "" COMMENT "命令描述",
`send_type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT "发送类型 0:query 1:panel",
`tool_type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT "使用工具的type 1:workFlow 2:插件",
`work_flow_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "使用workFlow的id",
`plugin_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "使用插件的id",
`plugin_tool_name` varchar(255) NOT NULL DEFAULT "" COMMENT "使用插件的api_name",
`template_query` text NULL COMMENT "query模板",
`components` json NULL COMMENT "panel参数",
`card_schema` text NULL COMMENT "卡片schema",
`tool_info` json NULL COMMENT "工具信息 包含name+变量列表",
`status` tinyint unsigned NOT NULL DEFAULT 0 COMMENT "状态,0无效,1有效",
`creator_id` bigint unsigned NULL DEFAULT 0 COMMENT "创建者ID",
`is_online` tinyint unsigned NOT NULL DEFAULT 0 COMMENT "是否为线上信息 0草稿 1线上",
`created_at` bigint NOT NULL DEFAULT 0 COMMENT "创建时间",
`updated_at` bigint NOT NULL DEFAULT 0 COMMENT "更新时间",
`agent_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "multi的指令时该指令由哪个节点执行",
`shortcut_icon` json NULL COMMENT "快捷指令图标",
`plugin_tool_id` bigint NOT NULL DEFAULT 0 COMMENT "tool_id",
PRIMARY KEY (`id`),
UNIQUE INDEX `uniq_object_command_id_type` (`object_id`, `command_id`, `is_online`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_general_ci COMMENT "bot快捷指令表";
-- Create "single_agent_draft" table
CREATE TABLE IF NOT EXISTS `single_agent_draft` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "Primary Key ID",
`agent_id` bigint NOT NULL DEFAULT 0 COMMENT "Agent ID",
`creator_id` bigint NOT NULL DEFAULT 0 COMMENT "Creator ID",
`space_id` bigint NOT NULL DEFAULT 0 COMMENT "Space ID",
`name` varchar(255) NOT NULL DEFAULT "" COMMENT "Agent Name",
`description` text NOT NULL COMMENT "Agent Description",
`icon_uri` varchar(255) NOT NULL DEFAULT "" COMMENT "Icon URI",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds",
`deleted_at` datetime(3) NULL COMMENT "delete time in millisecond",
`variables_meta_id` bigint NULL COMMENT "variables meta 表 ID",
`model_info` json NULL COMMENT "Model Configuration Information",
`onboarding_info` json NULL COMMENT "Onboarding Information",
`prompt` json NULL COMMENT "Agent Prompt Configuration",
`plugin` json NULL COMMENT "Agent Plugin Base Configuration",
`knowledge` json NULL COMMENT "Agent Knowledge Base Configuration",
`workflow` json NULL COMMENT "Agent Workflow Configuration",
`suggest_reply` json NULL COMMENT "Suggested Replies",
`jump_config` json NULL COMMENT "Jump Configuration",
`background_image_info_list` json NULL COMMENT "Background image",
`database_config` json NULL COMMENT "Agent Database Base Configuration",
`shortcut_command` json NULL COMMENT "shortcut command",
PRIMARY KEY (`id`),
INDEX `idx_creator_id` (`creator_id`),
UNIQUE INDEX `uniq_agent_id` (`agent_id`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Single Agent Draft Copy Table";
-- Create "single_agent_publish" table
CREATE TABLE IF NOT EXISTS `single_agent_publish` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "主键id",
`agent_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "agent_id",
`publish_id` varchar(50) NOT NULL DEFAULT "" COMMENT "发布 id" COLLATE utf8mb4_general_ci,
`connector_ids` json NULL COMMENT "发布的 connector_ids",
`version` varchar(255) NOT NULL DEFAULT "" COMMENT "Agent Version",
`publish_info` text NULL COMMENT "发布信息" COLLATE utf8mb4_general_ci,
`publish_time` bigint unsigned NOT NULL DEFAULT 0 COMMENT "发布时间",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds",
`creator_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "发布人 user_id",
`status` tinyint NOT NULL DEFAULT 0 COMMENT "状态 0:使用中 1:删除 3:禁用",
`extra` json NULL COMMENT "扩展字段",
PRIMARY KEY (`id`),
INDEX `idx_agent_id_version` (`agent_id`, `version`),
INDEX `idx_creator_id` (`creator_id`),
INDEX `idx_publish_id` (`publish_id`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "bot 渠道和发布版本流水表";
-- Create "single_agent_version" table
CREATE TABLE IF NOT EXISTS `single_agent_version` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "Primary Key ID",
`agent_id` bigint NOT NULL DEFAULT 0 COMMENT "Agent ID",
`creator_id` bigint NOT NULL DEFAULT 0 COMMENT "Creator ID",
`space_id` bigint NOT NULL DEFAULT 0 COMMENT "Space ID",
`name` varchar(255) NOT NULL DEFAULT "" COMMENT "Agent Name",
`description` text NOT NULL COMMENT "Agent Description",
`icon_uri` varchar(255) NOT NULL DEFAULT "" COMMENT "Icon URI",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds",
`deleted_at` datetime(3) NULL COMMENT "delete time in millisecond",
`variables_meta_id` bigint NULL COMMENT "variables meta 表 ID",
`model_info` json NULL COMMENT "Model Configuration Information",
`onboarding_info` json NULL COMMENT "Onboarding Information",
`prompt` json NULL COMMENT "Agent Prompt Configuration",
`plugin` json NULL COMMENT "Agent Plugin Base Configuration",
`knowledge` json NULL COMMENT "Agent Knowledge Base Configuration",
`workflow` json NULL COMMENT "Agent Workflow Configuration",
`suggest_reply` json NULL COMMENT "Suggested Replies",
`jump_config` json NULL COMMENT "Jump Configuration",
`connector_id` bigint unsigned NOT NULL COMMENT "Connector ID",
`version` varchar(255) NOT NULL DEFAULT "" COMMENT "Agent Version",
`background_image_info_list` json NULL COMMENT "Background image",
`database_config` json NULL COMMENT "Agent Database Base Configuration",
`shortcut_command` json NULL COMMENT "shortcut command",
PRIMARY KEY (`id`),
INDEX `idx_creator_id` (`creator_id`),
UNIQUE INDEX `uniq_agent_id_and_version_connector_id` (`agent_id`, `version`, `connector_id`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Single Agent Version Copy Table";
-- Create "space" table
CREATE TABLE IF NOT EXISTS `space` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "Primary Key ID, Space ID",
`owner_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Owner ID",
`name` varchar(200) NOT NULL DEFAULT "" COMMENT "Space Name",
`description` varchar(2000) NOT NULL DEFAULT "" COMMENT "Space Description",
`icon_uri` varchar(200) NOT NULL DEFAULT "" COMMENT "Icon URI",
`creator_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Creator ID",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Creation Time (Milliseconds)",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time (Milliseconds)",
`deleted_at` bigint unsigned NULL COMMENT "Deletion Time (Milliseconds)",
PRIMARY KEY (`id`),
INDEX `idx_creator_id` (`creator_id`),
INDEX `idx_owner_id` (`owner_id`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Space Table";
-- Create "space_user" table
CREATE TABLE IF NOT EXISTS `space_user` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "Primary Key ID, Auto Increment",
`space_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Space ID",
`user_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "User ID",
`role_type` int NOT NULL DEFAULT 3 COMMENT "Role Type: 1.owner 2.admin 3.member",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Creation Time (Milliseconds)",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time (Milliseconds)",
PRIMARY KEY (`id`),
INDEX `idx_user_id` (`user_id`),
UNIQUE INDEX `uniq_space_user` (`space_id`, `user_id`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Space Member Table";
-- Create "template" table
CREATE TABLE IF NOT EXISTS `template` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "Primary Key ID",
`agent_id` bigint NOT NULL DEFAULT 0 COMMENT "Agent ID",
`workflow_id` bigint NOT NULL DEFAULT 0 COMMENT "Workflow ID",
`space_id` bigint NOT NULL DEFAULT 0 COMMENT "Space ID",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds",
`heat` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Heat",
`product_entity_type` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Product Entity Type",
`meta_info` json NULL COMMENT "Meta Info",
`agent_extra` json NULL COMMENT "Agent Extra Info",
`workflow_extra` json NULL COMMENT "Workflow Extra Info",
`project_extra` json NULL COMMENT "Project Extra Info",
PRIMARY KEY (`id`),
UNIQUE INDEX `uniq_agent_id` (`agent_id`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Template Info Table";
-- Create "tool" table
CREATE TABLE IF NOT EXISTS `tool` (
`id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Tool ID",
`plugin_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Plugin ID",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds",
`version` varchar(255) NOT NULL DEFAULT "" COMMENT "Tool Version, e.g. v1.0.0",
`sub_url` varchar(512) NOT NULL DEFAULT "" COMMENT "Sub URL Path",
`method` varchar(64) NOT NULL DEFAULT "" COMMENT "HTTP Request Method",
`operation` json NULL COMMENT "Tool Openapi Operation Schema",
`activated_status` tinyint unsigned NOT NULL DEFAULT 0 COMMENT "0:activated; 1:deactivated",
PRIMARY KEY (`id`),
INDEX `idx_plugin_activated_status` (`plugin_id`, `activated_status`),
UNIQUE INDEX `uniq_idx_plugin_sub_url_method` (`plugin_id`, `sub_url`, `method`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Latest Tool";
-- Create "tool_draft" table
CREATE TABLE IF NOT EXISTS `tool_draft` (
`id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Tool ID",
`plugin_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Plugin ID",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds",
`sub_url` varchar(512) NOT NULL DEFAULT "" COMMENT "Sub URL Path",
`method` varchar(64) NOT NULL DEFAULT "" COMMENT "HTTP Request Method",
`operation` json NULL COMMENT "Tool Openapi Operation Schema",
`debug_status` tinyint unsigned NOT NULL DEFAULT 0 COMMENT "0:not pass; 1:pass",
`activated_status` tinyint unsigned NOT NULL DEFAULT 0 COMMENT "0:activated; 1:deactivated",
PRIMARY KEY (`id`),
INDEX `idx_plugin_created_at_id` (`plugin_id`, `created_at`, `id`),
UNIQUE INDEX `uniq_idx_plugin_sub_url_method` (`plugin_id`, `sub_url`, `method`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Draft Tool";
-- Create "tool_version" table
CREATE TABLE IF NOT EXISTS `tool_version` (
`id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Primary Key ID",
`tool_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Tool ID",
`plugin_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Plugin ID",
`version` varchar(255) NOT NULL DEFAULT "" COMMENT "Tool Version, e.g. v1.0.0",
`sub_url` varchar(512) NOT NULL DEFAULT "" COMMENT "Sub URL Path",
`method` varchar(64) NOT NULL DEFAULT "" COMMENT "HTTP Request Method",
`operation` json NULL COMMENT "Tool Openapi Operation Schema",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds",
`deleted_at` datetime NULL COMMENT "Delete Time",
PRIMARY KEY (`id`),
UNIQUE INDEX `uniq_idx_tool_version` (`tool_id`, `version`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Tool Version";
-- Create "user" table
CREATE TABLE IF NOT EXISTS `user` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "Primary Key ID",
`name` varchar(128) NOT NULL DEFAULT "" COMMENT "User Nickname",
`unique_name` varchar(128) NOT NULL DEFAULT "" COMMENT "User Unique Name",
`email` varchar(128) NOT NULL DEFAULT "" COMMENT "Email",
`password` varchar(128) NOT NULL DEFAULT "" COMMENT "Password (Encrypted)",
`description` varchar(512) NOT NULL DEFAULT "" COMMENT "User Description",
`icon_uri` varchar(512) NOT NULL DEFAULT "" COMMENT "Avatar URI",
`user_verified` bool NOT NULL DEFAULT 0 COMMENT "User Verification Status",
`locale` varchar(128) NOT NULL DEFAULT "" COMMENT "Locale",
`session_key` varchar(256) NOT NULL DEFAULT "" COMMENT "Session Key",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Creation Time (Milliseconds)",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time (Milliseconds)",
`deleted_at` bigint unsigned NULL COMMENT "Deletion Time (Milliseconds)",
PRIMARY KEY (`id`),
INDEX `idx_session_key` (`session_key`),
UNIQUE INDEX `uniq_email` (`email`),
UNIQUE INDEX `uniq_unique_name` (`unique_name`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "User Table";
-- Create "variable_instance" table
CREATE TABLE IF NOT EXISTS `variable_instance` (
`id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "主键ID",
`biz_type` tinyint unsigned NOT NULL COMMENT "1 for agent2 for app",
`biz_id` varchar(128) NOT NULL DEFAULT "" COMMENT "1 for agent_id2 for app_id",
`version` varchar(255) NOT NULL COMMENT "agent or project 版本,为空代表草稿态",
`keyword` varchar(255) NOT NULL COMMENT "记忆的KEY",
`type` tinyint NOT NULL COMMENT "记忆类型 1 KV 2 list",
`content` text NULL COMMENT "记忆内容",
`connector_uid` varchar(255) NOT NULL COMMENT "二方用户ID",
`connector_id` bigint NOT NULL COMMENT "二方id, e.g. coze = 10000010",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "创建时间",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "更新时间",
PRIMARY KEY (`id`),
INDEX `idx_connector_key` (`biz_id`, `biz_type`, `version`, `connector_uid`, `connector_id`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT "KV Memory";
-- Create "variables_meta" table
CREATE TABLE IF NOT EXISTS `variables_meta` (
`id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "主键ID",
`creator_id` bigint unsigned NOT NULL COMMENT "创建者ID",
`biz_type` tinyint unsigned NOT NULL COMMENT "1 for agent2 for app",
`biz_id` varchar(128) NOT NULL DEFAULT "" COMMENT "1 for agent_id2 for app_id",
`variable_list` json NULL COMMENT "变量配置的json数据",
`created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "create time",
`updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "update time",
`version` varchar(255) NOT NULL COMMENT "project版本,为空代表草稿态",
PRIMARY KEY (`id`),
INDEX `idx_user_key` (`creator_id`),
UNIQUE INDEX `uniq_project_key` (`biz_id`, `biz_type`, `version`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT "KV Memory meta";
-- Create "workflow_draft" table
CREATE TABLE IF NOT EXISTS `workflow_draft` (
`id` bigint unsigned NOT NULL COMMENT "workflow ID",
`canvas` mediumtext NOT NULL COMMENT "前端 schema",
`input_params` mediumtext NULL COMMENT " 入参 schema",
`output_params` mediumtext NULL COMMENT " 出参 schema",
`test_run_success` bool NOT NULL DEFAULT 0 COMMENT "0 未运行, 1 运行成功",
`modified` bool NOT NULL DEFAULT 0 COMMENT "0 未被修改, 1 已被修改",
`updated_at` bigint unsigned NULL,
`deleted_at` datetime(3) NULL,
`commit_id` varchar(255) NOT NULL COMMENT "used to uniquely identify a draft snapshot",
PRIMARY KEY (`id`),
INDEX `idx_updated_at` (`updated_at` DESC)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "workflow 画布草稿表用于记录workflow最新的草稿画布信息";
-- Create "workflow_execution" table
CREATE TABLE IF NOT EXISTS `workflow_execution` (
`id` bigint unsigned NOT NULL COMMENT "execute id",
`workflow_id` bigint unsigned NOT NULL COMMENT "workflow_id",
`version` varchar(50) NULL COMMENT "workflow version. empty if is draft",
`space_id` bigint unsigned NOT NULL COMMENT "the space id the workflow belongs to",
`mode` tinyint unsigned NOT NULL COMMENT "the execution mode: 1. debug run 2. release run 3. node debug",
`operator_id` bigint unsigned NOT NULL COMMENT "the user id that runs this workflow",
`connector_id` bigint unsigned NULL COMMENT "the connector on which this execution happened",
`connector_uid` varchar(64) NULL COMMENT "user id of the connector",
`created_at` bigint unsigned NOT NULL COMMENT "create time in millisecond",
`log_id` varchar(128) NULL COMMENT "log id",
`status` tinyint unsigned NULL COMMENT "1=running 2=success 3=fail 4=interrupted",
`duration` bigint unsigned NULL COMMENT "execution duration in millisecond",
`input` mediumtext NULL COMMENT "actual input of this execution",
`output` mediumtext NULL COMMENT "the actual output of this execution",
`error_code` varchar(255) NULL COMMENT "error code if any",
`fail_reason` mediumtext NULL COMMENT "the reason for failure",
`input_tokens` bigint unsigned NULL COMMENT "number of input tokens",
`output_tokens` bigint unsigned NULL COMMENT "number of output tokens",
`updated_at` bigint unsigned NULL COMMENT "update time in millisecond",
`root_execution_id` bigint unsigned NULL COMMENT "the top level execution id. Null if this is the root",
`parent_node_id` varchar(128) NULL COMMENT "the node key for the sub_workflow node that executes this workflow",
`app_id` bigint unsigned NULL COMMENT "app id this workflow execution belongs to",
`node_count` mediumint unsigned NULL COMMENT "the total node count of the workflow",
`resume_event_id` bigint unsigned NULL COMMENT "the current event ID which is resuming",
`agent_id` bigint unsigned NULL COMMENT "the agent that this execution binds to",
`sync_pattern` tinyint unsigned NULL COMMENT "the sync pattern 1. sync 2. async 3. stream",
`commit_id` varchar(255) NULL COMMENT "draft commit id this execution belongs to",
PRIMARY KEY (`id`),
INDEX `idx_workflow_id_version_mode_created_at` (`workflow_id`, `version`, `mode`, `created_at`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "workflow 执行记录表用于记录每次workflow执行时的状态";
-- Create "workflow_meta" table
CREATE TABLE IF NOT EXISTS `workflow_meta` (
`id` bigint unsigned NOT NULL COMMENT "workflow id",
`name` varchar(256) NOT NULL COMMENT "workflow name",
`description` varchar(2000) NOT NULL COMMENT "workflow description",
`icon_uri` varchar(256) NOT NULL COMMENT "icon uri",
`status` tinyint unsigned NOT NULL COMMENT "0:未发布过, 1:已发布过",
`content_type` tinyint unsigned NOT NULL COMMENT "0用户 1官方",
`mode` tinyint unsigned NOT NULL COMMENT "0:workflow, 3:chat_flow",
`created_at` bigint unsigned NOT NULL COMMENT "create time in millisecond",
`updated_at` bigint unsigned NULL COMMENT "update time in millisecond",
`deleted_at` datetime(3) NULL COMMENT "delete time in millisecond",
`creator_id` bigint unsigned NOT NULL COMMENT "user id for creator",
`tag` tinyint unsigned NULL COMMENT "template tag: Tag: 1=All, 2=Hot, 3=Information, 4=Music, 5=Picture, 6=UtilityTool, 7=Life, 8=Traval, 9=Network, 10=System, 11=Movie, 12=Office, 13=Shopping, 14=Education, 15=Health, 16=Social, 17=Entertainment, 18=Finance, 100=Hidden",
`author_id` bigint unsigned NOT NULL COMMENT "原作者用户 ID",
`space_id` bigint unsigned NOT NULL COMMENT " 空间 ID",
`updater_id` bigint unsigned NULL COMMENT " 更新元信息的用户 ID",
`source_id` bigint unsigned NULL COMMENT " 复制来源的 workflow ID",
`app_id` bigint unsigned NULL COMMENT "应用 ID",
`latest_version` varchar(50) NULL COMMENT "the version of the most recent publish",
`latest_version_ts` bigint unsigned NULL COMMENT "create time of latest version",
PRIMARY KEY (`id`),
INDEX `idx_app_id` (`app_id`),
INDEX `idx_latest_version_ts` (`latest_version_ts` DESC),
INDEX `idx_space_id_app_id_status_latest_version_ts` (`space_id`, `app_id`, `status`, `latest_version_ts`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "workflow 元信息表用于记录workflow基本的元信息";
-- Create "workflow_reference" table
CREATE TABLE IF NOT EXISTS `workflow_reference` (
`id` bigint unsigned NOT NULL COMMENT "workflow id",
`referred_id` bigint unsigned NOT NULL COMMENT "the id of the workflow that is referred by other entities",
`referring_id` bigint unsigned NOT NULL COMMENT "the entity id that refers this workflow",
`refer_type` tinyint unsigned NOT NULL COMMENT "1 subworkflow 2 tool",
`referring_biz_type` tinyint unsigned NOT NULL COMMENT "the biz type the referring entity belongs to: 1. workflow 2. agent",
`created_at` bigint unsigned NOT NULL COMMENT "create time in millisecond",
`status` tinyint unsigned NOT NULL COMMENT "whether this reference currently takes effect. 0: disabled 1: enabled",
`deleted_at` datetime(3) NULL,
PRIMARY KEY (`id`),
INDEX `idx_referred_id_referring_biz_type_status` (`referred_id`, `referring_biz_type`, `status`),
INDEX `idx_referring_id_status` (`referring_id`, `status`),
UNIQUE INDEX `uniq_referred_id_referring_id_refer_type` (`referred_id`, `referring_id`, `refer_type`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "workflow 关联关系表用于记录workflow 直接互相引用关系";
-- Create "workflow_snapshot" table
CREATE TABLE IF NOT EXISTS `workflow_snapshot` (
`workflow_id` bigint unsigned NOT NULL COMMENT "workflow id this snapshot belongs to",
`commit_id` varchar(255) NOT NULL COMMENT "the commit id of the workflow draft",
`canvas` mediumtext NOT NULL COMMENT "frontend schema for this snapshot",
`input_params` mediumtext NULL COMMENT "input parameter info",
`output_params` mediumtext NULL COMMENT "output parameter info",
`created_at` bigint unsigned NOT NULL,
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "ID",
PRIMARY KEY (`id`),
UNIQUE INDEX `uniq_workflow_id_commit_id` (`workflow_id`, `commit_id`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "snapshot for executed workflow draft";
-- Create "workflow_version" table
CREATE TABLE IF NOT EXISTS `workflow_version` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "ID",
`workflow_id` bigint unsigned NOT NULL COMMENT "workflow id",
`version` varchar(50) NOT NULL COMMENT "发布版本",
`version_description` varchar(2000) NOT NULL COMMENT "版本描述",
`canvas` mediumtext NOT NULL COMMENT "前端 schema",
`input_params` mediumtext NULL,
`output_params` mediumtext NULL,
`creator_id` bigint unsigned NOT NULL COMMENT "发布用户 ID",
`created_at` bigint unsigned NOT NULL COMMENT "创建时间毫秒时间戳",
`deleted_at` datetime(3) NULL COMMENT "删除毫秒时间戳",
`commit_id` varchar(255) NOT NULL COMMENT "the commit id corresponding to this version",
PRIMARY KEY (`id`),
INDEX `idx_id_created_at` (`workflow_id`, `created_at`),
UNIQUE INDEX `uniq_workflow_id_version` (`workflow_id`, `version`)
) ENGINE=InnoDB CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "workflow 画布版本信息表,用于记录不同版本的画布信息";

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,73 @@
#!/bin/bash
set -e
DRY_RUN=false
if [ "$1" == "--dry-run" ]; then
DRY_RUN=true
echo "Running in dry-run mode. No images will be pulled, tagged, or pushed."
fi
TARGET_REGISTRY="opencoze-cn-beijing.cr.volces.com/iac"
images=(
"mysql:8.4.5"
"bitnami/redis:8.0"
"opencoze/opencoze:latest"
"apache/rocketmq:5.3.2"
"bitnami/elasticsearch:8.18.0"
"minio/minio:RELEASE.2025-06-13T11-33-47Z-cpuv1"
"minio/mc:RELEASE.2025-05-21T01-59-54Z-cpuv1"
"arigaio/atlas:0.35.0-community-alpine"
"bitnami/etcd:3.5"
"alpine/curl:8.12.1"
"milvusdb/milvus:v2.5.10"
"busybox:latest"
)
# Function to tag and push an image
tag_and_push() {
source_image=$1
# Extract image name and tag (e.g., "etcd:3.5" from "bitnami/etcd:3.5")
image_name_tag=$(basename "$source_image")
target_image="$TARGET_REGISTRY/$image_name_tag"
echo "Tagging $source_image as $target_image"
if [ "$DRY_RUN" = false ]; then
docker tag "$source_image" "$target_image"
else
echo "[dry-run] docker tag \"$source_image\" \"$target_image\""
fi
echo "Pushing $target_image"
if [ "$DRY_RUN" = false ]; then
docker push "$target_image"
else
echo "[dry-run] docker push \"$target_image\""
fi
echo ""
}
# Pull all images first
for image in "${images[@]}"; do
if docker image inspect "${image}" >/dev/null 2>&1; then
echo "Image ${image} already exists locally, skipping pull."
else
echo "Pulling ${image}"
if [ "${DRY_RUN}" = false ]; then
docker pull "${image}"
else
echo "[dry-run] docker pull \"${image}\""
fi
fi
done
echo "All images pulled successfully."
echo ""
# Tag and push all images
for image in "${images[@]}"; do
tag_and_push "$image"
done
echo "All images have been tagged and pushed to $TARGET_REGISTRY."

View File

@@ -0,0 +1,22 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "opencoze.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "opencoze.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "opencoze.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "opencoze.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}

View File

@@ -0,0 +1,50 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "opencoze.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "opencoze.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "opencoze.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Common labels.
*/}}
{{- define "opencoze.labels" -}}
{{- if .Values.commonLabels }}
{{- toYaml .Values.commonLabels | nindent 4 }}
{{- end }}
{{- if .Values.component }}
app.kubernetes.io/component: {{ .Values.component }}
{{- end }}
app.kubernetes.io/name: {{ include "opencoze.name" . }}
helm.sh/chart: {{ include "opencoze.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

View File

@@ -0,0 +1,110 @@
{{- if .Values.cozeServer.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ printf "%s-server" (include "opencoze.fullname" .) }}
labels:
{{- include "opencoze.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.cozeServer.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "opencoze.name" . }}
app.kubernetes.io/component: server
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "opencoze.name" . }}
app.kubernetes.io/component: server
spec:
initContainers:
- name: wait-for-mysql
image: {{ .Values.images.busybox }}
command: ['sh', '-c', 'until nc -z {{ include "opencoze.fullname" . }}-mysql 3306; do echo waiting for mysql; sleep 2; done']
{{- if .Values.redis.enabled }}
- name: wait-for-redis
image: {{ .Values.images.busybox }}
command: ['sh', '-c', 'until nc -z {{ include "opencoze.fullname" . }}-redis {{ .Values.redis.port }}; do echo waiting for redis; sleep 2; done']
{{- end }}
{{- if .Values.rocketmq.enabled }}
- name: wait-for-rocketmq
image: {{ .Values.images.busybox }}
command: ['sh', '-c', 'until nc -z {{ include "opencoze.fullname" . }}-rocketmq-namesrv 9876; do echo waiting for rocketmq; sleep 2; done']
{{- end }}
{{- if .Values.elasticsearch.enabled }}
- name: wait-for-elasticsearch
image: {{ .Values.images.busybox }}
command: ['sh', '-c', 'until nc -z {{ include "opencoze.fullname" . }}-elasticsearch 9200; do echo waiting for elasticsearch; sleep 2; done']
{{- end }}
{{- if .Values.minio.enabled }}
- name: wait-for-minio
image: {{ .Values.images.busybox }}
command: ['sh', '-c', 'until nc -z {{ include "opencoze.fullname" . }}-minio 9000; do echo waiting for minio; sleep 2; done']
{{- end }}
{{- if .Values.milvus.enabled }}
- name: wait-for-milvus
image: {{ .Values.images.busybox }}
command: ['sh', '-c', 'until nc -z {{ include "opencoze.fullname" . }}-milvus 19530; do echo waiting for milvus; sleep 2; done']
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.cozeServer.image.repository }}:{{ .Values.cozeServer.image.tag }}"
imagePullPolicy: {{ .Values.cozeServer.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.cozeServer.service.port }}
env:
- name: MYSQL_HOST
value: "{{ include "opencoze.fullname" . }}-mysql"
- name: MYSQL_PORT
value: {{ .Values.mysql.port | quote }}
- name: MYSQL_USER
value: {{ .Values.mysql.user | quote }}
- name: MYSQL_PASSWORD
value: {{ .Values.mysql.password | quote }}
- name: MYSQL_DATABASE
value: {{ .Values.mysql.database | quote }}
- name: REDIS_ADDR
value: "{{ include "opencoze.fullname" . }}-redis:{{ .Values.redis.port }}"
- name: MINIO_AK
value: {{ .Values.minio.accessKey | quote }}
- name: MINIO_SK
value: {{ .Values.minio.secretKey | quote }}
- name: STORAGE_BUCKET
value: {{ .Values.minio.bucket | quote }}
- name: ES_ADDR
value: "http://{{ include "opencoze.fullname" . }}-elasticsearch:9200"
- name: ES_USERNAME
value: {{ .Values.elasticsearch.username | quote }}
- name: ES_PASSWORD
value: {{ .Values.elasticsearch.password | quote }}
- name: RMQ_NAME_SERVER
value: "http://{{ include "opencoze.fullname" . }}-rocketmq-namesrv:9876"
- name: MILVUS_ADDR
value: "{{ include "opencoze.fullname" . }}-milvus:19530"
- name: MYSQL_DSN
value: "{{ .Values.mysql.user }}:{{ .Values.mysql.password }}@tcp({{ include "opencoze.fullname" . }}-mysql:3306)/{{ .Values.mysql.database }}?charset=utf8mb4&parseTime=True&loc=Local"
{{- range $key, $val := .Values.cozeServer.env }}
- name: {{ $key }}
value: {{ $val | quote }}
{{- end }}
{{- if .Values.cozeServer.confHostPath }}
volumeMounts:
- name: opencoze-server-conf
mountPath: /app/resources/conf
{{- end }}
{{- if .Values.cozeServer.confHostPath }}
volumes:
- name: opencoze-server-conf
hostPath:
path: {{ .Values.cozeServer.confHostPath }}
type: DirectoryOrCreate
{{- end }}
{{- end }}

View File

@@ -0,0 +1,6 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "opencoze.fullname" . }}-es-init-config
data:
{{ (.Files.Glob "files/es/*.json").AsConfig | indent 2 }}

View File

@@ -0,0 +1,47 @@
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "opencoze.fullname" . }}-es-init
spec:
template:
spec:
restartPolicy: Never
initContainers:
- name: wait-for-es
image: {{ .Values.images.busybox }}
command: ['sh', '-c', 'until nc -z {{ include "opencoze.fullname" . }}-elasticsearch 9200; do echo waiting for elasticsearch; sleep 2; done']
containers:
- name: es-init
image: {{ .Values.images.curl }}
env:
- name: ES_USERNAME
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-es-secret
key: username
- name: ES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-es-secret
key: password
command:
- /bin/sh
- -c
- |
set -ex
/scripts/setup_es.sh
volumeMounts:
- name: es-init-script
mountPath: /scripts
- name: es-index-schema
mountPath: /es_index_schema
volumes:
- name: es-init-script
configMap:
name: {{ include "opencoze.fullname" . }}-es-init-script
defaultMode: 0755
- name: es-index-schema
configMap:
name: {{ include "opencoze.fullname" . }}-es-init-config
backoffLimit: 4

View File

@@ -0,0 +1,44 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "opencoze.fullname" . }}-es-init-script
data:
setup_es.sh: |
#!/bin/sh
set -ex
ES_HOST="http://{{ include "opencoze.fullname" . }}-elasticsearch:9200"
CURL_AUTH=""
if [ -n "$ES_USERNAME" ] && [ -n "$ES_PASSWORD" ]; then
CURL_AUTH="-u $ES_USERNAME:$ES_PASSWORD"
fi
# Upload index templates
for file in /es_index_schema/*.json; do
if [ -f "$file" ]; then
template_name=$(basename "$file" .index-template.json)
echo "Uploading index template $template_name"
curl -X PUT $CURL_AUTH "$ES_HOST/_index_template/$template_name" -H "Content-Type: application/json" --data-binary "@$file"
fi
done
# Create indices
for file in /es_index_schema/*.json; do
if [ -f "$file" ]; then
template_name=$(basename "$file" .index-template.json)
index_name=$template_name
echo "Creating index $index_name"
curl -X PUT $CURL_AUTH "$ES_HOST/$index_name" -H "Content-Type: application/json" -d'{
"settings": {
"index": {
"number_of_shards": 1,
"number_of_replicas": 1
}
}
}'
fi
done
echo "Elasticsearch setup complete."

View File

@@ -0,0 +1,10 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-es-secret
labels:
{{- include "opencoze.labels" . | nindent 4 }}
type: Opaque
data:
username: {{ .Values.elasticsearch.username | b64enc | quote }}
password: {{ .Values.elasticsearch.password | b64enc | quote }}

View File

@@ -0,0 +1,19 @@
{{- if .Values.elasticsearch.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "opencoze.fullname" . }}-elasticsearch
labels:
{{- include "opencoze.labels" . | nindent 4 }}
spec:
type: {{ .Values.elasticsearch.service.type }}
ports:
- port: {{ .Values.elasticsearch.service.port }}
targetPort: {{ .Values.elasticsearch.service.targetPort }}
protocol: TCP
name: http
selector:
app.kubernetes.io/component: elasticsearch
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "opencoze.name" . }}
{{- end }}

View File

@@ -0,0 +1,88 @@
{{- if .Values.elasticsearch.enabled }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "opencoze.fullname" . }}-elasticsearch
labels:
{{- include "opencoze.labels" . | nindent 4 }}
spec:
serviceName: {{ .Release.Name }}-elasticsearch
replicas: 1
selector:
matchLabels:
app.kubernetes.io/component: elasticsearch
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "opencoze.name" . }}
template:
metadata:
labels:
app.kubernetes.io/component: elasticsearch
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "opencoze.name" . }}
spec:
initContainers:
- name: install-plugins
image: "{{ .Values.elasticsearch.image.repository }}:{{ .Values.elasticsearch.image.tag }}"
securityContext:
runAsUser: 0
command:
- /bin/bash
- -c
- |
set -ex
echo 'Installing smartcn plugin...';
if [ ! -d /opt/bitnami/elasticsearch/plugins/analysis-smartcn ]; then
/opt/bitnami/elasticsearch/bin/elasticsearch-plugin install analysis-smartcn
fi
volumeMounts:
- name: es-plugins
mountPath: /opt/bitnami/elasticsearch/plugins
containers:
- name: elasticsearch
securityContext:
runAsUser: 0
image: "{{ .Values.elasticsearch.image.repository }}:{{ .Values.elasticsearch.image.tag }}"
env:
- name: ES_JAVA_OPTS
value: {{ .Values.elasticsearch.javaOpts | quote }}
- name: ELASTIC_USERNAME
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-es-secret
key: username
- name: ELASTIC_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-es-secret
key: password
command:
- /bin/bash
- -c
- |
/opt/bitnami/scripts/elasticsearch/setup.sh
chown -R elasticsearch:elasticsearch /bitnami/elasticsearch/data
chmod g+s /bitnami/elasticsearch/data
exec /opt/bitnami/scripts/elasticsearch/entrypoint.sh /opt/bitnami/scripts/elasticsearch/run.sh
ports:
- containerPort: {{ .Values.elasticsearch.service.port }}
volumeMounts:
- name: es-data
mountPath: /bitnami/elasticsearch/data
- name: es-plugins
mountPath: /opt/bitnami/elasticsearch/plugins
volumes:
- name: es-plugins
emptyDir: {}
- name: es-config
configMap:
name: {{ include "opencoze.fullname" . }}-es-init-config
volumeClaimTemplates:
- metadata:
name: es-data
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: {{ .Values.elasticsearch.persistence.storageClassName | quote }}
resources:
requests:
storage: {{ .Values.elasticsearch.persistence.size | quote }}
{{- end }}

View File

@@ -0,0 +1,20 @@
{{- if .Values.etcd.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "opencoze.fullname" . }}-etcd
labels:
{{- include "opencoze.labels" . | nindent 4 }}
spec:
ports:
- name: client
port: 2379
targetPort: 2379
- name: peer
port: 2380
targetPort: 2380
selector:
app.kubernetes.io/component: etcd
app.kubernetes.io/name: {{ include "opencoze.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

View File

@@ -0,0 +1,60 @@
{{- if .Values.etcd.enabled }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "opencoze.fullname" . }}-etcd
labels:
{{- include "opencoze.labels" . | nindent 4 }}
spec:
serviceName: {{ .Release.Name }}-etcd
replicas: 1
selector:
matchLabels:
app.kubernetes.io/component: etcd
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "opencoze.name" . }}
template:
metadata:
labels:
app.kubernetes.io/component: etcd
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "opencoze.name" . }}
spec:
containers:
- name: etcd
securityContext:
runAsUser: 0
image: "{{ .Values.etcd.image.repository }}:{{ .Values.etcd.image.tag }}"
env:
- name: ALLOW_NONE_AUTHENTICATION
value: "yes"
- name: ETCD_AUTO_COMPACTION_MODE
value: "revision"
- name: ETCD_AUTO_COMPACTION_RETENTION
value: "1000"
- name: ETCD_QUOTA_BACKEND_BYTES
value: "4294967296"
command:
- /bin/bash
- -c
- |
/opt/bitnami/scripts/etcd/setup.sh
chown -R etcd:etcd /bitnami/etcd
chmod g+s /bitnami/etcd
exec /opt/bitnami/scripts/etcd/entrypoint.sh /opt/bitnami/scripts/etcd/run.sh
ports:
- containerPort: 2379
- containerPort: 2380
volumeMounts:
- name: etcd-data
mountPath: /bitnami/etcd
volumeClaimTemplates:
- metadata:
name: etcd-data
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: {{ .Values.etcd.persistence.storageClassName | quote }}
resources:
requests:
storage: {{ .Values.etcd.persistence.size | quote }}
{{- end }}

View File

@@ -0,0 +1,101 @@
{{- if .Values.kibana.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "opencoze.fullname" . }}-kibana
labels:
{{- include "opencoze.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/component: kibana
app.kubernetes.io/name: {{ include "opencoze.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/component: kibana
app.kubernetes.io/name: {{ include "opencoze.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
securityContext:
runAsUser: 0
fsGroup: 1001
initContainers:
- name: wait-for-elasticsearch
image: {{ .Values.images.curl }}
env:
- name: ES_HOST
value: '{{ include "opencoze.fullname" . }}-elasticsearch'
- name: ES_PORT
value: "9200"
- name: ES_USERNAME
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-es-secret
key: username
- name: ES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-es-secret
key: password
command: ['sh', '-c', 'until curl -s -u "$ES_USERNAME:$ES_PASSWORD" "http://$ES_HOST:$ES_PORT/_cluster/health?wait_for_status=yellow&timeout=1s"; do echo "waiting for elasticsearch"; sleep 2; done;']
containers:
- name: kibana
image: "{{ .Values.kibana.image.repository }}:{{ .Values.kibana.image.tag }}"
env:
- name: KIBANA_ELASTICSEARCH_URL
value: "{{ include "opencoze.fullname" . }}-elasticsearch"
command:
- /bin/bash
- -c
- |
/opt/bitnami/scripts/kibana/setup.sh
chown -R kibana:kibana /bitnami/kibana
chmod g+s /bitnami/kibana
exec /opt/bitnami/scripts/kibana/entrypoint.sh /opt/bitnami/scripts/kibana/run.sh
/opt/bitnami/scripts/kibana/setup.sh
chown -R 1001:1001 /bitnami/kibana
chmod -R g+s /bitnami/kibana
exec /opt/bitnami/scripts/kibana/entrypoint.sh /opt/bitnami/scripts/kibana/run.sh
env:
- name: KIBANA_ELASTICSEARCH_URL
value: '{{ include "opencoze.fullname" . }}-elasticsearch'
- name: ELASTICSEARCH_USERNAME
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-es-secret
key: username
- name: ELASTICSEARCH_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-es-secret
key: password
ports:
- name: http
containerPort: {{ .Values.kibana.service.port }}
protocol: TCP
livenessProbe:
httpGet:
path: /api/status
port: http
initialDelaySeconds: 120
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
readinessProbe:
httpGet:
path: /api/status
port: http
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
volumeMounts:
- name: kibana-data
mountPath: /bitnami/kibana
volumes:
- name: kibana-data
emptyDir: {}
{{- end }}

View File

@@ -0,0 +1,19 @@
{{- if .Values.kibana.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "opencoze.fullname" . }}-kibana
labels:
{{- include "opencoze.labels" . | nindent 4 }}
spec:
type: {{ .Values.kibana.service.type }}
ports:
- port: {{ .Values.kibana.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
app.kubernetes.io/component: kibana
app.kubernetes.io/name: {{ include "opencoze.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

View File

@@ -0,0 +1,20 @@
{{- if .Values.milvus.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "opencoze.fullname" . }}-milvus
labels:
{{- include "opencoze.labels" . | nindent 4 }}
spec:
ports:
- name: milvus
port: 19530
targetPort: 19530
- name: metrics
port: 9091
targetPort: 9091
selector:
app.kubernetes.io/component: milvus
app.kubernetes.io/name: {{ include "opencoze.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

View File

@@ -0,0 +1,77 @@
{{- if .Values.milvus.enabled }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "opencoze.fullname" . }}-milvus
labels:
{{- include "opencoze.labels" . | nindent 4 }}
spec:
serviceName: {{ .Release.Name }}-milvus
replicas: 1
selector:
matchLabels:
app.kubernetes.io/component: milvus
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "opencoze.name" . }}
template:
metadata:
labels:
app.kubernetes.io/component: milvus
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "opencoze.name" . }}
spec:
containers:
- name: milvus
securityContext:
runAsUser: 0
image: "{{ .Values.milvus.image.repository }}:{{ .Values.milvus.image.tag }}"
command: ["milvus", "run", "standalone"]
env:
- name: ETCD_ENDPOINTS
value: "{{ include "opencoze.fullname" . }}-etcd:2379"
- name: MINIO_ADDRESS
value: "{{ include "opencoze.fullname" . }}-minio:9000"
- name: MINIO_BUCKET_NAME
value: {{ .Values.milvus.bucketName | quote }}
- name: MINIO_ACCESS_KEY_ID
value: {{ .Values.minio.accessKey | quote }}
- name: MINIO_SECRET_ACCESS_KEY
value: {{ .Values.minio.secretKey | quote }}
- name: MINIO_USE_SSL
value: "false"
- name: LOG_LEVEL
value: "debug"
ports:
- containerPort: 19530
- containerPort: 9091
livenessProbe:
httpGet:
path: /healthz
port: 9091
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 3
readinessProbe:
httpGet:
path: /healthz
port: 9091
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 3
successThreshold: 1
failureThreshold: 3
volumeMounts:
- name: milvus-data
mountPath: /var/lib/milvus
volumeClaimTemplates:
- metadata:
name: milvus-data
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: {{ .Values.milvus.persistence.storageClassName | quote }}
resources:
requests:
storage: {{ .Values.milvus.persistence.size | quote }}
{{- end }}

View File

@@ -0,0 +1,21 @@
{{- if .Values.minio.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "opencoze.fullname" . }}-minio
labels:
{{- include "opencoze.labels" . | nindent 4 }}
spec:
type: {{ .Values.minio.service.type }}
ports:
- name: api
port: {{ .Values.minio.service.port }}
targetPort: {{ .Values.minio.service.port }}
- name: console
port: {{ .Values.minio.service.consolePort }}
targetPort: {{ .Values.minio.service.consolePort }}
selector:
app.kubernetes.io/component: minio
app.kubernetes.io/name: {{ include "opencoze.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

View File

@@ -0,0 +1,65 @@
{{- if .Values.minio.enabled }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "opencoze.fullname" . }}-minio
labels:
{{- include "opencoze.labels" . | nindent 4 }}
spec:
serviceName: {{ .Release.Name }}-minio
replicas: 1
selector:
matchLabels:
app.kubernetes.io/component: minio
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "opencoze.name" . }}
template:
metadata:
labels:
app.kubernetes.io/component: minio
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "opencoze.name" . }}
spec:
containers:
- name: minio
image: "{{ .Values.minio.image.repository }}:{{ .Values.minio.image.tag }}"
args:
- server
- /data
- --console-address
- ":{{ .Values.minio.service.consolePort }}"
env:
- name: MINIO_ROOT_USER
value: {{ .Values.minio.accessKey | quote }}
- name: MINIO_ROOT_PASSWORD
value: {{ .Values.minio.secretKey | quote }}
- name: MINIO_DEFAULT_BUCKETS
value: "{{ .Values.minio.bucket }},{{ .Values.milvus.bucketName }}"
ports:
- containerPort: {{ .Values.minio.service.port }}
- containerPort: {{ .Values.minio.service.consolePort }}
volumeMounts:
- name: minio-data
mountPath: /data
livenessProbe:
httpGet:
path: /minio/health/live
port: {{ .Values.minio.service.port }}
initialDelaySeconds: 30
periodSeconds: 15
readinessProbe:
httpGet:
path: /minio/health/ready
port: {{ .Values.minio.service.port }}
initialDelaySeconds: 20
periodSeconds: 10
volumeClaimTemplates:
- metadata:
name: minio-data
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: {{ .Values.minio.persistence.storageClassName | quote }}
resources:
requests:
storage: {{ .Values.minio.persistence.size | quote }}
{{- end }}

View File

@@ -0,0 +1,6 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "opencoze.fullname" . }}-mysql-init
data:
{{ (.Files.Glob "files/mysql/*.sql").AsConfig | indent 2 }}

View File

@@ -0,0 +1,53 @@
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "opencoze.fullname" . }}-mysql-init
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-weight": "-10"
"helm.sh/hook-after-create": "true"
spec:
template:
spec:
initContainers:
- name: wait-for-mysql
image: {{ .Values.images.busybox }}
command: ['sh', '-c', 'until nc -z {{ .Release.Name }}-mysql 3306; do echo waiting for mysql; sleep 2; done']
- name: sql-init
image: "{{ .Values.mysql.image.repository }}:{{ .Values.mysql.image.tag }}"
command:
- "/bin/sh"
- "-c"
- |
mysql -h {{ .Release.Name }}-mysql -u root -p"{{ .Values.mysql.rootPassword }}" -e "CREATE USER IF NOT EXISTS '{{ .Values.mysql.user }}'@'%' IDENTIFIED BY '{{ .Values.mysql.password }}';GRANT ALL PRIVILEGES ON {{ .Values.mysql.database }}.* TO '{{ .Values.mysql.user }}'@'%';FLUSH PRIVILEGES;"
mysql -h {{ .Release.Name }}-mysql -u {{ .Values.mysql.user }} -p"{{ .Values.mysql.password }}" {{ .Values.mysql.database }} < /sql/schema.sql
mysql -h {{ .Release.Name }}-mysql -u {{ .Values.mysql.user }} -p"{{ .Values.mysql.password }}" {{ .Values.mysql.database }} < /sql/sql_init.sql
volumeMounts:
- name: init-sql
mountPath: /sql/sql_init.sql
subPath: sql_init.sql
- name: schema-sql
mountPath: /sql/schema.sql
subPath: schema.sql
env:
- name: MYSQL_PASSWORD
value: {{ .Values.mysql.password | quote }}
containers:
- name: job-completer
image: {{ .Values.images.busybox }}
command: ["echo", "MySQL initialization complete"]
volumes:
- name: init-sql
configMap:
name: {{ include "opencoze.fullname" . }}-mysql-init
items:
- key: sql_init.sql
path: sql_init.sql
- name: schema-sql
configMap:
name: {{ include "opencoze.fullname" . }}-mysql-init
items:
- key: schema.sql
path: schema.sql
restartPolicy: Never
backoffLimit: 5

View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "opencoze.fullname" . }}-mysql
labels:
{{- include "opencoze.labels" . | nindent 4 }}
spec:
type: ClusterIP
ports:
- port: {{ .Values.mysql.port }}
targetPort: {{ .Values.mysql.targetPort }}
name: mysql
selector:
app.kubernetes.io/component: mysql
app.kubernetes.io/name: {{ include "opencoze.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}

View File

@@ -0,0 +1,69 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "opencoze.fullname" . }}-mysql
stringData:
mysql-password: {{ .Values.mysql.password | quote }}
mysql-root-password: {{ .Values.mysql.rootPassword | quote }}
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "opencoze.fullname" . }}-mysql
labels:
{{- include "opencoze.labels" . | nindent 4 }}
spec:
serviceName: {{ .Release.Name }}-mysql
replicas: 1
selector:
matchLabels:
app.kubernetes.io/component: mysql
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "opencoze.name" . }}
template:
metadata:
labels:
app.kubernetes.io/component: mysql
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "opencoze.name" . }}
spec:
containers:
- name: mysql
image: "{{ .Values.mysql.image.repository }}:{{ .Values.mysql.image.tag }}"
env:
- name: MYSQL_ROOT_PASSWORD
value: {{ .Values.mysql.rootPassword | quote }}
- name: MYSQL_DATABASE
value: {{ .Values.mysql.database | quote }}
- name: MYSQL_USER
value: {{ .Values.mysql.user | quote }}
- name: MYSQL_PASSWORD
value: {{ .Values.mysql.password | quote }}
ports:
- containerPort: 3306
args:
- "--character-set-server=utf8mb4"
- "--collation-server=utf8mb4_unicode_ci"
readinessProbe:
exec:
command:
- mysqladmin
- ping
- -uroot
- -p{{ .Values.mysql.rootPassword }}
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
volumeMounts:
- name: mysql-data
mountPath: /var/lib/mysql
volumeClaimTemplates:
- metadata:
name: mysql-data
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: {{ .Values.mysql.persistence.storageClassName | quote }}
resources:
requests:
storage: {{ .Values.mysql.persistence.size | quote }}

View File

@@ -0,0 +1,17 @@
{{- if .Values.redis.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "opencoze.fullname" . }}-redis
labels:
{{- include "opencoze.labels" . | nindent 4 }}
spec:
ports:
- port: {{ .Values.redis.port }}
targetPort: {{ .Values.redis.port }}
protocol: TCP
selector:
app.kubernetes.io/component: redis
app.kubernetes.io/name: {{ include "opencoze.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

View File

@@ -0,0 +1,49 @@
{{- if .Values.redis.enabled }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "opencoze.fullname" . }}-redis
labels:
{{- include "opencoze.labels" . | nindent 4 }}
spec:
serviceName: {{ .Release.Name }}-redis
replicas: 1
selector:
matchLabels:
app.kubernetes.io/component: redis
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "opencoze.name" . }}
template:
metadata:
labels:
app.kubernetes.io/component: redis
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "opencoze.name" . }}
spec:
containers:
- name: redis
image: "{{ .Values.redis.image.repository }}:{{ .Values.redis.image.tag }}"
env:
- name: REDIS_AOF_ENABLED
value: {{ .Values.redis.aofEnabled | quote }}
- name: REDIS_PORT_NUMBER
value: {{ .Values.redis.port | quote }}
- name: REDIS_IO_THREADS
value: {{ .Values.redis.ioThreads | quote }}
- name: ALLOW_EMPTY_PASSWORD
value: {{ .Values.redis.allowEmptyPassword | quote }}
ports:
- containerPort: {{ .Values.redis.port }}
volumeMounts:
- name: redis-data
mountPath: /bitnami/redis/data
volumeClaimTemplates:
- metadata:
name: redis-data
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: {{ .Values.redis.persistence.storageClassName | quote }}
resources:
requests:
storage: {{ .Values.redis.persistence.size | quote }}
{{- end }}

View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "opencoze.fullname" . }}-broker-config
labels:
{{- include "opencoze.labels" . | nindent 4 }}
data:
broker.conf: |-
brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
brokerIP1 = __POD_IP__

View File

@@ -0,0 +1,23 @@
{{- if .Values.rocketmq.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "opencoze.fullname" . }}-rocketmq-broker
labels:
{{- include "opencoze.labels" . | nindent 4 }}
spec:
ports:
- port: 10909
targetPort: 10909
name: broker-a
- port: 10911
targetPort: 10911
name: broker-b
- port: 10912
targetPort: 10912
name: broker-c
selector:
app.kubernetes.io/component: rocketmq-broker
app.kubernetes.io/name: {{ include "opencoze.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

View File

@@ -0,0 +1,126 @@
{{- if .Values.rocketmq.enabled }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "opencoze.fullname" . }}-rocketmq-broker
labels:
{{- include "opencoze.labels" . | nindent 4 }}
spec:
serviceName: {{ .Release.Name }}-rocketmq-broker
replicas: 1
selector:
matchLabels:
app.kubernetes.io/component: rocketmq-broker
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "opencoze.name" . }}
template:
metadata:
labels:
app.kubernetes.io/component: rocketmq-broker
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "opencoze.name" . }}
spec:
initContainers:
- name: wait-for-namesrv
image: opencoze-cn-beijing.cr.volces.com/iac/busybox:latest
command: ['sh', '-c', 'until nc -z {{ .Release.Name }}-rocketmq-namesrv 9876; do echo waiting for namesrv; sleep 2; done']
volumes:
- name: broker-config
configMap:
name: {{ include "opencoze.fullname" . }}-broker-config
containers:
- name: broker
image: "{{ .Values.rocketmq.broker.image.repository }}:{{ .Values.rocketmq.broker.image.tag }}"
env:
- name: NAMESRV_ADDR
value: "{{ include "opencoze.fullname" . }}-rocketmq-namesrv:9876"
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
command:
- /bin/bash
- -c
- |
set -ex
mkdir -p /home/rocketmq/logs/rocketmqlogs /home/rocketmq/store
touch /home/rocketmq/logs/rocketmqlogs/tools.log \
/home/rocketmq/logs/rocketmqlogs/tools_default.log
chown -R rocketmq:rocketmq /home/rocketmq/logs /home/rocketmq/store
chmod g+s /home/rocketmq/logs /home/rocketmq/store
echo "Starting RocketMQ Broker..."
cp /home/rocketmq/conf/broker.conf /tmp/broker.conf
sed -i "s/__POD_IP__/$POD_IP/g" /tmp/broker.conf
echo "broker.conf content after sed:"
cat /tmp/broker.conf
/home/rocketmq/rocketmq-5.3.2/bin/mqbroker -c /tmp/broker.conf &
broker_ready=false
for i in {1..60}; do
if /home/rocketmq/rocketmq-5.3.2/bin/mqadmin clusterList -n $NAMESRV_ADDR | grep -q "DefaultCluster.*broker-a"; then
echo "Registered."
broker_ready=true
break
fi
echo "Not ready, retry $i/60..."
sleep 1
done
if [ "$broker_ready" = false ]; then
echo "ERROR: registration timed out."
exit 1
fi
touch /tmp/rocketmq_ready
echo "Broker started successfully."
echo "Creating topics..."
{{- range .Values.rocketmq.topics }}
/home/rocketmq/rocketmq-5.3.2/bin/mqadmin updateTopic -n $NAMESRV_ADDR -c DefaultCluster -t "{{ . }}"
{{- end }}
echo "Creating consumer groups..."
{{- range .Values.rocketmq.consumerGroups }}
/home/rocketmq/rocketmq-5.3.2/bin/mqadmin updateSubGroup -n $NAMESRV_ADDR -c DefaultCluster -g "{{ . }}"
{{- end }}
wait
readinessProbe:
exec:
command:
- sh
- -c
- "[ -f /tmp/rocketmq_ready ]"
initialDelaySeconds: 30
periodSeconds: 10
securityContext:
privileged: true
runAsUser: 0
ports:
- containerPort: 10909
- containerPort: 10911
volumeMounts:
- name: broker-store
mountPath: /home/rocketmq/store
- name: broker-logs
mountPath: /home/rocketmq/logs
- name: broker-config
mountPath: /home/rocketmq/conf/broker.conf
subPath: broker.conf
volumeClaimTemplates:
- metadata:
name: broker-store
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: {{ .Values.rocketmq.broker.persistence.store.storageClassName | quote }}
resources:
requests:
storage: {{ .Values.rocketmq.broker.persistence.store.size | quote }}
- metadata:
name: broker-logs
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: {{ .Values.rocketmq.broker.persistence.logs.storageClassName | quote }}
resources:
requests:
storage: {{ .Values.rocketmq.broker.persistence.logs.size | quote }}
{{- end }}

View File

@@ -0,0 +1,17 @@
{{- if .Values.rocketmq.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "opencoze.fullname" . }}-rocketmq-namesrv
labels:
{{- include "opencoze.labels" . | nindent 4 }}
spec:
clusterIP: None
ports:
- port: 9876
name: namesrv
selector:
app.kubernetes.io/component: rocketmq-namesrv
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "opencoze.name" . }}
{{- end }}

View File

@@ -0,0 +1,71 @@
{{- if .Values.rocketmq.enabled }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "opencoze.fullname" . }}-rocketmq-namesrv
labels:
{{- include "opencoze.labels" . | nindent 4 }}
spec:
serviceName: {{ .Release.Name }}-rocketmq-namesrv
replicas: 1
selector:
matchLabels:
app.kubernetes.io/component: rocketmq-namesrv
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "opencoze.name" . }}
template:
metadata:
labels:
app.kubernetes.io/component: rocketmq-namesrv
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "opencoze.name" . }}
spec:
containers:
- name: namesrv
securityContext:
runAsUser: 0
image: "{{ .Values.rocketmq.namesrv.image.repository }}:{{ .Values.rocketmq.namesrv.image.tag }}"
command:
- /bin/bash
- -c
- |
set -ex
export PATH=$PATH:/home/rocketmq/rocketmq-5.3.2/bin
mkdir -p /home/rocketmq/logs /home/rocketmq/store
chown -R rocketmq:rocketmq /home/rocketmq/logs /home/rocketmq/store
exec sh mqnamesrv
ports:
- containerPort: 9876
readinessProbe:
exec:
command:
- sh
- -c
- "/home/rocketmq/rocketmq-5.3.2/bin/mqadmin clusterList -n localhost:9876"
initialDelaySeconds: 20
periodSeconds: 10
timeoutSeconds: 5
volumeMounts:
- name: namesrv-store
mountPath: /home/rocketmq/store
- name: namesrv-logs
mountPath: /home/rocketmq/logs
volumeClaimTemplates:
- metadata:
name: namesrv-store
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: {{ .Values.rocketmq.namesrv.persistence.store.storageClassName | quote }}
resources:
requests:
storage: {{ .Values.rocketmq.namesrv.persistence.store.size | quote }}
- metadata:
name: namesrv-logs
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: {{ .Values.rocketmq.namesrv.persistence.logs.storageClassName | quote }}
resources:
requests:
storage: {{ .Values.rocketmq.namesrv.persistence.logs.size | quote }}
{{- end }}

View File

@@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: {{ printf "%s-server" (include "opencoze.fullname" .) }}
labels:
{{- include "opencoze.labels" . | nindent 4 }}
spec:
type: {{ .Values.cozeServer.service.type }}
ports:
- port: {{ .Values.cozeServer.service.port }}
targetPort: http
protocol: TCP
name: app-port
selector:
app.kubernetes.io/name: {{ include "opencoze.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: server

View File

@@ -0,0 +1,9 @@
{{- if not .Values.mysql.rootPassword -}}
{{- fail "mysql.rootPassword is required" -}}
{{- end -}}
{{- if not .Values.minio.accessKey -}}
{{- fail "minio.accessKey is required" -}}
{{- end -}}
{{- if not .Values.minio.secretKey -}}
{{- fail "minio.secretKey is required" -}}
{{- end -}}

View File

@@ -0,0 +1,45 @@
mysql:
persistence:
storageClassName: "hostpath"
redis:
persistence:
storageClassName: "hostpath"
# -- coze-server configuration
cozeServer:
env:
MINIO_ENDPOINT: "localhost:9000"
rocketmq:
namesrv:
persistence:
store:
storageClassName: "hostpath"
logs:
storageClassName: "hostpath"
broker:
persistence:
store:
storageClassName: "hostpath"
logs:
storageClassName: "hostpath"
elasticsearch:
persistence:
storageClassName: "hostpath"
minio:
persistence:
storageClassName: "hostpath"
etcd:
persistence:
storageClassName: "hostpath"
milvus:
persistence:
storageClassName: "hostpath"

View File

@@ -0,0 +1,263 @@
# Default values for opencoze.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
mysql:
enabled: true
port: 3306
targetPort: 3306
image:
repository: opencoze-cn-beijing.cr.volces.com/iac/mysql
tag: 8.4.5
rootPassword: "root"
database: opencoze
user: coze
password: coze123
persistence:
storageClassName: "opencoze-data"
size: "50Gi"
initScripts:
- files/mysql/init.sql
- files/mysql/sql_init.sql
redis:
enabled: true
image:
repository: opencoze-cn-beijing.cr.volces.com/iac/redis
tag: "7.2"
aofEnabled: "no"
port: 6379
ioThreads: 4
allowEmptyPassword: "yes"
password: ""
persistence:
storageClassName: "opencoze-data"
size: "50Gi"
# -- coze-server configuration
cozeServer:
enabled: true
# -- Number of replicas for the coze-server deployment
replicaCount: 1
image:
repository: opencoze-cn-beijing.cr.volces.com/iac/opencoze
pullPolicy: IfNotPresent
tag: 'latest'
service:
type: LoadBalancer
port: 8888
env:
LOG_LEVEL: "debug"
MAX_REQUEST_BODY_SIZE: "1073741824"
STORAGE_TYPE: "minio"
MINIO_POD_PROXY_URL: "opencoze-minio:9000"
MINIO_ENDPOINT: "127.0.0.1:9000"
ES_VERSION: "v8"
VECTOR_STORE_TYPE: "milvus"
EMBEDDING_TYPE: "openai"
OPENAI_EMBEDDING_BASE_URL: "https://api.openai.com/v1/embeddings"
OPENAI_EMBEDDING_MODEL: "text-embedding-3-large"
OPENAI_EMBEDDING_API_KEY: "your_api_key"
OPENAI_EMBEDDING_BY_AZURE: "false"
OPENAI_EMBEDDING_DIMS: "1024"
OCR_TYPE: "ve"
VE_OCR_AK: ""
VE_OCR_SK: ""
BUILTIN_CM_TYPE: "openai"
BUILTIN_CM_OPENAI_BASE_URL: "https://api.openai.com/v1/chat/completions"
BUILTIN_CM_OPENAI_API_KEY: "your_api_key"
BUILTIN_CM_OPENAI_BY_AZURE: "false"
BUILTIN_CM_OPENAI_MODEL: "gpt-4o-2024-05-13"
VE_IMAGEX_AK: ""
VE_IMAGEX_SK: ""
VE_IMAGEX_SERVER_ID: ""
VE_IMAGEX_DOMAIN: ""
VE_IMAGEX_TEMPLATE: ""
VE_IMAGEX_UPLOAD_HOST: "https://imagex.volcengineapi.com"
rocketmq:
enabled: true
namesrv:
replicaCount: 1
image:
repository: opencoze-cn-beijing.cr.volces.com/iac/rocketmq
tag: 5.3.2
persistence:
store:
storageClassName: "opencoze-data"
size: "20Gi"
logs:
storageClassName: "opencoze-data"
size: "20Gi"
resources:
limits:
cpu: 2000m
memory: 4Gi
livenessProbe:
exec:
command: ["sh", "-c", "mqadmin clusterList -n localhost:9876"]
initialDelaySeconds: 30
periodSeconds: 10
topics:
- opencoze_knowledge
- opencoze_search_app
- opencoze_search_resource
- "%RETRY%cg_knowledge"
- "%RETRY%cg_search_app"
- "%RETRY%cg_search_resource"
consumerGroups:
- cg_knowledge
- cg_search_app
- cg_search_resource
broker:
replicaCount: 1
image:
repository: opencoze-cn-beijing.cr.volces.com/iac/rocketmq
tag: 5.3.2
config: |
brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
persistence:
store:
storageClassName: "opencoze-data"
size: "20Gi"
logs:
storageClassName: "opencoze-data"
size: "20Gi"
resources:
limits:
cpu: 4000m
memory: 8Gi
initContainers:
- name: wait-for-namesrv
image: opencoze-cn-beijing.cr.volces.com/iac/busybox:latest
command: ['sh', '-c', 'until nc -z rocketmq-namesrv 9876; do echo waiting for namesrv; sleep 2; done']
elasticsearch:
enabled: true
image:
repository: opencoze-cn-beijing.cr.volces.com/iac/elasticsearch
tag: 8.18.0
javaOpts: "-Djdk.tls.client.protocols=TLSv1.2 -Dhttps.protocols=TLSv1.2 -Djavax.net.ssl.trustAll=true -Xms4096m -Xmx4096m"
username: ""
password: ""
persistence:
enabled: true
storageClassName: "opencoze-data"
accessModes:
- ReadWriteOnce
size: 50Gi
service:
type: ClusterIP
port: 9200
targetPort: 9200
minio:
enabled: true
image:
repository: opencoze-cn-beijing.cr.volces.com/iac/minio
tag: latest
accessKey: minioadmin
secretKey: minioadmin123
bucket: opencoze
service:
type: LoadBalancer
port: 9000
consolePort: 9001
persistence:
storageClassName: "opencoze-data"
size: "50Gi"
resources:
limits:
cpu: 8000m
memory: 16Gi
requests:
cpu: 4000m
memory: 8Gi
etcd:
enabled: true
image:
repository: opencoze-cn-beijing.cr.volces.com/iac/etcd
tag: 3.5
persistence:
storageClassName: "opencoze-data"
size: "20Gi"
milvus:
enabled: true
image:
repository: opencoze-cn-beijing.cr.volces.com/iac/milvus
tag: v2.5.10
bucketName: milvus
persistence:
storageClassName: "opencoze-data"
size: "20Gi"
kibana:
enabled: true
image:
repository: opencoze-cn-beijing.cr.volces.com/iac/kibana
tag: 8.18.0
service:
type: ClusterIP
port: 5601
images:
busybox: opencoze-cn-beijing.cr.volces.com/iac/busybox:latest
curl: opencoze-cn-beijing.cr.volces.com/iac/curl:8.12.1
# -- We will add other services like mysql, redis etc. here later
# This is to override the chart name.
nameOverride: ''
fullnameOverride: ''
# This is for setting Kubernetes Annotations to a Pod.
# For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
podAnnotations: {}
securityContext:
{}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
# This is for setting up a service more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/
service:
# This sets the service type more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
type: ClusterIP
# This sets the ports more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#field-spec-ports
port: 80
# This block is for setting up the ingress for more information can be found here: https://kubernetes.io/docs/concepts/services-networking/ingress/
ingress:
enabled: false
className: ''
annotations:
{}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local