Просмотр исходного кода

docs: Update README with detailed Docker deployment and update instructions

1808837298@qq.com 1 год назад
Родитель
Сommit
2072376694
2 измененных файлов с 65 добавлено и 10 удалено
  1. 34 5
      README.en.md
  2. 31 5
      README.md

+ 34 - 5
README.en.md

@@ -91,13 +91,10 @@ You can add custom models gpt-4-gizmo-* in channels. These are third-party model
 - `AZURE_DEFAULT_API_VERSION`: Azure channel default API version, if not specified in channel settings, use this version, default `2024-12-01-preview`
 - `AZURE_DEFAULT_API_VERSION`: Azure channel default API version, if not specified in channel settings, use this version, default `2024-12-01-preview`
 
 
 ## Deployment
 ## Deployment
+
 > [!TIP]
 > [!TIP]
 > Latest Docker image: `calciumion/new-api:latest`  
 > Latest Docker image: `calciumion/new-api:latest`  
-> Default account: root, password: 123456  
-> Update command:
-> ```
-> docker run --rm -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower -cR
-> ```
+> Default account: root, password: 123456
 
 
 ### Multi-Server Deployment
 ### Multi-Server Deployment
 - Must set `SESSION_SECRET` environment variable, otherwise login state will not be consistent across multiple servers.
 - Must set `SESSION_SECRET` environment variable, otherwise login state will not be consistent across multiple servers.
@@ -107,26 +104,58 @@ You can add custom models gpt-4-gizmo-* in channels. These are third-party model
 - Local database (default): SQLite (Docker deployment must mount `/data` directory)
 - Local database (default): SQLite (Docker deployment must mount `/data` directory)
 - Remote database: MySQL >= 5.7.8, PgSQL >= 9.6
 - Remote database: MySQL >= 5.7.8, PgSQL >= 9.6
 
 
