Skip to content

Commit bd5588a

Browse files
authored
🐛 Even when there is no historical login token, the login prompt needs to pop up #1476
2 parents 63478aa + 77402ec commit bd5588a

File tree

6 files changed

+366
-103
lines changed

6 files changed

+366
-103
lines changed

.github/workflows/codeql.yml

Lines changed: 0 additions & 102 deletions
This file was deleted.

doc/docs/.vitepress/config.mts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ export default defineConfig({
150150
items: [
151151
{ text: "Docker Build", link: "/en/deployment/docker-build" },
152152
{ text: "Dev Container", link: "/en/deployment/devcontainer" },
153+
{ text: "Upgrade Guide", link: "/en/deployment/upgrade-guide" },
153154
],
154155
},
155156
{
@@ -309,6 +310,7 @@ export default defineConfig({
309310
items: [
310311
{ text: "Docker 构建", link: "/zh/deployment/docker-build" },
311312
{ text: "开发容器", link: "/zh/deployment/devcontainer" },
313+
{ text: "升级指导", link: "/zh/deployment/upgrade-guide" },
312314
],
313315
},
314316
{
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# Nexent Upgrade Guide
2+
3+
## 🚀 Upgrade Overview
4+
5+
Follow these four steps to upgrade Nexent safely:
6+
7+
1. Clean up existing containers and images
8+
2. Pull the latest code and run the deployment script
9+
3. Apply database migrations
10+
4. Verify the deployment in your browser
11+
12+
---
13+
14+
## 🧹 Step 1: Clean up old images
15+
16+
Remove cached resources to avoid conflicts when redeploying:
17+
18+
```bash
19+
# Stop and remove existing containers
20+
docker compose down
21+
22+
# Inspect Nexent images
23+
docker images --filter "reference=nexent/*"
24+
25+
# Remove Nexent images
26+
# Windows PowerShell:
27+
docker images -q --filter "reference=nexent/*" | ForEach-Object { docker rmi -f $_ }
28+
# Linux/WSL:
29+
docker images -q --filter "reference=nexent/*" | xargs -r docker rmi -f
30+
31+
# (Optional) prune unused images and caches
32+
docker system prune -af
33+
```
34+
35+
> ⚠️ Notes
36+
> - Back up critical data before deleting images.
37+
> - To preserve database data, do not delete the mounted database volume (`/nexent/docker/volumes` or your custom path).
38+
39+
---
40+
41+
## 🔄 Step 2: Update code and redeploy
42+
43+
```bash
44+
git pull
45+
cd nexent/docker
46+
cp .env.example .env
47+
bash deploy.sh
48+
```
49+
50+
> 💡 Tip
51+
> - `.env.example` works for default deployments.
52+
> - Configure speech models (STT/TTS) in `.env` when needed. A frontend configuration flow is coming soon.
53+
54+
---
55+
56+
## 🗄️ Step 3: Apply database migrations
57+
58+
Run the SQL scripts shipped with each release to keep your schema up to date.
59+
60+
### ✅ Method A: Use a SQL editor (recommended)
61+
62+
1. Open your SQL client and create a new PostgreSQL connection.
63+
2. Retrieve connection settings from `/nexent/docker/.env`:
64+
- Host
65+
- Port
66+
- Database
67+
- User
68+
- Password
69+
3. Test the connection. When successful, you should see tables under the `nexent` schema.
70+
4. Open a new query window.
71+
5. Navigate to `/nexent/docker/sql`. Each file contains one migration script with its release date in the filename.
72+
6. Execute every script dated after your previous deployment, in chronological order.
73+
74+
> ⚠️ Important
75+
> - Always back up the database first, especially in production.
76+
> - Run scripts sequentially to avoid dependency issues.
77+
> - `.env` keys may be named `POSTGRES_HOST`, `POSTGRES_PORT`, and so on—map them accordingly in your SQL client.
78+
79+
### 🧰 Method B: Use the command line (no SQL client required)
80+
81+
1. Switch to the Docker directory:
82+
83+
```bash
84+
cd nexent/docker
85+
```
86+
87+
2. Read database connection details from `.env`, for example:
88+
89+
```bash
90+
POSTGRES_HOST=localhost
91+
POSTGRES_PORT=5432
92+
POSTGRES_DB=nexent
93+
POSTGRES_USER=root
94+
POSTGRES_PASSWORD=your_password
95+
```
96+
97+
3. Execute SQL files sequentially (host machine example):
98+
99+
```bash
100+
# Example: If today is November 6th and your last update was on October 20th,
101+
# and there are two new files 1030-update.sql and 1105-update.sql,
102+
# execute the following commands (please replace the placeholders with your actual values)
103+
docker exec -i nexent-postgresql psql -U [YOUR_POSTGRES_USER] -d [YOUR_POSTGRES_DB] < ./sql/1030-update.sql
104+
docker exec -i nexent-postgresql psql -U [YOUR_POSTGRES_USER] -d [YOUR_POSTGRES_DB] < ./sql/1105-update.sql
105+
```
106+
107+
Execute the scripts in chronological order based on your deployment date.
108+
109+
> 💡 Tips
110+
> - Load environment variables first if they are defined in `.env`:
111+
>
112+
> **Windows PowerShell:**
113+
> ```powershell
114+
> Get-Content .env | Where-Object { $_ -notmatch '^#' -and $_ -match '=' } | ForEach-Object { $key, $value = $_ -split '=', 2; [Environment]::SetEnvironmentVariable($key.Trim(), $value.Trim(), 'Process') }
115+
> ```
116+
>
117+
> **Linux/WSL:**
118+
> ```bash
119+
> export $(grep -v '^#' .env | xargs)
120+
> # Or use set -a to automatically export all variables
121+
> set -a; source .env; set +a
122+
> ```
123+
>
124+
> - Create a backup before running migrations:
125+
>
126+
> ```bash
127+
> docker exec -i nexent-postgres pg_dump -U [YOUR_POSTGRES_USER] [YOUR_POSTGRES_DB] > backup_$(date +%F).sql
128+
> ```
129+
130+
---
131+
132+
## 🌐 Step 4: Verify the deployment
133+
134+
After deployment:
135+
136+
1. Open `http://localhost:3000` in your browser.
137+
2. Review the [User Guide](https://doc.nexent.tech/en/user-guide/) to validate agent functionality.
138+
139+
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# Nexent 升级指导
2+
3+
## 🚀 升级流程概览
4+
5+
升级 Nexent 时建议依次完成以下四个步骤:
6+
7+
1. 清理旧版本容器与镜像
8+
2. 拉取最新代码并执行部署脚本
9+
3. 同步数据库结构
10+
4. 打开站点确认服务可用
11+
12+
---
13+
14+
## 🧹 步骤一:清理旧版本镜像
15+
16+
为避免缓存或版本冲突,先清理旧容器与镜像:
17+
18+
```bash
19+
# 停止并删除现有容器
20+
docker compose down
21+
22+
# 查看 Nexent 镜像
23+
docker images --filter "reference=nexent/*"
24+
25+
# 删除 Nexent 镜像
26+
# Windows PowerShell:
27+
docker images -q --filter "reference=nexent/*" | ForEach-Object { docker rmi -f $_ }
28+
29+
# Linux/WSL:
30+
docker images -q --filter "reference=nexent/*" | xargs -r docker rmi -f
31+
32+
# (可选)清理未使用的镜像与缓存
33+
docker system prune -af
34+
```
35+
36+
> ⚠️ 注意事项
37+
> - 删除镜像前请先备份重要数据。
38+
> - 若需保留数据库数据,请勿删除数据库 volume(通常位于 `/nexent/docker/volumes` 或自定义挂载路径)。
39+
40+
---
41+
42+
## 🔄 步骤二:更新代码并部署
43+
44+
```bash
45+
git pull
46+
cd nexent/docker
47+
cp .env.example .env
48+
bash deploy.sh
49+
```
50+
51+
> 💡 提示
52+
> - 默认为快速部署场景,可直接使用 `.env.example`
53+
> - 若需配置语音模型(STT/TTS),请在 `.env` 中补充相关变量,我们将尽快提供前端配置入口。
54+
55+
---
56+
57+
## 🗄️ 步骤三:同步数据库
58+
59+
升级后需要执行数据库迁移脚本,使 schema 保持最新。
60+
61+
### ✅ 方法一:使用 SQL 编辑器(推荐)
62+
63+
1. 打开 SQL 编辑器,新建 PostgreSQL 连接。
64+
2. 在 `/nexent/docker/.env` 中找到以下信息:
65+
- Host
66+
- Port
67+
- Database
68+
- User
69+
- Password
70+
3. 填写连接信息后测试连接,确认成功后可在 `nexent` schema 中查看所有表。
71+
4. 新建查询窗口。
72+
5. 打开 `/nexent/docker/sql` 目录,按文件名中的日期顺序查看 SQL 脚本。
73+
6. 根据上次部署日期,依次执行之后的每个 SQL 文件。
74+
75+
> ⚠️ 注意事项
76+
> - 升版本前请备份数据库,生产环境尤为重要。
77+
> - SQL 脚本需按时间顺序执行,避免依赖冲突。
78+
> - `.env` 变量可能命名为 `POSTGRES_HOST``POSTGRES_PORT` 等,请在客户端对应填写。
79+
80+
### 🧰 方法二:命令行执行(无需客户端)
81+
82+
1. 进入 Docker 目录:
83+
84+
```bash
85+
cd nexent/docker
86+
```
87+
88+
2. 从 `.env` 中获取数据库连接信息,例如:
89+
90+
```bash
91+
POSTGRES_HOST=localhost
92+
POSTGRES_PORT=5432
93+
POSTGRES_DB=nexent
94+
POSTGRES_USER=root
95+
POSTGRES_PASSWORD=your_password
96+
```
97+
98+
3. 通过容器执行 SQL 脚本(示例):
99+
100+
```bash
101+
# 假如现在是11月6日,上次更新版本的时间是10月20日
102+
# 此时新增了1030-update.sql和1105-update.sql两个文件
103+
# 我们需要执行以下命令(请注意替换占位符中的变量)
104+
docker exec -i nexent-postgresql psql -U [YOUR_POSTGRES_USER] -d [YOUR_POSTGRES_DB] < ./sql/1030-update.sql
105+
docker exec -i nexent-postgresql psql -U [YOUR_POSTGRES_USER] -d [YOUR_POSTGRES_DB] < ./sql/1105-update.sql
106+
```
107+
108+
请根据自己的部署时间,按时间顺序执行对应脚本。
109+
110+
> 💡 提示
111+
> - 若 `.env` 中定义了数据库变量,可先导入:
112+
>
113+
> **Windows PowerShell:**
114+
> ```powershell
115+
> Get-Content .env | Where-Object { $_ -notmatch '^#' -and $_ -match '=' } | ForEach-Object { $key, $value = $_ -split '=', 2; [Environment]::SetEnvironmentVariable($key.Trim(), $value.Trim(), 'Process') }
116+
> ```
117+
>
118+
> **Linux/WSL:**
119+
> ```bash
120+
> export $(grep -v '^#' .env | xargs)
121+
> # 或使用 set -a 自动导出所有变量
122+
> set -a; source .env; set +a
123+
> ```
124+
>
125+
> - 执行前建议先备份:
126+
>
127+
> ```bash
128+
> docker exec -i nexent-postgres pg_dump -U [YOUR_POSTGRES_USER] [YOUR_POSTGRES_DB] > backup_$(date +%F).sql
129+
> ```
130+
131+
---
132+
133+
## 🌐 步骤四:验证部署
134+
135+
部署完成后:
136+
137+
1. 在浏览器打开 `http://localhost:3000`
138+
2. 参考 [用户指南](https://doc.nexent.tech/zh/user-guide/) 完成智能体配置与验证

0 commit comments

Comments
 (0)