feat: 添加 PostgreSQL 支持用于 checkpoint 存储
- 添加 postgres:16-alpine 服务配置 - 配置 CHECKPOINT_DB_URL 环境变量 - 添加服务依赖和健康检查 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
723b249e42
commit
20d5e96986
52
docker-compose-with-pgsql.yml
Normal file
52
docker-compose-with-pgsql.yml
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
version: "3.8"
|
||||||
|
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:16-alpine
|
||||||
|
container_name: qwen-agent-postgres
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER=root
|
||||||
|
- POSTGRES_PASSWORD=
|
||||||
|
- POSTGRES_DB=agent_db
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
volumes:
|
||||||
|
- ../postgres_data:/var/lib/postgresql/data
|
||||||
|
restart: unless-stopped
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U agent_db"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
start_period: 10s
|
||||||
|
|
||||||
|
qwen-agent:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile.modelscope
|
||||||
|
container_name: qwen-agent-api
|
||||||
|
ports:
|
||||||
|
- "8001:8001"
|
||||||
|
environment:
|
||||||
|
# 应用配置
|
||||||
|
- BACKEND_HOST=http://api-dev.gbase.ai
|
||||||
|
- MAX_CONTEXT_TOKENS=262144
|
||||||
|
- DEFAULT_THINKING_ENABLE=true
|
||||||
|
# PostgreSQL 配置
|
||||||
|
- CHECKPOINT_DB_URL=postgresql://root:@postgres:5432/agent_db
|
||||||
|
volumes:
|
||||||
|
# 挂载项目数据目录
|
||||||
|
- ./projects:/app/projects
|
||||||
|
depends_on:
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
restart: unless-stopped
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "curl", "-f", "http://localhost:8001/api/health"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 3
|
||||||
|
start_period: 40s
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres_data:
|
||||||
@ -48,8 +48,8 @@ MCP_SSE_READ_TIMEOUT = int(os.getenv("MCP_SSE_READ_TIMEOUT", 300)) # SSE 读取
|
|||||||
|
|
||||||
# PostgreSQL 连接字符串
|
# PostgreSQL 连接字符串
|
||||||
# 格式: postgresql://user:password@host:port/database
|
# 格式: postgresql://user:password@host:port/database
|
||||||
CHECKPOINT_DB_URL = os.getenv("CHECKPOINT_DB_URL", "postgresql://postgres:AeEGDB0b7Z5GK0E2tblt@dev-circleo-pg.celp3nik7oaq.ap-northeast-1.rds.amazonaws.com:5432/gptbase")
|
#CHECKPOINT_DB_URL = os.getenv("CHECKPOINT_DB_URL", "postgresql://postgres:AeEGDB0b7Z5GK0E2tblt@dev-circleo-pg.celp3nik7oaq.ap-northeast-1.rds.amazonaws.com:5432/gptbase")
|
||||||
#CHECKPOINT_DB_URL = os.getenv("CHECKPOINT_DB_URL", "postgresql://moshui:@localhost:5432/moshui")
|
CHECKPOINT_DB_URL = os.getenv("CHECKPOINT_DB_URL", "postgresql://moshui:@localhost:5432/moshui")
|
||||||
|
|
||||||
# 连接池大小
|
# 连接池大小
|
||||||
# 同时可以持有的最大连接数
|
# 同时可以持有的最大连接数
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user