AssetManager.API/DEPLOY.md
OpenClaw Agent 1977dd609d fix: 请求收益曲线时自动回填历史数据
- GetNavHistoryAsync现在会自动检查是否有历史数据
- 无历史数据时自动调用BackfillNavHistoryInternalAsync
- 拆分内部回填方法,避免重复验证权限
2026-03-13 16:21:31 +00:00

73 lines
1.9 KiB
Markdown
Executable File
Raw Permalink 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 部署说明
## 快速启动
### 1. 直接使用 docker-compose 启动
```bash
# 启动服务(需要提前配置好外部 MySQL 连接)
docker-compose up -d
# 查看日志
docker-compose logs -f api
# 停止服务
docker-compose down
```
### 2. 单独构建镜像
```bash
# 构建镜像
docker build -t assetmanager-api:latest .
# 运行容器(需要自行配置 MySQL 连接)
docker run -d -p 7040:8080 \
-e ConnectionStrings__Default="server=你的MySQL地址;Database=assetmanager;Uid=root;Pwd=你的密码;CharSet=utf8mb4;" \
-e Jwt__SecretKey="你的自定义密钥" \
assetmanager-api:latest
```
## 环境变量说明
| 环境变量 | 说明 | 默认值 |
|---------|------|--------|
| `ASPNETCORE_ENVIRONMENT` | 运行环境 | `Production` |
| `ConnectionStrings__Default` | MySQL 连接字符串 | - |
| `Jwt__SecretKey` | JWT 签名密钥 | 开发环境默认值 |
| `Jwt__Issuer` | JWT 签发者 | `AssetManager` |
| `Jwt__Audience` | JWT 受众 | `AssetManager` |
| `Wechat__AppId` | 微信小程序 AppId | 测试默认值 |
| `Wechat__AppSecret` | 微信小程序 AppSecret | 测试默认值 |
| `Tiingo__ApiKey` | Tiingo 股票数据 API Key | 测试默认值 |
| `TZ` | 时区 | `Asia/Shanghai` |
## 端口说明
| 端口 | 服务 | 说明 |
|------|------|------|
| `7040` | 后端 API | HTTP 接口 |
## 数据持久化
- 应用日志:存储在 `logs` 卷中
## 生产环境注意事项
1. **必须修改默认密码和密钥**
- MySQL 连接密码
- JWT 签名密钥 (`Jwt__SecretKey`)
- 微信 AppId/AppSecret
- Tiingo API Key
2. 建议使用反向代理Nginx/Caddy提供 HTTPS 访问
## 常见问题
### 启动后 API 访问 500
检查 MySQL 连接是否正常,确认连接字符串配置正确。
### 微信登录失败
检查 `Wechat__AppId``Wechat__AppSecret` 是否配置正确。
### 市场数据获取失败
检查 `Tiingo__ApiKey` 是否有效,网络是否能访问 Tiingo API。