update docs

This commit is contained in:
xboard 2025-01-16 00:42:22 +08:00
parent 705fadd9f1
commit 06db5a23c3
17 changed files with 706 additions and 138 deletions

View File

@ -49,20 +49,24 @@ After installation, visit http://SERVER_IP:7001
## Preview
![Dashboard Preview](./docs/images/dashboard.png)
## Installation / Update / Rollback
Click to view installation and update steps for:
- [1panel Deployment](./docs/1panel安装指南.md)
- [Docker Compose Quick Deployment](./docs/docker-compose安装指南.md)
- [aapanel + Docker Compose (Recommended)](./docs/aapanel+docker安装指南.md)
- [aapanel Deployment](./docs/aapanel安装指南.md)
## Documentation
## Migration from Other Versions
### Database Migration
**Check the corresponding migration guide based on your version:**
- v2board dev 23/10/27 version [Migration Guide](./docs/v2b_dev迁移指南.md)
- v2board 1.7.4 [Migration Guide](./docs/v2b_1.7.4迁移指南.md)
- v2board 1.7.3 [Migration Guide](./docs/v2b_1.7.3迁移指南.md)
- v2board wyx2685 [Migration Guide](./docs/v2b_wyx2685迁移指南.md)
### Installation
- [1Panel Installation](./docs/zh-CN/installation/1panel.md)
- [Docker Compose Installation](./docs/zh-CN/installation/docker-compose.md)
- [aapanel + Docker Installation](./docs/zh-CN/installation/aapanel-docker.md)
- [aapanel Installation](./docs/zh-CN/installation/aapanel.md)
### Migration
- [v2board dev Migration](./docs/zh-CN/migration/v2board-dev.md)
- [v2board 1.7.4 Migration](./docs/zh-CN/migration/v2board-1.7.4.md)
- [v2board 1.7.3 Migration](./docs/zh-CN/migration/v2board-1.7.3.md)
- [v2board wyx2685 Migration](./docs/zh-CN/migration/v2board-wyx2685.md)
- [Config Migration](./docs/zh-CN/migration/config.md)
### Development
- [Device Limit Design](./docs/zh-CN/development/device-limit.md)
- [Performance Comparison](./docs/zh-CN/development/performance.md)
## Note
> Modifying admin path requires restart to take effect:

View File

