chore: import upstream snapshot with attribution
@@ -0,0 +1,277 @@
|
||||
# run mode
|
||||
export RUN_MODE="debug" # Currently supports debug mode. When set to debug, it helps developers print raw error messages during development and debugging, such as agent debugging.
|
||||
|
||||
# Server
|
||||
export LISTEN_ADDR=":8888"
|
||||
export LOG_LEVEL="debug"
|
||||
export MAX_REQUEST_BODY_SIZE=1073741824
|
||||
export SERVER_HOST="http://localhost${LISTEN_ADDR}"
|
||||
export MINIO_PROXY_ENDPOINT=""
|
||||
export USE_SSL="0"
|
||||
export SSL_CERT_FILE=""
|
||||
export SSL_KEY_FILE=""
|
||||
export WEB_LISTEN_ADDR="127.0.0.1:8888" # To enable remote access, use 0.0.0.0:8888.
|
||||
|
||||
# MySQL
|
||||
export MYSQL_ROOT_PASSWORD=root
|
||||
export MYSQL_DATABASE=opencoze
|
||||
export MYSQL_USER=coze
|
||||
export MYSQL_PASSWORD=coze123
|
||||
export MYSQL_HOST=127.0.0.1
|
||||
export MYSQL_PORT=3306
|
||||
export MYSQL_DSN="${MYSQL_USER}:${MYSQL_PASSWORD}@tcp(${MYSQL_HOST}:${MYSQL_PORT})/${MYSQL_DATABASE}?charset=utf8mb4&parseTime=True"
|
||||
export ATLAS_URL="mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@${MYSQL_HOST}:${MYSQL_PORT}/${MYSQL_DATABASE}?charset=utf8mb4&parseTime=True"
|
||||
|
||||
# Redis
|
||||
export REDIS_AOF_ENABLED=no
|
||||
export REDIS_IO_THREADS=4
|
||||
export ALLOW_EMPTY_PASSWORD=yes
|
||||
export REDIS_ADDR="127.0.0.1:6379"
|
||||
export REDIS_PASSWORD=""
|
||||
|
||||
# This Upload component used in Agent / workflow File/Image With LLM , support the component of imagex / storage
|
||||
# default: storage, use the settings of storage component
|
||||
# if imagex, you must finish the configuration of <VolcEngine ImageX>
|
||||
export FILE_UPLOAD_COMPONENT_TYPE="storage"
|
||||
|
||||
# VolcEngine ImageX
|
||||
export VE_IMAGEX_AK=""
|
||||
export VE_IMAGEX_SK=""
|
||||
export VE_IMAGEX_SERVER_ID=""
|
||||
export VE_IMAGEX_DOMAIN=""
|
||||
export VE_IMAGEX_TEMPLATE=""
|
||||
export VE_IMAGEX_UPLOAD_HOST="https://imagex.volcengineapi.com"
|
||||
|
||||
# Storage component
|
||||
export STORAGE_TYPE="minio" # minio / tos / s3
|
||||
export STORAGE_UPLOAD_HTTP_SCHEME="http" # http / https. If coze studio website is https, you must set it to https
|
||||
export STORAGE_BUCKET="opencoze"
|
||||
# MiniIO
|
||||
export MINIO_ROOT_USER=minioadmin
|
||||
export MINIO_ROOT_PASSWORD=minioadmin123
|
||||
export MINIO_DEFAULT_BUCKETS=milvus
|
||||
export MINIO_AK=$MINIO_ROOT_USER
|
||||
export MINIO_SK=$MINIO_ROOT_PASSWORD
|
||||
export MINIO_ENDPOINT="127.0.0.1:9000"
|
||||
export MINIO_API_HOST="http://${MINIO_ENDPOINT}"
|
||||
|
||||
# TOS
|
||||
export TOS_ACCESS_KEY=
|
||||
export TOS_SECRET_KEY=
|
||||
export TOS_ENDPOINT=https://tos-cn-beijing.volces.com
|
||||
export TOS_REGION=cn-beijing
|
||||
|
||||
# S3
|
||||
export S3_ACCESS_KEY=
|
||||
export S3_SECRET_KEY=
|
||||
export S3_ENDPOINT=
|
||||
export S3_BUCKET_ENDPOINT=
|
||||
export S3_REGION=
|
||||
|
||||
# Elasticsearch
|
||||
export ES_ADDR="http://127.0.0.1:9200"
|
||||
export ES_VERSION="v8"
|
||||
export ES_USERNAME=""
|
||||
export ES_PASSWORD=""
|
||||
export ES_NUMBER_OF_SHARDS="1"
|
||||
export ES_NUMBER_OF_REPLICAS="1"
|
||||
|
||||
export COZE_MQ_TYPE="nsq" # nsq / kafka / rmq
|
||||
export MQ_NAME_SERVER="127.0.0.1:4150"
|
||||
# RocketMQ
|
||||
export RMQ_ACCESS_KEY=""
|
||||
export RMQ_SECRET_KEY=""
|
||||
|
||||
# Settings for VectorStore
|
||||
# VectorStore type: milvus / vikingdb / oceanbase
|
||||
# If you want to use vikingdb, you need to set up the vikingdb configuration.
|
||||
export VECTOR_STORE_TYPE="milvus"
|
||||
# milvus vector store
|
||||
export MILVUS_ADDR="127.0.0.1:19530"
|
||||
export MILVUS_USER=""
|
||||
export MILVUS_PASSWORD=""
|
||||
export MILVUS_TOKEN=""
|
||||
# vikingdb vector store for Volcengine
|
||||
export VIKING_DB_HOST=""
|
||||
export VIKING_DB_REGION=""
|
||||
export VIKING_DB_AK=""
|
||||
export VIKING_DB_SK=""
|
||||
export VIKING_DB_SCHEME=""
|
||||
export VIKING_DB_MODEL_NAME="" # if vikingdb model name is not set, you need to set Embedding settings
|
||||
|
||||
# oceanbase vector store
|
||||
export OCEANBASE_HOST="127.0.0.1"
|
||||
export OCEANBASE_PORT=2881
|
||||
export OCEANBASE_USER="root@test"
|
||||
export OCEANBASE_PASSWORD="coze123"
|
||||
export OCEANBASE_DATABASE="test"
|
||||
|
||||
# Settings for Embedding
|
||||
# The Embedding model relied on by knowledge base vectorization does not need to be configured
|
||||
# if the vector database comes with built-in Embedding functionality (such as VikingDB). Currently,
|
||||
# Coze Studio supports four access methods: openai, ark, ollama, and custom http. Users can simply choose one of them when using
|
||||
# embedding type: openai / ark / ollama / http / gemini
|
||||
export EMBEDDING_TYPE="ark"
|
||||
export EMBEDDING_MAX_BATCH_SIZE=100
|
||||
|
||||
# openai embedding
|
||||
export OPENAI_EMBEDDING_BASE_URL="" # (string, required) OpenAI embedding base_url
|
||||
export OPENAI_EMBEDDING_MODEL="" # (string, required) OpenAI embedding model
|
||||
export OPENAI_EMBEDDING_API_KEY="" # (string, required) OpenAI embedding api_key
|
||||
export OPENAI_EMBEDDING_BY_AZURE=false # (bool, optional) OpenAI embedding by_azure
|
||||
export OPENAI_EMBEDDING_API_VERSION="" # (string, optional) OpenAI embedding azure api version
|
||||
export OPENAI_EMBEDDING_DIMS=1024 # (int, required) OpenAI embedding dimensions
|
||||
export OPENAI_EMBEDDING_REQUEST_DIMS=1024 # (int, optional) OpenAI embedding dimensions in requests, need to be empty if api doesn't support specifying dimensions.
|
||||
|
||||
# ark embedding by volcengine / byteplus
|
||||
export ARK_EMBEDDING_MODEL="" # (string, required) Ark embedding model
|
||||
export ARK_EMBEDDING_API_KEY="" # (string, required) Ark embedding api_key
|
||||
export ARK_EMBEDDING_DIMS="2048" # (int, required) Ark embedding dimensions
|
||||
export ARK_EMBEDDING_BASE_URL="" # (string, required) Ark embedding base_url
|
||||
export ARK_EMBEDDING_API_TYPE="" # (string, optional) Ark embedding api type, should be "text_api" / "multi_modal_api". Default "text_api".
|
||||
|
||||
# ollama embedding
|
||||
export OLLAMA_EMBEDDING_BASE_URL="" # (string, required) Ollama embedding base_url
|
||||
export OLLAMA_EMBEDDING_MODEL="" # (string, required) Ollama embedding model
|
||||
export OLLAMA_EMBEDDING_DIMS="" # (int, required) Ollama embedding dimensions
|
||||
|
||||
# gemini embedding
|
||||
export GEMINI_EMBEDDING_BASE_URL="" # (string, required) Gemini embedding base_url
|
||||
export GEMINI_EMBEDDING_MODEL="gemini-embedding-001" # (string, required) Gemini embedding model.
|
||||
export GEMINI_EMBEDDING_API_KEY="" # (string, required) Gemini embedding api_key
|
||||
export GEMINI_EMBEDDING_DIMS=2048 # (int, required) Gemini embedding dimensions
|
||||
export GEMINI_EMBEDDING_BACKEND="1" # (string, required) Gemini embedding backend, should be "1" for BackendGeminiAPI / "2" for BackendVertexAI.
|
||||
export GEMINI_EMBEDDING_PROJECT="" # (string, optional) Gemini embedding project
|
||||
export GEMINI_EMBEDDING_LOCATION="" # (string, optional) Gemini embedding location
|
||||
|
||||
# http embedding
|
||||
export HTTP_EMBEDDING_ADDR="" # (string, required) http embedding address
|
||||
export HTTP_EMBEDDING_DIMS=1024 # (string, required) http embedding dimensions
|
||||
|
||||
# Settings for Rerank
|
||||
# If you want to use the rerank-related functions in the knowledge base feature,You need to set up the rerank configuration.
|
||||
export RERANK_TYPE="" # current support `vikingdb`,`rrf`,default:rrf
|
||||
# vikingdb rerank
|
||||
export VIKINGDB_RERANK_HOST="" # optional,default:api-knowledgebase.mlp.cn-beijing.volces.com
|
||||
export VIKINGDB_RERANK_REGION="" # optional,default:cn-north-1
|
||||
export VIKINGDB_RERANK_AK="" # required
|
||||
export VIKINGDB_RERANK_SK="" # required
|
||||
export VIKINGDB_RERANK_MODEL="" # optional,default:base-multilingual-rerank,also support m3-v2-rerank
|
||||
|
||||
# Settings for OCR
|
||||
# If you want to use the OCR-related functions in the knowledge base feature,You need to set up the OCR configuration.
|
||||
# Currently, Coze Studio has built-in Volcano OCR.
|
||||
# Supported OCR types: `ve`, `paddleocr`
|
||||
export OCR_TYPE="ve"
|
||||
# ve ocr
|
||||
export VE_OCR_AK=""
|
||||
export VE_OCR_SK=""
|
||||
# paddleocr ocr
|
||||
export PADDLEOCR_OCR_API_URL=""
|
||||
|
||||
# Settings for Document Parser
|
||||
# Supported parser types: `builtin`, `paddleocr`
|
||||
export PARSER_TYPE="builtin"
|
||||
# paddleocr structure
|
||||
export PADDLEOCR_STRUCTURE_API_URL=""
|
||||
|
||||
# Settings for Model
|
||||
# Model for agent & workflow
|
||||
# add suffix number to add different models
|
||||
export MODEL_PROTOCOL_0="ark" # protocol
|
||||
export MODEL_OPENCOZE_ID_0="100001" # id for record
|
||||
export MODEL_NAME_0="" # model name for show
|
||||
export MODEL_ID_0="" # model name for connection
|
||||
export MODEL_API_KEY_0="" # model api key
|
||||
export MODEL_BASE_URL_0="" # model base url
|
||||
|
||||
# Model for knowledge nl2sql, messages2query (rewrite), image annotation, workflow knowledge recall
|
||||
# add prefix to assign specific model, downgrade to default config when prefix is not configured:
|
||||
# 1. nl2sql: NL2SQL_ (e.g. NL2SQL_BUILTIN_CM_TYPE)
|
||||
# 2. messages2query: M2Q_ (e.g. M2Q_BUILTIN_CM_TYPE)
|
||||
# 3. image annotation: IA_ (e.g. IA_BUILTIN_CM_TYPE)
|
||||
# 4. workflow knowledge recall: WKR_ (e.g. WKR_BUILTIN_CM_TYPE)
|
||||
# supported chat model type: openai / ark / deepseek / ollama / qwen / gemini
|
||||
export BUILTIN_CM_TYPE="ark"
|
||||
# type openai
|
||||
export BUILTIN_CM_OPENAI_BASE_URL=""
|
||||
export BUILTIN_CM_OPENAI_API_KEY=""
|
||||
export BUILTIN_CM_OPENAI_BY_AZURE=false
|
||||
export BUILTIN_CM_OPENAI_MODEL=""
|
||||
|
||||
# type ark
|
||||
export BUILTIN_CM_ARK_API_KEY=""
|
||||
export BUILTIN_CM_ARK_MODEL=""
|
||||
export BUILTIN_CM_ARK_BASE_URL=""
|
||||
|
||||
# type deepseek
|
||||
export BUILTIN_CM_DEEPSEEK_BASE_URL=""
|
||||
export BUILTIN_CM_DEEPSEEK_API_KEY=""
|
||||
export BUILTIN_CM_DEEPSEEK_MODEL=""
|
||||
|
||||
# type ollama
|
||||
export BUILTIN_CM_OLLAMA_BASE_URL=""
|
||||
export BUILTIN_CM_OLLAMA_MODEL=""
|
||||
|
||||
# type qwen
|
||||
export BUILTIN_CM_QWEN_BASE_URL=""
|
||||
export BUILTIN_CM_QWEN_API_KEY=""
|
||||
export BUILTIN_CM_QWEN_MODEL=""
|
||||
|
||||
# type gemini
|
||||
export BUILTIN_CM_GEMINI_BACKEND=""
|
||||
export BUILTIN_CM_GEMINI_API_KEY=""
|
||||
export BUILTIN_CM_GEMINI_PROJECT=""
|
||||
export BUILTIN_CM_GEMINI_LOCATION=""
|
||||
export BUILTIN_CM_GEMINI_BASE_URL=""
|
||||
export BUILTIN_CM_GEMINI_MODEL=""
|
||||
|
||||
|
||||
# Workflow Code Runner Configuration
|
||||
# Supported code runner types: sandbox / local
|
||||
# Default using local
|
||||
# - sandbox: execute python code in a sandboxed env with deno + pyodide
|
||||
# - local: using venv, no env isolation
|
||||
export CODE_RUNNER_TYPE="local"
|
||||
# Sandbox sub configuration
|
||||
# Access restricted to specific environment variables, split with comma, e.g. "PATH,USERNAME"
|
||||
export CODE_RUNNER_ALLOW_ENV=""
|
||||
# Read access restricted to specific paths, split with comma, e.g. "/tmp,./data"
|
||||
export CODE_RUNNER_ALLOW_READ=""
|
||||
# Write access restricted to specific paths, split with comma, e.g. "/tmp,./data"
|
||||
export CODE_RUNNER_ALLOW_WRITE=""
|
||||
# Subprocess execution restricted to specific commands, split with comma, e.g. "python,git"
|
||||
export CODE_RUNNER_ALLOW_RUN=""
|
||||
# Network access restricted to specific domains/IPs, split with comma, e.g. "api.test.com,api.test.org:8080"
|
||||
# The following CDN supports downloading the packages required for pyodide to run Python code. Sandbox may not work properly if removed.
|
||||
export CODE_RUNNER_ALLOW_NET="cdn.jsdelivr.net"
|
||||
# Foreign Function Interface access to specific libraries, split with comma, e.g. "/usr/lib/libm.so"
|
||||
export CODE_RUNNER_ALLOW_FFI=""
|
||||
# Directory for deno modules, default using pwd. e.g. "/tmp/path/node_modules"
|
||||
export CODE_RUNNER_NODE_MODULES_DIR=""
|
||||
# Code execution timeout, default 60 seconds. e.g. "2.56"
|
||||
export CODE_RUNNER_TIMEOUT_SECONDS=""
|
||||
# Code execution memory limit, default 100MB. e.g. "256"
|
||||
export CODE_RUNNER_MEMORY_LIMIT_MB=""
|
||||
|
||||
# The function of registration controller
|
||||
# If you want to disable the registration feature, set DISABLE_USER_REGISTRATION to true. You can then control allowed registrations via a whitelist with ALLOW_REGISTRATION_EMAIL.
|
||||
export DISABLE_USER_REGISTRATION="" # default "", if you want to disable, set to true
|
||||
export ALLOW_REGISTRATION_EMAIL="" # is a list of email addresses, separated by ",". Example: "11@example.com,22@example.com"
|
||||
|
||||
# Plugin AES secret.
|
||||
# PLUGIN_AES_AUTH_SECRET is the secret of used to encrypt plugin authorization payload.
|
||||
# The size of secret must be 16, 24 or 32 bytes.
|
||||
export PLUGIN_AES_AUTH_SECRET='^*6x3hdu2nc%-p38'
|
||||
# PLUGIN_AES_STATE_SECRET is the secret of used to encrypt oauth state.
|
||||
# The size of secret must be 16, 24 or 32 bytes.
|
||||
export PLUGIN_AES_STATE_SECRET='osj^kfhsd*(z!sno'
|
||||
# PLUGIN_AES_OAUTH_TOKEN_SECRET is the secret of used to encrypt oauth refresh token and access token.
|
||||
# The size of secret must be 16, 24 or 32 bytes.
|
||||
export PLUGIN_AES_OAUTH_TOKEN_SECRET='cn+$PJ(HhJ[5d*z9'
|
||||
|
||||
|
||||
# Coze Saas API Configuration
|
||||
export COZE_SAAS_PLUGIN_ENABLED="" # default "", if you want to enable, set to true
|
||||
export COZE_SAAS_API_BASE_URL="https://api.coze.cn"
|
||||
export COZE_SAAS_API_KEY=""
|
||||
@@ -0,0 +1,274 @@
|
||||
# Server
|
||||
export LISTEN_ADDR=":8888"
|
||||
export LOG_LEVEL="debug"
|
||||
export MAX_REQUEST_BODY_SIZE=1073741824
|
||||
export SERVER_HOST="http://localhost${LISTEN_ADDR}"
|
||||
export USE_SSL="0"
|
||||
export SSL_CERT_FILE=""
|
||||
export SSL_KEY_FILE=""
|
||||
export WEB_LISTEN_ADDR="127.0.0.1:8888" # To enable remote access, use 0.0.0.0:8888.
|
||||
|
||||
# MySQL
|
||||
export MYSQL_ROOT_PASSWORD=root
|
||||
export MYSQL_DATABASE=opencoze
|
||||
export MYSQL_USER=coze
|
||||
export MYSQL_PASSWORD=coze123
|
||||
export MYSQL_HOST=mysql
|
||||
export MYSQL_PORT=3306
|
||||
export MYSQL_DSN="${MYSQL_USER}:${MYSQL_PASSWORD}@tcp(${MYSQL_HOST}:${MYSQL_PORT})/${MYSQL_DATABASE}?charset=utf8mb4&parseTime=True"
|
||||
export ATLAS_URL="mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@${MYSQL_HOST}:${MYSQL_PORT}/${MYSQL_DATABASE}?charset=utf8mb4&parseTime=True"
|
||||
export MYSQL_MAX_IDLE_CONNS=10
|
||||
export MYSQL_MAX_OPEN_CONNS=100
|
||||
export MYSQL_CONN_MAX_LIFETIME=3600 # seconds
|
||||
export MYSQL_CONN_MAX_IDLE_TIME=600 # seconds
|
||||
|
||||
# Redis
|
||||
export REDIS_AOF_ENABLED=no
|
||||
export REDIS_IO_THREADS=4
|
||||
export ALLOW_EMPTY_PASSWORD=yes
|
||||
export REDIS_ADDR="redis:6379"
|
||||
export REDIS_PASSWORD=""
|
||||
|
||||
# This Upload component used in Agent / workflow File/Image With LLM , support the component of imagex / storage
|
||||
# default: storage, use the settings of storage component
|
||||
# if imagex, you must finish the configuration of <VolcEngine ImageX>
|
||||
export FILE_UPLOAD_COMPONENT_TYPE="storage"
|
||||
|
||||
# VolcEngine ImageX
|
||||
export VE_IMAGEX_AK=""
|
||||
export VE_IMAGEX_SK=""
|
||||
export VE_IMAGEX_SERVER_ID=""
|
||||
export VE_IMAGEX_DOMAIN=""
|
||||
export VE_IMAGEX_TEMPLATE=""
|
||||
export VE_IMAGEX_UPLOAD_HOST="https://imagex.volcengineapi.com"
|
||||
|
||||
# Storage component
|
||||
export STORAGE_TYPE="minio" # minio / tos / s3
|
||||
export STORAGE_UPLOAD_HTTP_SCHEME="http" # http / https. If coze studio website is https, you must set it to https
|
||||
export STORAGE_BUCKET="opencoze"
|
||||
# MiniIO
|
||||
export MINIO_ROOT_USER=minioadmin
|
||||
export MINIO_ROOT_PASSWORD=minioadmin123
|
||||
export MINIO_DEFAULT_BUCKETS=milvus
|
||||
export MINIO_AK=$MINIO_ROOT_USER
|
||||
export MINIO_SK=$MINIO_ROOT_PASSWORD
|
||||
export MINIO_ENDPOINT="minio:9000"
|
||||
export MINIO_API_HOST="http://${MINIO_ENDPOINT}"
|
||||
export MINIO_USE_SSL=false
|
||||
|
||||
# TOS
|
||||
export TOS_ACCESS_KEY=
|
||||
export TOS_SECRET_KEY=
|
||||
export TOS_ENDPOINT=https://tos-cn-beijing.volces.com
|
||||
export TOS_REGION=cn-beijing
|
||||
|
||||
# S3
|
||||
export S3_ACCESS_KEY=
|
||||
export S3_SECRET_KEY=
|
||||
export S3_ENDPOINT=
|
||||
export S3_BUCKET_ENDPOINT=
|
||||
export S3_REGION=
|
||||
|
||||
# Elasticsearch
|
||||
export ES_ADDR="http://elasticsearch:9200"
|
||||
export ES_VERSION="v8"
|
||||
export ES_USERNAME=""
|
||||
export ES_PASSWORD=""
|
||||
export ES_NUMBER_OF_SHARDS="1"
|
||||
export ES_NUMBER_OF_REPLICAS="1"
|
||||
|
||||
# Backend Event Bus
|
||||
export COZE_MQ_TYPE="nsq" # nsq / kafka / rmq / pulsar / nats
|
||||
export MQ_NAME_SERVER="nsqd:4150"
|
||||
# RocketMQ
|
||||
export RMQ_ACCESS_KEY=""
|
||||
export RMQ_SECRET_KEY=""
|
||||
# Pulsar
|
||||
# Use Pulsar as backend eventbus, MQ_NAME_SERVER example is: "pulsar:6650"
|
||||
# Fill PULSAR_JWT_TOKEN for JWT auth, leave empty for no auth
|
||||
export PULSAR_SERVICE_URL="pulsar://pulsar-service:6650"
|
||||
export PULSAR_JWT_TOKEN=""
|
||||
# NATS
|
||||
# Use NATS as backend eventbus with JetStream support
|
||||
# Set COZE_MQ_TYPE="nats" and MQ_NAME_SERVER="nats:4222" to enable NATS
|
||||
# NATS_SERVER_URL: NATS server connection URL, supports nats:// and tls:// protocols
|
||||
# For cluster setup, use comma-separated URLs: "nats://nats1:4222,nats://nats2:4222"
|
||||
# For TLS connection: "tls://nats:4222"
|
||||
export NATS_SERVER_URL="nats://nats:4222"
|
||||
# NATS_JWT_TOKEN: JWT token for NATS authentication (leave empty for no auth)
|
||||
export NATS_JWT_TOKEN=""
|
||||
# NATS_NKEY_SEED: Path to NATS seed file for NKey authentication (optional)
|
||||
export NATS_NKEY_SEED=""
|
||||
# NATS_USERNAME: Username for NATS authentication (optional)
|
||||
export NATS_USERNAME=""
|
||||
# NATS_PASSWORD: Password for NATS authentication (optional)
|
||||
export NATS_PASSWORD=""
|
||||
# NATS_TOKEN: Token for NATS authentication (optional)
|
||||
export NATS_TOKEN=""
|
||||
# NATS_STREAM_REPLICAS: Number of replicas for JetStream streams (default: 1)
|
||||
export NATS_STREAM_REPLICAS="1"
|
||||
# NATS_USE_JETSTREAM: Enable JetStream mode for message persistence and reliability (default: false)
|
||||
export NATS_USE_JETSTREAM="true"
|
||||
|
||||
# Settings for VectorStore
|
||||
# VectorStore type: milvus / vikingdb / oceanbase
|
||||
# If you want to use vikingdb, you need to set up the vikingdb configuration.
|
||||
export VECTOR_STORE_TYPE="milvus"
|
||||
# milvus vector store
|
||||
export MILVUS_ADDR="milvus:19530"
|
||||
export MILVUS_USER=""
|
||||
export MILVUS_PASSWORD=""
|
||||
export MILVUS_TOKEN=""
|
||||
# vikingdb vector store for Volcengine
|
||||
export VIKING_DB_HOST=""
|
||||
export VIKING_DB_REGION=""
|
||||
export VIKING_DB_AK=""
|
||||
export VIKING_DB_SK=""
|
||||
export VIKING_DB_SCHEME=""
|
||||
export VIKING_DB_MODEL_NAME="" # if vikingdb model name is not set, you need to set Embedding settings
|
||||
|
||||
# oceanbase vector store
|
||||
export OCEANBASE_HOST="127.0.0.1"
|
||||
export OCEANBASE_PORT=2881
|
||||
export OCEANBASE_USER="root@test"
|
||||
export OCEANBASE_PASSWORD="coze123"
|
||||
export OCEANBASE_DATABASE="test"
|
||||
|
||||
# Settings for Embedding
|
||||
# The Embedding model relied on by knowledge base vectorization does not need to be configured
|
||||
# if the vector database comes with built-in Embedding functionality (such as VikingDB). Currently,
|
||||
# Coze Studio supports four access methods: openai, ark, ollama, and custom http. Users can simply choose one of them when using
|
||||
# embedding type: ark / openai / ollama / gemini / http
|
||||
export EMBEDDING_TYPE="ark"
|
||||
export EMBEDDING_MAX_BATCH_SIZE=100
|
||||
|
||||
# ark embedding by volcengine / byteplus
|
||||
export ARK_EMBEDDING_BASE_URL="" # (string, required) Ark embedding base_url
|
||||
export ARK_EMBEDDING_MODEL="" # (string, required) Ark embedding model
|
||||
export ARK_EMBEDDING_API_KEY="" # (string, required) Ark embedding api_key
|
||||
export ARK_EMBEDDING_DIMS="2048" # (int, required) Ark embedding dimensions
|
||||
export ARK_EMBEDDING_API_TYPE="" # (string, optional) Ark embedding api type, should be "text_api" / "multi_modal_api". Default "text_api".
|
||||
|
||||
# openai embedding
|
||||
export OPENAI_EMBEDDING_BASE_URL="" # (string, required) OpenAI embedding base_url
|
||||
export OPENAI_EMBEDDING_MODEL="" # (string, required) OpenAI embedding model
|
||||
export OPENAI_EMBEDDING_API_KEY="" # (string, required) OpenAI embedding api_key
|
||||
export OPENAI_EMBEDDING_BY_AZURE=false # (bool, optional) OpenAI embedding by_azure
|
||||
export OPENAI_EMBEDDING_API_VERSION="" # (string, optional) OpenAI embedding azure api version
|
||||
export OPENAI_EMBEDDING_DIMS=1024 # (int, required) OpenAI embedding dimensions
|
||||
export OPENAI_EMBEDDING_REQUEST_DIMS=1024 # (int, optional) OpenAI embedding dimensions in requests, need to be empty if api doesn't support specifying dimensions.
|
||||
|
||||
# ollama embedding
|
||||
export OLLAMA_EMBEDDING_BASE_URL="" # (string, required) Ollama embedding base_url
|
||||
export OLLAMA_EMBEDDING_MODEL="" # (string, required) Ollama embedding model
|
||||
export OLLAMA_EMBEDDING_DIMS="" # (int, required) Ollama embedding dimensions
|
||||
|
||||
# gemini embedding
|
||||
export GEMINI_EMBEDDING_BASE_URL="" # (string, required) Gemini embedding base_url
|
||||
export GEMINI_EMBEDDING_MODEL="gemini-embedding-001" # (string, required) Gemini embedding model.
|
||||
export GEMINI_EMBEDDING_API_KEY="" # (string, required) Gemini embedding api_key
|
||||
export GEMINI_EMBEDDING_DIMS=2048 # (int, required) Gemini embedding dimensions
|
||||
export GEMINI_EMBEDDING_BACKEND="1" # (string, required) Gemini embedding backend, should be "1" for BackendGeminiAPI / "2" for BackendVertexAI.
|
||||
export GEMINI_EMBEDDING_PROJECT="" # (string, optional) Gemini embedding project
|
||||
export GEMINI_EMBEDDING_LOCATION="" # (string, optional) Gemini embedding location
|
||||
|
||||
# http embedding
|
||||
export HTTP_EMBEDDING_ADDR="" # (string, required) http embedding address
|
||||
export HTTP_EMBEDDING_DIMS=1024 # (string, required) http embedding dimensions
|
||||
|
||||
# Settings for Rerank
|
||||
# If you want to use the rerank-related functions in the knowledge base feature,You need to set up the rerank configuration.
|
||||
export RERANK_TYPE="" # current support `vikingdb`,`rrf`,default:rrf
|
||||
# vikingdb rerank
|
||||
export VIKINGDB_RERANK_HOST="" # optional,default:api-knowledgebase.mlp.cn-beijing.volces.com
|
||||
export VIKINGDB_RERANK_REGION="" # optional,default:cn-north-1
|
||||
export VIKINGDB_RERANK_AK="" # required
|
||||
export VIKINGDB_RERANK_SK="" # required
|
||||
export VIKINGDB_RERANK_MODEL="" # optional,default:base-multilingual-rerank,also support m3-v2-rerank
|
||||
|
||||
# Settings for OCR
|
||||
# If you want to use the OCR-related functions in the knowledge base feature,You need to set up the OCR configuration.
|
||||
# Currently, Coze Studio has built-in Volcano OCR.
|
||||
# Supported OCR types: `ve`, `paddleocr`
|
||||
export OCR_TYPE="ve"
|
||||
# ve ocr
|
||||
export VE_OCR_AK=""
|
||||
export VE_OCR_SK=""
|
||||
# paddleocr ocr
|
||||
export PADDLEOCR_OCR_API_URL=""
|
||||
|
||||
# Settings for Document Parser
|
||||
# Supported parser types: `builtin`, `paddleocr`
|
||||
export PARSER_TYPE="builtin"
|
||||
# paddleocr structure
|
||||
export PADDLEOCR_STRUCTURE_API_URL=""
|
||||
|
||||
# Settings for Model
|
||||
# Model for agent & workflow
|
||||
# add suffix number to add different models
|
||||
export MODEL_PROTOCOL_0="ark" # protocol
|
||||
export MODEL_OPENCOZE_ID_0="100001" # id for record
|
||||
export MODEL_NAME_0="" # model name for show
|
||||
export MODEL_ID_0="" # model name for connection
|
||||
export MODEL_API_KEY_0="" # model api key
|
||||
export MODEL_BASE_URL_0="" # model base url
|
||||
|
||||
# Model for knowledge nl2sql, messages2query (rewrite), image annotation, workflow knowledge recall
|
||||
# add prefix to assign specific model, downgrade to default config when prefix is not configured:
|
||||
# 1. nl2sql: NL2SQL_ (e.g. NL2SQL_BUILTIN_CM_TYPE)
|
||||
# 2. messages2query: M2Q_ (e.g. M2Q_BUILTIN_CM_TYPE)
|
||||
# 3. image annotation: IA_ (e.g. IA_BUILTIN_CM_TYPE)
|
||||
# 4. workflow knowledge recall: WKR_ (e.g. WKR_BUILTIN_CM_TYPE)
|
||||
# supported chat model type: openai / ark / deepseek / ollama / qwen / gemini
|
||||
export BUILTIN_CM_TYPE="ark"
|
||||
# type openai
|
||||
export BUILTIN_CM_OPENAI_BASE_URL=""
|
||||
export BUILTIN_CM_OPENAI_API_KEY=""
|
||||
export BUILTIN_CM_OPENAI_BY_AZURE=false
|
||||
export BUILTIN_CM_OPENAI_MODEL=""
|
||||
|
||||
# type ark
|
||||
export BUILTIN_CM_ARK_API_KEY=""
|
||||
export BUILTIN_CM_ARK_MODEL=""
|
||||
export BUILTIN_CM_ARK_BASE_URL=""
|
||||
|
||||
# type deepseek
|
||||
export BUILTIN_CM_DEEPSEEK_BASE_URL=""
|
||||
export BUILTIN_CM_DEEPSEEK_API_KEY=""
|
||||
export BUILTIN_CM_DEEPSEEK_MODEL=""
|
||||
|
||||
# type ollama
|
||||
export BUILTIN_CM_OLLAMA_BASE_URL=""
|
||||
export BUILTIN_CM_OLLAMA_MODEL=""
|
||||
|
||||
# type qwen
|
||||
export BUILTIN_CM_QWEN_BASE_URL=""
|
||||
export BUILTIN_CM_QWEN_API_KEY=""
|
||||
export BUILTIN_CM_QWEN_MODEL=""
|
||||
|
||||
# type gemini
|
||||
export BUILTIN_CM_GEMINI_BACKEND=""
|
||||
export BUILTIN_CM_GEMINI_API_KEY=""
|
||||
export BUILTIN_CM_GEMINI_PROJECT=""
|
||||
export BUILTIN_CM_GEMINI_LOCATION=""
|
||||
export BUILTIN_CM_GEMINI_BASE_URL=""
|
||||
export BUILTIN_CM_GEMINI_MODEL=""
|
||||
|
||||
|
||||
|
||||
# The function of registration controller
|
||||
# If you want to disable the registration feature, set DISABLE_USER_REGISTRATION to true. You can then control allowed registrations via a whitelist with ALLOW_REGISTRATION_EMAIL.
|
||||
export DISABLE_USER_REGISTRATION="" # default "", if you want to disable, set to true
|
||||
export ALLOW_REGISTRATION_EMAIL="" # is a list of email addresses, separated by ",". Example: "11@example.com,22@example.com"
|
||||
|
||||
# Plugin AES secret.
|
||||
# PLUGIN_AES_AUTH_SECRET is the secret of used to encrypt plugin authorization payload.
|
||||
# The size of secret must be 16, 24 or 32 bytes.
|
||||
export PLUGIN_AES_AUTH_SECRET='^*6x3hdu2nc%-p38'
|
||||
# PLUGIN_AES_STATE_SECRET is the secret of used to encrypt oauth state.
|
||||
# The size of secret must be 16, 24 or 32 bytes.
|
||||
export PLUGIN_AES_STATE_SECRET='osj^kfhsd*(z!sno'
|
||||
# PLUGIN_AES_OAUTH_TOKEN_SECRET is the secret of used to encrypt oauth refresh token and access token.
|
||||
# The size of secret must be 16, 24 or 32 bytes.
|
||||
export PLUGIN_AES_OAUTH_TOKEN_SECRET='cn+$PJ(HhJ[5d*z9'
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
## 0. setup environment
|
||||
|
||||
On Mac :
|
||||
|
||||
brew install ariga/tap/atlas
|
||||
|
||||
On Linux :
|
||||
|
||||
curl -sSf https://atlasgo.sh | sh -s -- --community
|
||||
|
||||
Setup to you database url :
|
||||
|
||||
export ATLAS_URL="mysql://coze:coze123@localhost:3306/opencoze?charset=utf8mb4&parseTime=True"
|
||||
|
||||
## 2. init baseline
|
||||
|
||||
# cd ./docker/atlas
|
||||
atlas migrate diff initial --env local --to $ATLAS_URL
|
||||
|
||||
# The following command is the same as the one above.
|
||||
atlas migrate diff initial \
|
||||
--dir "file://migrations" \
|
||||
--to $ATLAS_URL \
|
||||
--dev-url "docker://mysql/8/"
|
||||
|
||||
## 3. update database table
|
||||
|
||||
On developer machine(I want add/update table for my business)
|
||||
|
||||
# First, add or update your table as needed.
|
||||
|
||||
# Second, autogenerate diff sql
|
||||
# cd ./docker/atlas
|
||||
atlas migrate diff update --env local --to $ATLAS_URL # step 1
|
||||
|
||||
# The following command is the same as the one above.
|
||||
atlas migrate diff update \
|
||||
--dir "file://migrations" \
|
||||
--to $ATLAS_URL \
|
||||
--dev-url "docker://mysql/8/"
|
||||
# will autogenerate some xxxxx_update.sql in margrations
|
||||
|
||||
|
||||
# Third, Check whether the contents of the new xxxx_update.sql file are correct.
|
||||
# If any changes are needed, please modify it manually.
|
||||
# If you manually modified margrations file, you need to run the following command to update its hash value.
|
||||
# If you did not manually modify margrations file, do not run the following command.
|
||||
atlas migrate hash # step 2 if need
|
||||
atlas migrate status --url $ATLAS_URL --dir "file://migrations" # check status
|
||||
|
||||
# Last, dump the latest database schema for other developer
|
||||
atlas schema inspect -u $ATLAS_URL --exclude "atlas_schema_revisions,table_*" > opencoze_latest_schema.hcl # step 3
|
||||
|
||||
## 4. apply migration
|
||||
|
||||
On developer machine(I want to update my local database with the changes that others developer have made)
|
||||
|
||||
# cd ./docker/atlas
|
||||
atlas schema apply -u $ATLAS_URL --to file://opencoze_latest_schema.hcl # step 1 for developer on mac, this command will execute in start_debug.sh
|
||||
|
||||
On Server machine
|
||||
|
||||
atlas migrate apply --url $ATLAS_URL --dir "file://migrations" --baseline "20250703095335" # step 1 for dev server
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
env "local" {
|
||||
url = "mysql://coze:coze123@localhost:3306/opencoze?charset=utf8mb4&parseTime=True"
|
||||
dev = "docker://mysql/8"
|
||||
|
||||
|
||||
migration {
|
||||
dir = "file://migrations"
|
||||
exclude = ["atlas_schema_revisions", "table_*"]
|
||||
baseline = "20250703095335"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
-- Add new schema named "opencoze"
|
||||
CREATE DATABASE IF NOT EXISTS `opencoze` COLLATE utf8mb4_unicode_ci;
|
||||
-- Create "agent_to_database" table
|
||||
CREATE TABLE `opencoze`.`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`)) CHARSET utf8mb4 COLLATE utf8mb4_general_ci COMMENT "agent_to_database info";
|
||||
-- Create "agent_tool_draft" table
|
||||
CREATE TABLE `opencoze`.`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`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Draft Agent Tool";
|
||||
-- Create "agent_tool_version" table
|
||||
CREATE TABLE `opencoze`.`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`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Agent Tool Version";
|
||||
-- Create "api_key" table
|
||||
CREATE TABLE `opencoze`.`api_key` (`id` bigint NOT NULL AUTO_INCREMENT COMMENT "Primary Key ID", `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`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "api key table";
|
||||
-- Create "app_connector_release_ref" table
|
||||
CREATE TABLE `opencoze`.`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 `idx_record_connector` (`record_id`, `connector_id`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Connector Release Record Reference";
|
||||
-- Create "app_draft" table
|
||||
CREATE TABLE `opencoze`.`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", `desc` 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`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Draft Application";
|
||||
-- Create "app_release_record" table
|
||||
CREATE TABLE `opencoze`.`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", `desc` 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`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Application Release Record";
|
||||
-- Create "conversation" table
|
||||
CREATE TABLE `opencoze`.`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`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "会话信息表";
|
||||
-- Create "data_copy_task" table
|
||||
CREATE TABLE `opencoze`.`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 "错误信息", PRIMARY KEY (`master_task_id`, `origin_data_id`, `data_type`)) CHARSET utf8mb4 COLLATE utf8mb4_general_ci COMMENT "data方向复制任务记录表";
|
||||
-- Create "draft_database_info" table
|
||||
CREATE TABLE `opencoze`.`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`)) CHARSET utf8mb4 COLLATE utf8mb4_general_ci COMMENT "draft database info";
|
||||
-- Create "knowledge" table
|
||||
CREATE TABLE `opencoze`.`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`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "知识库表";
|
||||
-- Create "knowledge_document" table
|
||||
CREATE TABLE `opencoze`.`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`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "知识库文档表";
|
||||
-- Create "knowledge_document_review" table
|
||||
CREATE TABLE `opencoze`.`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))) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "文档审阅表";
|
||||
-- Create "knowledge_document_slice" table
|
||||
CREATE TABLE `opencoze`.`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` double 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`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "知识库文件切片表";
|
||||
-- Create "message" table
|
||||
CREATE TABLE `opencoze`.`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`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "消息表";
|
||||
-- Create "model_entity" table
|
||||
CREATE TABLE `opencoze`.`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 NOT 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`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "模型信息";
|
||||
-- Create "model_meta" table
|
||||
CREATE TABLE `opencoze`.`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`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "模型元信息";
|
||||
-- Create "node_execution" table
|
||||
CREATE TABLE `opencoze`.`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", `node_name` varchar(128) NOT NULL COMMENT "name of the node", `node_type` varchar(128) NOT NULL COMMENT "the type of the node, in string", `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", `output` mediumtext NULL COMMENT "actual output of the node", `raw_output` mediumtext NULL COMMENT "the original output of the node", `error_info` mediumtext NULL COMMENT "error info", `error_level` varchar(32) NULL COMMENT "level of the error", `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", `parent_node_id` varchar(128) NULL COMMENT "when as inner node for loop or batch, this is the parent node's key", `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", 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`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
-- Create "online_database_info" table
|
||||
CREATE TABLE `opencoze`.`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`)) CHARSET utf8mb4 COLLATE utf8mb4_general_ci COMMENT "online database info";
|
||||
-- Create "plugin" table
|
||||
CREATE TABLE `opencoze`.`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`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Latest Plugin";
|
||||
-- Create "plugin_draft" table
|
||||
CREATE TABLE `opencoze`.`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`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Draft Plugin";
|
||||
-- Create "plugin_oauth_auth" table
|
||||
CREATE TABLE `opencoze`.`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` varchar(1024) NOT NULL DEFAULT "" COMMENT "Access Token", `refresh_token` varchar(1024) NOT NULL DEFAULT "" 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`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Plugin OAuth Authorization Code Info";
|
||||
-- Create "plugin_version" table
|
||||
CREATE TABLE `opencoze`.`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`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Plugin Version";
|
||||
-- Create "prompt_resource" table
|
||||
CREATE TABLE `opencoze`.`prompt_resource` (`id` bigint 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`)) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT "prompt_resource";
|
||||
-- Create "run_record" table
|
||||
CREATE TABLE `opencoze`.`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,", `token_count` int NOT NULL DEFAULT 0 COMMENT "token 消耗", `output_tokens` int NOT NULL DEFAULT 0 COMMENT "消耗的 output token 数", `input_tokens` int NOT NULL DEFAULT 0 COMMENT "消耗的 input token 数", `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, PRIMARY KEY (`id`), INDEX `idx_c_s` (`conversation_id`, `section_id`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "执行记录表";
|
||||
-- Create "shortcut_command" table
|
||||
CREATE TABLE `opencoze`.`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`)) CHARSET utf8mb4 COLLATE utf8mb4_general_ci COMMENT "bot快捷指令表";
|
||||
-- Create "single_agent_draft" table
|
||||
CREATE TABLE `opencoze`.`single_agent_draft` (`id` bigint 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", `desc` 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` json NULL COMMENT "Agent Database Base Configuration", `shortcut_command` json NULL COMMENT "shortcut command", PRIMARY KEY (`id`), UNIQUE INDEX `idx_agent_id` (`agent_id`), INDEX `idx_creator_id` (`creator_id`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Single Agent Draft Copy Table";
|
||||
-- Create "single_agent_publish" table
|
||||
CREATE TABLE `opencoze`.`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`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "bot 渠道和发布版本流水表";
|
||||
-- Create "single_agent_version" table
|
||||
CREATE TABLE `opencoze`.`single_agent_version` (`id` bigint 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", `desc` 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` json NULL COMMENT "Agent Database Base Configuration", `shortcut_command` json NULL COMMENT "shortcut command", PRIMARY KEY (`id`), UNIQUE INDEX `idx_agent_id_and_version_connector_id` (`agent_id`, `version`, `connector_id`), INDEX `idx_creator_id` (`creator_id`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Single Agent Version Copy Table";
|
||||
-- Create "space" table
|
||||
CREATE TABLE `opencoze`.`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`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Space Table" AUTO_INCREMENT 666;
|
||||
-- Create "space_user" table
|
||||
CREATE TABLE `opencoze`.`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 `uk_space_user` (`space_id`, `user_id`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Space Member Table";
|
||||
-- Create "template" table
|
||||
CREATE TABLE `opencoze`.`template` (`id` bigint 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 `idx_agent_id` (`agent_id`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Template Info Table";
|
||||
-- Create "tool" table
|
||||
CREATE TABLE `opencoze`.`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`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Latest Tool";
|
||||
-- Create "tool_draft" table
|
||||
CREATE TABLE `opencoze`.`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`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Draft Tool";
|
||||
-- Create "tool_version" table
|
||||
CREATE TABLE `opencoze`.`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`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Tool Version";
|
||||
-- Create "user" table
|
||||
CREATE TABLE `opencoze`.`user` (`id` bigint 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`), UNIQUE INDEX `idx_email` (`email`), INDEX `idx_session_key` (`session_key`), UNIQUE INDEX `idx_unique_name` (`unique_name`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "User Table";
|
||||
-- Create "variable_instance" table
|
||||
CREATE TABLE `opencoze`.`variable_instance` (`id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "主键ID", `biz_type` tinyint unsigned NOT NULL COMMENT "1 for agent,2 for app", `biz_id` varchar(128) NOT NULL DEFAULT "" COMMENT "1 for agent_id,2 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`)) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT "KV Memory";
|
||||
-- Create "variables_meta" table
|
||||
CREATE TABLE `opencoze`.`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 agent,2 for app", `biz_id` varchar(128) NOT NULL DEFAULT "" COMMENT "1 for agent_id,2 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`), UNIQUE INDEX `idx_project_key` (`biz_id`, `biz_type`, `version`), INDEX `idx_user_key` (`creator_id`)) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT "KV Memory meta";
|
||||
-- Create "workflow_draft" table
|
||||
CREATE TABLE `opencoze`.`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)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
-- Create "workflow_execution" table
|
||||
CREATE TABLE `opencoze`.`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`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
-- Create "workflow_meta" table
|
||||
CREATE TABLE `opencoze`.`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`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
-- Create "workflow_reference" table
|
||||
CREATE TABLE `opencoze`.`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`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
-- Create "workflow_snapshot" table
|
||||
CREATE TABLE `opencoze`.`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, PRIMARY KEY (`workflow_id`, `commit_id`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "snapshot for executed workflow draft";
|
||||
-- Create "workflow_version" table
|
||||
CREATE TABLE `opencoze`.`workflow_version` (`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`, `version`), INDEX `idx_id_created_at` (`id`, `created_at`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
@@ -0,0 +1,2 @@
|
||||
-- Modify "run_record" table
|
||||
ALTER TABLE `opencoze`.`run_record` DROP COLUMN `token_count`, DROP COLUMN `output_tokens`, DROP COLUMN `input_tokens`, ADD COLUMN `usage` json NULL COMMENT "usage";
|
||||
@@ -0,0 +1,2 @@
|
||||
-- Modify "plugin_oauth_auth" table
|
||||
ALTER TABLE `opencoze`.`plugin_oauth_auth` MODIFY COLUMN `access_token` text NOT NULL COMMENT "Access Token", MODIFY COLUMN `refresh_token` text NOT NULL COMMENT "Refresh Token";
|
||||
@@ -0,0 +1,10 @@
|
||||
-- Modify "api_key" table
|
||||
ALTER TABLE `opencoze`.`api_key` RENAME COLUMN `key` TO `api_key`;
|
||||
-- Modify "app_draft" table
|
||||
ALTER TABLE `opencoze`.`app_draft` RENAME COLUMN `desc` TO `description`;
|
||||
-- Modify "app_release_record" table
|
||||
ALTER TABLE `opencoze`.`app_release_record` RENAME COLUMN `desc` TO `description`;
|
||||
-- Modify "single_agent_draft" table
|
||||
ALTER TABLE `opencoze`.`single_agent_draft` RENAME COLUMN `desc` TO `description`, RENAME COLUMN `database` TO `database_config`;
|
||||
-- Modify "single_agent_version" table
|
||||
ALTER TABLE `opencoze`.`single_agent_version` RENAME COLUMN `desc` TO `description`, RENAME COLUMN `database` TO `database_config`;
|
||||
@@ -0,0 +1,38 @@
|
||||
-- Modify "api_key" table
|
||||
ALTER TABLE `opencoze`.`api_key` MODIFY COLUMN `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "Primary Key ID";
|
||||
-- Modify "app_connector_release_ref" table
|
||||
ALTER TABLE `opencoze`.`app_connector_release_ref` RENAME INDEX `idx_record_connector` TO `uniq_record_connector`;
|
||||
-- Modify "app_draft" table
|
||||
ALTER TABLE `opencoze`.`app_draft` RENAME COLUMN `Name` TO `name`;
|
||||
-- Modify "app_release_record" table
|
||||
ALTER TABLE `opencoze`.`app_release_record` RENAME COLUMN `Name` TO `name`;
|
||||
-- Modify "knowledge_document_slice" table
|
||||
ALTER TABLE `opencoze`.`knowledge_document_slice` MODIFY COLUMN `sequence` decimal(20,5) NOT NULL COMMENT "切片顺序号, 从1开始";
|
||||
-- Modify "model_entity" table
|
||||
ALTER TABLE `opencoze`.`model_entity` MODIFY COLUMN `default_params` json NULL COMMENT "默认参数";
|
||||
-- Modify "node_execution" table
|
||||
ALTER TABLE `opencoze`.`node_execution` COMMENT "node 节点运行记录,用于记录每次workflow执行时,每个节点的状态信息", COLLATE utf8mb4_0900_ai_ci;
|
||||
-- Modify "prompt_resource" table
|
||||
ALTER TABLE `opencoze`.`prompt_resource` MODIFY COLUMN `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "主键ID";
|
||||
-- Modify "single_agent_draft" table
|
||||
ALTER TABLE `opencoze`.`single_agent_draft` MODIFY COLUMN `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "Primary Key ID", RENAME INDEX `idx_agent_id` TO `uniq_agent_id`;
|
||||
-- Modify "single_agent_version" table
|
||||
ALTER TABLE `opencoze`.`single_agent_version` MODIFY COLUMN `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "Primary Key ID", RENAME INDEX `idx_agent_id_and_version_connector_id` TO `uniq_agent_id_and_version_connector_id`;
|
||||
-- Modify "space_user" table
|
||||
ALTER TABLE `opencoze`.`space_user` RENAME INDEX `uk_space_user` TO `uniq_space_user`;
|
||||
-- Modify "template" table
|
||||
ALTER TABLE `opencoze`.`template` MODIFY COLUMN `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "Primary Key ID", RENAME INDEX `idx_agent_id` TO `uniq_agent_id`;
|
||||
-- Modify "user" table
|
||||
ALTER TABLE `opencoze`.`user` AUTO_INCREMENT 888, MODIFY COLUMN `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "Primary Key ID", RENAME INDEX `idx_email` TO `uniq_email`, RENAME INDEX `idx_unique_name` TO `uniq_unique_name`;
|
||||
-- Modify "variables_meta" table
|
||||
ALTER TABLE `opencoze`.`variables_meta` RENAME INDEX `idx_project_key` TO `uniq_project_key`;
|
||||
-- Modify "workflow_draft" table
|
||||
ALTER TABLE `opencoze`.`workflow_draft` COMMENT "workflow 画布草稿表,用于记录workflow最新的草稿画布信息";
|
||||
-- Modify "workflow_execution" table
|
||||
ALTER TABLE `opencoze`.`workflow_execution` COMMENT "workflow 执行记录表,用于记录每次workflow执行时的状态";
|
||||
-- Modify "workflow_meta" table
|
||||
ALTER TABLE `opencoze`.`workflow_meta` COMMENT "workflow 元信息表,用于记录workflow基本的元信息";
|
||||
-- Modify "workflow_reference" table
|
||||
ALTER TABLE `opencoze`.`workflow_reference` COMMENT "workflow 关联关系表,用于记录workflow 直接互相引用关系";
|
||||
-- Modify "workflow_version" table
|
||||
ALTER TABLE `opencoze`.`workflow_version` COMMENT "workflow 画布版本信息表,用于记录不同版本的画布信息";
|
||||
@@ -0,0 +1,8 @@
|
||||
-- Modify "data_copy_task" table
|
||||
ALTER TABLE `opencoze`.`data_copy_task` ADD COLUMN `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "ID", DROP PRIMARY KEY, ADD PRIMARY KEY (`id`), ADD UNIQUE INDEX `uniq_master_task_id_origin_data_id_data_type` (`master_task_id`, `origin_data_id`, `data_type`);
|
||||
-- Modify "workflow_snapshot" table
|
||||
ALTER TABLE `opencoze`.`workflow_snapshot` ADD COLUMN `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "ID", DROP PRIMARY KEY, ADD PRIMARY KEY (`id`), ADD UNIQUE INDEX `uniq_workflow_id_commit_id` (`workflow_id`, `commit_id`);
|
||||
-- Modify "workflow_version" table
|
||||
ALTER TABLE `opencoze`.`workflow_version` DROP INDEX `idx_id_created_at`;
|
||||
-- Modify "workflow_version" table
|
||||
ALTER TABLE `opencoze`.`workflow_version` MODIFY COLUMN `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "ID", ADD COLUMN `workflow_id` bigint unsigned NOT NULL COMMENT "workflow id", DROP PRIMARY KEY, ADD PRIMARY KEY (`id`), ADD INDEX `idx_id_created_at` (`workflow_id`, `created_at`), ADD UNIQUE INDEX `uniq_workflow_id_version` (`workflow_id`, `version`);
|
||||
@@ -0,0 +1,12 @@
|
||||
-- Create "connector_workflow_version" table
|
||||
CREATE TABLE `opencoze`.`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`)
|
||||
) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
@@ -0,0 +1,100 @@
|
||||
-- Create "app_conversation_template_draft" table
|
||||
CREATE TABLE `opencoze`.`app_conversation_template_draft` (
|
||||
`id` bigint unsigned NOT NULL COMMENT "id",
|
||||
`app_id` bigint unsigned NOT NULL COMMENT "app id",
|
||||
`space_id` bigint unsigned NOT NULL COMMENT "space id",
|
||||
`name` varchar(256) NOT NULL COMMENT "conversation name",
|
||||
`template_id` bigint unsigned NOT NULL COMMENT "template id",
|
||||
`creator_id` bigint unsigned NOT NULL COMMENT "creator id",
|
||||
`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",
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `idx_space_id_app_id_template_id` (`space_id`, `app_id`, `template_id`)
|
||||
) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
-- Create "app_conversation_template_online" table
|
||||
CREATE TABLE `opencoze`.`app_conversation_template_online` (
|
||||
`id` bigint unsigned NOT NULL COMMENT "id",
|
||||
`app_id` bigint unsigned NOT NULL COMMENT "app id",
|
||||
`space_id` bigint unsigned NOT NULL COMMENT "space id",
|
||||
`name` varchar(256) NOT NULL COMMENT "conversation name",
|
||||
`template_id` bigint unsigned NOT NULL COMMENT "template id",
|
||||
`version` varchar(256) NOT NULL COMMENT "version name",
|
||||
`creator_id` bigint unsigned NOT NULL COMMENT "creator id",
|
||||
`created_at` bigint unsigned NOT NULL COMMENT "create time in millisecond",
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `idx_space_id_app_id_template_id_version` (`space_id`, `app_id`, `template_id`, `version`)
|
||||
) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
-- Create "app_dynamic_conversation_draft" table
|
||||
CREATE TABLE `opencoze`.`app_dynamic_conversation_draft` (
|
||||
`id` bigint unsigned NOT NULL COMMENT "id",
|
||||
`app_id` bigint unsigned NOT NULL COMMENT "app id",
|
||||
`name` varchar(256) NOT NULL COMMENT "conversation name",
|
||||
`user_id` bigint unsigned NOT NULL COMMENT "user id",
|
||||
`connector_id` bigint unsigned NOT NULL COMMENT "connector id",
|
||||
`conversation_id` bigint unsigned NOT NULL COMMENT "conversation id",
|
||||
`created_at` bigint unsigned NOT NULL COMMENT "create time in millisecond",
|
||||
`deleted_at` datetime(3) NULL COMMENT "delete time in millisecond",
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `idx_app_id_connector_id_user_id` (`app_id`, `connector_id`, `user_id`),
|
||||
INDEX `idx_connector_id_user_id_name` (`connector_id`, `user_id`, `name`)
|
||||
) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
-- Create "app_dynamic_conversation_online" table
|
||||
CREATE TABLE `opencoze`.`app_dynamic_conversation_online` (
|
||||
`id` bigint unsigned NOT NULL COMMENT "id",
|
||||
`app_id` bigint unsigned NOT NULL COMMENT "app id",
|
||||
`name` varchar(256) NOT NULL COMMENT "conversation name",
|
||||
`user_id` bigint unsigned NOT NULL COMMENT "user id",
|
||||
`connector_id` bigint unsigned NOT NULL COMMENT "connector id",
|
||||
`conversation_id` bigint unsigned NOT NULL COMMENT "conversation id",
|
||||
`created_at` bigint unsigned NOT NULL COMMENT "create time in millisecond",
|
||||
`deleted_at` datetime(3) NULL COMMENT "delete time in millisecond",
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `idx_app_id_connector_id_user_id` (`app_id`, `connector_id`, `user_id`),
|
||||
INDEX `idx_connector_id_user_id_name` (`connector_id`, `user_id`, `name`)
|
||||
) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
-- Create "app_static_conversation_draft" table
|
||||
CREATE TABLE `opencoze`.`app_static_conversation_draft` (
|
||||
`id` bigint unsigned NOT NULL COMMENT "id",
|
||||
`template_id` bigint unsigned NOT NULL COMMENT "template id",
|
||||
`user_id` bigint unsigned NOT NULL COMMENT "user id",
|
||||
`connector_id` bigint unsigned NOT NULL COMMENT "connector id",
|
||||
`conversation_id` bigint unsigned NOT NULL COMMENT "conversation id",
|
||||
`created_at` bigint unsigned NOT NULL COMMENT "create time in millisecond",
|
||||
`deleted_at` datetime(3) NULL COMMENT "delete time in millisecond",
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `idx_connector_id_user_id_template_id` (`connector_id`, `user_id`, `template_id`)
|
||||
) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
-- Create "app_static_conversation_online" table
|
||||
CREATE TABLE `opencoze`.`app_static_conversation_online` (
|
||||
`id` bigint unsigned NOT NULL COMMENT "id",
|
||||
`template_id` bigint unsigned NOT NULL COMMENT "template id",
|
||||
`user_id` bigint unsigned NOT NULL COMMENT "user id",
|
||||
`connector_id` bigint unsigned NOT NULL COMMENT "connector id",
|
||||
`conversation_id` bigint unsigned NOT NULL COMMENT "conversation id",
|
||||
`created_at` bigint unsigned NOT NULL COMMENT "create time in millisecond",
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `idx_connector_id_user_id_template_id` (`connector_id`, `user_id`, `template_id`)
|
||||
) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
-- Create "chat_flow_role_config" table
|
||||
CREATE TABLE `opencoze`.`chat_flow_role_config` (
|
||||
`id` bigint unsigned NOT NULL COMMENT "id",
|
||||
`workflow_id` bigint unsigned NOT NULL COMMENT "workflow id",
|
||||
`connector_id` bigint unsigned NULL COMMENT "connector id",
|
||||
`name` varchar(256) NOT NULL COMMENT "role name",
|
||||
`description` mediumtext NOT NULL COMMENT "role description",
|
||||
`version` varchar(256) NOT NULL COMMENT "version",
|
||||
`avatar` varchar(256) NOT NULL COMMENT "avatar uri",
|
||||
`background_image_info` mediumtext NOT NULL COMMENT "background image information, object structure",
|
||||
`onboarding_info` mediumtext NOT NULL COMMENT "intro information, object structure",
|
||||
`suggest_reply_info` mediumtext NOT NULL COMMENT "user suggestions, object structure",
|
||||
`audio_config` mediumtext NOT NULL COMMENT "agent audio config, object structure",
|
||||
`user_input_config` varchar(256) NOT NULL COMMENT "user input config, object structure",
|
||||
`creator_id` bigint unsigned NOT NULL COMMENT "creator id",
|
||||
`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",
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `idx_connector_id_version` (`connector_id`, `version`),
|
||||
INDEX `idx_workflow_id_version` (`workflow_id`, `version`)
|
||||
) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
@@ -0,0 +1,48 @@
|
||||
-- Modify "conversation" table
|
||||
ALTER TABLE `opencoze`.`conversation` COMMENT "conversation info record", MODIFY COLUMN `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "id", MODIFY COLUMN `connector_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Publish Connector ID", MODIFY COLUMN `scene` tinyint NOT NULL DEFAULT 0 COMMENT "conversation scene", MODIFY COLUMN `section_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "section_id", MODIFY COLUMN `creator_id` bigint unsigned NULL DEFAULT 0 COMMENT "creator_id", MODIFY COLUMN `ext` text NULL COMMENT "ext", MODIFY COLUMN `created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds", MODIFY COLUMN `updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds";
|
||||
-- Modify "data_copy_task" table
|
||||
ALTER TABLE `opencoze`.`data_copy_task` COMMENT "data copy task record", MODIFY COLUMN `master_task_id` varchar(128) NULL DEFAULT "" COMMENT "task id", MODIFY COLUMN `origin_data_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "origin data id", MODIFY COLUMN `target_data_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "target data id", MODIFY COLUMN `origin_space_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "origin space id", MODIFY COLUMN `target_space_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "target space id", MODIFY COLUMN `origin_user_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "origin user id", MODIFY COLUMN `target_user_id` bigint unsigned NULL DEFAULT 0 COMMENT "target user id", MODIFY COLUMN `origin_app_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "origin app id", MODIFY COLUMN `target_app_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "target app id", MODIFY COLUMN `data_type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT "data type 1:knowledge, 2:database", MODIFY COLUMN `ext_info` varchar(255) NOT NULL DEFAULT "" COMMENT "ext", MODIFY COLUMN `start_time` bigint NULL DEFAULT 0 COMMENT "task start time", MODIFY COLUMN `finish_time` bigint NULL COMMENT "task finish time", MODIFY COLUMN `status` tinyint NOT NULL DEFAULT 1 COMMENT "1: Create 2: Running 3: Success 4: Failure", MODIFY COLUMN `error_msg` varchar(128) NULL COMMENT "error msg";
|
||||
-- Modify "knowledge" table
|
||||
ALTER TABLE `opencoze`.`knowledge` COMMENT "knowledge tabke", MODIFY COLUMN `id` bigint unsigned NOT NULL COMMENT "id", MODIFY COLUMN `name` varchar(150) NOT NULL DEFAULT "" COMMENT "knowledge's name", MODIFY COLUMN `app_id` bigint NOT NULL DEFAULT 0 COMMENT "app id", MODIFY COLUMN `creator_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "creator id", MODIFY COLUMN `space_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "space id", MODIFY COLUMN `deleted_at` datetime(3) NULL COMMENT "Delete Time", MODIFY COLUMN `status` tinyint NOT NULL DEFAULT 1 COMMENT "0 initialization, 1 effective, 2 invalid", MODIFY COLUMN `description` text NULL COMMENT "description", MODIFY COLUMN `icon_uri` varchar(150) NULL COMMENT "icon uri", MODIFY COLUMN `format_type` tinyint NOT NULL DEFAULT 0 COMMENT "0: Text 1: Table 2: Images";
|
||||
-- Modify "knowledge_document" table
|
||||
ALTER TABLE `opencoze`.`knowledge_document` COMMENT "knowledge document info", MODIFY COLUMN `id` bigint unsigned NOT NULL COMMENT "id", MODIFY COLUMN `knowledge_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "knowledge id", MODIFY COLUMN `name` varchar(150) NOT NULL DEFAULT "" COMMENT "document name", MODIFY COLUMN `file_extension` varchar(20) NOT NULL DEFAULT "0" COMMENT "Document type, txt/pdf/csv etc..", MODIFY COLUMN `document_type` int NOT NULL DEFAULT 0 COMMENT "Document type: 0: Text 1: Table 2: Image", MODIFY COLUMN `uri` text NULL COMMENT "uri", MODIFY COLUMN `size` bigint unsigned NOT NULL DEFAULT 0 COMMENT "document size", MODIFY COLUMN `slice_count` bigint unsigned NOT NULL DEFAULT 0 COMMENT "slice count", MODIFY COLUMN `char_count` bigint unsigned NOT NULL DEFAULT 0 COMMENT "number of characters", MODIFY COLUMN `creator_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "creator id", MODIFY COLUMN `space_id` bigint NOT NULL DEFAULT 0 COMMENT "space id", MODIFY COLUMN `deleted_at` datetime(3) NULL COMMENT "Delete Time", MODIFY COLUMN `source_type` int NULL DEFAULT 0 COMMENT "0: Local file upload, 2: Custom text, 103: Feishu 104: Lark", MODIFY COLUMN `status` int NOT NULL DEFAULT 0 COMMENT "status", MODIFY COLUMN `fail_reason` text NULL COMMENT "fail reason", MODIFY COLUMN `parse_rule` json NULL COMMENT "parse rule", MODIFY COLUMN `table_info` json NULL COMMENT "table info";
|
||||
-- Modify "knowledge_document_review" table
|
||||
ALTER TABLE `opencoze`.`knowledge_document_review` COMMENT "Document slice preview info", MODIFY COLUMN `id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "id", MODIFY COLUMN `space_id` bigint NOT NULL DEFAULT 0 COMMENT "space id", MODIFY COLUMN `name` varchar(150) NOT NULL DEFAULT "" COMMENT "name", MODIFY COLUMN `type` varchar(10) NOT NULL DEFAULT "0" COMMENT "document type", MODIFY COLUMN `uri` text NULL COMMENT "uri", MODIFY COLUMN `format_type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT "0 text, 1 table, 2 images", MODIFY COLUMN `status` tinyint unsigned NOT NULL DEFAULT 0 COMMENT "0 Processing 1 Completed 2 Failed 3 Expired", MODIFY COLUMN `chunk_resp_uri` text NULL COMMENT "pre-sliced uri", MODIFY COLUMN `deleted_at` datetime(3) NULL COMMENT "Delete Time", MODIFY COLUMN `creator_id` bigint NOT NULL DEFAULT 0 COMMENT "creator id";
|
||||
-- Modify "knowledge_document_slice" table
|
||||
ALTER TABLE `opencoze`.`knowledge_document_slice` COMMENT "knowledge document slice", MODIFY COLUMN `id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "id", MODIFY COLUMN `document_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "document_id", MODIFY COLUMN `content` text NULL COMMENT "content", MODIFY COLUMN `sequence` decimal(20,5) NOT NULL COMMENT "slice sequence number, starting from 1", MODIFY COLUMN `deleted_at` datetime(3) NULL COMMENT "Delete Time", MODIFY COLUMN `creator_id` bigint NOT NULL DEFAULT 0 COMMENT "creator id", MODIFY COLUMN `space_id` bigint NOT NULL DEFAULT 0 COMMENT "space id", MODIFY COLUMN `status` int NOT NULL DEFAULT 0 COMMENT "status", MODIFY COLUMN `fail_reason` text NULL COMMENT "fail reason", MODIFY COLUMN `hit` bigint unsigned NOT NULL DEFAULT 0 COMMENT "hit counts ";
|
||||
-- Modify "message" table
|
||||
ALTER TABLE `opencoze`.`message` COMMENT "message record", MODIFY COLUMN `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "id", MODIFY COLUMN `run_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "run_id", MODIFY COLUMN `role` varchar(100) NOT NULL DEFAULT "" COMMENT "role: user、assistant、system", MODIFY COLUMN `content_type` varchar(100) NOT NULL DEFAULT "" COMMENT "content type 1 text", MODIFY COLUMN `content` mediumtext NULL COMMENT "content", MODIFY COLUMN `message_type` varchar(100) NOT NULL DEFAULT "" COMMENT "message_type", MODIFY COLUMN `display_content` text NULL COMMENT "display content", MODIFY COLUMN `ext` text NULL COMMENT "message ext" COLLATE utf8mb4_general_ci, MODIFY COLUMN `section_id` bigint unsigned NULL COMMENT "section_id", MODIFY COLUMN `broken_position` int NULL DEFAULT -1 COMMENT "broken position", MODIFY COLUMN `status` tinyint unsigned NOT NULL DEFAULT 0 COMMENT "message status: 1 Available 2 Deleted 3 Replaced 4 Broken 5 Failed 6 Streaming 7 Pending", MODIFY COLUMN `model_content` mediumtext NULL COMMENT "model content", MODIFY COLUMN `meta_info` text NULL COMMENT "text tagging information such as citation and highlighting", MODIFY COLUMN `reasoning_content` text NULL COMMENT "reasoning content" COLLATE utf8mb4_general_ci, MODIFY COLUMN `created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds", MODIFY COLUMN `updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds";
|
||||
-- Modify "model_entity" table
|
||||
ALTER TABLE `opencoze`.`model_entity` COMMENT "Model information", MODIFY COLUMN `id` bigint unsigned NOT NULL COMMENT "id", MODIFY COLUMN `meta_id` bigint unsigned NOT NULL COMMENT "model metadata id", MODIFY COLUMN `name` varchar(128) NOT NULL COMMENT "name", MODIFY COLUMN `description` text NULL COMMENT "description", MODIFY COLUMN `default_params` json NULL COMMENT "default params", MODIFY COLUMN `scenario` bigint unsigned NOT NULL COMMENT "scenario", MODIFY COLUMN `status` int NOT NULL DEFAULT 1 COMMENT "model status", MODIFY COLUMN `deleted_at` bigint unsigned NULL COMMENT "Delete Time";
|
||||
-- Modify "model_meta" table
|
||||
ALTER TABLE `opencoze`.`model_meta` COMMENT "Model metadata", MODIFY COLUMN `id` bigint unsigned NOT NULL COMMENT "id", MODIFY COLUMN `model_name` varchar(128) NOT NULL COMMENT "model name", MODIFY COLUMN `protocol` varchar(128) NOT NULL COMMENT "model protocol", MODIFY COLUMN `capability` json NULL COMMENT "capability", MODIFY COLUMN `conn_config` json NULL COMMENT "model conn config", MODIFY COLUMN `status` int NOT NULL DEFAULT 1 COMMENT "model status", MODIFY COLUMN `description` varchar(2048) NOT NULL DEFAULT "" COMMENT "description", MODIFY COLUMN `deleted_at` bigint unsigned NULL COMMENT "Delete Time";
|
||||
-- Modify "node_execution" table
|
||||
ALTER TABLE `opencoze`.`node_execution` COMMENT "Node run record, used to record the status information of each node during each workflow execution";
|
||||
-- Modify "prompt_resource" table
|
||||
ALTER TABLE `opencoze`.`prompt_resource` MODIFY COLUMN `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "id", MODIFY COLUMN `space_id` bigint NOT NULL COMMENT "space id", MODIFY COLUMN `name` varchar(255) NOT NULL COMMENT "name", MODIFY COLUMN `description` varchar(255) NOT NULL COMMENT "description", MODIFY COLUMN `prompt_text` mediumtext NULL COMMENT "prompt text", MODIFY COLUMN `status` int NOT NULL COMMENT "status, 0 is invalid, 1 is valid", MODIFY COLUMN `creator_id` bigint NOT NULL COMMENT "creator id", MODIFY COLUMN `created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds", MODIFY COLUMN `updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds";
|
||||
-- Modify "run_record" table
|
||||
ALTER TABLE `opencoze`.`run_record` COMMENT "run record", MODIFY COLUMN `id` bigint unsigned NOT NULL COMMENT "id", MODIFY COLUMN `conversation_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "conversation id", MODIFY COLUMN `source` tinyint unsigned NOT NULL DEFAULT 0 COMMENT "Execute source 0 API", MODIFY COLUMN `status` varchar(255) NOT NULL DEFAULT "" COMMENT "status,0 Unknown, 1-Created,2-InProgress,3-Completed,4-Failed,5-Expired,6-Cancelled,7-RequiresAction", MODIFY COLUMN `creator_id` bigint NOT NULL DEFAULT 0 COMMENT "creator id", MODIFY COLUMN `created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds", MODIFY COLUMN `updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds", MODIFY COLUMN `failed_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Fail Time in Milliseconds", MODIFY COLUMN `completed_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Finish Time in Milliseconds", MODIFY COLUMN `chat_request` text NULL COMMENT "Original request field" COLLATE utf8mb4_general_ci, MODIFY COLUMN `ext` text NULL COMMENT "ext" COLLATE utf8mb4_general_ci;
|
||||
-- Modify "shortcut_command" table
|
||||
ALTER TABLE `opencoze`.`shortcut_command` COMMENT "bot shortcut command table", MODIFY COLUMN `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "id", MODIFY COLUMN `object_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Entity ID, this command can be used for this entity", MODIFY COLUMN `command_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "command id", MODIFY COLUMN `command_name` varchar(255) NOT NULL DEFAULT "" COMMENT "command name", MODIFY COLUMN `shortcut_command` varchar(255) NOT NULL DEFAULT "" COMMENT "shortcut command", MODIFY COLUMN `description` varchar(2000) NOT NULL DEFAULT "" COMMENT "description", MODIFY COLUMN `send_type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT "send type 0:query 1:panel", MODIFY COLUMN `tool_type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT "Type 1 of tool used: WorkFlow 2: Plugin", MODIFY COLUMN `work_flow_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "workflow id", MODIFY COLUMN `plugin_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "plugin id", MODIFY COLUMN `plugin_tool_name` varchar(255) NOT NULL DEFAULT "" COMMENT "plugin tool name", MODIFY COLUMN `template_query` text NULL COMMENT "template query", MODIFY COLUMN `components` json NULL COMMENT "Panel parameters", MODIFY COLUMN `card_schema` text NULL COMMENT "card schema", MODIFY COLUMN `tool_info` json NULL COMMENT "Tool information includes name+variable list", MODIFY COLUMN `status` tinyint unsigned NOT NULL DEFAULT 0 COMMENT "Status, 0 is invalid, 1 is valid", MODIFY COLUMN `creator_id` bigint unsigned NULL DEFAULT 0 COMMENT "creator id", MODIFY COLUMN `is_online` tinyint unsigned NOT NULL DEFAULT 0 COMMENT "Is online information: 0 draft 1 online", MODIFY COLUMN `created_at` bigint NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds", MODIFY COLUMN `updated_at` bigint NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds", MODIFY COLUMN `agent_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "When executing a multi instruction, which node executes the instruction", MODIFY COLUMN `shortcut_icon` json NULL COMMENT "shortcut icon";
|
||||
-- Modify "single_agent_draft" table
|
||||
ALTER TABLE `opencoze`.`single_agent_draft` MODIFY COLUMN `variables_meta_id` bigint NULL COMMENT "variables meta table ID";
|
||||
-- Modify "single_agent_publish" table
|
||||
ALTER TABLE `opencoze`.`single_agent_publish` COMMENT "Bot connector and release version info", MODIFY COLUMN `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "id", MODIFY COLUMN `publish_id` varchar(50) NOT NULL DEFAULT "" COMMENT "publish id" COLLATE utf8mb4_general_ci, MODIFY COLUMN `connector_ids` json NULL COMMENT "connector_ids", MODIFY COLUMN `publish_info` text NULL COMMENT "publish info" COLLATE utf8mb4_general_ci, MODIFY COLUMN `publish_time` bigint unsigned NOT NULL DEFAULT 0 COMMENT "publish time", MODIFY COLUMN `creator_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "creator id", MODIFY COLUMN `status` tinyint NOT NULL DEFAULT 0 COMMENT "Status 0: In use 1: Delete 3: Disabled", MODIFY COLUMN `extra` json NULL COMMENT "extra";
|
||||
-- Modify "single_agent_version" table
|
||||
ALTER TABLE `opencoze`.`single_agent_version` MODIFY COLUMN `variables_meta_id` bigint NULL COMMENT "variables meta table ID";
|
||||
-- Modify "variable_instance" table
|
||||
ALTER TABLE `opencoze`.`variable_instance` MODIFY COLUMN `id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "id", MODIFY COLUMN `version` varchar(255) NOT NULL COMMENT "agent or project version empty represents draft status", MODIFY COLUMN `keyword` varchar(255) NOT NULL COMMENT "Keyword to Memory", MODIFY COLUMN `type` tinyint NOT NULL COMMENT "Memory type 1 KV 2 list", MODIFY COLUMN `content` text NULL COMMENT "content", MODIFY COLUMN `connector_uid` varchar(255) NOT NULL COMMENT "connector_uid", MODIFY COLUMN `connector_id` bigint NOT NULL COMMENT "connector_id, e.g. coze = 10000010", MODIFY COLUMN `created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds", MODIFY COLUMN `updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds";
|
||||
-- Modify "variables_meta" table
|
||||
ALTER TABLE `opencoze`.`variables_meta` MODIFY COLUMN `id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "id", MODIFY COLUMN `creator_id` bigint unsigned NOT NULL COMMENT "creator id", MODIFY COLUMN `variable_list` json NULL COMMENT "JSON data for variable configuration", MODIFY COLUMN `created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds", MODIFY COLUMN `updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds", MODIFY COLUMN `version` varchar(255) NOT NULL COMMENT "Project version, empty represents draft status";
|
||||
-- Modify "workflow_draft" table
|
||||
ALTER TABLE `opencoze`.`workflow_draft` COMMENT "Workflow canvas draft table, used to record the latest draft canvas information of workflow", MODIFY COLUMN `canvas` mediumtext NOT NULL COMMENT "Front end schema", MODIFY COLUMN `input_params` mediumtext NULL COMMENT "Input schema", MODIFY COLUMN `output_params` mediumtext NULL COMMENT "Output parameter schema", MODIFY COLUMN `test_run_success` bool NOT NULL DEFAULT 0 COMMENT "0 not running, 1 running successfully", MODIFY COLUMN `modified` bool NOT NULL DEFAULT 0 COMMENT "0 has not been modified, 1 has been modified", MODIFY COLUMN `updated_at` bigint unsigned NULL COMMENT "Update Time in Milliseconds", MODIFY COLUMN `deleted_at` datetime(3) NULL COMMENT "Delete Time";
|
||||
-- Modify "workflow_execution" table
|
||||
ALTER TABLE `opencoze`.`workflow_execution` COMMENT "Workflow Execution Record Table, used to record the status of each workflow execution";
|
||||
-- Modify "workflow_meta" table
|
||||
ALTER TABLE `opencoze`.`workflow_meta` COMMENT "The workflow metadata table,used to record the basic metadata of workflow", MODIFY COLUMN `status` tinyint unsigned NOT NULL COMMENT "0: Not published, 1: Published", MODIFY COLUMN `content_type` tinyint unsigned NOT NULL COMMENT "0 Users 1 Official", MODIFY COLUMN `author_id` bigint unsigned NOT NULL COMMENT "Original author user ID", MODIFY COLUMN `space_id` bigint unsigned NOT NULL COMMENT "space id", MODIFY COLUMN `updater_id` bigint unsigned NULL COMMENT "User ID for updating metadata", MODIFY COLUMN `source_id` bigint unsigned NULL COMMENT "Workflow ID of source", MODIFY COLUMN `app_id` bigint unsigned NULL COMMENT "app id";
|
||||
-- Modify "workflow_reference" table
|
||||
ALTER TABLE `opencoze`.`workflow_reference` COMMENT "The workflow association table,used to record the direct mutual reference relationship between workflows", MODIFY COLUMN `deleted_at` datetime(3) NULL COMMENT "Delete Time";
|
||||
-- Modify "workflow_snapshot" table
|
||||
ALTER TABLE `opencoze`.`workflow_snapshot` MODIFY COLUMN `created_at` bigint unsigned NOT NULL COMMENT "Create Time in Milliseconds";
|
||||
-- Modify "workflow_version" table
|
||||
ALTER TABLE `opencoze`.`workflow_version` COMMENT "Workflow Canvas Version Information Table, used to record canvas information for different versions", MODIFY COLUMN `version` varchar(50) NOT NULL COMMENT "Published version", MODIFY COLUMN `version_description` varchar(2000) NOT NULL COMMENT "Version Description", MODIFY COLUMN `canvas` mediumtext NOT NULL COMMENT "Front end schema", MODIFY COLUMN `input_params` mediumtext NULL COMMENT "input params", MODIFY COLUMN `output_params` mediumtext NULL COMMENT "output params", MODIFY COLUMN `creator_id` bigint unsigned NOT NULL COMMENT "creator id", MODIFY COLUMN `created_at` bigint unsigned NOT NULL COMMENT "Create Time in Milliseconds", MODIFY COLUMN `deleted_at` datetime(3) NULL COMMENT "Delete Time";
|
||||
@@ -0,0 +1,18 @@
|
||||
-- Modify "connector_workflow_version" table
|
||||
ALTER TABLE `opencoze`.`connector_workflow_version` COMMENT "connector workflow version", RENAME INDEX `idx_connector_id_workflow_id_version` TO `uniq_connector_id_workflow_id_version`;
|
||||
-- Modify "knowledge" table
|
||||
ALTER TABLE `opencoze`.`knowledge` MODIFY COLUMN `name` varchar(150) NOT NULL DEFAULT "" COMMENT "knowledge_s name";
|
||||
-- Modify "node_execution" table
|
||||
ALTER TABLE `opencoze`.`node_execution` MODIFY COLUMN `composite_node_index` bigint unsigned NULL COMMENT "loop or batch_s execution index", MODIFY COLUMN `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;
|
||||
-- Modify "plugin_oauth_auth" table
|
||||
ALTER TABLE `opencoze`.`plugin_oauth_auth` MODIFY COLUMN `access_token` text NULL COMMENT "Access Token", MODIFY COLUMN `refresh_token` text NULL COMMENT "Refresh Token";
|
||||
-- Modify "single_agent_draft" table
|
||||
ALTER TABLE `opencoze`.`single_agent_draft` MODIFY COLUMN `description` text NULL COMMENT "Agent Description";
|
||||
-- Modify "single_agent_version" table
|
||||
ALTER TABLE `opencoze`.`single_agent_version` MODIFY COLUMN `description` text NULL COMMENT "Agent Description";
|
||||
-- Modify "workflow_draft" table
|
||||
ALTER TABLE `opencoze`.`workflow_draft` MODIFY COLUMN `canvas` mediumtext NULL COMMENT "Front end schema";
|
||||
-- Modify "workflow_snapshot" table
|
||||
ALTER TABLE `opencoze`.`workflow_snapshot` MODIFY COLUMN `canvas` mediumtext NULL COMMENT "frontend schema for this snapshot";
|
||||
-- Modify "workflow_version" table
|
||||
ALTER TABLE `opencoze`.`workflow_version` MODIFY COLUMN `canvas` mediumtext NULL COMMENT "Front end schema";
|
||||
@@ -0,0 +1,2 @@
|
||||
-- Create "files" table
|
||||
CREATE TABLE `opencoze`.`files` (`id` bigint unsigned NOT NULL COMMENT "id", `name` varchar(255) NOT NULL DEFAULT "" COMMENT "file name", `file_size` bigint unsigned NOT NULL DEFAULT 0 COMMENT "file size", `tos_uri` varchar(1024) NOT NULL DEFAULT "" COMMENT "TOS URI", `status` tinyint unsigned NOT NULL DEFAULT 0 COMMENT "status,0invalid,1valid", `comment` varchar(1024) NOT NULL DEFAULT "" COMMENT "file comment", `source` tinyint unsigned NOT NULL DEFAULT 0 COMMENT "source:1 from API,", `creator_id` varchar(512) NOT NULL DEFAULT "" COMMENT "creator id", `content_type` varchar(255) NOT NULL DEFAULT "" COMMENT "content type", `coze_account_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT "coze account 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", PRIMARY KEY (`id`), INDEX `idx_creator_id` (`creator_id`)) CHARSET utf8mb4 COLLATE utf8mb4_general_ci COMMENT "file resource table";
|
||||
@@ -0,0 +1,7 @@
|
||||
-- Modify "api_key" table
|
||||
ALTER TABLE `opencoze`.`api_key` ADD COLUMN `ak_type` tinyint NOT NULL DEFAULT 0 COMMENT "api key type ";
|
||||
-- Modify "single_agent_draft" table
|
||||
ALTER TABLE `opencoze`.`single_agent_draft` ADD COLUMN `bot_mode` tinyint NOT NULL DEFAULT 0 COMMENT "bot mode,0:single mode 2:chatflow mode" AFTER `database_config`, ADD COLUMN `layout_info` text NULL COMMENT "chatflow layout info";
|
||||
-- Modify "single_agent_version" table
|
||||
ALTER TABLE `opencoze`.`single_agent_version` ADD COLUMN `bot_mode` tinyint NOT NULL DEFAULT 0 COMMENT "bot mode,0:single mode 2:chatflow mode" AFTER `database_config`, ADD COLUMN `layout_info` text NULL COMMENT "chatflow layout info";
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
-- Modify "conversation" table
|
||||
ALTER TABLE `opencoze`.`conversation` ADD COLUMN `name` varchar(255) NOT NULL DEFAULT "" COMMENT "conversation name" AFTER `id`;
|
||||
@@ -0,0 +1,7 @@
|
||||
-- Modify "agent_tool_draft" table
|
||||
ALTER TABLE `opencoze`.`agent_tool_draft` ADD COLUMN `source` tinyint NOT NULL DEFAULT 0 COMMENT "tool source 1 coze saas 0 default";
|
||||
-- Modify "agent_tool_version" table
|
||||
ALTER TABLE `opencoze`.`agent_tool_version` ADD COLUMN `source` tinyint NOT NULL DEFAULT 0 COMMENT "tool source 1 coze saas 0 default";
|
||||
|
||||
-- Modify "shortcut_command" table
|
||||
ALTER TABLE `opencoze`.`shortcut_command` ADD COLUMN `source` tinyint NULL DEFAULT 0 COMMENT "plugin source 1 coze saas 0 default";
|
||||
@@ -0,0 +1,24 @@
|
||||
-- Modify "app_conversation_template_draft" table
|
||||
ALTER TABLE `opencoze`.`app_conversation_template_draft` COMMENT "app_conversation_template_draft";
|
||||
-- Modify "app_conversation_template_online" table
|
||||
ALTER TABLE `opencoze`.`app_conversation_template_online` COMMENT "app_conversation_template_online";
|
||||
-- Modify "app_dynamic_conversation_draft" table
|
||||
ALTER TABLE `opencoze`.`app_dynamic_conversation_draft` COMMENT "app_dynamic_conversation_draft";
|
||||
-- Modify "app_dynamic_conversation_online" table
|
||||
ALTER TABLE `opencoze`.`app_dynamic_conversation_online` COMMENT "app_dynamic_conversation_online";
|
||||
-- Modify "chat_flow_role_config" table
|
||||
ALTER TABLE `opencoze`.`chat_flow_role_config` COMMENT "chat_flow_role_config", MODIFY COLUMN `description` mediumtext NULL COMMENT "role description", MODIFY COLUMN `version` varchar(256) NULL COMMENT "version", MODIFY COLUMN `background_image_info` mediumtext NULL COMMENT "background image information, object structure", MODIFY COLUMN `onboarding_info` mediumtext NULL COMMENT "intro information, object structure", MODIFY COLUMN `suggest_reply_info` mediumtext NULL COMMENT "user suggestions, object structure", MODIFY COLUMN `audio_config` mediumtext NULL COMMENT "agent audio config, object structure";
|
||||
-- Modify "conversation" table
|
||||
ALTER TABLE `opencoze`.`conversation` MODIFY COLUMN `name` varchar(255) NULL DEFAULT "" COMMENT "conversation name";
|
||||
-- Modify "node_execution" table
|
||||
ALTER TABLE `opencoze`.`node_execution` COLLATE utf8mb4_unicode_ci;
|
||||
-- Modify "prompt_resource" table
|
||||
ALTER TABLE `opencoze`.`prompt_resource` COLLATE utf8mb4_unicode_ci;
|
||||
-- Modify "variable_instance" table
|
||||
ALTER TABLE `opencoze`.`variable_instance` COLLATE utf8mb4_unicode_ci;
|
||||
-- Modify "variables_meta" table
|
||||
ALTER TABLE `opencoze`.`variables_meta` COLLATE utf8mb4_unicode_ci;
|
||||
-- Create "kv_entries" table
|
||||
CREATE TABLE `opencoze`.`kv_entries` (`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "id", `namespace` varchar(255) NOT NULL COMMENT "namespace", `key_data` varchar(255) NOT NULL COMMENT "key_data", `value_data` longblob NULL COMMENT "value_data", PRIMARY KEY (`id`), UNIQUE INDEX `uniq_namespace_key` (`namespace`, `key_data`)) CHARSET utf8mb4 COLLATE utf8mb4_general_ci COMMENT "kv data";
|
||||
-- Create "model_instance" table
|
||||
CREATE TABLE `opencoze`.`model_instance` (`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "id", `type` tinyint NOT NULL COMMENT "Model Type 0-LLM 1-TextEmbedding 2-Rerank ", `provider` json NOT NULL COMMENT "Provider Information", `display_info` json NOT NULL COMMENT "Display Information", `connection` json NOT NULL COMMENT "Connection Information", `capability` json NOT NULL COMMENT "Model Capability", `parameters` json NOT NULL COMMENT "Model Parameters", `extra` json NULL COMMENT "Extra Information", `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", PRIMARY KEY (`id`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Model Instance Management Table";
|
||||
@@ -0,0 +1,5 @@
|
||||
-- Modify "app_static_conversation_draft" table
|
||||
ALTER TABLE `opencoze`.`app_static_conversation_draft` COMMENT "app_static_conversation_draft";
|
||||
-- Modify "app_static_conversation_online" table
|
||||
ALTER TABLE `opencoze`.`app_static_conversation_online` COMMENT "app_static_conversation_online";
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
-- Modify "conversation" table
|
||||
ALTER TABLE `opencoze`.`conversation` ADD COLUMN `user_id` varchar(255) NOT NULL DEFAULT "" COMMENT "user id with runtime";
|
||||
@@ -0,0 +1,18 @@
|
||||
h1:rpu8MnfqHOGZgvvh8p2w3lMlIMNBL/6X1UZ6ng6v4oM=
|
||||
20250703095335_initial.sql h1:/joaeUTMhXqAEc0KwsSve5+bYM0qPOp+9OizJtsRc+U=
|
||||
20250703115304_update.sql h1:cbYo6Q6Lh96hB4hu5KW2Nn/Mr0VDpg7a1WPgpIb1SOc=
|
||||
20250704040445_update.sql h1:QWmoPY//oQ+GFZwET9w/oAWa8mM0KVaD5G8Yiu9bMqY=
|
||||
20250708075302_update.sql h1:QGyaDOKhpdgSrb2CsqsiqL+FKMvXaLjxdMtwt+QsuRA=
|
||||
20250710100212_update.sql h1:mN/3iKQDoIw2BTkMwWp3I/qOAcVGrQJ5tOJ0OqH4ZWU=
|
||||
20250711034533_update.sql h1:EWeK//5urS9hJIRCeD3lwQYWNH9AIKEWG9pMLdw7KPc=
|
||||
20250717125913_update.sql h1:WtPR99RlWZn0rXZsB19qp1hq0FwO5qmFhcTcV6EnFYs=
|
||||
20250718104121_update.sql h1:JY7wbfjkmqTUAvTKBm9mC1w/cobKfSGK3eqYBUpDF0k=
|
||||
20250730131847_update.sql h1:3bSBm4UxtXWKSmnQHcd/T9uqw6riB0vcFNatiR6Ptj8=
|
||||
20250802115105_update.sql h1:89M8rwxbidK8uZ0UDFS++HQw+m/b0vugbfrF6kQXbEI=
|
||||
20250812093734_update.sql h1:27fQaPt0LYi1dA7MABvERthVR4pj4MRWFgdRVR3cd6w=
|
||||
20250813081543_update.sql h1:HyBPu1LVs8oiyABbZDU3fFW0n6MeC7qOpzcHWVkwNVc=
|
||||
20250822060516_update.sql h1:KoL8FPXw5/JMsJMtJsoGFIc4wYHlngBudeYSz5o4iKU=
|
||||
20251015103940_update.sql h1:ivE+qtF4q3bMFroid1yMSO465s5Oiey/5VvQ7GWnBlY=
|
||||
20251016034721_update.sql h1:BLXpKpa3LBVyiuMDGSwud6WwM+34jQQvn11ytYZCbrw=
|
||||
20251024091145_update.sql h1:WH/24vD2bYK6udS7GRO1Enzw81SjCpRcbOSkzUhiMrk=
|
||||
20251028085526_update.sql h1:Nv8QPX8ctvnQmDeA8z4kr1ltTEULErgD7FxpMHyzYCg=
|
||||
@@ -0,0 +1,580 @@
|
||||
name: coze-studio-debug
|
||||
|
||||
x-env-file: &env_file
|
||||
- .env.debug
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:8.4.5
|
||||
container_name: coze-mysql
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root}
|
||||
MYSQL_DATABASE: ${MYSQL_DATABASE:-opencoze}
|
||||
MYSQL_USER: ${MYSQL_USER:-coze}
|
||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-coze123}
|
||||
profiles: ['middleware', 'mysql-setup', 'mysql']
|
||||
env_file: *env_file
|
||||
ports:
|
||||
- '127.0.0.1:3306:3306'
|
||||
volumes:
|
||||
- ./data/mysql:/var/lib/mysql
|
||||
- ./volumes/mysql/schema.sql:/docker-entrypoint-initdb.d/init.sql
|
||||
- ./atlas/opencoze_latest_schema.hcl:/opencoze_latest_schema.hcl:ro
|
||||
entrypoint:
|
||||
- bash
|
||||
- -c
|
||||
- |
|
||||
/usr/local/bin/docker-entrypoint.sh mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci &
|
||||
MYSQL_PID=$$!
|
||||
|
||||
echo 'Waiting for MySQL to start...'
|
||||
until mysqladmin ping -h localhost -u root -p$${MYSQL_ROOT_PASSWORD} --silent 2>/dev/null; do
|
||||
echo 'MySQL is starting...'
|
||||
sleep 2
|
||||
done
|
||||
|
||||
echo 'Waiting for workflow_version table to exist...'
|
||||
while true; do
|
||||
if mysql -h localhost -u root -p$${MYSQL_ROOT_PASSWORD} $${MYSQL_DATABASE} -e "SHOW TABLES LIKE 'workflow_version';" 2>/dev/null | grep -q "workflow_version"; then
|
||||
echo 'Found workflow_version table, continuing...'
|
||||
break
|
||||
else
|
||||
echo 'workflow_version table not found, retrying in 2 seconds...'
|
||||
sleep 2
|
||||
fi
|
||||
done
|
||||
|
||||
echo 'MySQL is ready, installing Atlas CLI...'
|
||||
|
||||
if ! command -v atlas >/dev/null 2>&1; then
|
||||
echo 'Installing Atlas CLI...'
|
||||
curl -sSf https://atlasgo.sh | sh -s -- -y --community
|
||||
export PATH=$$PATH:/root/.local/bin
|
||||
else
|
||||
echo 'Atlas CLI already installed'
|
||||
fi
|
||||
|
||||
if [ -f '/opencoze_latest_schema.hcl' ]; then
|
||||
echo 'Running Atlas migrations...'
|
||||
ATLAS_URL="mysql://$${MYSQL_USER}:$${MYSQL_PASSWORD}@localhost:3306/$${MYSQL_DATABASE}"
|
||||
atlas schema apply -u "$ATLAS_URL" --to "file:///opencoze_latest_schema.hcl" --exclude "atlas_schema_revisions,table_*" --auto-approve
|
||||
echo 'Atlas migrations completed successfully'
|
||||
else
|
||||
echo 'No migrations found'
|
||||
fi
|
||||
wait $$MYSQL_PID
|
||||
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
'CMD',
|
||||
'mysqladmin',
|
||||
'ping',
|
||||
'-h',
|
||||
'localhost',
|
||||
'-u$${MYSQL_USER}',
|
||||
'-p$${MYSQL_PASSWORD}',
|
||||
]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
networks:
|
||||
- coze-network
|
||||
|
||||
redis:
|
||||
image: bitnamilegacy/redis:8.0
|
||||
container_name: coze-redis
|
||||
user: root
|
||||
privileged: true
|
||||
profiles: ['middleware']
|
||||
env_file: *env_file
|
||||
environment:
|
||||
- REDIS_AOF_ENABLED=${REDIS_AOF_ENABLED:-no}
|
||||
- REDIS_PORT_NUMBER=${REDIS_PORT_NUMBER:-6379}
|
||||
- REDIS_IO_THREADS=${REDIS_IO_THREADS:-4}
|
||||
- ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD:-yes}
|
||||
ports:
|
||||
- '127.0.0.1:6379:6379'
|
||||
volumes:
|
||||
- ./data/bitnami/redis:/bitnami/redis/data:rw,Z
|
||||
command: >
|
||||
bash -c "
|
||||
/opt/bitnami/scripts/redis/setup.sh
|
||||
# Set proper permissions for data directories
|
||||
chown -R redis:redis /bitnami/redis/data
|
||||
chmod g+s /bitnami/redis/data
|
||||
|
||||
exec /opt/bitnami/scripts/redis/entrypoint.sh /opt/bitnami/scripts/redis/run.sh
|
||||
"
|
||||
depends_on:
|
||||
minio-setup:
|
||||
condition: service_completed_successfully
|
||||
mysql-setup-schema:
|
||||
condition: service_completed_successfully
|
||||
mysql-setup-init-sql:
|
||||
condition: service_completed_successfully
|
||||
healthcheck:
|
||||
test: ['CMD', 'redis-cli', 'ping']
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
networks:
|
||||
- coze-network
|
||||
|
||||
# rocketmq-namesrv:
|
||||
# image: apache/rocketmq:5.3.2
|
||||
# container_name: coze-rocketmq-namesrv
|
||||
# privileged: true
|
||||
# user: root
|
||||
# profiles: ['middleware']
|
||||
# env_file: *env_file
|
||||
# ports:
|
||||
# - '127.0.0.1:9876:9876'
|
||||
# volumes:
|
||||
# - ./data/rocketmq/namesrv/logs:/home/rocketmq/logs:rw,Z
|
||||
# - ./data/rocketmq/namesrv/store:/home/rocketmq/store:rw,Z
|
||||
# environment:
|
||||
# - ALLOW_ANONYMOUS_LOGIN=yes
|
||||
# command: >
|
||||
# bash -c "
|
||||
# # Set proper permissions for data directories
|
||||
# mkdir -p /home/rocketmq/logs /home/rocketmq/store
|
||||
# mkdir -p /home/rocketmq/logs/rocketmqlogs
|
||||
# touch /home/rocketmq/logs/rocketmqlogs/tools.log
|
||||
# touch /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 NameServer...'
|
||||
# sh mqnamesrv
|
||||
# "
|
||||
# healthcheck:
|
||||
# test: ['CMD', 'sh', 'mqadmin', 'clusterList', '-n', 'localhost:9876']
|
||||
# interval: 5s
|
||||
# timeout: 10s
|
||||
# retries: 10
|
||||
# start_period: 10s
|
||||
# networks:
|
||||
# - coze-network
|
||||
# rocketmq-broker:
|
||||
# image: apache/rocketmq:5.3.2
|
||||
# container_name: coze-rocketmq-broker
|
||||
# privileged: true
|
||||
# user: root
|
||||
# profiles: ['middleware']
|
||||
# env_file: *env_file
|
||||
# ports:
|
||||
# - '127.0.0.1:10909:10909'
|
||||
# - '127.0.0.1:10911:10911'
|
||||
# - '127.0.0.1:10912:10912'
|
||||
# volumes:
|
||||
# - ./data/rocketmq/broker/logs:/home/rocketmq/logs:rw,Z
|
||||
# - ./data/rocketmq/broker/store:/home/rocketmq/store:rw,Z
|
||||
# - ./volumes/rocketmq/broker.conf:/home/rocketmq/conf/broker.conf:rw,Z
|
||||
# networks:
|
||||
# - coze-network
|
||||
# command: >
|
||||
# bash -c '
|
||||
# # Set proper permissions
|
||||
# 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..."
|
||||
# sh mqbroker -n rocketmq-namesrv:9876 -c /home/rocketmq/conf/broker.conf &
|
||||
|
||||
# echo "Waiting for Broker registration..."
|
||||
# broker_ready=false
|
||||
# for i in {1..60}; do
|
||||
# if sh mqadmin clusterList -n rocketmq-namesrv:9876 \
|
||||
# | 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
|
||||
|
||||
# echo "Creating topics..."
|
||||
# for t in opencoze_knowledge opencoze_search_app opencoze_search_resource \
|
||||
# %RETRY%cg_knowledge %RETRY%cg_search_app %RETRY%cg_search_resource; do
|
||||
# sh mqadmin updateTopic -n rocketmq-namesrv:9876 \
|
||||
# -c DefaultCluster -t "$$t"
|
||||
# done
|
||||
|
||||
# touch /tmp/rocketmq_ready
|
||||
# echo "Broker started successfully."
|
||||
# wait
|
||||
# '
|
||||
# depends_on:
|
||||
# - rocketmq-namesrv
|
||||
# healthcheck:
|
||||
# test: ['CMD-SHELL', '[ -f /tmp/rocketmq_ready ]']
|
||||
# interval: 10s
|
||||
# timeout: 10s
|
||||
# retries: 10
|
||||
# start_period: 10s
|
||||
|
||||
elasticsearch:
|
||||
image: bitnamilegacy/elasticsearch:8.18.0
|
||||
container_name: coze-elasticsearch
|
||||
user: root
|
||||
privileged: true
|
||||
profiles: ['middleware']
|
||||
env_file: *env_file
|
||||
environment:
|
||||
- TEST=1
|
||||
# Add Java certificate trust configuration
|
||||
# - ES_JAVA_OPTS=-Djdk.tls.client.protocols=TLSv1.2 -Dhttps.protocols=TLSv1.2 -Djavax.net.ssl.trustAll=true -Xms4096m -Xmx4096m
|
||||
ports:
|
||||
- '127.0.0.1:9200:9200'
|
||||
volumes:
|
||||
- ./data/bitnami/elasticsearch:/bitnami/elasticsearch/data
|
||||
- ./volumes/elasticsearch/elasticsearch.yml:/opt/bitnami/elasticsearch/config/my_elasticsearch.yml
|
||||
- ./volumes/elasticsearch/analysis-smartcn.zip:/opt/bitnami/elasticsearch/analysis-smartcn.zip:rw,Z
|
||||
- ./volumes/elasticsearch/setup_es.sh:/setup_es.sh
|
||||
- ./volumes/elasticsearch/es_index_schema:/es_index_schema
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
'CMD-SHELL',
|
||||
'curl -f http://localhost:9200 && [ -f /tmp/es_plugins_ready ] && [ -f /tmp/es_init_complete ]',
|
||||
]
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
networks:
|
||||
- coze-network
|
||||
# Install smartcn analyzer plugin and initialize ES
|
||||
command: >
|
||||
bash -c "
|
||||
/opt/bitnami/scripts/elasticsearch/setup.sh
|
||||
# Set proper permissions for data directories
|
||||
chown -R elasticsearch:elasticsearch /bitnami/elasticsearch/data
|
||||
chmod g+s /bitnami/elasticsearch/data
|
||||
|
||||
# Create plugin directory
|
||||
mkdir -p /bitnami/elasticsearch/plugins;
|
||||
|
||||
# Unzip plugin to plugin directory and set correct permissions
|
||||
echo 'Installing smartcn plugin...';
|
||||
if [ ! -d /opt/bitnami/elasticsearch/plugins/analysis-smartcn ]; then
|
||||
|
||||
# Download plugin package locally
|
||||
echo 'Copying smartcn plugin...';
|
||||
cp /opt/bitnami/elasticsearch/analysis-smartcn.zip /tmp/analysis-smartcn.zip
|
||||
|
||||
elasticsearch-plugin install file:///tmp/analysis-smartcn.zip
|
||||
if [[ "$$?" != "0" ]]; then
|
||||
echo 'Plugin installation failed, exiting operation';
|
||||
rm -rf /opt/bitnami/elasticsearch/plugins/analysis-smartcn
|
||||
exit 1;
|
||||
fi;
|
||||
rm -f /tmp/analysis-smartcn.zip;
|
||||
fi;
|
||||
|
||||
# Create marker file indicating plugin installation success
|
||||
touch /tmp/es_plugins_ready;
|
||||
echo 'Plugin installation successful, marker file created';
|
||||
|
||||
# Start initialization script in background
|
||||
(
|
||||
echo 'Waiting for Elasticsearch to be ready...'
|
||||
until curl -s -f http://localhost:9200/_cat/health >/dev/null 2>&1; do
|
||||
echo 'Elasticsearch not ready, waiting...'
|
||||
sleep 2
|
||||
done
|
||||
echo 'Elasticsearch is ready!'
|
||||
|
||||
# Run ES initialization script
|
||||
echo 'Running Elasticsearch initialization...'
|
||||
sed 's/\r$$//' /setup_es.sh > /setup_es_fixed.sh
|
||||
chmod +x /setup_es_fixed.sh
|
||||
/setup_es_fixed.sh --index-dir /es_index_schema
|
||||
# Create marker file indicating initialization completion
|
||||
touch /tmp/es_init_complete
|
||||
echo 'Elasticsearch initialization completed successfully!'
|
||||
) &
|
||||
|
||||
# Start Elasticsearch
|
||||
exec /opt/bitnami/scripts/elasticsearch/entrypoint.sh /opt/bitnami/scripts/elasticsearch/run.sh
|
||||
echo -e "⏳ Adjusting Elasticsearch disk watermark settings..."
|
||||
"
|
||||
|
||||
minio:
|
||||
image: minio/minio:RELEASE.2025-06-13T11-33-47Z-cpuv1
|
||||
container_name: coze-minio
|
||||
user: root
|
||||
privileged: true
|
||||
profiles: ['middleware']
|
||||
env_file: *env_file
|
||||
ports:
|
||||
- '9000:9000'
|
||||
- '9001:9001'
|
||||
volumes:
|
||||
- ./data/minio:/data
|
||||
environment:
|
||||
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minioadmin}
|
||||
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-minioadmin123}
|
||||
MINIO_DEFAULT_BUCKETS: ${STORAGE_BUCKET:-opencoze},${MINIO_DEFAULT_BUCKETS:-milvus}
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
'CMD-SHELL',
|
||||
'/usr/bin/mc alias set health_check http://localhost:9000 ${MINIO_ROOT_USER} ${MINIO_ROOT_PASSWORD} && /usr/bin/mc ready health_check',
|
||||
]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
networks:
|
||||
- coze-network
|
||||
|
||||
etcd:
|
||||
image: bitnamilegacy/etcd:3.5
|
||||
container_name: coze-etcd
|
||||
user: root
|
||||
privileged: true
|
||||
profiles: ['middleware']
|
||||
env_file: *env_file
|
||||
environment:
|
||||
- ETCD_AUTO_COMPACTION_MODE=revision
|
||||
- ETCD_AUTO_COMPACTION_RETENTION=1000
|
||||
- ETCD_QUOTA_BACKEND_BYTES=4294967296
|
||||
- ALLOW_NONE_AUTHENTICATION=yes
|
||||
ports:
|
||||
- '127.0.0.1:2379:2379'
|
||||
- '127.0.0.1:2380:2380'
|
||||
volumes:
|
||||
- ./data/bitnami/etcd:/bitnami/etcd:rw,Z
|
||||
- ./volumes/etcd/etcd.conf.yml:/opt/bitnami/etcd/conf/etcd.conf.yml:ro,Z
|
||||
command: >
|
||||
bash -c "
|
||||
/opt/bitnami/scripts/etcd/setup.sh
|
||||
# Set proper permissions for data and config directories
|
||||
chown -R etcd:etcd /bitnami/etcd
|
||||
chmod g+s /bitnami/etcd
|
||||
|
||||
exec /opt/bitnami/scripts/etcd/entrypoint.sh /opt/bitnami/scripts/etcd/run.sh
|
||||
"
|
||||
healthcheck:
|
||||
test: ['CMD', 'etcdctl', 'endpoint', 'health']
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
networks:
|
||||
- coze-network
|
||||
|
||||
milvus:
|
||||
container_name: coze-milvus
|
||||
image: milvusdb/milvus:v2.5.10
|
||||
user: root
|
||||
privileged: true
|
||||
profiles: ['middleware']
|
||||
env_file: *env_file
|
||||
command: >
|
||||
bash -c "
|
||||
# Set proper permissions for data directories
|
||||
chown -R root:root /var/lib/milvus
|
||||
chmod g+s /var/lib/milvus
|
||||
|
||||
exec milvus run standalone
|
||||
"
|
||||
security_opt:
|
||||
- seccomp:unconfined
|
||||
environment:
|
||||
ETCD_ENDPOINTS: coze-etcd:2379
|
||||
MINIO_ADDRESS: coze-minio:9000
|
||||
MINIO_BUCKET_NAME: ${MINIO_DEFAULT_BUCKETS:-milvus}
|
||||
MINIO_ACCESS_KEY_ID: ${MINIO_ROOT_USER:-minioadmin}
|
||||
MINIO_SECRET_ACCESS_KEY: ${MINIO_ROOT_PASSWORD:-minioadmin123}
|
||||
MINIO_USE_SSL: false
|
||||
LOG_LEVEL: debug
|
||||
volumes:
|
||||
- ./data/milvus:/var/lib/milvus:rw,Z
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9091/healthz']
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
ports:
|
||||
- '127.0.0.1:19530:19530'
|
||||
- '127.0.0.1:9091:9091'
|
||||
depends_on:
|
||||
etcd:
|
||||
condition: service_healthy
|
||||
minio:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- coze-network
|
||||
nsqlookupd:
|
||||
image: nsqio/nsq:v1.2.1
|
||||
container_name: coze-nsqlookupd
|
||||
command: /nsqlookupd
|
||||
profiles: ['middleware']
|
||||
ports:
|
||||
- '127.0.0.1:4160:4160'
|
||||
- '127.0.0.1:4161:4161'
|
||||
networks:
|
||||
- coze-network
|
||||
healthcheck:
|
||||
test: ['CMD-SHELL', 'nsqlookupd --version']
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
|
||||
nsqd:
|
||||
image: nsqio/nsq:v1.2.1
|
||||
container_name: coze-nsqd
|
||||
command: /nsqd --lookupd-tcp-address=coze-nsqlookupd:4160 --broadcast-address=coze-nsqd
|
||||
profiles: ['middleware']
|
||||
ports:
|
||||
- '127.0.0.1:4150:4150'
|
||||
- '127.0.0.1:4151:4151'
|
||||
depends_on:
|
||||
nsqlookupd:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- coze-network
|
||||
healthcheck:
|
||||
test: ['CMD-SHELL', '/nsqd --version']
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
|
||||
nsqadmin:
|
||||
image: nsqio/nsq:v1.2.1
|
||||
container_name: coze-nsqadmin
|
||||
command: /nsqadmin --lookupd-http-address=coze-nsqlookupd:4161
|
||||
profiles: ['middleware']
|
||||
ports:
|
||||
- '127.0.0.1:4171:4171'
|
||||
depends_on:
|
||||
nsqlookupd:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- coze-network
|
||||
|
||||
minio-setup:
|
||||
image: minio/mc:RELEASE.2025-05-21T01-59-54Z-cpuv1
|
||||
container_name: coze-minio-setup
|
||||
profiles: ['middleware']
|
||||
env_file: *env_file
|
||||
depends_on:
|
||||
minio:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- ./volumes/minio/default_icon/:/default_icon
|
||||
- ./volumes/minio/official_plugin_icon/:/official_plugin_icon
|
||||
entrypoint: >
|
||||
/bin/sh -c "
|
||||
(/usr/bin/mc alias set localminio http://coze-minio:9000 ${MINIO_ROOT_USER} ${MINIO_ROOT_PASSWORD} && \
|
||||
/usr/bin/mc mb --ignore-existing localminio/${STORAGE_BUCKET} && \
|
||||
/usr/bin/mc cp --recursive /default_icon/ localminio/${STORAGE_BUCKET}/default_icon/ && \
|
||||
/usr/bin/mc cp --recursive /official_plugin_icon/ localminio/${STORAGE_BUCKET}/official_plugin_icon/ && \
|
||||
echo 'upload files to minio complete: Files uploaded to ${STORAGE_BUCKET} bucket.') || exit 1; \
|
||||
"
|
||||
networks:
|
||||
- coze-network
|
||||
restart: 'no'
|
||||
|
||||
mysql-setup-schema:
|
||||
image: arigaio/atlas:0.35.0-community-alpine
|
||||
container_name: coze-mysql-setup-schema
|
||||
profiles: ['middleware', 'mysql-setup', 'run-server']
|
||||
env_file: *env_file
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- ./atlas/opencoze_latest_schema.hcl:/opencoze_latest_schema.hcl
|
||||
entrypoint:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
set -ex
|
||||
TMP_ATLAS_URL="${ATLAS_URL}"
|
||||
if [ "${MYSQL_HOST}" = "localhost" ] || [ "${MYSQL_HOST}" = "127.0.0.1" ]; then
|
||||
echo "MYSQL_HOST is localhost or 127.0.0.1, replacing with docker network address"
|
||||
TMP_ATLAS_URL="mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@mysql:${MYSQL_PORT}/${MYSQL_DATABASE}?charset=utf8mb4&parseTime=True"
|
||||
fi
|
||||
|
||||
echo "final atlas url: $${TMP_ATLAS_URL}"
|
||||
for i in `seq 1 60`; do
|
||||
if atlas schema apply \
|
||||
-u "$${TMP_ATLAS_URL}" \
|
||||
--to file:///opencoze_latest_schema.hcl \
|
||||
--exclude "atlas_schema_revisions,table_*" \
|
||||
--auto-approve; then
|
||||
echo "MySQL setup complete."
|
||||
exit 0
|
||||
fi
|
||||
echo "atlas schema apply failed, retrying...($$i/60)"
|
||||
sleep 1
|
||||
done
|
||||
echo "MySQL setup failed after 60 retries."
|
||||
exit 1
|
||||
networks:
|
||||
- coze-network
|
||||
mysql-setup-init-sql:
|
||||
image: mysql:8.4.5
|
||||
container_name: coze-mysql-setup-init-sql
|
||||
profiles: ['middleware', 'mysql-setup', 'run-server', 'volcano-setup']
|
||||
env_file: *env_file
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
set -ex
|
||||
for i in $$(seq 1 60); do
|
||||
DB_HOST="$${MYSQL_HOST}"
|
||||
if [ "$${MYSQL_HOST}" = "localhost" ] || [ "$${MYSQL_HOST}" = "127.0.0.1" ]; then
|
||||
DB_HOST="mysql"
|
||||
fi
|
||||
if mysql -h "$${DB_HOST}" -P"$${MYSQL_PORT}" -u"$${MYSQL_USER}" -p"$${MYSQL_PASSWORD}" "$${MYSQL_DATABASE}" < /schema.sql && \
|
||||
mysql -h "$${DB_HOST}" -P"$${MYSQL_PORT}" -u"$${MYSQL_USER}" -p"$${MYSQL_PASSWORD}" "$${MYSQL_DATABASE}" < /sql_init.sql; then
|
||||
echo 'MySQL init success.'
|
||||
exit 0
|
||||
fi
|
||||
echo "Retrying to connect to mysql... ($$i/60)"
|
||||
sleep 1
|
||||
done
|
||||
echo 'Failed to init mysql db.'
|
||||
exit 1
|
||||
volumes:
|
||||
- ./volumes/mysql/sql_init.sql:/sql_init.sql
|
||||
- ./volumes/mysql/schema.sql:/schema.sql
|
||||
networks:
|
||||
- coze-network
|
||||
restart: 'no'
|
||||
|
||||
coze-server:
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: backend/Dockerfile
|
||||
image: opencoze/opencoze:latest
|
||||
profiles: ['build-server']
|
||||
|
||||
networks:
|
||||
coze-network:
|
||||
driver: bridge
|
||||
@@ -0,0 +1,381 @@
|
||||
name: coze-studio
|
||||
# Environment file will be specified via --env-file parameter
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:8.4.5
|
||||
container_name: coze-mysql
|
||||
restart: always
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root}
|
||||
MYSQL_DATABASE: ${MYSQL_DATABASE:-opencoze}
|
||||
MYSQL_USER: ${MYSQL_USER:-coze}
|
||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-coze123}
|
||||
# ports:
|
||||
# - '3306'
|
||||
volumes:
|
||||
- ./data/mysql:/var/lib/mysql
|
||||
- ./volumes/mysql/schema.sql:/docker-entrypoint-initdb.d/init.sql
|
||||
command:
|
||||
- --character-set-server=utf8mb4
|
||||
- --collation-server=utf8mb4_unicode_ci
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
'CMD',
|
||||
'mysqladmin',
|
||||
'ping',
|
||||
'-h',
|
||||
'localhost',
|
||||
'-u$${MYSQL_USER}',
|
||||
'-p$${MYSQL_PASSWORD}',
|
||||
]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
networks:
|
||||
- coze-network
|
||||
|
||||
redis:
|
||||
image: bitnamilegacy/redis:8.0
|
||||
container_name: coze-redis
|
||||
restart: always
|
||||
user: root
|
||||
privileged: true
|
||||
environment:
|
||||
- REDIS_AOF_ENABLED=${REDIS_AOF_ENABLED:-no}
|
||||
- REDIS_PORT_NUMBER=${REDIS_PORT_NUMBER:-6379}
|
||||
- REDIS_IO_THREADS=${REDIS_IO_THREADS:-4}
|
||||
- ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD:-yes}
|
||||
# ports:
|
||||
# - '6379'
|
||||
volumes:
|
||||
- ./data/bitnami/redis:/bitnami/redis/data:rw,Z
|
||||
command: >
|
||||
bash -c "
|
||||
/opt/bitnami/scripts/redis/setup.sh
|
||||
# Set proper permissions for data directories
|
||||
chown -R redis:redis /bitnami/redis/data
|
||||
chmod g+s /bitnami/redis/data
|
||||
|
||||
exec /opt/bitnami/scripts/redis/entrypoint.sh /opt/bitnami/scripts/redis/run.sh
|
||||
"
|
||||
healthcheck:
|
||||
test: ['CMD', 'redis-cli', 'ping']
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
networks:
|
||||
- coze-network
|
||||
elasticsearch:
|
||||
image: bitnamilegacy/elasticsearch:8.18.0
|
||||
container_name: coze-elasticsearch
|
||||
restart: always
|
||||
user: root
|
||||
privileged: true
|
||||
environment:
|
||||
- TEST=1
|
||||
# Add Java certificate trust configuration
|
||||
# - ES_JAVA_OPTS=-Djdk.tls.client.protocols=TLSv1.2 -Dhttps.protocols=TLSv1.2 -Djavax.net.ssl.trustAll=true -Xms4096m -Xmx4096m
|
||||
# ports:
|
||||
# - '9200'
|
||||
volumes:
|
||||
- ./data/bitnami/elasticsearch:/bitnami/elasticsearch/data
|
||||
- ./volumes/elasticsearch/elasticsearch.yml:/opt/bitnami/elasticsearch/config/my_elasticsearch.yml
|
||||
- ./volumes/elasticsearch/analysis-smartcn.zip:/opt/bitnami/elasticsearch/analysis-smartcn.zip:rw,Z
|
||||
- ./volumes/elasticsearch/setup_es.sh:/setup_es.sh
|
||||
- ./volumes/elasticsearch/es_index_schema:/es_index_schema
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
'CMD-SHELL',
|
||||
'curl -f http://localhost:9200 && [ -f /tmp/es_plugins_ready ] && [ -f /tmp/es_init_complete ]',
|
||||
]
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
networks:
|
||||
- coze-network
|
||||
# Install smartcn analyzer plugin and initialize ES
|
||||
command: >
|
||||
bash -c "
|
||||
/opt/bitnami/scripts/elasticsearch/setup.sh
|
||||
# Set proper permissions for data directories
|
||||
chown -R elasticsearch:elasticsearch /bitnami/elasticsearch/data
|
||||
chmod g+s /bitnami/elasticsearch/data
|
||||
|
||||
# Create plugin directory
|
||||
mkdir -p /bitnami/elasticsearch/plugins;
|
||||
|
||||
# Unzip plugin to plugin directory and set correct permissions
|
||||
echo 'Installing smartcn plugin...';
|
||||
if [ ! -d /opt/bitnami/elasticsearch/plugins/analysis-smartcn ]; then
|
||||
|
||||
# Download plugin package locally
|
||||
echo 'Copying smartcn plugin...';
|
||||
cp /opt/bitnami/elasticsearch/analysis-smartcn.zip /tmp/analysis-smartcn.zip
|
||||
|
||||
elasticsearch-plugin install file:///tmp/analysis-smartcn.zip
|
||||
if [[ "$$?" != "0" ]]; then
|
||||
echo 'Plugin installation failed, exiting operation';
|
||||
rm -rf /opt/bitnami/elasticsearch/plugins/analysis-smartcn
|
||||
exit 1;
|
||||
fi;
|
||||
rm -f /tmp/analysis-smartcn.zip;
|
||||
fi;
|
||||
|
||||
# Create marker file indicating plugin installation success
|
||||
touch /tmp/es_plugins_ready;
|
||||
echo 'Plugin installation successful, marker file created';
|
||||
|
||||
# Start initialization script in background
|
||||
(
|
||||
echo 'Waiting for Elasticsearch to be ready...'
|
||||
until curl -s -f http://localhost:9200/_cat/health >/dev/null 2>&1; do
|
||||
echo 'Elasticsearch not ready, waiting...'
|
||||
sleep 2
|
||||
done
|
||||
echo 'Elasticsearch is ready!'
|
||||
|
||||
# Run ES initialization script
|
||||
echo 'Running Elasticsearch initialization...'
|
||||
sed 's/\r$$//' /setup_es.sh > /setup_es_fixed.sh
|
||||
chmod +x /setup_es_fixed.sh
|
||||
/setup_es_fixed.sh --index-dir /es_index_schema
|
||||
# Create marker file indicating initialization completion
|
||||
touch /tmp/es_init_complete
|
||||
echo 'Elasticsearch initialization completed successfully!'
|
||||
) &
|
||||
|
||||
# Start Elasticsearch
|
||||
exec /opt/bitnami/scripts/elasticsearch/entrypoint.sh /opt/bitnami/scripts/elasticsearch/run.sh
|
||||
echo -e "⏳ Adjusting Elasticsearch disk watermark settings..."
|
||||
"
|
||||
|
||||
minio:
|
||||
image: minio/minio:RELEASE.2025-06-13T11-33-47Z-cpuv1
|
||||
container_name: coze-minio
|
||||
user: root
|
||||
privileged: true
|
||||
restart: always
|
||||
# ports:
|
||||
# - '9000'
|
||||
# - '9001'
|
||||
volumes:
|
||||
- ./data/minio:/data
|
||||
- ./volumes/minio/default_icon/:/default_icon
|
||||
- ./volumes/minio/official_plugin_icon/:/official_plugin_icon
|
||||
environment:
|
||||
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minioadmin}
|
||||
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-minioadmin123}
|
||||
MINIO_DEFAULT_BUCKETS: ${STORAGE_BUCKET:-opencoze},${MINIO_DEFAULT_BUCKETS:-oceanbase}
|
||||
entrypoint:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
# Run initialization in background
|
||||
(
|
||||
# Wait for MinIO to be ready
|
||||
until (/usr/bin/mc alias set localminio http://localhost:9000 $${MINIO_ROOT_USER} $${MINIO_ROOT_PASSWORD}) do
|
||||
echo "Waiting for MinIO to be ready..."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Create bucket and copy files
|
||||
/usr/bin/mc mb --ignore-existing localminio/$${STORAGE_BUCKET}
|
||||
/usr/bin/mc cp --recursive /default_icon/ localminio/$${STORAGE_BUCKET}/default_icon/
|
||||
/usr/bin/mc cp --recursive /official_plugin_icon/ localminio/$${STORAGE_BUCKET}/official_plugin_icon/
|
||||
|
||||
echo "MinIO initialization complete."
|
||||
) &
|
||||
|
||||
# Start minio server in foreground
|
||||
exec minio server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
'CMD-SHELL',
|
||||
'/usr/bin/mc alias set health_check http://localhost:9000 ${MINIO_ROOT_USER} ${MINIO_ROOT_PASSWORD} && /usr/bin/mc ready health_check',
|
||||
]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
networks:
|
||||
- coze-network
|
||||
|
||||
etcd:
|
||||
image: bitnamilegacy/etcd:3.5
|
||||
container_name: coze-etcd
|
||||
user: root
|
||||
restart: always
|
||||
privileged: true
|
||||
environment:
|
||||
- ETCD_AUTO_COMPACTION_MODE=revision
|
||||
- ETCD_AUTO_COMPACTION_RETENTION=1000
|
||||
- ETCD_QUOTA_BACKEND_BYTES=4294967296
|
||||
- ALLOW_NONE_AUTHENTICATION=yes
|
||||
# ports:
|
||||
# - '2379'
|
||||
# - '2380'
|
||||
volumes:
|
||||
- ./data/bitnami/etcd:/bitnami/etcd:rw,Z
|
||||
- ./volumes/etcd/etcd.conf.yml:/opt/bitnami/etcd/conf/etcd.conf.yml:ro,Z
|
||||
command: >
|
||||
bash -c "
|
||||
/opt/bitnami/scripts/etcd/setup.sh
|
||||
# Set proper permissions for data and config directories
|
||||
chown -R etcd:etcd /bitnami/etcd
|
||||
chmod g+s /bitnami/etcd
|
||||
|
||||
exec /opt/bitnami/scripts/etcd/entrypoint.sh /opt/bitnami/scripts/etcd/run.sh
|
||||
"
|
||||
healthcheck:
|
||||
test: ['CMD', 'etcdctl', 'endpoint', 'health']
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
networks:
|
||||
- coze-network
|
||||
|
||||
# OceanBase for vector storage
|
||||
oceanbase:
|
||||
image: oceanbase/oceanbase-ce:latest
|
||||
container_name: coze-oceanbase
|
||||
restart: always
|
||||
environment:
|
||||
MODE: SLIM
|
||||
OB_DATAFILE_SIZE: 1G
|
||||
OB_SYS_PASSWORD: ${OCEANBASE_PASSWORD:-coze123}
|
||||
OB_TENANT_PASSWORD: ${OCEANBASE_PASSWORD:-coze123}
|
||||
OB_CLUSTER_NAME: ${OCEANBASE_CLUSTER_NAME:-cozeAi}
|
||||
ports:
|
||||
- '2881:2881'
|
||||
volumes:
|
||||
- ./data/oceanbase/ob:/root/ob
|
||||
- ./data/oceanbase/cluster:/root/.obd/cluster
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 4G
|
||||
reservations:
|
||||
memory: 2G
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
'CMD-SHELL',
|
||||
'obclient -h127.0.0.1 -P2881 -uroot@test -pcoze123 -e "SELECT 1;"',
|
||||
]
|
||||
interval: 10s
|
||||
retries: 30
|
||||
start_period: 30s
|
||||
timeout: 10s
|
||||
networks:
|
||||
- coze-network
|
||||
nsqlookupd:
|
||||
image: nsqio/nsq:v1.2.1
|
||||
container_name: coze-nsqlookupd
|
||||
command: /nsqlookupd
|
||||
restart: always
|
||||
# ports:
|
||||
# - '4160'
|
||||
# - '4161'
|
||||
networks:
|
||||
- coze-network
|
||||
healthcheck:
|
||||
test: ['CMD-SHELL', 'nsqlookupd --version']
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
|
||||
nsqd:
|
||||
image: nsqio/nsq:v1.2.1
|
||||
container_name: coze-nsqd
|
||||
command: /nsqd --lookupd-tcp-address=nsqlookupd:4160 --broadcast-address=nsqd
|
||||
restart: always
|
||||
# ports:
|
||||
# - '4150'
|
||||
# - '4151'
|
||||
depends_on:
|
||||
nsqlookupd:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- coze-network
|
||||
healthcheck:
|
||||
test: ['CMD-SHELL', '/nsqd --version']
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
|
||||
nsqadmin:
|
||||
image: nsqio/nsq:v1.2.1
|
||||
container_name: coze-nsqadmin
|
||||
command: /nsqadmin --lookupd-http-address=nsqlookupd:4161
|
||||
restart: always
|
||||
# ports:
|
||||
# - '4171'
|
||||
depends_on:
|
||||
nsqlookupd:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- coze-network
|
||||
|
||||
coze-server:
|
||||
# build:
|
||||
# context: ../
|
||||
# dockerfile: backend/Dockerfile
|
||||
image: cozedev/coze-studio-server:latest
|
||||
restart: always
|
||||
container_name: coze-server
|
||||
# environment:
|
||||
# LISTEN_ADDR: 0.0.0.0:8888
|
||||
networks:
|
||||
- coze-network
|
||||
# ports:
|
||||
# - '8888'
|
||||
# - '8889'
|
||||
volumes:
|
||||
- .env:/app/.env
|
||||
- ../backend/conf:/app/resources/conf
|
||||
# - ../backend/static:/app/resources/static
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
elasticsearch:
|
||||
condition: service_healthy
|
||||
minio:
|
||||
condition: service_healthy
|
||||
oceanbase:
|
||||
condition: service_healthy
|
||||
command: ['/app/opencoze']
|
||||
|
||||
coze-web:
|
||||
# build:
|
||||
# context: ..
|
||||
# dockerfile: frontend/Dockerfile
|
||||
image: cozedev/coze-studio-web:latest
|
||||
container_name: coze-web
|
||||
restart: always
|
||||
ports:
|
||||
- "${WEB_LISTEN_ADDR:-8888}:80"
|
||||
# - "443:443" # SSL port (uncomment if using SSL)
|
||||
volumes:
|
||||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro # Main nginx config
|
||||
- ./nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf:ro # Proxy config
|
||||
# - ./nginx/ssl:/etc/nginx/ssl:ro # SSL certificates (uncomment if using SSL)
|
||||
depends_on:
|
||||
- coze-server
|
||||
networks:
|
||||
- coze-network
|
||||
|
||||
networks:
|
||||
coze-network:
|
||||
driver: bridge
|
||||
@@ -0,0 +1,530 @@
|
||||
name: coze-studio-debug
|
||||
|
||||
x-env-file: &env_file
|
||||
- .env.debug
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:8.4.5
|
||||
container_name: coze-mysql
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root}
|
||||
MYSQL_DATABASE: ${MYSQL_DATABASE:-opencoze}
|
||||
MYSQL_USER: ${MYSQL_USER:-coze}
|
||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-coze123}
|
||||
profiles: ['middleware', 'mysql-setup', 'mysql']
|
||||
env_file: *env_file
|
||||
ports:
|
||||
- '3306:3306'
|
||||
volumes:
|
||||
- ./data/mysql:/var/lib/mysql
|
||||
command:
|
||||
- --character-set-server=utf8mb4
|
||||
- --collation-server=utf8mb4_unicode_ci
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
'CMD',
|
||||
'mysqladmin',
|
||||
'ping',
|
||||
'-h',
|
||||
'localhost',
|
||||
'-u$${MYSQL_USER}',
|
||||
'-p$${MYSQL_PASSWORD}',
|
||||
]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
networks:
|
||||
- coze-network
|
||||
|
||||
redis:
|
||||
image: bitnamilegacy/redis:8.0
|
||||
container_name: coze-redis
|
||||
user: root
|
||||
privileged: true
|
||||
profiles: ['middleware']
|
||||
env_file: *env_file
|
||||
environment:
|
||||
- REDIS_AOF_ENABLED=${REDIS_AOF_ENABLED:-no}
|
||||
- REDIS_PORT_NUMBER=${REDIS_PORT_NUMBER:-6379}
|
||||
- REDIS_IO_THREADS=${REDIS_IO_THREADS:-4}
|
||||
- ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD:-yes}
|
||||
ports:
|
||||
- '6379:6379'
|
||||
volumes:
|
||||
- ./data/bitnami/redis:/bitnami/redis/data:rw,Z
|
||||
command: >
|
||||
bash -c "
|
||||
/opt/bitnami/scripts/redis/setup.sh
|
||||
# Set proper permissions for data directories
|
||||
chown -R redis:redis /bitnami/redis/data
|
||||
chmod g+s /bitnami/redis/data
|
||||
|
||||
exec /opt/bitnami/scripts/redis/entrypoint.sh /opt/bitnami/scripts/redis/run.sh
|
||||
"
|
||||
depends_on:
|
||||
minio-setup:
|
||||
condition: service_completed_successfully
|
||||
mysql-setup-schema:
|
||||
condition: service_completed_successfully
|
||||
mysql-setup-init-sql:
|
||||
condition: service_completed_successfully
|
||||
healthcheck:
|
||||
test: ['CMD', 'redis-cli', 'ping']
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
networks:
|
||||
- coze-network
|
||||
|
||||
# rocketmq-namesrv:
|
||||
# image: apache/rocketmq:5.3.2
|
||||
# container_name: coze-rocketmq-namesrv
|
||||
# privileged: true
|
||||
# user: root
|
||||
# profiles: ['middleware']
|
||||
# env_file: *env_file
|
||||
# ports:
|
||||
# - '9876:9876'
|
||||
# volumes:
|
||||
# - ./data/rocketmq/namesrv/logs:/home/rocketmq/logs:rw,Z
|
||||
# - ./data/rocketmq/namesrv/store:/home/rocketmq/store:rw,Z
|
||||
# environment:
|
||||
# - ALLOW_ANONYMOUS_LOGIN=yes
|
||||
# command: >
|
||||
# bash -c "
|
||||
# # Set proper permissions for data directories
|
||||
# mkdir -p /home/rocketmq/logs /home/rocketmq/store
|
||||
# mkdir -p /home/rocketmq/logs/rocketmqlogs
|
||||
# touch /home/rocketmq/logs/rocketmqlogs/tools.log
|
||||
# touch /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 NameServer...'
|
||||
# sh mqnamesrv
|
||||
# "
|
||||
# healthcheck:
|
||||
# test: ['CMD', 'sh', 'mqadmin', 'clusterList', '-n', 'localhost:9876']
|
||||
# interval: 5s
|
||||
# timeout: 10s
|
||||
# retries: 10
|
||||
# start_period: 10s
|
||||
# networks:
|
||||
# - coze-network
|
||||
# rocketmq-broker:
|
||||
# image: apache/rocketmq:5.3.2
|
||||
# container_name: coze-rocketmq-broker
|
||||
# privileged: true
|
||||
# user: root
|
||||
# profiles: ['middleware']
|
||||
# env_file: *env_file
|
||||
# ports:
|
||||
# - '10909:10909'
|
||||
# - '10911:10911'
|
||||
# - '10912:10912'
|
||||
# volumes:
|
||||
# - ./data/rocketmq/broker/logs:/home/rocketmq/logs:rw,Z
|
||||
# - ./data/rocketmq/broker/store:/home/rocketmq/store:rw,Z
|
||||
# - ./volumes/rocketmq/broker.conf:/home/rocketmq/conf/broker.conf:rw,Z
|
||||
# networks:
|
||||
# - coze-network
|
||||
# command: >
|
||||
# bash -c '
|
||||
# # Set proper permissions
|
||||
# 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..."
|
||||
# sh mqbroker -n rocketmq-namesrv:9876 -c /home/rocketmq/conf/broker.conf &
|
||||
|
||||
# echo "Waiting for Broker registration..."
|
||||
# broker_ready=false
|
||||
# for i in {1..60}; do
|
||||
# if sh mqadmin clusterList -n rocketmq-namesrv:9876 \
|
||||
# | 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
|
||||
|
||||
# echo "Creating topics..."
|
||||
# for t in opencoze_knowledge opencoze_search_app opencoze_search_resource \
|
||||
# %RETRY%cg_knowledge %RETRY%cg_search_app %RETRY%cg_search_resource; do
|
||||
# sh mqadmin updateTopic -n rocketmq-namesrv:9876 \
|
||||
# -c DefaultCluster -t "$$t"
|
||||
# done
|
||||
|
||||
# touch /tmp/rocketmq_ready
|
||||
# echo "Broker started successfully."
|
||||
# wait
|
||||
# '
|
||||
# depends_on:
|
||||
# - rocketmq-namesrv
|
||||
# healthcheck:
|
||||
# test: ['CMD-SHELL', '[ -f /tmp/rocketmq_ready ]']
|
||||
# interval: 10s
|
||||
# timeout: 10s
|
||||
# retries: 10
|
||||
# start_period: 10s
|
||||
|
||||
elasticsearch:
|
||||
image: bitnamilegacy/elasticsearch:8.18.0
|
||||
container_name: coze-elasticsearch
|
||||
user: root
|
||||
privileged: true
|
||||
profiles: ['middleware']
|
||||
env_file: *env_file
|
||||
environment:
|
||||
- TEST=1
|
||||
# Add Java certificate trust configuration
|
||||
# - ES_JAVA_OPTS=-Djdk.tls.client.protocols=TLSv1.2 -Dhttps.protocols=TLSv1.2 -Djavax.net.ssl.trustAll=true -Xms4096m -Xmx4096m
|
||||
ports:
|
||||
- '9200:9200'
|
||||
volumes:
|
||||
- ./data/bitnami/elasticsearch:/bitnami/elasticsearch/data
|
||||
- ./volumes/elasticsearch/elasticsearch.yml:/opt/bitnami/elasticsearch/config/my_elasticsearch.yml
|
||||
- ./volumes/elasticsearch/analysis-smartcn.zip:/opt/bitnami/elasticsearch/analysis-smartcn.zip:rw,Z
|
||||
- ./volumes/elasticsearch/setup_es.sh:/setup_es.sh
|
||||
- ./volumes/elasticsearch/es_index_schema:/es_index_schemas
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
'CMD-SHELL',
|
||||
'curl -f http://localhost:9200 && [ -f /tmp/es_plugins_ready ] && [ -f /tmp/es_init_complete ]',
|
||||
]
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
networks:
|
||||
- coze-network
|
||||
# Install smartcn analyzer plugin and initialize ES
|
||||
command: >
|
||||
bash -c "
|
||||
/opt/bitnami/scripts/elasticsearch/setup.sh
|
||||
# Set proper permissions for data directories
|
||||
chown -R elasticsearch:elasticsearch /bitnami/elasticsearch/data
|
||||
chmod g+s /bitnami/elasticsearch/data
|
||||
|
||||
# Create plugin directory
|
||||
mkdir -p /bitnami/elasticsearch/plugins;
|
||||
|
||||
# Unzip plugin to plugin directory and set correct permissions
|
||||
echo 'Installing smartcn plugin...';
|
||||
if [ ! -d /opt/bitnami/elasticsearch/plugins/analysis-smartcn ]; then
|
||||
|
||||
# Download plugin package locally
|
||||
echo 'Copying smartcn plugin...';
|
||||
cp /opt/bitnami/elasticsearch/analysis-smartcn.zip /tmp/analysis-smartcn.zip
|
||||
|
||||
elasticsearch-plugin install file:///tmp/analysis-smartcn.zip
|
||||
if [[ "$$?" != "0" ]]; then
|
||||
echo 'Plugin installation failed, exiting operation';
|
||||
rm -rf /opt/bitnami/elasticsearch/plugins/analysis-smartcn
|
||||
exit 1;
|
||||
fi;
|
||||
rm -f /tmp/analysis-smartcn.zip;
|
||||
fi;
|
||||
|
||||
# Create marker file indicating plugin installation success
|
||||
touch /tmp/es_plugins_ready;
|
||||
echo 'Plugin installation successful, marker file created';
|
||||
|
||||
# Start initialization script in background
|
||||
(
|
||||
echo 'Waiting for Elasticsearch to be ready...'
|
||||
until curl -s -f http://localhost:9200/_cat/health >/dev/null 2>&1; do
|
||||
echo 'Elasticsearch not ready, waiting...'
|
||||
sleep 2
|
||||
done
|
||||
echo 'Elasticsearch is ready!'
|
||||
|
||||
# Run ES initialization script
|
||||
echo 'Running Elasticsearch initialization...'
|
||||
sed 's/\r$$//' /setup_es.sh > /setup_es_fixed.sh
|
||||
chmod +x /setup_es_fixed.sh
|
||||
/setup_es_fixed.sh --index-dir /es_index_schemas
|
||||
# Create marker file indicating initialization completion
|
||||
touch /tmp/es_init_complete
|
||||
echo 'Elasticsearch initialization completed successfully!'
|
||||
) &
|
||||
|
||||
# Start Elasticsearch
|
||||
exec /opt/bitnami/scripts/elasticsearch/entrypoint.sh /opt/bitnami/scripts/elasticsearch/run.sh
|
||||
echo -e "⏳ Adjusting Elasticsearch disk watermark settings..."
|
||||
"
|
||||
|
||||
minio:
|
||||
image: minio/minio:RELEASE.2025-06-13T11-33-47Z-cpuv1
|
||||
container_name: coze-minio
|
||||
user: root
|
||||
privileged: true
|
||||
profiles: ['middleware']
|
||||
env_file: *env_file
|
||||
ports:
|
||||
- '9000:9000'
|
||||
- '9001:9001'
|
||||
volumes:
|
||||
- ./data/minio:/data
|
||||
environment:
|
||||
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minioadmin}
|
||||
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-minioadmin123}
|
||||
MINIO_DEFAULT_BUCKETS: ${MINIO_BUCKET:-opencoze},${MINIO_DEFAULT_BUCKETS:-oceanbase}
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
'CMD-SHELL',
|
||||
'/usr/bin/mc alias set health_check http://localhost:9000 ${MINIO_ROOT_USER} ${MINIO_ROOT_PASSWORD} && /usr/bin/mc ready health_check',
|
||||
]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
networks:
|
||||
- coze-network
|
||||
|
||||
etcd:
|
||||
image: bitnamilegacy/etcd:3.5
|
||||
container_name: coze-etcd
|
||||
user: root
|
||||
privileged: true
|
||||
profiles: ['middleware']
|
||||
env_file: *env_file
|
||||
environment:
|
||||
- ETCD_AUTO_COMPACTION_MODE=revision
|
||||
- ETCD_AUTO_COMPACTION_RETENTION=1000
|
||||
- ETCD_QUOTA_BACKEND_BYTES=4294967296
|
||||
- ALLOW_NONE_AUTHENTICATION=yes
|
||||
ports:
|
||||
- 2379:2379
|
||||
- 2380:2380
|
||||
volumes:
|
||||
- ./data/bitnami/etcd:/bitnami/etcd:rw,Z
|
||||
- ./volumes/etcd/etcd.conf.yml:/opt/bitnami/etcd/conf/etcd.conf.yml:ro,Z
|
||||
command: >
|
||||
bash -c "
|
||||
/opt/bitnami/scripts/etcd/setup.sh
|
||||
# Set proper permissions for data and config directories
|
||||
chown -R etcd:etcd /bitnami/etcd
|
||||
chmod g+s /bitnami/etcd
|
||||
|
||||
exec /opt/bitnami/scripts/etcd/entrypoint.sh /opt/bitnami/scripts/etcd/run.sh
|
||||
"
|
||||
healthcheck:
|
||||
test: ['CMD', 'etcdctl', 'endpoint', 'health']
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
networks:
|
||||
- coze-network
|
||||
|
||||
# OceanBase for vector storage
|
||||
oceanbase:
|
||||
image: oceanbase/oceanbase-ce:latest
|
||||
container_name: coze-oceanbase
|
||||
environment:
|
||||
MODE: SLIM
|
||||
OB_DATAFILE_SIZE: 1G
|
||||
OB_SYS_PASSWORD: ${OCEANBASE_PASSWORD:-coze123}
|
||||
OB_TENANT_PASSWORD: ${OCEANBASE_PASSWORD:-coze123}
|
||||
OB_CLUSTER_NAME: ${OCEANBASE_CLUSTER_NAME:-cozeAi}
|
||||
profiles: ['middleware']
|
||||
env_file: *env_file
|
||||
ports:
|
||||
- '2881:2881'
|
||||
volumes:
|
||||
- ./data/oceanbase/ob:/root/ob
|
||||
- ./data/oceanbase/cluster:/root/.obd/cluster
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 4G
|
||||
reservations:
|
||||
memory: 2G
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
'CMD-SHELL',
|
||||
'obclient -h127.0.0.1 -P2881 -uroot@test -pcoze123 -e "SELECT 1;"',
|
||||
]
|
||||
interval: 10s
|
||||
retries: 30
|
||||
start_period: 30s
|
||||
timeout: 10s
|
||||
networks:
|
||||
- coze-network
|
||||
|
||||
nsqlookupd:
|
||||
image: nsqio/nsq:v1.2.1
|
||||
container_name: coze-nsqlookupd
|
||||
command: /nsqlookupd
|
||||
profiles: ['middleware']
|
||||
ports:
|
||||
- '4160:4160'
|
||||
- '4161:4161'
|
||||
networks:
|
||||
- coze-network
|
||||
healthcheck:
|
||||
test: ['CMD-SHELL', 'nsqlookupd --version']
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
|
||||
nsqd:
|
||||
image: nsqio/nsq:v1.2.1
|
||||
container_name: coze-nsqd
|
||||
command: /nsqd --lookupd-tcp-address=coze-nsqlookupd:4160 --broadcast-address=coze-nsqd
|
||||
profiles: ['middleware']
|
||||
ports:
|
||||
- '4150:4150'
|
||||
- '4151:4151'
|
||||
depends_on:
|
||||
nsqlookupd:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- coze-network
|
||||
healthcheck:
|
||||
test: ['CMD-SHELL', '/nsqd --version']
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
|
||||
nsqadmin:
|
||||
image: nsqio/nsq:v1.2.1
|
||||
container_name: coze-nsqadmin
|
||||
command: /nsqadmin --lookupd-http-address=coze-nsqlookupd:4161
|
||||
profiles: ['middleware']
|
||||
ports:
|
||||
- '4171:4171'
|
||||
depends_on:
|
||||
nsqlookupd:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- coze-network
|
||||
|
||||
minio-setup:
|
||||
image: minio/mc:RELEASE.2025-05-21T01-59-54Z-cpuv1
|
||||
container_name: coze-minio-setup
|
||||
profiles: ['middleware']
|
||||
env_file: *env_file
|
||||
depends_on:
|
||||
minio:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- ./volumes/minio/default_icon/:/default_icon
|
||||
- ./volumes/minio/official_plugin_icon/:/official_plugin_icon
|
||||
entrypoint: >
|
||||
/bin/sh -c "
|
||||
(/usr/bin/mc alias set localminio http://coze-minio:9000 ${MINIO_ROOT_USER} ${MINIO_ROOT_PASSWORD} && \
|
||||
/usr/bin/mc mb --ignore-existing localminio/${STORAGE_BUCKET} && \
|
||||
/usr/bin/mc cp --recursive /default_icon/ localminio/${STORAGE_BUCKET}/default_icon/ && \
|
||||
/usr/bin/mc cp --recursive /official_plugin_icon/ localminio/${STORAGE_BUCKET}/official_plugin_icon/ && \
|
||||
echo 'upload files to minio complete: Files uploaded to ${STORAGE_BUCKET} bucket.') || exit 1; \
|
||||
"
|
||||
networks:
|
||||
- coze-network
|
||||
restart: 'no'
|
||||
|
||||
mysql-setup-schema:
|
||||
image: arigaio/atlas:0.35.0-community-alpine
|
||||
container_name: coze-mysql-setup-schema
|
||||
profiles: ['middleware', 'mysql-setup', 'run-server']
|
||||
env_file: *env_file
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- ./atlas/opencoze_latest_schema.hcl:/opencoze_latest_schema.hcl
|
||||
entrypoint:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
set -ex
|
||||
TMP_ATLAS_URL="${ATLAS_URL}"
|
||||
if [ "${MYSQL_HOST}" = "localhost" ] || [ "${MYSQL_HOST}" = "127.0.0.1" ]; then
|
||||
echo "MYSQL_HOST is localhost or 127.0.0.1, replacing with docker network address"
|
||||
TMP_ATLAS_URL="mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@mysql:${MYSQL_PORT}/${MYSQL_DATABASE}?charset=utf8mb4&parseTime=True"
|
||||
fi
|
||||
|
||||
echo "final atlas url: $${TMP_ATLAS_URL}"
|
||||
for i in `seq 1 60`; do
|
||||
if atlas schema apply \
|
||||
-u "$${TMP_ATLAS_URL}" \
|
||||
--to file:///opencoze_latest_schema.hcl \
|
||||
--exclude "atlas_schema_revisions,table_*" \
|
||||
--auto-approve; then
|
||||
echo "MySQL setup complete."
|
||||
exit 0
|
||||
fi
|
||||
echo "atlas schema apply failed, retrying...($$i/60)"
|
||||
sleep 1
|
||||
done
|
||||
echo "MySQL setup failed after 60 retries."
|
||||
exit 1
|
||||
networks:
|
||||
- coze-network
|
||||
mysql-setup-init-sql:
|
||||
image: mysql:8.4.5
|
||||
container_name: coze-mysql-setup-init-sql
|
||||
profiles: ['middleware', 'mysql-setup', 'run-server', 'volcano-setup']
|
||||
env_file: *env_file
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
set -ex
|
||||
for i in $$(seq 1 60); do
|
||||
DB_HOST="$${MYSQL_HOST}"
|
||||
if [ "$${MYSQL_HOST}" = "localhost" ] || [ "$${MYSQL_HOST}" = "127.0.0.1" ]; then
|
||||
DB_HOST="mysql"
|
||||
fi
|
||||
if mysql -h "$${DB_HOST}" -P"$${MYSQL_PORT}" -u"$${MYSQL_USER}" -p"$${MYSQL_PASSWORD}" "$${MYSQL_DATABASE}" < /schema.sql && \
|
||||
mysql -h "$${DB_HOST}" -P"$${MYSQL_PORT}" -u"$${MYSQL_USER}" -p"$${MYSQL_PASSWORD}" "$${MYSQL_DATABASE}" < /sql_init.sql; then
|
||||
echo 'MySQL init success.'
|
||||
exit 0
|
||||
fi
|
||||
echo "Retrying to connect to mysql... ($$i/60)"
|
||||
sleep 1
|
||||
done
|
||||
echo 'Failed to init mysql db.'
|
||||
exit 1
|
||||
volumes:
|
||||
- ./volumes/mysql/sql_init.sql:/sql_init.sql
|
||||
- ./volumes/mysql/schema.sql:/schema.sql
|
||||
networks:
|
||||
- coze-network
|
||||
restart: 'no'
|
||||
|
||||
coze-server:
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: backend/Dockerfile
|
||||
image: opencoze/opencoze:latest
|
||||
profiles: ['build-server']
|
||||
|
||||
networks:
|
||||
coze-network:
|
||||
driver: bridge
|
||||
@@ -0,0 +1,438 @@
|
||||
name: coze-studio
|
||||
x-env-file: &env_file
|
||||
- .env
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:8.4.5
|
||||
container_name: coze-mysql
|
||||
restart: always
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root}
|
||||
MYSQL_DATABASE: ${MYSQL_DATABASE:-opencoze}
|
||||
MYSQL_USER: ${MYSQL_USER:-coze}
|
||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-coze123}
|
||||
env_file: *env_file
|
||||
# ports:
|
||||
# - '3306'
|
||||
volumes:
|
||||
- ./data/mysql:/var/lib/mysql
|
||||
- ./volumes/mysql/schema.sql:/docker-entrypoint-initdb.d/init.sql
|
||||
- ./atlas/opencoze_latest_schema.hcl:/opencoze_latest_schema.hcl:ro
|
||||
entrypoint:
|
||||
- bash
|
||||
- -c
|
||||
- |
|
||||
/usr/local/bin/docker-entrypoint.sh mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci &
|
||||
MYSQL_PID=$$!
|
||||
|
||||
echo 'Waiting for MySQL to start...'
|
||||
until mysqladmin ping -h localhost -u root -p$${MYSQL_ROOT_PASSWORD} --silent 2>/dev/null; do
|
||||
echo 'MySQL is starting...'
|
||||
sleep 2
|
||||
done
|
||||
|
||||
echo 'Waiting for workflow_version table to exist...'
|
||||
while true; do
|
||||
if mysql -h localhost -u root -p$${MYSQL_ROOT_PASSWORD} $${MYSQL_DATABASE} -e "SHOW TABLES LIKE 'workflow_version';" 2>/dev/null | grep -q "workflow_version"; then
|
||||
echo 'Found workflow_version table, continuing...'
|
||||
break
|
||||
else
|
||||
echo 'workflow_version table not found, retrying in 2 seconds...'
|
||||
sleep 2
|
||||
fi
|
||||
done
|
||||
|
||||
echo 'MySQL is ready, installing Atlas CLI...'
|
||||
|
||||
if ! command -v atlas >/dev/null 2>&1; then
|
||||
echo 'Installing Atlas CLI...'
|
||||
curl -sSf https://atlasgo.sh | sh -s -- -y --community
|
||||
export PATH=$$PATH:/root/.local/bin
|
||||
else
|
||||
echo 'Atlas CLI already installed'
|
||||
fi
|
||||
|
||||
if [ -f '/opencoze_latest_schema.hcl' ]; then
|
||||
echo 'Running Atlas migrations...'
|
||||
ATLAS_URL="mysql://$${MYSQL_USER}:$${MYSQL_PASSWORD}@localhost:3306/$${MYSQL_DATABASE}"
|
||||
atlas schema apply -u "$ATLAS_URL" --to "file:///opencoze_latest_schema.hcl" --exclude "atlas_schema_revisions,table_*" --auto-approve
|
||||
echo 'Atlas migrations completed successfully'
|
||||
else
|
||||
echo 'No migrations found'
|
||||
fi
|
||||
wait $$MYSQL_PID
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
'CMD',
|
||||
'mysqladmin',
|
||||
'ping',
|
||||
'-h',
|
||||
'localhost',
|
||||
'-u$${MYSQL_USER}',
|
||||
'-p$${MYSQL_PASSWORD}',
|
||||
]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
networks:
|
||||
- coze-network
|
||||
|
||||
redis:
|
||||
image: bitnamilegacy/redis:8.0
|
||||
container_name: coze-redis
|
||||
restart: always
|
||||
user: root
|
||||
privileged: true
|
||||
env_file: *env_file
|
||||
environment:
|
||||
- REDIS_AOF_ENABLED=${REDIS_AOF_ENABLED:-no}
|
||||
- REDIS_PORT_NUMBER=${REDIS_PORT_NUMBER:-6379}
|
||||
- REDIS_IO_THREADS=${REDIS_IO_THREADS:-4}
|
||||
- ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD:-yes}
|
||||
# ports:
|
||||
# - '6379'
|
||||
volumes:
|
||||
- ./data/bitnami/redis:/bitnami/redis/data:rw,Z
|
||||
command: >
|
||||
bash -c "
|
||||
/opt/bitnami/scripts/redis/setup.sh
|
||||
# Set proper permissions for data directories
|
||||
chown -R redis:redis /bitnami/redis/data
|
||||
chmod g+s /bitnami/redis/data
|
||||
|
||||
exec /opt/bitnami/scripts/redis/entrypoint.sh /opt/bitnami/scripts/redis/run.sh
|
||||
"
|
||||
healthcheck:
|
||||
test: ['CMD', 'redis-cli', 'ping']
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
networks:
|
||||
- coze-network
|
||||
elasticsearch:
|
||||
image: bitnamilegacy/elasticsearch:8.18.0
|
||||
container_name: coze-elasticsearch
|
||||
restart: always
|
||||
user: root
|
||||
privileged: true
|
||||
env_file: *env_file
|
||||
environment:
|
||||
- TEST=1
|
||||
# Add Java certificate trust configuration
|
||||
# - ES_JAVA_OPTS=-Djdk.tls.client.protocols=TLSv1.2 -Dhttps.protocols=TLSv1.2 -Djavax.net.ssl.trustAll=true -Xms4096m -Xmx4096m
|
||||
# ports:
|
||||
# - '9200'
|
||||
volumes:
|
||||
- ./data/bitnami/elasticsearch:/bitnami/elasticsearch/data
|
||||
- ./volumes/elasticsearch/elasticsearch.yml:/opt/bitnami/elasticsearch/config/my_elasticsearch.yml
|
||||
- ./volumes/elasticsearch/analysis-smartcn.zip:/opt/bitnami/elasticsearch/analysis-smartcn.zip:rw,Z
|
||||
- ./volumes/elasticsearch/setup_es.sh:/setup_es.sh
|
||||
- ./volumes/elasticsearch/es_index_schema:/es_index_schema
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
'CMD-SHELL',
|
||||
'curl -f http://localhost:9200 && [ -f /tmp/es_plugins_ready ] && [ -f /tmp/es_init_complete ]',
|
||||
]
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
networks:
|
||||
- coze-network
|
||||
# Install smartcn analyzer plugin and initialize ES
|
||||
command: >
|
||||
bash -c "
|
||||
/opt/bitnami/scripts/elasticsearch/setup.sh
|
||||
# Set proper permissions for data directories
|
||||
chown -R elasticsearch:elasticsearch /bitnami/elasticsearch/data
|
||||
chmod g+s /bitnami/elasticsearch/data
|
||||
|
||||
# Create plugin directory
|
||||
mkdir -p /bitnami/elasticsearch/plugins;
|
||||
|
||||
# Unzip plugin to plugin directory and set correct permissions
|
||||
echo 'Installing smartcn plugin...';
|
||||
if [ ! -d /opt/bitnami/elasticsearch/plugins/analysis-smartcn ]; then
|
||||
|
||||
# Download plugin package locally
|
||||
echo 'Copying smartcn plugin...';
|
||||
cp /opt/bitnami/elasticsearch/analysis-smartcn.zip /tmp/analysis-smartcn.zip
|
||||
|
||||
elasticsearch-plugin install file:///tmp/analysis-smartcn.zip
|
||||
if [[ "$$?" != "0" ]]; then
|
||||
echo 'Plugin installation failed, exiting operation';
|
||||
rm -rf /opt/bitnami/elasticsearch/plugins/analysis-smartcn
|
||||
exit 1;
|
||||
fi;
|
||||
rm -f /tmp/analysis-smartcn.zip;
|
||||
fi;
|
||||
|
||||
# Create marker file indicating plugin installation success
|
||||
touch /tmp/es_plugins_ready;
|
||||
echo 'Plugin installation successful, marker file created';
|
||||
|
||||
# Start initialization script in background
|
||||
(
|
||||
echo 'Waiting for Elasticsearch to be ready...'
|
||||
until curl -s -f http://localhost:9200/_cat/health >/dev/null 2>&1; do
|
||||
echo 'Elasticsearch not ready, waiting...'
|
||||
sleep 2
|
||||
done
|
||||
echo 'Elasticsearch is ready!'
|
||||
|
||||
# Run ES initialization script
|
||||
echo 'Running Elasticsearch initialization...'
|
||||
sed 's/\r$$//' /setup_es.sh > /setup_es_fixed.sh
|
||||
chmod +x /setup_es_fixed.sh
|
||||
/setup_es_fixed.sh --index-dir /es_index_schema
|
||||
# Create marker file indicating initialization completion
|
||||
touch /tmp/es_init_complete
|
||||
echo 'Elasticsearch initialization completed successfully!'
|
||||
) &
|
||||
|
||||
# Start Elasticsearch
|
||||
exec /opt/bitnami/scripts/elasticsearch/entrypoint.sh /opt/bitnami/scripts/elasticsearch/run.sh
|
||||
echo -e "⏳ Adjusting Elasticsearch disk watermark settings..."
|
||||
"
|
||||
|
||||
minio:
|
||||
image: minio/minio:RELEASE.2025-06-13T11-33-47Z-cpuv1
|
||||
container_name: coze-minio
|
||||
user: root
|
||||
privileged: true
|
||||
restart: always
|
||||
env_file: *env_file
|
||||
# ports:
|
||||
# - '9000'
|
||||
# - '9001'
|
||||
volumes:
|
||||
- ./data/minio:/data
|
||||
- ./volumes/minio/default_icon/:/default_icon
|
||||
- ./volumes/minio/official_plugin_icon/:/official_plugin_icon
|
||||
environment:
|
||||
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minioadmin}
|
||||
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-minioadmin123}
|
||||
MINIO_DEFAULT_BUCKETS: ${STORAGE_BUCKET:-opencoze},${MINIO_DEFAULT_BUCKETS:-milvus}
|
||||
entrypoint:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
# Run initialization in background
|
||||
(
|
||||
# Wait for MinIO to be ready
|
||||
until (/usr/bin/mc alias set localminio http://localhost:9000 $${MINIO_ROOT_USER} $${MINIO_ROOT_PASSWORD}) do
|
||||
echo "Waiting for MinIO to be ready..."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Create bucket and copy files
|
||||
/usr/bin/mc mb --ignore-existing localminio/$${STORAGE_BUCKET}
|
||||
/usr/bin/mc cp --recursive /default_icon/ localminio/$${STORAGE_BUCKET}/default_icon/
|
||||
/usr/bin/mc cp --recursive /official_plugin_icon/ localminio/$${STORAGE_BUCKET}/official_plugin_icon/
|
||||
|
||||
echo "MinIO initialization complete."
|
||||
) &
|
||||
|
||||
# Start minio server in foreground
|
||||
exec minio server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
'CMD-SHELL',
|
||||
'/usr/bin/mc alias set health_check http://localhost:9000 ${MINIO_ROOT_USER} ${MINIO_ROOT_PASSWORD} && /usr/bin/mc ready health_check',
|
||||
]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
networks:
|
||||
- coze-network
|
||||
|
||||
etcd:
|
||||
image: bitnamilegacy/etcd:3.5
|
||||
container_name: coze-etcd
|
||||
user: root
|
||||
restart: always
|
||||
privileged: true
|
||||
env_file: *env_file
|
||||
environment:
|
||||
- ETCD_AUTO_COMPACTION_MODE=revision
|
||||
- ETCD_AUTO_COMPACTION_RETENTION=1000
|
||||
- ETCD_QUOTA_BACKEND_BYTES=4294967296
|
||||
- ALLOW_NONE_AUTHENTICATION=yes
|
||||
# ports:
|
||||
# - '2379'
|
||||
# - '2380'
|
||||
volumes:
|
||||
- ./data/bitnami/etcd:/bitnami/etcd:rw,Z
|
||||
- ./volumes/etcd/etcd.conf.yml:/opt/bitnami/etcd/conf/etcd.conf.yml:ro,Z
|
||||
command: >
|
||||
bash -c "
|
||||
/opt/bitnami/scripts/etcd/setup.sh
|
||||
# Set proper permissions for data and config directories
|
||||
chown -R etcd:etcd /bitnami/etcd
|
||||
chmod g+s /bitnami/etcd
|
||||
|
||||
exec /opt/bitnami/scripts/etcd/entrypoint.sh /opt/bitnami/scripts/etcd/run.sh
|
||||
"
|
||||
healthcheck:
|
||||
test: ['CMD', 'etcdctl', 'endpoint', 'health']
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
networks:
|
||||
- coze-network
|
||||
|
||||
milvus:
|
||||
container_name: coze-milvus
|
||||
image: milvusdb/milvus:v2.5.10
|
||||
user: root
|
||||
privileged: true
|
||||
restart: always
|
||||
env_file: *env_file
|
||||
command: >
|
||||
bash -c "
|
||||
# Set proper permissions for data directories
|
||||
chown -R root:root /var/lib/milvus
|
||||
chmod g+s /var/lib/milvus
|
||||
|
||||
exec milvus run standalone
|
||||
"
|
||||
security_opt:
|
||||
- seccomp:unconfined
|
||||
environment:
|
||||
ETCD_ENDPOINTS: etcd:2379
|
||||
MINIO_ADDRESS: minio:9000
|
||||
MINIO_BUCKET_NAME: ${MINIO_DEFAULT_BUCKETS:-milvus}
|
||||
MINIO_ACCESS_KEY_ID: ${MINIO_ROOT_USER:-minioadmin}
|
||||
MINIO_SECRET_ACCESS_KEY: ${MINIO_ROOT_PASSWORD:-minioadmin123}
|
||||
MINIO_USE_SSL: false
|
||||
LOG_LEVEL: debug
|
||||
volumes:
|
||||
- ./data/milvus:/var/lib/milvus:rw,Z
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9091/healthz']
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
# ports:
|
||||
# - '19530'
|
||||
# - '9091'
|
||||
depends_on:
|
||||
etcd:
|
||||
condition: service_healthy
|
||||
minio:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- coze-network
|
||||
nsqlookupd:
|
||||
image: nsqio/nsq:v1.2.1
|
||||
container_name: coze-nsqlookupd
|
||||
command: /nsqlookupd
|
||||
restart: always
|
||||
# ports:
|
||||
# - '4160'
|
||||
# - '4161'
|
||||
networks:
|
||||
- coze-network
|
||||
healthcheck:
|
||||
test: ['CMD-SHELL', 'nsqlookupd --version']
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
|
||||
nsqd:
|
||||
image: nsqio/nsq:v1.2.1
|
||||
container_name: coze-nsqd
|
||||
command: /nsqd --lookupd-tcp-address=nsqlookupd:4160 --broadcast-address=nsqd
|
||||
restart: always
|
||||
# ports:
|
||||
# - '4150'
|
||||
# - '4151'
|
||||
depends_on:
|
||||
nsqlookupd:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- coze-network
|
||||
healthcheck:
|
||||
test: ['CMD-SHELL', '/nsqd --version']
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
|
||||
nsqadmin:
|
||||
image: nsqio/nsq:v1.2.1
|
||||
container_name: coze-nsqadmin
|
||||
command: /nsqadmin --lookupd-http-address=nsqlookupd:4161
|
||||
restart: always
|
||||
# ports:
|
||||
# - '4171'
|
||||
depends_on:
|
||||
nsqlookupd:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- coze-network
|
||||
|
||||
coze-server:
|
||||
# build:
|
||||
# context: ../
|
||||
# dockerfile: backend/Dockerfile
|
||||
image: cozedev/coze-studio-server:latest
|
||||
restart: always
|
||||
container_name: coze-server
|
||||
env_file: *env_file
|
||||
# environment:
|
||||
# LISTEN_ADDR: 0.0.0.0:8888
|
||||
networks:
|
||||
- coze-network
|
||||
# ports:
|
||||
# - '8888'
|
||||
# - '8889'
|
||||
volumes:
|
||||
- .env:/app/.env
|
||||
- ../backend/conf:/app/resources/conf
|
||||
# - ../backend/static:/app/resources/static
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
elasticsearch:
|
||||
condition: service_healthy
|
||||
minio:
|
||||
condition: service_healthy
|
||||
milvus:
|
||||
condition: service_healthy
|
||||
command: ['/app/opencoze']
|
||||
|
||||
coze-web:
|
||||
# build:
|
||||
# context: ..
|
||||
# dockerfile: frontend/Dockerfile
|
||||
image: cozedev/coze-studio-web:latest
|
||||
container_name: coze-web
|
||||
restart: always
|
||||
ports:
|
||||
- "${WEB_LISTEN_ADDR:-8888}:80"
|
||||
# - "443:443" # SSL port (uncomment if using SSL)
|
||||
volumes:
|
||||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro # Main nginx config
|
||||
- ./nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf:ro # Proxy config
|
||||
# - ./nginx/ssl:/etc/nginx/ssl:ro # SSL certificates (uncomment if using SSL)
|
||||
depends_on:
|
||||
- coze-server
|
||||
networks:
|
||||
- coze-network
|
||||
|
||||
networks:
|
||||
coze-network:
|
||||
driver: bridge
|
||||
@@ -0,0 +1,105 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
# Static resources
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
index index.html index.htm;
|
||||
autoindex on;
|
||||
autoindex_exact_size off;
|
||||
autoindex_localtime on;
|
||||
|
||||
etag on;
|
||||
if_modified_since exact;
|
||||
add_header Cache-Control "no-cache";
|
||||
add_header Cache-Control "public, max-age=3600";
|
||||
}
|
||||
|
||||
# API proxy
|
||||
location ~ ^/(api|v[1-3]|admin)(/|$) {
|
||||
proxy_pass http://coze-server:8888;
|
||||
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# Timeout settings
|
||||
proxy_connect_timeout 60s; # Connection timeout to upstream
|
||||
proxy_send_timeout 60s; # Timeout for sending data to upstream
|
||||
proxy_read_timeout 600s; # Timeout for reading response from upstream (600s for SSE)
|
||||
|
||||
|
||||
# SSL/TLS settings
|
||||
proxy_ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
|
||||
proxy_ssl_verify off;
|
||||
|
||||
|
||||
sub_filter ':8889' ':8888/local_storage';
|
||||
sub_filter 'minio:9000' '$http_host/local_storage';
|
||||
sub_filter_once off;
|
||||
sub_filter_types 'application/json' 'text/event-stream';
|
||||
}
|
||||
|
||||
location /local_storage/ {
|
||||
if ($args ~* "(^|.*&)x-wf-file_name=[^&]*(&.*|$)") {
|
||||
set $args $1$2;
|
||||
}
|
||||
if ($args ~* "^x-wf-file_name=[^&]*$") {
|
||||
set $args "";
|
||||
}
|
||||
|
||||
rewrite ^/local_storage/(.*)$ /$1 break;
|
||||
proxy_pass http://minio:9000;
|
||||
proxy_set_header Host minio:9000;
|
||||
}
|
||||
}
|
||||
|
||||
# if you want to use https, you can uncomment the following code
|
||||
# server {
|
||||
# listen 443 ssl;
|
||||
# server_name _;
|
||||
|
||||
# ssl_certificate /etc/nginx/ssl/pem;
|
||||
# ssl_certificate_key /etc/nginx/ssl/key;
|
||||
# ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
|
||||
# ssl_prefer_server_ciphers on;
|
||||
# ssl_session_cache shared:SSL:10m;
|
||||
# ssl_session_timeout 10m;
|
||||
|
||||
# # Static resources
|
||||
# location / {
|
||||
# root /usr/share/nginx/html;
|
||||
# try_files $uri $uri/ /index.html;
|
||||
# index index.html index.htm;
|
||||
# autoindex on;
|
||||
# autoindex_exact_size off;
|
||||
# autoindex_localtime on;
|
||||
# }
|
||||
|
||||
# # # API proxy
|
||||
# location /api/ {
|
||||
# proxy_pass https://coze-server:8888;
|
||||
#
|
||||
# proxy_set_header Host $host;
|
||||
# proxy_set_header X-Real-IP $remote_addr;
|
||||
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
# proxy_set_header X-Forwarded-Proto $scheme;
|
||||
#
|
||||
# # Timeout settings
|
||||
# proxy_connect_timeout 60s; # Connection timeout to upstream
|
||||
# proxy_send_timeout 60s; # Timeout for sending data to upstream
|
||||
# proxy_read_timeout 60s; # Timeout for reading response from upstream
|
||||
#
|
||||
# # Buffer settings
|
||||
# proxy_buffer_size 4k; # Buffer size for headers
|
||||
# proxy_buffers 8 4k; # Number and size of buffers for upstream response
|
||||
# proxy_busy_buffers_size 8k; # Buffer size for busy connections
|
||||
#
|
||||
# # SSL/TLS settings
|
||||
# proxy_ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
|
||||
# proxy_ssl_verify off;
|
||||
# }
|
||||
# }
|
||||
@@ -0,0 +1,14 @@
|
||||
worker_processes 1;
|
||||
events { worker_connections 1024; }
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
|
||||
# setting client request body size limit - 0 means no limit
|
||||
client_max_body_size 0;
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
cluster:
|
||||
name: "docker-cluster"
|
||||
routing:
|
||||
allocation:
|
||||
disk:
|
||||
watermark:
|
||||
low: "99%"
|
||||
high: "99%"
|
||||
flood_stage: "99%"
|
||||
discovery:
|
||||
type: single-node
|
||||
xpack:
|
||||
security:
|
||||
enabled: false
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Parse command-line arguments
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--es-address)
|
||||
case "$2" in
|
||||
"" | -*) echo "Error: Missing value for $1" >&2; exit 1;;
|
||||
esac
|
||||
ES_ADDR_ARG="$2"
|
||||
shift 2
|
||||
;;
|
||||
--index-dir)
|
||||
case "$2" in
|
||||
"" | -*) echo "Error: Missing value for $1" >&2; exit 1;;
|
||||
esac
|
||||
INDEX_DIR_ARG="$2"
|
||||
shift 2
|
||||
;;
|
||||
--docker-host)
|
||||
case "$2" in
|
||||
"true" | "false") REPLACE_ES_ADDR_WITH_DOCKER_HOST_ARG="$2" ;;
|
||||
*) echo "Error: Invalid value for $1. Must be 'true' or 'false'" >&2; exit 1;;
|
||||
esac
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# If ES_ADDR_ARG argument is provided, use it. Otherwise, use environment variable or default logic.
|
||||
if [ -n "$ES_ADDR_ARG" ]; then
|
||||
ES_ADDR=$ES_ADDR_ARG
|
||||
fi
|
||||
|
||||
REPLACE_ES_ADDR=${REPLACE_ES_ADDR_WITH_DOCKER_HOST_ARG:-true}
|
||||
if [ "$REPLACE_ES_ADDR" = "true" ]; then
|
||||
case "$ES_ADDR" in
|
||||
*localhost*|*"127.0.0.1"*)
|
||||
echo "ES_ADDR is localhost, using docker address: http://elasticsearch:9200"
|
||||
ES_ADDR="http://elasticsearch:9200"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# If INDEX_DIR_ARG argument is provided, use it. Otherwise, use the default.
|
||||
if [ -n "$INDEX_DIR_ARG" ]; then
|
||||
INDEX_DIR=$INDEX_DIR_ARG
|
||||
else
|
||||
INDEX_DIR=/es_index_schema
|
||||
fi
|
||||
|
||||
echo "ES_ADDR: $ES_ADDR"
|
||||
echo "INDEX_DIR: $INDEX_DIR"
|
||||
|
||||
AUTH_PARAM=""
|
||||
if [ -n "$ES_USERNAME" ]; then
|
||||
AUTH_PARAM="-k -u $ES_USERNAME:$ES_PASSWORD"
|
||||
fi
|
||||
|
||||
for i in $(seq 1 60); do
|
||||
echo "Checking Elasticsearch availability... (attempt $i)"
|
||||
if curl -s -f $AUTH_PARAM "${ES_ADDR}/_cat/health"; then
|
||||
echo "Elasticsearch is up and running!"
|
||||
break
|
||||
fi
|
||||
echo "Elasticsearch not available, retrying in 1 seconds..."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo -e "🔍 Checking smartcn plugin status..."
|
||||
if ! curl -s $AUTH_PARAM "${ES_ADDR}/_cat/plugins" | grep -q "analysis-smartcn"; then
|
||||
echo -e "❌ smartcn plugin not loaded correctly, please ensure the plugin is installed and Elasticsearch is restarted"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "🔍 Initializing Elasticsearch index templates..."
|
||||
ES_TEMPLATES=$(find "$INDEX_DIR" -type f -name "*.index-template.json" | sort)
|
||||
if [ -z "$ES_TEMPLATES" ]; then
|
||||
echo -e "ℹ️ No Elasticsearch index templates found in $INDEX_DIR"
|
||||
exit 1
|
||||
else
|
||||
# Add index creation logic
|
||||
for template_file in $ES_TEMPLATES; do
|
||||
template_name=$(basename "$template_file" | sed 's/\.index-template\.json$//')
|
||||
# Check if index template exists
|
||||
if curl -s -f $AUTH_PARAM -I "${ES_ADDR}/_index_template/$template_name" >/dev/null; then
|
||||
echo -e "ℹ️ Index template $template_name already exists"
|
||||
else
|
||||
echo -e "➡️ Registering template: $template_name"
|
||||
|
||||
# Attempt to register index template
|
||||
response=$(curl -s $AUTH_PARAM -X PUT "${ES_ADDR}/_index_template/$template_name" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d @"$template_file" 2>&1)
|
||||
|
||||
# Check if successful
|
||||
if echo "$response" | grep -q '"acknowledged":true'; then
|
||||
echo -e "✅ Template $template_name registered successfully"
|
||||
else
|
||||
echo -e "❌ Failed to register template $template_name. Response: $response"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
index_name=$(basename "$template_file" | sed 's/\.index-template\.json$//')
|
||||
# Check if index exists
|
||||
if ! curl -s -f $AUTH_PARAM "${ES_ADDR}/_cat/indices/$index_name" >/dev/null; then
|
||||
echo -e "➡️ Creating index: $index_name"
|
||||
# Create index (matching template's index_patterns)
|
||||
curl $AUTH_PARAM -X PUT "${ES_ADDR}/$index_name" -H "Content-Type: application/json"
|
||||
echo ""
|
||||
|
||||
# Set refresh interval if index was just created
|
||||
echo -e "🔄 Setting refresh_interval for index: $index_name..."
|
||||
CURL_OUTPUT=$(curl -s $AUTH_PARAM -w "\nHTTP_STATUS_CODE:%{http_code}" -X PUT "${ES_ADDR}/${index_name}/_settings" -H 'Content-Type: application/json' -d'
|
||||
{
|
||||
"index": {
|
||||
"refresh_interval": "10ms"
|
||||
}
|
||||
}')
|
||||
echo -e "📄 Curl command output for $index_name:\n$CURL_OUTPUT"
|
||||
# Extract the JSON body from the output, excluding the HTTP_STATUS_CODE line
|
||||
JSON_BODY=$(echo "$CURL_OUTPUT" | sed '$d')
|
||||
if ! echo "$JSON_BODY" | grep -q '"acknowledged":true'; then
|
||||
echo -e "⚠️ Warning: Failed to set refresh interval for $index_name index. Response Body: $JSON_BODY. Please check and set manually."
|
||||
exit 1
|
||||
else
|
||||
echo -e "✅ Successfully set refresh_interval for $index_name."
|
||||
fi
|
||||
else
|
||||
echo -e "ℹ️ Index $index_name already exists"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
echo "Elasticsearch setup completed."
|
||||
exit 0
|
||||
@@ -0,0 +1 @@
|
||||
{}
|
||||
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 9.0 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 192 KiB |
|
After Width: | Height: | Size: 192 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 226 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 420 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 953 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 814 B |
|
After Width: | Height: | Size: 352 B |
|
After Width: | Height: | Size: 664 B |
|
After Width: | Height: | Size: 521 B |
|
After Width: | Height: | Size: 524 B |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 186 KiB |
|
After Width: | Height: | Size: 289 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 37 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 37 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.2 KiB |