修改部署

This commit is contained in:
dekun
2026-05-19 02:10:22 +08:00
parent c21707b111
commit 809a7cc38f
2 changed files with 146 additions and 82 deletions
+31 -10
View File
@@ -43,34 +43,51 @@
## 环境要求
- 系统:**Ubuntu** 22.04 / 24.04(生产环境推荐)
- Python **3.10+**
- 上游服务:**Ollama**(或其它 OpenAI 兼容 HTTP API
- 生产建议:**PM2** 守护进程**宝塔** 或 Nginx 做 HTTPS 反代
- 生产建议:**root** 部署到 **`/opt/openai_node`****PM2** 守护;**宝塔** 或 Nginx 做 HTTPS 反代
---
## 快速开始
## 快速开始Ubuntu / root / /opt
### 1. 克隆仓库
以下命令在 **root** 下执行,安装目录为 **`/opt/openai_node`**。
### 1. 安装系统依赖
```bash
git clone https://git.bz121.com/dekun/openai_node.git
cd openai_node
apt update
apt install -y python3 python3-venv python3-pip git curl
# PM2 需要 Node.js(若未安装)
curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
apt install -y nodejs
npm install -g pm2
```
### 2. 安装依赖
### 2. 克隆仓库
```bash
cd /opt
git clone https://git.bz121.com/dekun/openai_node.git
cd /opt/openai_node
```
### 3. 安装 Python 依赖
```bash
python3 -m venv venv
source venv/bin/activate # Windows: .\venv\Scripts\Activate.ps1
source venv/bin/activate
pip install -r requirements.txt -U
```
### 3. 配置文件
### 4. 配置文件
```bash
cd /opt/openai_node
cp gateway.json.example gateway.json
cp nodes.json.example nodes.json
chmod 600 gateway.json nodes.json
```
编辑 **`gateway.json`**
@@ -90,13 +107,17 @@ cp nodes.json.example nodes.json
- `models[].id` 必须与调用 API 时 JSON 里的 **`model` 字段完全一致**(Ollama 模型名)。
- `models[].label` 为 Web 卡片上的显示名。
### 4. 启动
### 5. 启动(调试)
```bash
cd /opt/openai_node
source venv/bin/activate
export JWT_SECRET="请改为长随机字符串"
python -m uvicorn main:app --host 0.0.0.0 --port 8150
```
生产环境请用 PM2,见 **[DEPLOY.md](./DEPLOY.md)**。
浏览器打开 `http://127.0.0.1:8150`
| 路径 | 说明 |
@@ -204,7 +225,7 @@ curl https://你的域名/v1/chat/completions \
## 生产部署
详见 **[DEPLOY.md](./DEPLOY.md)**VPS、宝塔反代 8150、frp 多机、PM2
详见 **[DEPLOY.md](./DEPLOY.md)****Ubuntu**、**root** 用户、目录 **`/opt/openai_node`**、宝塔反代 **8150**、frp 多机、PM2。
---