## 1.目录结构
```
.
├── bin
│   ├── conf.sh
│   ├── control.sh 运维操作脚本
│   ├── docker.sh
│   └── utils.sh
├── configs
│   └── settings.sh 配置文件
│   └── license 授权文件目录
├── logs 日志文件目录
└── repo 
    ├── images docker镜像文件目录
    ├── models
    └── python
```
---

## 2.服务部署

### 2.1 授权管理

- 获取服务器信息,发给授权人员生成授权文件(已有授权文件忽略此步骤)

```
bin/control.sh systeminfo
```

- 授权文件更新

```
bin/control.sh update_license /path_to/xxx.secret
```

### 2.2 配置文件

- 编辑`configs/settings.sh`

```
# 日志目录
LOG_BASE_DIR=${BASE_DIR}/logs

# 端口
BACKEND_PORT=80
# TODO 此端口随机,不需要配置
TRITON_HTTP_PORT=8000
TRITON_GRPC_PORT=8001
TRITON_METRICS_PORT=8002

# sanic-worker TODO 可配置
BACKEND_SANIC_WORKER_NUM=4

# GPU/CPU
# 使用CPU: TRITON_GPUS=
# 使用GPU0/GPU1: TRITON_GPUS=0,1
TRITON_GPUS=0
```

### 2.3 启动

```
bin/control.sh start all
```

### 2.4 停止

```
bin/control.sh stop all
```

### 2.5 重启

- 重启后端服务,适用于只更新了授权文件

```
bin/control.sh restart backend 
```

- 重启所有,适用于更新了repo文件夹

```
bin/control.sh restart all
```

### 2.6 日志查看
```
bin/control.sh logs triton
bin/control.sh logs backend
```

## TODO 01
- ~~backend logs~~
- ~~backend sanic worker num可配置~~
- 授权部分
- 取消java,更新接口及文档,完善响应结果

## TODO 02
- 随机选择triton端口,该配置项无意义
- 转onnx,体积缩小900M+
- 统一OCR结果
- 参数校验
- 移除多余的包

## TODO 03
- 日志补充
- ASGI & supervisor ? 
- async ?