mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-28 04:59:52 +01:00
Update dev-ops-integration.md
This commit is contained in:
parent
9dbfacf201
commit
d55ae6e398
1 changed files with 65 additions and 65 deletions
|
|
@ -1,58 +1,58 @@
|
|||
# 全模块源码部署自动升级方法
|
||||
# Full module source code deployment automatic upgrade method
|
||||
|
||||
本教程是方便全模块源码部署的爱好者,如何通过自动命令,自动拉取源码,自动编译,自动启动端口运行。实现最高效率的升级系统。
|
||||
This tutorial is for those who are interested in deploying full-module source code. It shows you how to use automatic commands to automatically pull source code, automatically compile, and automatically start port operations, achieving the most efficient upgrade system.
|
||||
|
||||
本项目的测试平台`https://2662r3426b.vicp.fun`,从开放以来就使用了该方法,效果良好。
|
||||
The test platform of this project, `https://2662r3426b.vicp.fun`, has used this method since it was released, with good results.
|
||||
|
||||
教程可参考B站博主`毕乐labs`发布的视频教程:[《开源小智服务器xiaozhi-server自动更新以及最新版本MCP接入点配置保姆教程》](https://www.bilibili.com/video/BV15H37zHE7Q)
|
||||
For tutorials, please refer to the video tutorial released by B station blogger `Bi Le Labs`: [Open Source Xiaozhi Server xiaozhi-server automatic update and the latest version of MCP access point configuration nanny tutorial] (https://www.bilibili.com/video/BV15H37zHE7Q)
|
||||
|
||||
# 开始条件
|
||||
- 你的电脑/服务器是linux操作系统
|
||||
- 你已经跑通了整个流程
|
||||
- 你喜欢跟进最新功能,但是觉得每次手动部署有点麻烦,期待有一个自动更新的方法
|
||||
# Start conditions
|
||||
- Your computer/server is running Linux
|
||||
- You've run through the entire process.
|
||||
- You like to keep up with the latest features, but find it troublesome to deploy manually each time, and hope to have an automatic update method
|
||||
|
||||
第二个条件必须满足,因为本教程所涉及的某些文件,JDK、Node.js环境、Conda环境等,是需要你跑通整个流程才有的,如果你没有跑通,当我讲到某个文件的时候,你可能就不知道什么意思。
|
||||
The second condition must be met because some of the files involved in this tutorial, such as JDK, Node.js environment, and Conda environment, require you to run through the entire process. If you don't run through it, you may not know what I mean when I talk about a certain file.
|
||||
|
||||
# 教程效果
|
||||
- 解决国内不能拉取最新项目源码问题
|
||||
- 自动拉取代码编译前端文件
|
||||
- 自动拉取代码编译java文件,自动杀掉8002端口,自动启动8002端口
|
||||
- 自动拉取python代码,自动杀掉8000端口,自动启动8000端口
|
||||
# Tutorial Effect
|
||||
- Solve the problem of not being able to pull the latest project source code in China
|
||||
- Automatically pull code and compile front-end files
|
||||
- Automatically pull code to compile Java files, automatically kill port 8002, and automatically start port 8002
|
||||
- Automatically pull Python code, automatically kill port 8000, and automatically start port 8000
|
||||
|
||||
# 第一步 选好你的项目目录
|
||||
# The first step is to choose your project directory
|
||||
|
||||
例如,我规划了我的项目目录是,这是一个新建的空白的目录,如果你不想出错,可以和我一样
|
||||
For example, I planned my project directory to be a new blank directory. If you don’t want to make mistakes, you can do the same as me.
|
||||
```
|
||||
/home/system/xiaozhi
|
||||
```
|
||||
|
||||
# 第二步 克隆本项目
|
||||
此刻,先要执行第一句话,拉取源码,这句命令适用于国内网络的服务器和电脑,无需翻墙
|
||||
# Step 2: Clone this project
|
||||
At this moment, you must first execute the first sentence to pull the source code. This command is applicable to servers and computers on the domestic network and does not require a VPN.
|
||||
|
||||
```
|
||||
cd /home/system/xiaozhi
|
||||
git clone https://ghproxy.net/https://github.com/xinnan-tech/xiaozhi-esp32-server.git
|
||||
```
|
||||
|
||||
执行完后,你的项目目录会多了一个文件夹`xiaozhi-esp32-server`,这个就是项目的源码
|
||||
After the execution, your project directory will have an additional folder `xiaozhi-esp32-server`, which is the source code of the project
|
||||
|
||||
# 第三步 复制基础的文件
|
||||
# The third step is to copy the basic files
|
||||
|
||||
如果你之前已经跑通了整个流程,对funasr的模型文件`xiaozhi-server/models/SenseVoiceSmall/model.pt`和你的私有配置文件`xiaozhi-server/data/.config.yaml`这两个文件不会陌生。
|
||||
If you have run through the entire process before, you will be familiar with the funasr model file `xiaozhi-server/models/SenseVoiceSmall/model.pt` and your private configuration file `xiaozhi-server/data/.config.yaml`.
|
||||
|
||||
此刻你需要把`model.pt`文件复制到新的目录去,你可以这样
|
||||
Now you need to copy the `model.pt` file to the new directory, you can do this
|
||||
```
|
||||
# 创建需要的目录
|
||||
# Create the required directories
|
||||
mkdir -p /home/system/xiaozhi/xiaozhi-esp32-server/main/xiaozhi-server/data/
|
||||
|
||||
cp 你原来的.config.yaml完整路径 /home/system/xiaozhi/xiaozhi-esp32-server/main/xiaozhi-server/data/.config.yaml
|
||||
cp 你原来的model.pt完整路径 /home/system/xiaozhi/xiaozhi-esp32-server/main/xiaozhi-server/models/SenseVoiceSmall/model.pt
|
||||
cp your original .config.yaml full path /home/system/xiaozhi/xiaozhi-esp32-server/main/xiaozhi-server/data/.config.yaml
|
||||
cp your original model.pt full path /home/system/xiaozhi/xiaozhi-esp32-server/main/xiaozhi-server/models/SenseVoiceSmall/model.pt
|
||||
```
|
||||
|
||||
# 第四步 建立三个自动编译文件
|
||||
# The fourth step is to create three automatic compilation files
|
||||
|
||||
## 4.1 自动编译mananger-web模块
|
||||
在`/home/system/xiaozhi/`目录下,创建名字为`update_8001.sh`的文件,内容如下
|
||||
## 4.1 Automatically compile the mananger-web module
|
||||
In the `/home/system/xiaozhi/` directory, create a file named `update_8001.sh` with the following content
|
||||
|
||||
```
|
||||
cd /home/system/xiaozhi/xiaozhi-esp32-server
|
||||
|
|
@ -68,14 +68,14 @@ rm -rf /home/system/xiaozhi/manager-web
|
|||
mv /home/system/xiaozhi/xiaozhi-esp32-server/main/manager-web/dist /home/system/xiaozhi/manager-web
|
||||
```
|
||||
|
||||
保存好后执行赋权命令
|
||||
After saving, execute the empowerment command
|
||||
```
|
||||
chmod 777 update_8001.sh
|
||||
```
|
||||
执行完后,继续往下
|
||||
After execution, continue to
|
||||
|
||||
## 4.2 自动编译运行manager-api模块
|
||||
在`/home/system/xiaozhi/`目录下,创建名字为`update_8002.sh`的文件,内容如下
|
||||
## 4.2 Automatically compile and run the manager-api module
|
||||
In the `/home/system/xiaozhi/` directory, create a file named `update_8002.sh` with the following content
|
||||
|
||||
```
|
||||
cd /home/system/xiaozhi/xiaozhi-esp32-server
|
||||
|
|
@ -87,21 +87,21 @@ rm -rf target
|
|||
mvn clean package -Dmaven.test.skip=true
|
||||
cd /home/system/xiaozhi/
|
||||
|
||||
# 查找占用8002端口的进程号
|
||||
# Find the process number occupying port 8002
|
||||
PID=$(sudo netstat -tulnp | grep 8002 | awk '{print $7}' | cut -d'/' -f1)
|
||||
|
||||
rm -rf /home/system/xiaozhi/xiaozhi-esp32-api.jar
|
||||
mv /home/system/xiaozhi/xiaozhi-esp32-server/main/manager-api/target/xiaozhi-esp32-api.jar /home/system/xiaozhi/xiaozhi-esp32-api.jar
|
||||
|
||||
# 检查是否找到进程号
|
||||
# Check if the process ID is found
|
||||
if [ -z "$PID" ]; then
|
||||
echo "没有找到占用8002端口的进程"
|
||||
echo "No process occupying port 8002 was found"
|
||||
else
|
||||
echo "找到占用8002端口的进程,进程号为: $PID"
|
||||
# 杀掉进程
|
||||
echo "Found the process occupying port 8002, process ID: $PID"
|
||||
# Kill the process
|
||||
kill -9 $PID
|
||||
kill -9 $PID
|
||||
echo "已杀掉进程 $PID"
|
||||
echo "Process $PID has been killed"
|
||||
fi
|
||||
|
||||
nohup java -jar xiaozhi-esp32-api.jar --spring.profiles.active=dev &
|
||||
|
|
@ -109,34 +109,34 @@ nohup java -jar xiaozhi-esp32-api.jar --spring.profiles.active=dev &
|
|||
tail tail -f nohup.out
|
||||
```
|
||||
|
||||
保存好后执行赋权命令
|
||||
After saving, execute the empowerment command
|
||||
```
|
||||
chmod 777 update_8002.sh
|
||||
```
|
||||
执行完后,继续往下
|
||||
After execution, continue to
|
||||
|
||||
## 4.3 自动编译运行Python项目
|
||||
在`/home/system/xiaozhi/`目录下,创建名字为`update_8000.sh`的文件,内容如下
|
||||
## 4.3 Automatically compile and run Python projects
|
||||
In the `/home/system/xiaozhi/` directory, create a file named `update_8000.sh` with the following content
|
||||
|
||||
```
|
||||
cd /home/system/xiaozhi/xiaozhi-esp32-server
|
||||
git pull origin main
|
||||
|
||||
# 查找占用8000端口的进程号
|
||||
# Find the process number occupying port 8000
|
||||
PID=$(sudo netstat -tulnp | grep 8000 | awk '{print $7}' | cut -d'/' -f1)
|
||||
|
||||
# 检查是否找到进程号
|
||||
# Check if the process ID is found
|
||||
if [ -z "$PID" ]; then
|
||||
echo "没有找到占用8000端口的进程"
|
||||
echo "No process occupying port 8000 was found"
|
||||
else
|
||||
echo "找到占用8000端口的进程,进程号为: $PID"
|
||||
# 杀掉进程
|
||||
echo "Found the process occupying port 8000, process ID: $PID"
|
||||
# Kill the process
|
||||
kill -9 $PID
|
||||
kill -9 $PID
|
||||
echo "已杀掉进程 $PID"
|
||||
echo "Process $PID has been killed"
|
||||
fi
|
||||
cd main/xiaozhi-server
|
||||
# 初始化conda环境
|
||||
# Initialize the conda environment
|
||||
source ~/.bashrc
|
||||
conda activate xiaozhi-esp32-server
|
||||
pip install -r requirements.txt
|
||||
|
|
@ -144,39 +144,39 @@ nohup python app.py >/dev/null &
|
|||
tail -f /home/system/xiaozhi/xiaozhi-esp32-server/main/xiaozhi-server/tmp/server.log
|
||||
```
|
||||
|
||||
保存好后执行赋权命令
|
||||
After saving, execute the empowerment command
|
||||
```
|
||||
chmod 777 update_8000.sh
|
||||
```
|
||||
执行完后,继续往下
|
||||
After execution, continue to
|
||||
|
||||
# 日常更新
|
||||
# Daily Updates
|
||||
|
||||
以上的脚本都建立好后,日常更新,我们只要依次执行以下命令就可以做到自动更新和启动
|
||||
After the above scripts are created, for daily updates, we only need to execute the following commands in sequence to automatically update and start
|
||||
|
||||
```
|
||||
cd /home/system/xiaozhi
|
||||
# 更新并启动Java程序
|
||||
# Update and start the Java program
|
||||
./update_8001.sh
|
||||
# 更新web程序
|
||||
# Update web application
|
||||
./update_8002.sh
|
||||
# 更新并启动python程序
|
||||
# Update and start the python program
|
||||
./update_8000.sh
|
||||
|
||||
|
||||
# 后期想查看java日志,执行以下命令
|
||||
# If you want to view the Java log later, execute the following command
|
||||
tail -f nohup.out
|
||||
# 后期想查看python日志,执行以下命令
|
||||
# If you want to view the python log later, execute the following command
|
||||
tail -f /home/system/xiaozhi/xiaozhi-esp32-server/main/xiaozhi-server/tmp/server.log
|
||||
```
|
||||
|
||||
# 注意事项
|
||||
测试平台`https://2662r3426b.vicp.fun`,是使用nginx做了反向代理。nginx.conf详细配置可以[参考这里](https://github.com/xinnan-tech/xiaozhi-esp32-server/issues/791)
|
||||
# Notes
|
||||
The test platform `https://2662r3426b.vicp.fun` uses nginx as a reverse proxy. The detailed configuration of nginx.conf can be found here [https://github.com/xinnan-tech/xiaozhi-esp32-server/issues/791]
|
||||
|
||||
## 常见问题
|
||||
## Frequently Asked Questions
|
||||
|
||||
### 1、为什么没有见到8001端口?
|
||||
回答:8001是开发环境使用的,用于运行前端的端口。如果你是服务器部署,不建议使用`npm run serve`启动8001端口运行前端,而是像本教程一样编译成html文件,然后使用nginx来管理访问。
|
||||
### 1. Why can’t I see port 8001?
|
||||
Answer: Port 8001 is used in the development environment and is used to run the front-end. If you are deploying on a server, it is not recommended to use `npm run serve` to start the front-end on port 8001. Instead, compile it into an HTML file as shown in this tutorial and use nginx to manage access.
|
||||
|
||||
### 2、每次更新需要更新手动SQL语句吗?
|
||||
回答:不需要,因为项目使用**Liquibase**管理数据库版本,会自动执行新的sql脚本。
|
||||
### 2. Do I need to update the manual SQL statement every time I update?
|
||||
Answer: No, because the project uses **Liquibase** to manage the database version, which will automatically execute the new SQL script.
|
||||
|
|
|
|||
Loading…
Reference in a new issue