+### Deployment with BT Panel
+Install BT Panel (**version 9.2.0** or above) from [BT Panel Official Website](https://www.bt.cn/new/download.html), choose the stable version script to download and install.  
+After installation, log in to BT Panel and click Docker in the menu bar. First-time access will prompt to install Docker service. Click Install Now and follow the prompts to complete installation.  
+After installation, find **New-API** in the app store, click install, configure basic options to complete installation.  
+[Pictorial Guide](BT.md)
+
 ### Docker Deployment
 ### Docker Deployment
+
 ### Using Docker Compose (Recommended)
 ### Using Docker Compose (Recommended)
 ```shell
 ```shell
 # Clone project
 # Clone project
 git clone https://github.com/Calcium-Ion/new-api.git
 git clone https://github.com/Calcium-Ion/new-api.git
 cd new-api
 cd new-api
 # Edit docker-compose.yml as needed
 # Edit docker-compose.yml as needed
+# nano docker-compose.yml
+# vim docker-compose.yml
 # Start
 # Start
 docker-compose up -d
 docker-compose up -d
 ```
 ```
 
 
+#### Update Version
+```shell
+docker-compose pull
+docker-compose up -d
+```
+
 ### Direct Docker Image Usage
 ### Direct Docker Image Usage
 ```shell
 ```shell
 # SQLite deployment:
 # SQLite deployment:
 docker run --name new-api -d --restart always -p 3000:3000 -e TZ=Asia/Shanghai -v /home/ubuntu/data/new-api:/data calciumion/new-api:latest
 docker run --name new-api -d --restart always -p 3000:3000 -e TZ=Asia/Shanghai -v /home/ubuntu/data/new-api:/data calciumion/new-api:latest
+
 # MySQL deployment (add -e SQL_DSN="root:123456@tcp(localhost:3306)/oneapi"), modify database connection parameters as needed
 # MySQL deployment (add -e SQL_DSN="root:123456@tcp(localhost:3306)/oneapi"), modify database connection parameters as needed
 # Example:
 # Example:
 docker run --name new-api -d --restart always -p 3000:3000 -e SQL_DSN="root:123456@tcp(localhost:3306)/oneapi" -e TZ=Asia/Shanghai -v /home/ubuntu/data/new-api:/data calciumion/new-api:latest
 docker run --name new-api -d --restart always -p 3000:3000 -e SQL_DSN="root:123456@tcp(localhost:3306)/oneapi" -e TZ=Asia/Shanghai -v /home/ubuntu/data/new-api:/data calciumion/new-api:latest
 ```
 ```
 
 
+#### Update Version
+```shell
+# Pull the latest image
+docker pull calciumion/new-api:latest
+# Stop and remove the old container
+docker stop new-api
+docker rm new-api
+# Run the new container with the same parameters as before
+docker run --name new-api -d --restart always -p 3000:3000 -e TZ=Asia/Shanghai -v /home/ubuntu/data/new-api:/data calciumion/new-api:latest
+```
+
+Alternatively, you can use Watchtower for automatic updates (not recommended, may cause database incompatibility):
+```shell
+docker run --rm -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower -cR
+```
+
 ## Channel Retry
 ## Channel Retry
 Channel retry is implemented, configurable in `Settings->Operation Settings->General Settings`. **Cache recommended**.  
 Channel retry is implemented, configurable in `Settings->Operation Settings->General Settings`. **Cache recommended**.  
 First retry uses same priority, second retry uses next priority, and so on.
 First retry uses same priority, second retry uses next priority, and so on.

+ 31 - 5
README.md

@@ -96,13 +96,10 @@
 - `CRYPTO_SECRET`:加密密钥,用于加密数据库内容。
 - `CRYPTO_SECRET`:加密密钥,用于加密数据库内容。
 - `AZURE_DEFAULT_API_VERSION`:Azure渠道默认API版本,如果渠道设置中未指定API版本,则使用此版本,默认为 `2024-12-01-preview`
 - `AZURE_DEFAULT_API_VERSION`:Azure渠道默认API版本,如果渠道设置中未指定API版本,则使用此版本,默认为 `2024-12-01-preview`
 ## 部署
 ## 部署
+
 > [!TIP]
 > [!TIP]
 > 最新版Docker镜像:`calciumion/new-api:latest`  
 > 最新版Docker镜像:`calciumion/new-api:latest`  
-> 默认账号root 密码123456  
-> 更新指令:
-> ```
-> docker run --rm -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower -cR
-> ```
+> 默认账号root 密码123456
 
 
 ### 多机部署
 ### 多机部署
 - 必须设置环境变量 `SESSION_SECRET`,否则会导致多机部署时登录状态不一致。
 - 必须设置环境变量 `SESSION_SECRET`,否则会导致多机部署时登录状态不一致。
@@ -119,25 +116,54 @@
 [图文教程](BT.md)
 [图文教程](BT.md)
 
 
 ### 基于 Docker 进行部署
 ### 基于 Docker 进行部署
+
+> [!TIP]
+> 默认管理员账号root 密码123456
+
 ### 使用 Docker Compose 部署(推荐)
 ### 使用 Docker Compose 部署(推荐)
 ```shell
 ```shell
 # 下载项目
 # 下载项目
 git clone https://github.com/Calcium-Ion/new-api.git
 git clone https://github.com/Calcium-Ion/new-api.git
 cd new-api
 cd new-api
 # 按需编辑 docker-compose.yml
 # 按需编辑 docker-compose.yml
+# nano docker-compose.yml
+# vim docker-compose.yml
 # 启动
 # 启动
 docker-compose up -d
 docker-compose up -d
 ```
 ```
 
 
+#### 更新版本
+```shell
+docker-compose pull
+docker-compose up -d
+```
+
 ### 直接使用 Docker 镜像
 ### 直接使用 Docker 镜像
 ```shell
 ```shell
 # 使用 SQLite 的部署命令:
 # 使用 SQLite 的部署命令:
 docker run --name new-api -d --restart always -p 3000:3000 -e TZ=Asia/Shanghai -v /home/ubuntu/data/new-api:/data calciumion/new-api:latest
 docker run --name new-api -d --restart always -p 3000:3000 -e TZ=Asia/Shanghai -v /home/ubuntu/data/new-api:/data calciumion/new-api:latest
+
 # 使用 MySQL 的部署命令,在上面的基础上添加 `-e SQL_DSN="root:123456@tcp(localhost:3306)/oneapi"`,请自行修改数据库连接参数。
 # 使用 MySQL 的部署命令,在上面的基础上添加 `-e SQL_DSN="root:123456@tcp(localhost:3306)/oneapi"`,请自行修改数据库连接参数。
 # 例如:
 # 例如:
 docker run --name new-api -d --restart always -p 3000:3000 -e SQL_DSN="root:123456@tcp(localhost:3306)/oneapi" -e TZ=Asia/Shanghai -v /home/ubuntu/data/new-api:/data calciumion/new-api:latest
 docker run --name new-api -d --restart always -p 3000:3000 -e SQL_DSN="root:123456@tcp(localhost:3306)/oneapi" -e TZ=Asia/Shanghai -v /home/ubuntu/data/new-api:/data calciumion/new-api:latest
 ```
 ```
 
 
+#### 更新版本
+```shell
+# 拉取最新镜像
+docker pull calciumion/new-api:latest
+# 停止并删除旧容器
+docker stop new-api
+docker rm new-api
+# 使用相同参数运行新容器
+docker run --name new-api -d --restart always -p 3000:3000 -e TZ=Asia/Shanghai -v /home/ubuntu/data/new-api:/data calciumion/new-api:latest
+```
+
+或者使用 Watchtower 自动更新(不推荐,可能会导致数据库不兼容):
+```shell
+docker run --rm -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower -cR
+```
+
 ## 渠道重试
 ## 渠道重试
 渠道重试功能已经实现,可以在`设置->运营设置->通用设置`设置重试次数,**建议开启缓存**功能。  
 渠道重试功能已经实现,可以在`设置->运营设置->通用设置`设置重试次数,**建议开启缓存**功能。  
 如果开启了重试功能,第一次重试使用同优先级,第二次重试使用下一个优先级,以此类推。
 如果开启了重试功能,第一次重试使用同优先级,第二次重试使用下一个优先级,以此类推。