mirror of
https://github.com/labring/FastGPT.git
synced 2026-05-07 01:02:55 +08:00
perf: deploy doc
This commit is contained in:
@@ -10,6 +10,38 @@
|
||||
# - aiproxy: 3010
|
||||
# - 使用 pgvector 作为默认的向量库
|
||||
|
||||
# plugin auth token
|
||||
x-plugin-auth-token: &x-plugin-auth-token 'token'
|
||||
# code sandbox token
|
||||
x-code-sandbox-token: &x-code-sandbox-token 'codesandbox'
|
||||
# volume manager auth token
|
||||
x-volume-manager-auth-token: &x-volume-manager-auth-token 'vmtoken'
|
||||
# aiproxy token
|
||||
x-aiproxy-token: &x-aiproxy-token 'token'
|
||||
# 数据库连接相关配置
|
||||
x-share-db-config: &x-share-db-config
|
||||
MONGODB_URI: mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 100
|
||||
REDIS_URL: redis://default:mypassword@redis:6379
|
||||
# @see https://doc.fastgpt.cn/docs/self-host/config/object-storage
|
||||
STORAGE_VENDOR: minio # minio | aws-s3 | cos | oss
|
||||
STORAGE_REGION: us-east-1
|
||||
STORAGE_ACCESS_KEY_ID: minioadmin
|
||||
STORAGE_SECRET_ACCESS_KEY: minioadmin
|
||||
STORAGE_PUBLIC_BUCKET: fastgpt-public
|
||||
STORAGE_PRIVATE_BUCKET: fastgpt-private
|
||||
STORAGE_EXTERNAL_ENDPOINT: http://192.168.0.2:9000 # 一个服务器和客户端均可访问到存储桶的地址,可以是固定的宿主机 IP 或者域名,注意不要填写成 127.0.0.1 或者 localhost 等本地回环地址(因为容器里无法使用)
|
||||
STORAGE_S3_ENDPOINT: http://fastgpt-minio:9000 # 协议://域名(IP):端口
|
||||
STORAGE_S3_FORCE_PATH_STYLE: true
|
||||
STORAGE_S3_MAX_RETRIES: 3
|
||||
# Log 配置
|
||||
x-log-config: &x-log-config
|
||||
LOG_ENABLE_CONSOLE: true
|
||||
LOG_CONSOLE_LEVEL: debug
|
||||
LOG_ENABLE_OTEL: false
|
||||
LOG_OTEL_LEVEL: info
|
||||
LOG_OTEL_URL: http://localhost:4318/v1/logs
|
||||
|
||||
services:
|
||||
# Vector DB
|
||||
pg:
|
||||
@@ -134,19 +166,57 @@ services:
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
sandbox:
|
||||
container_name: sandbox
|
||||
code-sandbox:
|
||||
container_name: code-sandbox
|
||||
image: ${{fastgpt-sandbox.image}}:${{fastgpt-sandbox.tag}}
|
||||
ports:
|
||||
- 3002:3000
|
||||
networks:
|
||||
- fastgpt
|
||||
restart: always
|
||||
environment:
|
||||
<<: [*x-log-config]
|
||||
LOG_OTEL_SERVICE_NAME: fastgpt-code-sandbox
|
||||
SANDBOX_TOKEN: *x-code-sandbox-token
|
||||
# ===== Resource Limits =====
|
||||
# Execution timeout per request (ms)
|
||||
SANDBOX_MAX_TIMEOUT: 60000
|
||||
# Maximum allowed memory per user code execution (MB)
|
||||
# Note: System automatically adds 50MB for runtime overhead
|
||||
# Actual process limit = SANDBOX_MAX_MEMORY_MB + 50MB
|
||||
SANDBOX_MAX_MEMORY_MB: 256
|
||||
|
||||
# ===== Process Pool =====
|
||||
# Number of pre-warmed worker processes (JS + Python)
|
||||
SANDBOX_POOL_SIZE: 20
|
||||
|
||||
# ===== Network Request Limits =====
|
||||
# Whether to check if the request is to a private network
|
||||
CHECK_INTERNAL_IP: false
|
||||
# Maximum number of HTTP requests per execution
|
||||
SANDBOX_REQUEST_MAX_COUNT: 30
|
||||
# Timeout for each outbound HTTP request (ms)
|
||||
SANDBOX_REQUEST_TIMEOUT: 60000
|
||||
# Maximum response body size for outbound requests
|
||||
SANDBOX_REQUEST_MAX_RESPONSE_MB: 10
|
||||
# Maximum request body size for outbound requests (MB)
|
||||
SANDBOX_REQUEST_MAX_BODY_MB: 5
|
||||
|
||||
# ===== Module Control =====
|
||||
# JS allowed modules whitelist (comma-separated)
|
||||
SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring
|
||||
# Python allowed modules whitelist (comma-separated)
|
||||
SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:3000/health']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
fastgpt-mcp-server:
|
||||
container_name: fastgpt-mcp-server
|
||||
image: ${{fastgpt-mcp_server.image}}:${{fastgpt-mcp_server.tag}}
|
||||
ports:
|
||||
- 3005:3000
|
||||
- 3003:3000
|
||||
networks:
|
||||
- fastgpt
|
||||
restart: always
|
||||
@@ -157,27 +227,84 @@ services:
|
||||
container_name: fastgpt-plugin
|
||||
restart: always
|
||||
ports:
|
||||
- 3003:3000
|
||||
- 3004:3000
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- AUTH_TOKEN=token
|
||||
# @see https://fastgpt.cn/docs/self-host/config/object-storage
|
||||
- STORAGE_VENDOR=minio # minio | aws-s3 | cos | oss
|
||||
- STORAGE_REGION=us-east-1
|
||||
- STORAGE_ACCESS_KEY_ID=minioadmin
|
||||
- STORAGE_SECRET_ACCESS_KEY=minioadmin
|
||||
- STORAGE_PUBLIC_BUCKET=fastgpt-public
|
||||
- STORAGE_PRIVATE_BUCKET=fastgpt-private
|
||||
- STORAGE_EXTERNAL_ENDPOINT=https://minio.com # 一个公开的、前端和用户可以直接访问的对象存储连接
|
||||
- STORAGE_S3_ENDPOINT=http://fastgpt-minio:9000 # 协议://域名(IP):端口
|
||||
- STORAGE_S3_FORCE_PATH_STYLE=true
|
||||
- STORAGE_S3_MAX_RETRIES=3
|
||||
- MONGODB_URI=mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin&directConnection=true
|
||||
- REDIS_URL=redis://default:mypassword@redis:6379
|
||||
<<: [*x-share-db-config, *x-log-config]
|
||||
AUTH_TOKEN: *x-plugin-auth-token
|
||||
# 工具网络请求,最大请求和响应体
|
||||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
# 最大 API 请求体大小
|
||||
MAX_API_SIZE: 10
|
||||
# 传递给 OTLP 收集器的服务名称
|
||||
LOG_OTEL_SERVICE_NAME: fastgpt-plugin
|
||||
depends_on:
|
||||
fastgpt-minio:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:3000/health']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
|
||||
# 沙盒控制器:管理 Docker 容器的创建/执行/停止/删除
|
||||
# runtime=docker 模式需要挂载 Docker socket
|
||||
# 配置 docker.host_ip 为宿主机 LAN IP(容器内访问宿主机服务用)
|
||||
opensandbox-server:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/opensandbox-server:v0.1.9
|
||||
container_name: opensandbox-server
|
||||
restart: always
|
||||
ports:
|
||||
- 8090:8090
|
||||
networks:
|
||||
- fastgpt
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载
|
||||
configs:
|
||||
- source: opensandbox-config
|
||||
target: /etc/opensandbox/config.toml
|
||||
environment:
|
||||
SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:8090/health']
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
# 卷管理微服务:负责幂等创建/删除 Docker named volume 或 k8s PVC
|
||||
volume-manager:
|
||||
image: ${{volume-manager.image}}:${{volume-manager.tag}}
|
||||
container_name: volume-manager
|
||||
restart: always
|
||||
ports:
|
||||
- 3005:3000
|
||||
networks:
|
||||
- fastgpt
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro # Docker 模式必须挂载(只读即可)
|
||||
environment:
|
||||
PORT: 3000
|
||||
VM_RUNTIME: docker
|
||||
VM_AUTH_TOKEN: *x-volume-manager-auth-token # 对应 AGENT_SANDBOX_VOLUME_MANAGER_TOKEN
|
||||
VM_VOLUME_NAME_PREFIX: fastgpt-session # volume 名称前缀
|
||||
VM_LOG_LEVEL: info
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
'CMD',
|
||||
'bun',
|
||||
'-e',
|
||||
"fetch('http://localhost:3000/health').then((res) => { if (!res.ok) throw new Error(String(res.status)); })"
|
||||
]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
# Pre-pull only: not started by `docker compose up` (uses profile `prepull`).
|
||||
agent-sandbox-image:
|
||||
image: ${{agent-sandbox-image.image}}:${{agent-sandbox-image.tag}}
|
||||
profiles:
|
||||
- prepull
|
||||
|
||||
# AI Proxy
|
||||
aiproxy:
|
||||
image: ${{aiproxy.image}}:${{aiproxy.tag}}
|
||||
@@ -193,17 +320,17 @@ services:
|
||||
- aiproxy
|
||||
environment:
|
||||
# 对应 fastgpt 里的AIPROXY_API_TOKEN
|
||||
- ADMIN_KEY=aiproxy
|
||||
ADMIN_KEY: *x-aiproxy-token
|
||||
# 错误日志详情保存时间(小时)
|
||||
- LOG_DETAIL_STORAGE_HOURS=1
|
||||
LOG_DETAIL_STORAGE_HOURS: 1
|
||||
# 数据库连接地址
|
||||
- SQL_DSN=postgres://postgres:aiproxy@aiproxy_pg:5432/aiproxy
|
||||
SQL_DSN: postgres://postgres:aiproxy@aiproxy_pg:5432/aiproxy
|
||||
# 最大重试次数
|
||||
- RETRY_TIMES=3
|
||||
RETRY_TIMES: 3
|
||||
# 不需要计费
|
||||
- BILLING_ENABLED=false
|
||||
BILLING_ENABLED: false
|
||||
# 不需要严格检测模型
|
||||
- DISABLE_MODEL_CONFIG=true
|
||||
DISABLE_MODEL_CONFIG: true
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:3000/api/status']
|
||||
interval: 5s
|
||||
@@ -230,3 +357,24 @@ services:
|
||||
networks:
|
||||
fastgpt:
|
||||
aiproxy:
|
||||
|
||||
configs:
|
||||
opensandbox-config:
|
||||
content: |
|
||||
[server]
|
||||
host = "0.0.0.0"
|
||||
port = 8090
|
||||
log_level = "INFO"
|
||||
|
||||
[runtime]
|
||||
type = "docker"
|
||||
execd_image = "sandbox-registry.cn-zhangjiakou.cr.aliyuncs.com/opensandbox/execd:v1.0.6"
|
||||
|
||||
[egress]
|
||||
image = "sandbox-registry.cn-zhangjiakou.cr.aliyuncs.com/opensandbox/egress:v1.0.1"
|
||||
|
||||
[docker]
|
||||
network_mode = "bridge"
|
||||
# 容器内访问宿主机服务时需要设置为宿主机 IP 或 hostname
|
||||
# macOS/Windows: host.docker.internal;Linux: 宿主机 LAN IP(如 192.168.1.100)
|
||||
host_ip = "host.docker.internal"
|
||||
|
||||
Reference in New Issue
Block a user