merge: sync upstream/master from cedar2025/Xboard

合并上游 cedar2025/Xboard 的 master,并按交互决策保留本地改动。
This commit is contained in:
yinjianm
2026-03-19 21:04:27 +08:00
101 changed files with 3274 additions and 80278 deletions
+94 -62
View File
@@ -1,38 +1,48 @@
# 1Panel 快速部署指南
# Quick Deployment Guide for 1Panel
本文档介绍如何使用 1Panel 部署 Xboard。
This guide explains how to deploy Xboard using 1Panel.
## 1. 环境准备
## 1. Environment Preparation
安装 1Panel
Install 1Panel:
```bash
curl -sSL https://resource.fit2cloud.com/1panel/package/quick_start.sh -o quick_start.sh && \
sudo bash quick_start.sh
```
## 2. 环境配置
## 2. Environment Configuration
1. 从应用商店安装:
- OpenResty(任意版本)
- 勾选“外部端口访问”以放行防火墙
- MySQL 5.7ARM 架构请使用 MariaDB
1. Install from App Store:
- OpenResty (any version)
- ⚠️ Check "External Port Access" to open firewall
- MySQL 5.7 (Use MariaDB for ARM architecture)
2. 创建数据库:
- 数据库名:`xboard`
- 用户名:`xboard`
- 权限:所有主机(%
- 请保存数据库密码,安装时需要使用
2. Create Database:
- Database name: `xboard`
- Username: `xboard`
- Access rights: All hosts (%)
- Save the database password for installation
## 3. 部署步骤
## 3. Deployment Steps
1. 添加网站:
- 进入“网站” > “创建网站” > “反向代理”
- 域名:填写你的域名
- 代号:`xboard`
- 代理地址:`127.0.0.1:7001`
1. Add Website:
- Go to "Website" > "Create Website" > "Reverse Proxy"
- Domain: Enter your domain
- Code: `xboard`
- Proxy address: `127.0.0.1:7001`
2. 配置反向代理:
2. Configure Reverse Proxy:
```nginx
location /ws/ {
proxy_pass http://127.0.0.1:8076;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_read_timeout 60s;
}
location ^~ / {
proxy_pass http://127.0.0.1:7001;
proxy_http_version 1.1;
@@ -49,31 +59,32 @@ location ^~ / {
proxy_cache off;
}
```
> The `/ws/` location enables WebSocket real-time node synchronization via `ws-server`. This service is enabled by default and can be toggled in Admin Panel > System Settings > Server.
3. 安装 Xboard
3. Install Xboard:
```bash
# 进入网站目录
# Enter site directory
cd /opt/1panel/apps/openresty/openresty/www/sites/xboard/index
# 安装 Git(未安装时执行)
# Install Git (if not installed)
## Ubuntu/Debian
apt update && apt install -y git
## CentOS/RHEL
yum update && yum install -y git
# 克隆仓库
git clone -b compose --depth 1 https://github.com/Micah123321/Xboard ./
# Clone repository
git clone -b compose --depth 1 https://github.com/cedar2025/Xboard ./
# 配置 Docker Compose
# Configure Docker Compose
```
4. 编辑 compose.yaml
4. Edit compose.yaml:
```yaml
services:
web:
image: ghcr.io/Micah123321/xboard:new
image: ghcr.io/cedar2025/xboard:new
volumes:
- ./.docker/.data/redis/:/data/
- redis-data:/data
- ./.env:/www/.env
- ./.docker/.data/:/www/.docker/.data
- ./storage/logs:/www/storage/logs
@@ -91,9 +102,9 @@ services:
- 1panel-network
horizon:
image: ghcr.io/Micah123321/xboard:new
image: ghcr.io/cedar2025/xboard:new
volumes:
- ./.docker/.data/redis/:/data/
- redis-data:/data
- ./.env:/www/.env
- ./.docker/.data/:/www/.docker/.data
- ./storage/logs:/www/storage/logs
@@ -104,6 +115,22 @@ services:
- 1panel-network
depends_on:
- redis
ws-server:
image: ghcr.io/cedar2025/xboard:new
volumes:
- redis-data:/data
- ./.env:/www/.env
- ./.docker/.data/:/www/.docker/.data
- ./storage/logs:/www/storage/logs
- ./plugins:/www/plugins
restart: on-failure
ports:
- 8076:8076
networks:
- 1panel-network
command: php artisan ws-server start
depends_on:
- redis
redis:
image: redis:7-alpine
@@ -112,67 +139,72 @@ services:
networks:
- 1panel-network
volumes:
- ./.docker/.data/redis:/data
- redis-data:/data
volumes:
redis-data:
networks:
1panel-network:
external: true
```
5. 初始化安装:
5. Initialize Installation:
```bash
# 安装依赖并初始化
# Install dependencies and initialize
docker compose run -it --rm web php artisan xboard:install
```
重要配置说明:
1. 数据库配置
- Database Host:按部署方式填写:
1. 如果数据库与 Xboard 在同一网络,填写 `mysql`
2. 如果连接失败,进入:数据库 -> 选择数据库 -> 连接信息 -> 容器连接,使用其中的 Host 值
3. 如果使用外部数据库,填写实际数据库地址
- Database Port`3306`(默认端口,除非你另有配置)
- Database Name`xboard`(前面创建的数据库)
- Database User`xboard`(前面创建的用户)
- Database Password:填写前面保存的密码
⚠️ Important Configuration Notes:
1. Database Configuration
- Database Host: Choose based on your deployment:
1. If database and Xboard are in the same network, use `mysql`
2. If connection fails, go to: Database -> Select Database -> Connection Info -> Container Connection, and use the "Host" value
3. If using external database, enter your actual database host
- Database Port: `3306` (default port unless configured otherwise)
- Database Name: `xboard` (the database created earlier)
- Database User: `xboard` (the user created earlier)
- Database Password: Enter the password saved earlier
2. Redis 配置
- 选择使用内置 Redis
- 无需额外配置
2. Redis Configuration
- Choose to use built-in Redis
- No additional configuration needed
3. 管理员信息
- 保存安装完成后显示的管理员账号信息
- 记录管理后台访问地址
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. 启动服务:
6. Start Services:
```bash
docker compose up -d
```
## 4. 版本更新
## 4. Version Update
> 重要说明:更新命令会因安装版本不同而有所区别:
> - 如果是最近安装(新版本),使用以下命令:
> 💡 Important Note: The update command varies depending on your installation version:
> - If you installed recently (new version), use this command:
```bash
docker compose pull && \
docker compose run -it --rm web php artisan xboard:update && \
docker compose up -d
```
> - 如果是较早安装(旧版本),请把 `web` 替换为 `xboard`
> - If you installed earlier (old version), replace `web` with `xboard`:
```bash
docker compose pull && \
docker compose run -it --rm xboard php artisan xboard:update && \
docker compose up -d
```
> 不确定该用哪个命令?先尝试新版本命令,失败后再使用旧版本命令。
> 🤔 Not sure which to use? Try the new version command first, if it fails, use the old version command.
## 重要提示
## Important Notes
- 请确保已开启防火墙,避免 7001 端口直接暴露到公网
- 代码修改后需要重启服务才能生效
- 建议配置 SSL 证书以保障访问安全
- ⚠️ 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
> The node will automatically detect WebSocket availability during handshake. No extra configuration is needed on the node side.
+76 -62
View File
@@ -1,89 +1,99 @@
# aaPanel + Docker 环境下的 Xboard 部署指南
# Xboard Deployment Guide for aaPanel + Docker Environment
## 目录
1. [环境要求](#环境要求)
2. [快速部署](#快速部署)
3. [详细配置](#详细配置)
4. [维护指南](#维护指南)
5. [故障排查](#故障排查)
## Table of Contents
1. [Requirements](#requirements)
2. [Quick Deployment](#quick-deployment)
3. [Detailed Configuration](#detailed-configuration)
4. [Maintenance Guide](#maintenance-guide)
5. [Troubleshooting](#troubleshooting)
## 环境要求
## Requirements
### 硬件要求
- CPU1 核及以上
- 内存:2GB 及以上
- 存储:可用空间 10GB+
### Hardware Requirements
- CPU: 1 core or above
- Memory: 2GB or above
- Storage: 10GB+ available space
### 软件要求
- 操作系统:Ubuntu 20.04+ / CentOS 7+ / Debian 10+
- aaPanel 最新版本
- Docker Docker Compose
- Nginx(任意版本)
### Software Requirements
- Operating System: Ubuntu 20.04+ / CentOS 7+ / Debian 10+
- Latest version of aaPanel
- Docker and Docker Compose
- Nginx (any version)
- MySQL 5.7+
## 快速部署
## Quick Deployment
### 1. 安装 aaPanel
### 1. Install aaPanel
```bash
curl -sSL https://www.aapanel.com/script/install_6.0_en.sh -o install_6.0_en.sh && \
bash install_6.0_en.sh aapanel
```
### 2. 基础环境配置
### 2. Basic Environment Setup
#### 2.1 安装 Docker
#### 2.1 Install Docker
```bash
# 安装 Docker
# Install Docker
curl -sSL https://get.docker.com | bash
# CentOS 系统还需要执行:
# For CentOS systems, also run:
systemctl enable docker
systemctl start docker
```
#### 2.2 安装必需组件
aaPanel 面板中安装:
- Nginx(任意版本)
#### 2.2 Install Required Components
In the aaPanel dashboard, install:
- Nginx (any version)
- MySQL 5.7
- PHP Redis 不需要安装
- ⚠️ PHP and Redis are not required
### 3. 网站配置
### 3. Site Configuration
#### 3.1 创建网站
1. 进入:aaPanel > 网站 > 添加站点
2. 填写信息:
- 域名:填写你的网站域名
- 数据库:选择 MySQL
- PHP 版本:选择纯静态
#### 3.1 Create Website
1. Navigate to: aaPanel > Website > Add site
2. Fill in the information:
- Domain: Enter your site domain
- Database: Select MySQL
- PHP Version: Select Pure Static
#### 3.2 部署 Xboard
#### 3.2 Deploy Xboard
```bash
# 进入网站目录
# Enter site directory
cd /www/wwwroot/your-domain
# 清理目录
# Clean directory
chattr -i .user.ini
rm -rf .htaccess 404.html 502.html index.html .user.ini
# 克隆仓库
git clone https://github.com/Micah123321/Xboard.git ./
# Clone repository
git clone https://github.com/cedar2025/Xboard.git ./
# 准备配置文件
# Prepare configuration file
cp compose.sample.yaml compose.yaml
# 安装依赖并初始化
# Install dependencies and initialize
docker compose run -it --rm web sh init.sh
```
> 请保存安装完成后显示的管理后台地址、用户名和密码
> ⚠️ Please save the admin dashboard URL, username, and password shown after installation
#### 3.3 启动服务
#### 3.3 Start Services
```bash
docker compose up -d
```
#### 3.4 配置反向代理
将以下内容添加到网站配置:
#### 3.4 Configure Reverse Proxy
Add the following content to your site configuration:
```nginx
location /ws/ {
proxy_pass http://127.0.0.1:8076;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_read_timeout 60s;
}
location ^~ / {
proxy_pass http://127.0.0.1:7001;
proxy_http_version 1.1;
@@ -100,19 +110,20 @@ location ^~ / {
proxy_cache off;
}
```
> The `/ws/` location enables real-time node synchronization via `ws-server`. This service is enabled by default and can be toggled in Admin Panel > System Settings > Server.
## 维护指南
## Maintenance Guide
### 版本更新
### Version Updates
> 重要说明:更新命令会因你安装的版本不同而有所区别:
> - 如果是最近安装(新版本),使用:
> 💡 Important Note: Update commands may vary depending on your installed version:
> - For recent installations (new version), use:
```bash
docker compose pull && \
docker compose run -it --rm web sh update.sh && \
docker compose up -d
```
> - 如果是较早安装(旧版本),请把 `web` 替换为 `xboard`
> - For older installations, replace `web` with `xboard`:
```bash
git config --global --add safe.directory $(pwd)
git fetch --all && git reset --hard origin/master && git pull origin master
@@ -120,18 +131,21 @@ docker compose pull && \
docker compose run -it --rm xboard sh update.sh && \
docker compose up -d
```
> 不确定该用哪个命令?先尝试新版本命令,失败后再使用旧版本命令。
> 🤔 Not sure which to use? Try the new version command first, if it fails, use the old version command.
### 日常维护
- 定期查看日志:`docker compose logs`
- 监控系统资源使用情况
- 定期备份数据库和配置文件
### Routine Maintenance
- Regular log checking: `docker compose logs`
- Monitor system resource usage
- Regular backup of database and configuration files
## 故障排查
## Troubleshooting
如果在安装或运行中遇到问题,请检查:
1. 系统要求是否满足
2. 所有必需端口是否可用
3. Docker 服务是否正常运行
4. Nginx 配置是否正确
5. 查看日志以获取详细报错信息
If you encounter any issues during installation or operation, please check:
1. **Empty Admin Dashboard**: If the admin panel is blank, run `git submodule update --init --recursive --force` to restore the theme files.
2. System requirements are met
3. All required ports are available
3. Docker services are running properly
4. Nginx configuration is correct
5. Check logs for detailed error messages
> The node will automatically detect WebSocket availability during handshake. No extra configuration is needed on the node side.
+116 -81
View File
@@ -1,46 +1,46 @@
# aaPanel 环境下的 Xboard 部署指南
# Xboard Deployment Guide for aaPanel Environment
## 目录
1. [环境要求](#环境要求)
2. [快速部署](#快速部署)
3. [详细配置](#详细配置)
4. [维护指南](#维护指南)
5. [故障排查](#故障排查)
## Table of Contents
1. [Requirements](#requirements)
2. [Quick Deployment](#quick-deployment)
3. [Detailed Configuration](#detailed-configuration)
4. [Maintenance Guide](#maintenance-guide)
5. [Troubleshooting](#troubleshooting)
## 环境要求
## Requirements
### 硬件要求
- CPU1 核及以上
- 内存:2GB 及以上
- 存储:可用空间 10GB+
### Hardware Requirements
- CPU: 1 core or above
- Memory: 2GB or above
- Storage: 10GB+ available space
### 软件要求
- 操作系统:Ubuntu 20.04+ / Debian 10+CentOS 7 不推荐)
- aaPanel 最新版本
### Software Requirements
- Operating System: Ubuntu 20.04+ / Debian 10+ (⚠️ CentOS 7 is not recommended)
- Latest version of aaPanel
- PHP 8.2
- MySQL 5.7+
- Redis
- Nginx(任意版本)
- Nginx (any version)
## 快速部署
## Quick Deployment
### 1. 安装 aaPanel
### 1. Install aaPanel
```bash
URL=https://www.aapanel.com/script/install_6.0_en.sh && \
if [ -f /usr/bin/curl ];then curl -ksSO "$URL" ;else wget --no-check-certificate -O install_6.0_en.sh "$URL";fi && \
bash install_6.0_en.sh aapanel
```
### 2. 基础环境配置
### 2. Basic Environment Setup
#### 2.1 安装 LNMP 环境
aaPanel 面板中安装:
- Nginx(任意版本)
#### 2.1 Install LNMP Environment
In the aaPanel dashboard, install:
- Nginx (any version)
- MySQL 5.7
- PHP 8.2
#### 2.2 安装 PHP 扩展
必需的 PHP 扩展:
#### 2.2 Install PHP Extensions
Required PHP extensions:
- redis
- fileinfo
- swoole
@@ -48,41 +48,41 @@ bash install_6.0_en.sh aapanel
- event
- mbstring
#### 2.3 启用所需 PHP 函数
需要启用的函数:
#### 2.3 Enable Required PHP Functions
Functions that need to be enabled:
- putenv
- proc_open
- pcntl_alarm
- pcntl_signal
### 3. 网站配置
### 3. Site Configuration
#### 3.1 创建网站
1. 进入:aaPanel > 网站 > 添加站点
2. 填写信息:
- 域名:填写你的网站域名
- 数据库:选择 MySQL
- PHP 版本:选择 8.2
#### 3.1 Create Website
1. Navigate to: aaPanel > Website > Add site
2. Fill in the information:
- Domain: Enter your site domain
- Database: Select MySQL
- PHP Version: Select 8.2
#### 3.2 部署 Xboard
#### 3.2 Deploy Xboard
```bash
# 进入网站目录
# Enter site directory
cd /www/wwwroot/your-domain
# 清理目录
# Clean directory
chattr -i .user.ini
rm -rf .htaccess 404.html 502.html index.html .user.ini
# 克隆仓库
git clone https://github.com/Micah123321/Xboard.git ./
# Clone repository
git clone https://github.com/cedar2025/Xboard.git ./
# 安装依赖
# Install dependencies
sh init.sh
```
#### 3.3 配置网站
1. 运行目录设置为 `/public`
2. 添加伪静态规则:
#### 3.3 Configure Site
1. Set running directory to `/public`
2. Add rewrite rules:
```nginx
location /downloads {
}
@@ -99,33 +99,33 @@ location ~ .*\.(js|css)?$
}
```
## 详细配置
## Detailed Configuration
### 1. 配置守护进程
1. 安装 Supervisor
2. 添加队列守护进程:
- 名称:`Xboard`
- 运行用户:`www`
- 运行目录:网站目录
- 启动命令:`php artisan horizon`
- 进程数量:1
### 1. Configure Daemon Process
1. Install Supervisor
2. Add queue daemon process:
- Name: `Xboard`
- Run User: `www`
- Running Directory: Site directory
- Start Command: `php artisan horizon`
- Process Count: 1
### 2. 配置计划任务
- 类型:Shell 脚本
- 任务名称:v2board
- 执行用户:www
- 执行周期:每 1 分钟
- 脚本内容:`php /www/wwwroot/site-directory/artisan schedule:run`
### 2. Configure Scheduled Tasks
- Type: Shell Script
- Task Name: v2board
- Run User: www
- Frequency: 1 minute
- Script Content: `php /www/wwwroot/site-directory/artisan schedule:run`
### 3. Octane 配置(可选)
#### 3.1 添加 Octane 守护进程
- 名称:Octane
- 运行用户:www
- 运行目录:网站目录
- 启动命令:`/www/server/php/82/bin/php artisan octane:start --port 7010`
- 进程数量:1
### 3. Octane Configuration (Optional)
#### 3.1 Add Octane Daemon Process
- Name: Octane
- Run User: www
- Running Directory: Site directory
- Start Command: `/www/server/php/82/bin/php artisan octane:start --port 7010`
- Process Count: 1
#### 3.2 Octane 专用伪静态规则
#### 3.2 Octane-specific Rewrite Rules
```nginx
location ~* \.(jpg|jpeg|png|gif|js|css|svg|woff2|woff|ttf|eot|wasm|json|ico)$ {
}
@@ -146,30 +146,65 @@ location ~ .* {
}
```
## 维护指南
## Maintenance Guide
### 版本更新
### Version Updates
```bash
# 进入网站目录
# Enter site directory
cd /www/wwwroot/your-domain
# 执行更新脚本
# Execute update script
git fetch --all && git reset --hard origin/master && git pull origin master
sh update.sh
# 如果启用了 Octane,请重启守护进程
# aaPanel > 应用商店 > 工具 > Supervisor > 重启 Octane
# If Octane is enabled, restart the daemon process
# aaPanel > App Store > Tools > Supervisor > Restart Octane
```
### 日常维护
- 定期检查日志
- 监控系统资源使用情况
- 定期备份数据库和配置文件
### Routine Maintenance
- Regular log checking
- Monitor system resource usage
- Regular backup of database and configuration files
## 故障排查
## Troubleshooting
### 常见问题
1. 修改后台路径后,需要重启服务才会生效
2. 启用 Octane 后,任何代码变更都需要重启才会生效
3. PHP 扩展安装失败时,请检查 PHP 版本是否正确
4. 数据库连接失败时,请检查数据库配置和权限
### Common Issues
1. **Empty Admin Dashboard**: If the admin panel is blank, run `git submodule update --init --recursive --force` to restore the theme files.
2. Changes to admin path require service restart to take effect
3. Any code changes after enabling Octane require restart to take effect
3. When PHP extension installation fails, check if PHP version is correct
4. For database connection failures, check database configuration and permissions
## Enable WebSocket Real-time Sync (Optional)
WebSocket enables real-time synchronization of configurations and user changes to nodes.
### 1. Start WS Server
Add a WebSocket daemon process in aaPanel Supervisor:
- Name: `Xboard-WS`
- Run User: `www`
- Running Directory: Site directory
- Start Command: `php artisan ws-server start`
- Process Count: 1
### 2. Configure Nginx
Add the WebSocket location **before** the main `location ^~ /` block in your site's Nginx configuration:
```nginx
location /ws/ {
proxy_pass http://127.0.0.1:8076;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_read_timeout 60s;
}
```
### 3. Restart Services
Restart the Octane and WS Server processes in Supervisor.
> The node will automatically detect WebSocket availability during handshake. No extra configuration is needed on the node side.