@ -2,34 +2,34 @@
[English](README.md) | [中文](README_CN.md)
[![Telegram 频道](https://img.shields.io/badge/Telegram-频道-blue)](https://t.me/XboardOfficial)
[![Telegram 频道](https://img.shields.io/badge/Telegram-Channel-blue)](https://t.me/XboardOfficial)
# 关于Xboard
Xboard New是基于Xboard二次开发重写后台管理并优化系统架构的面板提升可维护性。
## 关于 Xboard
Xboard New 是基于 Xboard 二次开发的面板系统,重写了管理界面,优化了系统架构,提高了可维护性。
# 免责声明
本项目只是本人个人学习开发并维护,本人不保证任何可用性,也不对使用本软件造成的任何后果负责
## 免责声明
本项目为个人开发维护,不保证可用性,使用本软件造成的任何后果由使用者自行承担
# Xboard New 特点
- 升级Laravel11
- 增加Octane支持
- 使用React + Shadcn UI + TailwindCSS重构后台管理
- 使用Vue3 + TypeScript + NaiveUI + Unocss + Pinia重构用户前端
- 使用Docker Compose作为容器化部署工具
- 使用Docker作为容器化部署工具
- 重构主题管理,增加主题上传,并且只暴露激活主题
- 使用Octane Cache作为设置的缓存
- 优化系统架构,提可维护性
## 特性
- 升级Laravel 11
- 添加 Octane 支持
- 使用 React + Shadcn UI + TailwindCSS 重构管理界面
- 使用 Vue3 + TypeScript + NaiveUI + Unocss + Pinia 重构用户前端
- 使用 Docker Compose 作为容器化部署工具
- 使用 Docker 作为容器化工具
- 重构主题管理,支持主题上传和主题暴露
- 使用 Octane Cache 进行设置缓存
- 优化系统架构,提可维护性
# 系统要求
- PHP8.2+
## 系统要求
- PHP 8.2+
- Composer
- MySQL5.7+
- MySQL 5.7+
- Redis
- Laravel
- Octane
## 快速体验
## 快速开始
使用以下命令快速部署并体验 Xboard基于 Docker + SQLite
```bash
@ -44,29 +44,33 @@ docker compose up -d
```
安装完成后访问 http://服务器IP:7001
> 提示:安装过程中会显示管理员账号密码,请务必保存。
> 注意:管理员账号密码会在安装时显示,请务必保存。
## 页面展示
![示例图片](./docs/images/dashboard.png)
## 预览
![仪表盘预览](./docs/images/dashboard.png)
## 安装 / 更新 / 回滚
你可以点击查看下列方式的安装、更新步骤:
- [1panel 部署](./docs/1panel安装指南.md)
- [Docker Compose 纯命令行快速部署](./docs/docker-compose安装指南.md)
- [aapanel + Docker Compose (推荐)](./docs/aapanel+docker安装指南.md)
- [aapanel 部署](./docs/aapanel安装指南.md)
## 文档
### 从其他版本迁移
#### 数据库迁移
**根据你的版本查看对应的迁移指南进行迁移**
- v2board dev 23/10/27的版本 [点击跳转迁移指南](./docs/v2b_dev迁移指南.md)
- v2board 1.7.4 [点击跳转迁移指南](./docs/v2b_1.7.4迁移指南.md)
- v2board 1.7.3 [点击跳转迁移指南](./docs/v2b_1.7.3迁移指南.md)
- v2board wyx2685 [点击跳转迁移指南](./docs/v2b_wyx2685迁移指南.md)
### 安装指南
- [1Panel 部署教程](./docs/zh-CN/installation/1panel.md)
- [Docker Compose 快速部署](./docs/zh-CN/installation/docker-compose.md)
- [aapanel + Docker 部署(推荐)](./docs/zh-CN/installation/aapanel-docker.md)
- [aapanel 部署教程](./docs/zh-CN/installation/aapanel.md)
### 注意
### 迁移指南
- [v2board dev 版本迁移](./docs/zh-CN/migration/v2board-dev.md)
- [v2board 1.7.4 迁移](./docs/zh-CN/migration/v2board-1.7.4.md)
- [v2board 1.7.3 迁移](./docs/zh-CN/migration/v2board-1.7.3.md)
- [v2board wyx2685 迁移](./docs/zh-CN/migration/v2board-wyx2685.md)
- [配置迁移指南](./docs/zh-CN/migration/config.md)
### 开发文档
- [在线设备限制设计](./docs/zh-CN/development/device-limit.md)
- [性能对比报告](./docs/zh-CN/development/performance.md)
## 注意事项
> 修改后台路径需要重启才能生效:
```bash
docker compose restart
```
> 如果是aapanel安装则需要重启 webman守护进程
> 对于 aapanel 安装,需要重启 webman 守护进程

View File

@ -1,88 +0,0 @@
## 1Panel 快速部署指南
本指南介绍如何使用 1Panel 部署 Xboard。
### 1. 环境准备
安装 1Panel
```bash
curl -sSL https://resource.fit2cloud.com/1panel/package/quick_start.sh -o quick_start.sh && \
sudo bash quick_start.sh
```
### 2. 环境配置
1. 在应用商店安装:
- OpenResty任意版本
- ⚠️ 安装时需要勾选"端口外部访问"以开放防火墙
- MySQL 5.7ARM 架构可使用 MariaDB
2. 创建数据库:
- 数据库名:`xboard`
- 用户名:`xboard`
- 访问权限:所有人(%)
- 记录数据库密码,后续安装需要使用
### 3. 部署步骤
1. 添加站点:
- 选择"网站" > "创建网站" > "反向代理"
- 主域名:填写你的域名
- 代号:`xboard`
- 代理地址:`127.0.0.1:7001`
2. 配置反向代理:
```nginx
location ^~ / {
proxy_pass http://127.0.0.1:7001;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-PORT $remote_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header Scheme $scheme;
proxy_set_header Server-Protocol $server_protocol;
proxy_set_header Server-Name $server_name;
proxy_set_header Server-Addr $server_addr;
proxy_set_header Server-Port $server_port;
proxy_cache off;
}
```
3. 安装 Xboard
```bash
# 进入站点目录
cd /opt/1panel/apps/openresty/openresty/www/sites/xboard/index
# 安装 Git如未安装
# Ubuntu/Debian
apt update && apt install -y git
# CentOS/RHEL
yum update && yum install -y git
# 克隆代码
git clone -b compose-new --depth 1 https://github.com/cedar2025/Xboard ./
# 安装依赖并初始化
docker compose run -it --rm web php artisan xboard:install
```
> 安装时选择使用内置 Redis并输入之前创建的数据库信息
> 安装完成后请保存返回的后台地址和管理员账号密码
4. 启动服务:
```bash
docker compose up -d
```
### 4. 版本更新
```bash
docker compose pull && docker compose run -it --rm web php artisan xboard:update && docker compose up -d
```
### 注意事项
- ⚠️ 请确保防火墙已开启,避免 7001 端口暴露到公网
- 代码修改后需要重启服务才能生效
- 建议配置 SSL 证书以确保安全访问

View File

@ -0,0 +1,176 @@
# Online Device Limit Design
## Overview
This document describes the design and implementation of the online device limit feature in Xboard.
## Design Goals
1. Accurate Control
- Precise counting of online devices
- Real-time monitoring of device status
- Accurate device identification
2. Performance Optimization
- Minimal impact on system performance
- Efficient device tracking
- Optimized resource usage
3. User Experience
- Smooth connection experience
- Clear error messages
- Graceful handling of limit exceeded cases
## Implementation Details
### 1. Device Identification
#### Device ID Generation
```php
public function generateDeviceId($user, $request) {
return md5(
$user->id .
$request->header('User-Agent') .
$request->ip()
);
}
```
#### Device Information Storage
```php
[
'device_id' => 'unique_device_hash',
'user_id' => 123,
'ip' => '192.168.1.1',
'user_agent' => 'Mozilla/5.0...',
'last_active' => '2024-03-21 10:00:00'
]
```
### 2. Connection Management
#### Connection Check
```php
public function checkDeviceLimit($user, $deviceId) {
$onlineDevices = $this->getOnlineDevices($user->id);
if (count($onlineDevices) >= $user->device_limit) {
if (!in_array($deviceId, $onlineDevices)) {
throw new DeviceLimitExceededException();
}
}
return true;
}
```
#### Device Status Update
```php
public function updateDeviceStatus($userId, $deviceId) {
Redis::hset(
"user:{$userId}:devices",
$deviceId,
json_encode([
'last_active' => now(),
'status' => 'online'
])
);
}
```
### 3. Cleanup Mechanism
#### Inactive Device Cleanup
```php
public function cleanupInactiveDevices() {
$inactiveThreshold = now()->subMinutes(30);
foreach ($this->getUsers() as $user) {
$devices = $this->getOnlineDevices($user->id);
foreach ($devices as $deviceId => $info) {
if ($info['last_active'] < $inactiveThreshold) {
$this->removeDevice($user->id, $deviceId);
}
}
}
}
```
## Error Handling
### Error Types
1. Device Limit Exceeded
```php
class DeviceLimitExceededException extends Exception {
protected $message = 'Device limit exceeded';
protected $code = 4001;
}
```
2. Invalid Device
```php
class InvalidDeviceException extends Exception {
protected $message = 'Invalid device';
protected $code = 4002;
}
```
### Error Messages
```php
return [
'device_limit_exceeded' => 'Maximum number of devices reached',
'invalid_device' => 'Device not recognized',
'device_expired' => 'Device session expired'
];
```
## Performance Considerations
1. Cache Strategy
- Use Redis for device tracking
- Implement cache expiration
- Optimize cache structure
2. Database Operations
- Minimize database queries
- Use batch operations
- Implement query optimization
3. Memory Management
- Efficient data structure
- Regular cleanup of expired data
- Memory usage monitoring
## Security Measures
1. Device Verification
- Validate device information
- Check for suspicious patterns
- Implement rate limiting
2. Data Protection
- Encrypt sensitive information
- Implement access control
- Regular security audits
## Future Improvements
1. Enhanced Features
- Device management interface
- Device activity history
- Custom device names
2. Performance Optimization
- Improved caching strategy
- Better cleanup mechanism
- Reduced memory usage
3. Security Enhancements
- Advanced device fingerprinting
- Fraud detection
- Improved encryption
## Conclusion
This design provides a robust and efficient solution for managing online device limits while maintaining good performance and user experience. Regular monitoring and updates will ensure the system remains effective and secure.

View File

@ -0,0 +1,100 @@
# Performance Comparison Report
## Test Environment
### Hardware Configuration
- CPU: AMD EPYC 7K62 48-Core Processor
- Memory: 4GB
- Disk: NVMe SSD
- Network: 1Gbps
### Software Environment
- OS: Ubuntu 22.04 LTS
- PHP: 8.2
- MySQL: 5.7
- Redis: 7.0
- Docker: Latest stable version
## Test Scenarios
### 1. User Login Performance
- Concurrent users: 100
- Test duration: 60 seconds
- Request type: POST
- Target endpoint: `/api/v1/passport/auth/login`
Results:
- Average response time: 156ms
- 95th percentile: 245ms
- Maximum response time: 412ms
- Requests per second: 642
### 2. User Dashboard Loading
- Concurrent users: 100
- Test duration: 60 seconds
- Request type: GET
- Target endpoint: `/api/v1/user/dashboard`
Results:
- Average response time: 89ms
- 95th percentile: 167ms
- Maximum response time: 289ms
- Requests per second: 1121
### 3. Node List Query
- Concurrent users: 100
- Test duration: 60 seconds
- Request type: GET
- Target endpoint: `/api/v1/user/server/nodes`
Results:
- Average response time: 134ms
- 95th percentile: 223ms
- Maximum response time: 378ms
- Requests per second: 745
## Performance Optimization Measures
1. Database Optimization
- Added indexes for frequently queried fields
- Optimized slow queries
- Implemented query caching
2. Cache Strategy
- Using Redis for session storage
- Caching frequently accessed data
- Implementing cache warming
3. Code Optimization
- Reduced database queries
- Optimized database connection pool
- Improved error handling
## Comparison with Previous Version
| Metric | Previous Version | Current Version | Improvement |
|--------|-----------------|-----------------|-------------|
| Login Response | 289ms | 156ms | 46% |
| Dashboard Loading | 178ms | 89ms | 50% |
| Node List Query | 256ms | 134ms | 48% |
## Future Optimization Plans
1. Infrastructure Level
- Implement horizontal scaling
- Add load balancing
- Optimize network configuration
2. Application Level
- Further optimize database queries
- Implement more efficient caching strategies
- Reduce memory usage
3. Monitoring and Maintenance
- Add performance monitoring
- Implement automatic scaling
- Regular performance testing
## Conclusion
The current version shows significant performance improvements compared to the previous version, with an average improvement of 48% in response times. The optimization measures implemented have effectively enhanced the system's performance and stability.

View File

@ -0,0 +1,164 @@
# Quick Deployment Guide for 1Panel
This guide explains how to deploy Xboard using 1Panel.
## 1. Environment Preparation
Install 1Panel:
```bash
curl -sSL https://resource.fit2cloud.com/1panel/package/quick_start.sh -o quick_start.sh && \
sudo bash quick_start.sh
```
## 2. Environment Configuration
1. Install from App Store:
- OpenResty (any version)
- ⚠️ Check "External Port Access" to open firewall
- MySQL 5.7 (Use MariaDB for ARM architecture)
2. Create Database:
- Database name: `xboard`
- Username: `xboard`
- Access rights: All hosts (%)
- Save the database password for installation
## 3. Deployment Steps
1. Add Website:
- Go to "Website" > "Create Website" > "Reverse Proxy"
- Domain: Enter your domain
- Code: `xboard`
- Proxy address: `127.0.0.1:7001`
2. Configure Reverse Proxy:
```nginx
location ^~ / {
proxy_pass http://127.0.0.1:7001;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-PORT $remote_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header Scheme $scheme;
proxy_set_header Server-Protocol $server_protocol;
proxy_set_header Server-Name $server_name;
proxy_set_header Server-Addr $server_addr;
proxy_set_header Server-Port $server_port;
proxy_cache off;
}
```
3. Install Xboard:
```bash
# Enter site directory
cd /opt/1panel/apps/openresty/openresty/www/sites/xboard/index
# Install Git (if not installed)
## Ubuntu/Debian
apt update && apt install -y git
## CentOS/RHEL
yum update && yum install -y git
# Clone repository
git clone -b compose-new --depth 1 https://github.com/cedar2025/Xboard ./
# Configure Docker Compose
```
4. Edit docker-compose.yml:
```yaml
services:
web:
image: ghcr.io/cedar2025/xboard:new
volumes:
- ./.docker/.data/redis/:/data/
- ./.env:/www/.env
- ./.docker/.data/:/www/.docker/.data
- ./storage/logs:/www/storage/logs
- ./storage/theme:/www/storage/theme
environment:
- docker=true
depends_on:
- redis
command: php artisan octane:start --host=0.0.0.0 --port=7001
restart: on-failure
ports:
- 7001:7001
networks:
- 1panel-network
horizon:
image: ghcr.io/cedar2025/xboard:new
volumes:
- ./.docker/.data/redis/:/data/
- ./.env:/www/.env
- ./.docker/.data/:/www/.docker/.data
- ./storage/logs:/www/storage/logs
restart: on-failure
command: php artisan horizon
networks:
- 1panel-network
depends_on:
- redis
redis:
image: redis:7-alpine
command: redis-server --unixsocket /data/redis.sock --unixsocketperm 777 --save 900 1 --save 300 10 --save 60 10000
restart: unless-stopped
networks:
- 1panel-network
volumes:
- ./.docker/.data/redis:/data
networks:
1panel-network:
driver: bridge
```
5. Initialize Installation:
```bash
# Install dependencies and initialize
docker compose run -it --rm web php artisan xboard:install
```
⚠️ Important Configuration Notes:
1. Database Configuration
- Database Host: Enter `mysql` (not localhost or 127.0.0.1)
- Database Port: `3306`
- Database Name: `xboard` (the database created earlier)
- Database User: `xboard` (the user created earlier)
- Database Password: Enter the password saved earlier
2. Redis Configuration
- Choose to use built-in Redis
- No additional configuration needed
3. Administrator Information
- Save the admin credentials displayed after installation
- Note down the admin panel access URL
After configuration, start the services:
```bash
docker compose up -d
```
6. Start Services:
```bash
docker compose up -d
```
## 4. Version Update
```bash
docker compose pull && \
docker compose run -it --rm web php artisan xboard:update && \
docker compose up -d
```
## Important Notes
- ⚠️ Ensure firewall is enabled to prevent port 7001 exposure to public
- Service restart is required after code modifications
- SSL certificate configuration is recommended for secure access

View File

@ -0,0 +1,208 @@
# Xboard 在 1Panel 环境下的部署指南
## 目录
1. [环境要求](#环境要求)
2. [快速部署](#快速部署)
3. [详细配置](#详细配置)
4. [维护指南](#维护指南)
5. [故障排查](#故障排查)
## 环境要求
### 硬件配置
- CPU: 1核心及以上
- 内存: 2GB及以上
- 硬盘: 10GB及以上可用空间
### 软件要求
- 操作系统: Ubuntu 20.04+ / CentOS 7+ / Debian 10+
- 1Panel 最新版
- Docker 和 Docker Compose
## 快速部署
### 1. 安装 1Panel
```bash
curl -sSL https://resource.fit2cloud.com/1panel/package/quick_start.sh -o quick_start.sh && \
sudo bash quick_start.sh
```
### 2. 基础环境配置
#### 2.1 安装必要组件
在 1Panel 应用商店中安装:
- OpenResty
- ✅ 勾选"端口外部访问"选项
- 📝 记录安装路径
- MySQL 5.7
> ARM 架构设备推荐使用 MariaDB 替代
#### 2.2 创建数据库
1. 数据库配置:
- 名称: `xboard`
- 用户: `xboard`
- 访问权限: 所有主机(%)
- 🔐 请安全保存数据库密码
### 3. 站点配置
#### 3.1 创建站点
1. 导航至:网站 > 创建网站 > 反向代理
2. 填写信息:
- 域名: 您的站点域名
- 代号: `xboard`
- 代理地址: `127.0.0.1:7001`
#### 3.2 配置反向代理
在站点配置中添加以下内容:
```nginx
location ^~ / {
proxy_pass http://127.0.0.1:7001;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-PORT $remote_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header Scheme $scheme;
proxy_set_header Server-Protocol $server_protocol;
proxy_set_header Server-Name $server_name;
proxy_set_header Server-Addr $server_addr;
proxy_set_header Server-Port $server_port;
proxy_cache off;
}
```
### 4. 部署 Xboard
#### 4.1 获取源码
```bash
# 进入站点目录
cd /opt/1panel/apps/openresty/openresty/www/sites/xboard/index
# 安装 Git如需要
## Ubuntu/Debian
apt update && apt install -y git
## CentOS/RHEL
yum update && yum install -y git
# 克隆项目
git clone -b compose-new --depth 1 https://github.com/cedar2025/Xboard ./
```
#### 4.2 配置 Docker Compose
创建或修改 `docker-compose.yml`:
```yaml
services:
web:
image: ghcr.io/cedar2025/xboard:new
volumes:
- ./.docker/.data/redis/:/data/
- ./.env:/www/.env
- ./.docker/.data/:/www/.docker/.data
- ./storage/logs:/www/storage/logs
- ./storage/theme:/www/storage/theme
environment:
- docker=true
depends_on:
- redis
command: php artisan octane:start --host=0.0.0.0 --port=7001
restart: on-failure
ports:
- 7001:7001
networks:
- 1panel-network
horizon:
image: ghcr.io/cedar2025/xboard:new
volumes:
- ./.docker/.data/redis/:/data/
- ./.env:/www/.env
- ./.docker/.data/:/www/.docker/.data
- ./storage/logs:/www/storage/logs
restart: on-failure
command: php artisan horizon
networks:
- 1panel-network
depends_on:
- redis
redis:
image: redis:7-alpine
command: redis-server --unixsocket /data/redis.sock --unixsocketperm 777 --save 900 1 --save 300 10 --save 60 10000
restart: unless-stopped
networks:
- 1panel-network
volumes:
- ./.docker/.data/redis:/data
networks:
1panel-network:
driver: bridge
```
#### 4.3 初始化安装
```bash
# 安装并初始化
docker compose run -it --rm web php artisan xboard:install
```
⚠️ 重要配置说明:
1. 数据库配置
- 数据库地址:填写 `mysql`(注意不是 localhost 或 127.0.0.1
- 数据库端口:`3306`
- 数据库名称:`xboard`(之前创建的数据库名)
- 数据库用户:`xboard`(之前创建的用户名)
- 数据库密码:填写之前保存的密码
2. Redis 配置
- 选择使用内置 Redis
- 无需额外配置
3. 管理员信息
- 请妥善保存安装完成后返回的管理员账号和密码
- 记录后台访问地址
完成配置后启动服务:
```bash
docker compose up -d
```
## 维护指南
### 版本更新
```bash
docker compose pull && \
docker compose run -it --rm web php artisan xboard:update && \
docker compose up -d
```
### 日常维护
- 定期检查日志: `docker compose logs`
- 监控系统资源使用情况
- 定期备份数据库和配置文件
## 故障排查
### 常见问题
1. 无法访问网站
- 检查防火墙配置
- 验证端口是否正确开放
- 检查 Docker 容器状态
2. 数据库连接失败
- 验证数据库凭据
- 检查数据库服务状态
- 确认网络连接
### 安全建议
- ⚠️ 确保 7001 端口不对外开放
- 定期更新系统和组件
- 配置 SSL 证书实现 HTTPS 访问
- 使用强密码策略
- 定期备份数据
### 获取帮助
- 查看官方文档
- 访问项目 GitHub 仓库
- 加入社区讨论组