Files
Cyrene/docs/deploy/docker-compose.md
T
2026-05-30 08:49:07 +08:00

80 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Docker Compose 生产部署
## 快速开始
```bash
# 1. 配置环境变量
cp .docker.env.example .docker.env
# 编辑 .docker.env,填入真实的 API Key 和密码
# 2. 配置 Caddyfile(有域名时)
# 将 :80 替换为你的域名,并取消 HSTS 注释
# 3. 启动所有服务
docker compose --env-file .docker.env up -d
# 4. 查看状态
docker compose ps
docker compose logs -f
```
## 服务清单
| 服务 | 端口 | 说明 |
|------|------|------|
| caddy | 80 / 443 | 反向代理,自动 HTTPS |
| gateway | 8080 (内部) | API 网关 |
| ai-core | 8081 (内部) | AI 核心 |
| memory-service | 8091 (内部) | 记忆检索 |
| voice-service | 8093 (内部) | 语音识别 |
| iot-debug-service | 8083 (内部) | IoT 调试 |
| postgres | 5432 (内部) | 数据库 (pgvector/pg16) |
| redis | 6379 (内部) | 缓存 |
| qdrant | 6333 (内部) | 向量数据库 |
| minio | 9000 (内部) | 对象存储 |
| searxng | 8080 (内部) | 搜索引擎 |
## 环境变量
所有变量在 `.docker.env` 中配置。必填项:
| 变量 | 说明 |
|------|------|
| `LLM_API_URL` | LLM API 地址 |
| `LLM_API_KEY` | LLM API 密钥 |
| `POSTGRES_PASSWORD` | 数据库密码 |
| `JWT_SECRET` | JWT 签名密钥 |
| `MINIO_SECRET_KEY` | MinIO 密钥 |
## 域名与 HTTPS
有域名时修改 [Caddyfile](../../Caddyfile)
```caddy
# 将 :80 改为你的域名
your-domain.com {
# 取消 HSTS 注释
header {
Strict-Transport-Security "max-age=31536000; includeSubDomains"
}
}
```
Caddy 会自动从 Let's Encrypt 申请证书,确保 `ACME_EMAIL` 已正确填写。
## 常用命令
```bash
# 重新构建并启动单个服务
docker compose up -d --build gateway
# 查看特定服务日志
docker compose logs -f ai-core
# 停止所有服务
docker compose down
# 停止并删除数据卷(危险)
docker compose down -v
```