Add Linux account workspace runtime
This commit is contained in:
@@ -583,6 +583,22 @@ bash "$HOME/zk-data-agent/scripts/install-from-git.sh"
|
||||
- 安装前端依赖并构建。
|
||||
- 安装并启动用户级 systemd 服务。
|
||||
|
||||
如果要启用“平台账号 = Linux 用户”的托管工作区,需要使用 root/systemd system 服务部署:
|
||||
|
||||
```bash
|
||||
cd "$HOME/zk-data-agent"
|
||||
sudo -E env PATH="$PATH" bash scripts/deploy-ubuntu.sh main --system-service --enable-linux-accounts
|
||||
```
|
||||
|
||||
启用后:
|
||||
|
||||
- 平台注册/登录账号时会同步创建同名 Linux 用户。
|
||||
- 平台密码会同步设置为 Linux 用户密码。
|
||||
- Linux 用户允许 SSH 登录。
|
||||
- 本机托管工作区会使用 `/home/<account_id>/zk-agent/`。
|
||||
- `python_exec`、`python_package`、`bash` 会在对应 Linux 用户身份下执行。
|
||||
- Jupyter 远程工作区保持现有逻辑,不参与本机 Linux 用户隔离。
|
||||
|
||||
`.env.deploy` 会保存:
|
||||
|
||||
```text
|
||||
@@ -595,6 +611,8 @@ CLAW_BACKEND_PORT
|
||||
CLAW_FRONTEND_HOST
|
||||
CLAW_FRONTEND_PORT
|
||||
CLAW_API_URL
|
||||
CLAW_SERVICE_SCOPE
|
||||
CLAW_ENABLE_LINUX_ACCOUNTS
|
||||
CLAW_NPM_BIN
|
||||
CLAW_NPX_BIN
|
||||
CLAW_NODE_BIN
|
||||
@@ -618,6 +636,12 @@ bash scripts/update-server-fast.sh
|
||||
bash scripts/deploy-ubuntu.sh
|
||||
```
|
||||
|
||||
root/system 服务更新:
|
||||
|
||||
```bash
|
||||
sudo -E env PATH="$PATH" bash scripts/deploy-ubuntu.sh main --system-service --enable-linux-accounts
|
||||
```
|
||||
|
||||
部署指定分支:
|
||||
|
||||
```bash
|
||||
@@ -632,7 +656,7 @@ bash scripts/deploy-ubuntu.sh main --force
|
||||
|
||||
### 服务管理
|
||||
|
||||
部署脚本会安装两个用户级 systemd 服务:
|
||||
部署脚本默认安装用户级 systemd 服务;以 root 执行或指定 `--system-service` 时安装 system 级服务。服务名默认是:
|
||||
|
||||
```text
|
||||
zk-data-agent-backend
|
||||
@@ -646,6 +670,13 @@ systemctl --user status zk-data-agent-backend
|
||||
systemctl --user status zk-data-agent-frontend
|
||||
```
|
||||
|
||||
system 级服务使用:
|
||||
|
||||
```bash
|
||||
systemctl status zk-data-agent-backend
|
||||
systemctl status zk-data-agent-frontend
|
||||
```
|
||||
|
||||
查看日志:
|
||||
|
||||
```bash
|
||||
@@ -653,12 +684,25 @@ journalctl --user -u zk-data-agent-backend -f
|
||||
journalctl --user -u zk-data-agent-frontend -f
|
||||
```
|
||||
|
||||
system 级日志使用:
|
||||
|
||||
```bash
|
||||
journalctl -u zk-data-agent-backend -f
|
||||
journalctl -u zk-data-agent-frontend -f
|
||||
```
|
||||
|
||||
重启服务:
|
||||
|
||||
```bash
|
||||
systemctl --user restart zk-data-agent-backend zk-data-agent-frontend
|
||||
```
|
||||
|
||||
system 级重启使用:
|
||||
|
||||
```bash
|
||||
systemctl restart zk-data-agent-backend zk-data-agent-frontend
|
||||
```
|
||||
|
||||
停止服务:
|
||||
|
||||
```bash
|
||||
@@ -683,6 +727,7 @@ Ubuntu 部署建议:
|
||||
- Python `3.10.14`
|
||||
- Node.js `20` 或 `22`
|
||||
- `npm`
|
||||
- 启用 Linux 账号工作区时,还需要 `passwd`、`python3`、`python3-venv`,并要求服务以 root/systemd system 方式运行。
|
||||
|
||||
首次安装如果缺 Python 编译依赖,可以执行:
|
||||
|
||||
@@ -690,7 +735,7 @@ Ubuntu 部署建议:
|
||||
bash scripts/deploy-ubuntu.sh --bootstrap-system
|
||||
```
|
||||
|
||||
`--bootstrap-system` 会使用 `sudo apt-get` 安装系统依赖;应用代码、虚拟环境、前端依赖、运行数据和 systemd 用户服务仍然位于当前用户目录。
|
||||
`--bootstrap-system` 会使用 `sudo apt-get` 安装系统依赖;普通模式下应用代码、虚拟环境、前端依赖、运行数据和 systemd 用户服务仍然位于当前用户目录。启用 `--enable-linux-accounts` 后,账号工作区位于 `/home/<account_id>/zk-agent/`。
|
||||
|
||||
## 开发验证
|
||||
|
||||
|
||||
Reference in New Issue
Block a user