diff --git a/README.md b/README.md index e03e219..0e20814 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ - **SSH 系统信息获取**:支持手动触发,也可配置自动同步;SSH 密码采用 AES-256-GCM 加密存储 - **数据导入/导出**:JSON 格式完整备份与恢复 - **操作日志**:记录所有增删改操作及来源 IP +- **PVE 虚拟机管理**:支持 Proxmox VE 节点管理、VM 状态查看、远程启停操作 ## 技术栈 @@ -38,7 +39,7 @@ go run . 前端开发服务器默认在 `http://localhost:5173`,并代理 `/api` 到 `http://127.0.0.1:8080`。 -### 生产构建(单二进制部署) +### 生产构建 ```bash make build @@ -81,33 +82,37 @@ docker run -d \ lan-manager ``` -### 方式三:使用预构建镜像(如果已发布到镜像仓库) +### 方式三:服务器部署(本地构建二进制 + 服务器构建镜像) + +适用于服务器网络较慢、无法直接拉取 node/golang 镜像的场景: ```bash +# 1. 本地交叉编译 Linux 二进制 +CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o server/lan-manager-linux ./server/main.go + +# 2. 本地构建前端 +cd web && npm run build + +# 3. 将二进制和 dist/ 上传到服务器 +cp server/lan-manager-linux /server/path/ +cp -r web/dist /server/path/ + +# 4. 在服务器上构建镜像(只需 alpine 基础镜像,无需 node/golang) +cd /server/path +docker build -t lan-manager . + +# 5. 运行容器 docker run -d \ --name lan-manager \ -p 8080:8080 \ -v $(pwd)/data:/app/data \ -e ADMIN_PASS=your-secure-password \ - your-registry/lan-manager:latest + -e ENCRYPT_KEY=your-encrypt-key \ + -e WEB_STATIC_PATH=/app/static \ + --restart unless-stopped \ + lan-manager ``` -## Debian 12 一键部署 - -```bash -# 1. 解压部署包 -tar -xzf deploy/lan-manager-debian12.tar.gz -cd lan-manager-debian12 - -# 2. 编辑环境变量(务必修改 ADMIN_PASS 和 ENCRYPT_KEY) -nano lan-manager.env - -# 3. 执行安装脚本 -sudo bash install.sh -``` - -安装完成后服务自动启动,通过 `systemctl status lan-manager` 查看状态。 - ## Nginx 反向代理示例 ```nginx @@ -153,9 +158,6 @@ server { ``` lan-manager/ -├── deploy/ # Debian 12 部署包 -├── docs/ # 需求文档与计划 -├── scripts/ # systemd 服务示例 ├── server/ # Go 后端 │ ├── main.go │ ├── config/ @@ -167,7 +169,8 @@ lan-manager/ │ └── static/ # 嵌入的前端构建产物 ├── web/ # Vue 前端 │ ├── src/ -│ └── dist/ +│ ├── public/ # 静态资源(logo、favicon 等) +│ └── dist/ # 构建产物 ├── Dockerfile # Docker 构建文件 ├── docker-compose.yml # Docker Compose 配置 ├── Makefile @@ -189,3 +192,4 @@ lan-manager/ 2. **网络访问**:容器需要访问宿主机网络或目标局域网,默认使用 bridge 网络模式 3. **Ping 权限**:容器内可能需要 `NET_RAW` 能力才能执行 ICMP ping,已在 Dockerfile 中通过 `setcap` 配置 4. **环境变量**:建议通过 `.env` 文件或 Docker Compose 管理敏感配置 +5. **静态文件**:使用 `WEB_STATIC_PATH` 环境变量时,需确保路径在容器内存在且可读 diff --git a/web/index.html b/web/index.html index 180f933..1856d41 100644 --- a/web/index.html +++ b/web/index.html @@ -3,8 +3,13 @@ + + - 局域网机器管理后台 + LAN Manager · 局域网资产管理 + + +
diff --git a/web/public/favicon.ico b/web/public/favicon.ico new file mode 100644 index 0000000..1141549 Binary files /dev/null and b/web/public/favicon.ico differ diff --git a/web/public/logo.svg b/web/public/logo.svg new file mode 100644 index 0000000..10a77bd --- /dev/null +++ b/web/public/logo.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/web/src/App.vue b/web/src/App.vue index cdf41fb..38e62d3 100644 --- a/web/src/App.vue +++ b/web/src/App.vue @@ -16,156 +16,373 @@ onMounted(() => { diff --git a/web/src/components/MainLayout.vue b/web/src/components/MainLayout.vue index ce1ea25..d65f4f0 100644 --- a/web/src/components/MainLayout.vue +++ b/web/src/components/MainLayout.vue @@ -2,10 +2,20 @@
@@ -48,8 +64,9 @@ + > + + + > + + + > + + @@ -34,7 +40,7 @@ - diff --git a/web/src/views/MachineList.vue b/web/src/views/MachineList.vue index 2915a92..4e0ca92 100644 --- a/web/src/views/MachineList.vue +++ b/web/src/views/MachineList.vue @@ -4,44 +4,75 @@
- +
- - - - + + Linux + + + Windows + + + macOS + + + Other + 添加机器 - 导出数据 - 导入数据 + 导出 + 导入
- -
-
+ +
+
- +
+ + + + {{ osShort(m.os_type) }} +
{{ m.hostname }} - {{ m.is_online ? '在线' : '离线' }} - 服务 {{ m.service_count }} + + + {{ m.is_online ? '在线' : '离线' }} + + + {{ m.service_count }} +
- {{ m.ip }} - {{ m.os_type }} + + {{ m.ip }} + + + {{ m.os_type }} + {{ m.os_version }} - {{ m.uptime }} + + {{ m.uptime }} + - {{ m.pve_vm_status === 'running' ? 'VM运行中' : m.pve_vm_status === 'stopped' ? 'VM已停止' : 'VM检测中' }} + + + {{ m.pve_vm_status === 'running' ? 'VM运行中' : m.pve_vm_status === 'stopped' ? 'VM已停止' : 'VM检测中' }} +
-
C
+
+ +
CPU
@@ -49,7 +80,9 @@
{{ extractPercent(m.cpu_info) }}%
-
M
+
+ +
RAM
@@ -57,7 +90,9 @@
{{ extractDetail(m.memory_info) }}
-
D
+
+ +
DISK
@@ -68,68 +103,101 @@
- {{ p.trim() }} + {{ p.trim() }} +{{ m.listen_ports.split(',').length - 6 }}
+ 同步于 {{ formatTime(m.ssh_synced_at) }}
- + + + - - + + - + + + - + + + - + + + - - - - + + Linux + + + Windows + + + macOS + + + Other + - + + + - SSH 配置 + + SSH 配置 + - + + + - + + + - + + + - PVE 配置(可选) + + PVE 配置(可选) + - + + +
@@ -138,7 +206,12 @@