feat: merge PVE VM management + local features

- Merge PVE (Proxmox VE) virtual machine management from remote
  - PVE host CRUD API
  - VM status query / start / stop operations
  - PVE database tables and models
  - Frontend VM status display and control buttons
  - SPA routing fix for nested asset paths

- Keep local features:
  - Change password functionality
  - Log cleanup service
  - Docker containerization (Dockerfile + docker-compose)
  - Empty machine ping log spam fix
  - settings table for admin password storage

- Update machines handlers to support PVE fields
- Update frontend API client with PVE endpoints
This commit is contained in:
shirainbown
2026-06-18 22:33:45 +08:00
parent af306c183c
commit 6f507b319e
18 changed files with 1619 additions and 22 deletions

View File

@@ -46,6 +46,52 @@ make build
./lan-manager
```
## Docker 部署(推荐)
### 方式一:使用 Docker Compose推荐
```bash
# 1. 克隆项目后,直接启动
docker-compose up -d
# 2. 查看日志
docker-compose logs -f
# 3. 停止服务
docker-compose down
```
服务将运行在 `http://localhost:8080`
数据持久化在 `./data/` 目录(通过 volume 挂载)。
### 方式二:手动构建和运行
```bash
# 构建镜像
docker build -t lan-manager .
# 运行容器
docker run -d \
--name lan-manager \
-p 8080:8080 \
-v $(pwd)/data:/app/data \
-e ADMIN_PASS=your-secure-password \
-e ENCRYPT_KEY=your-encrypt-key \
lan-manager
```
### 方式三:使用预构建镜像(如果已发布到镜像仓库)
```bash
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
```
## Debian 12 一键部署
```bash
@@ -122,6 +168,8 @@ lan-manager/
├── web/ # Vue 前端
│ ├── src/
│ └── dist/
├── Dockerfile # Docker 构建文件
├── docker-compose.yml # Docker Compose 配置
├── Makefile
├── go.mod
└── README.md
@@ -134,3 +182,10 @@ lan-manager/
- **自动同步 SSH**:若机器已保存 SSH 用户名和密码,后台每次 Ping 检测成功后会自动通过 SSH 抓取系统信息并同步到数据库
- **在线检测机制**:每分钟对所有机器 IP 执行 ICMP Ping3 秒内无响应视为离线
- **磁盘显示策略**:机器列表卡片仅展示 `/` 根分区占用;详情页展示所有真实磁盘分区
## Docker 部署注意事项
1. **数据持久化**:通过 volume 挂载 `./data` 目录到容器,确保数据在容器重建后不丢失
2. **网络访问**:容器需要访问宿主机网络或目标局域网,默认使用 bridge 网络模式
3. **Ping 权限**:容器内可能需要 `NET_RAW` 能力才能执行 ICMP ping已在 Dockerfile 中通过 `setcap` 配置
4. **环境变量**:建议通过 `.env` 文件或 Docker Compose 管理敏感配置