refactor: 更新项目引用路径从perfect-panel/ppanel-server到perfect-panel/server
Build docker and publish / build (20.15.1) (push) Failing after 6m27s

feat: 添加版本和构建时间变量
fix: 修正短信队列类型注释错误
style: 清理未使用的代码和测试文件
docs: 更新安装文档中的下载链接
chore: 迁移数据库脚本添加日志和订阅配置
This commit is contained in:
2025-10-13 01:33:03 -07:00
parent 393b42f35a
commit c582087c0f
974 changed files with 23609 additions and 23398 deletions
+150 -77
View File
@@ -1,88 +1,161 @@
### 配置文件说明
# PPanel 配置指南
#### 1. 配置文件路径
本文件为 PPanel 应用程序的配置文件提供全面指南。配置文件采用 YAML 格式,定义了服务器、日志、数据库、Redis 和管理员访问的相关设置。
配置文件默认路径为:`./etc/ppanel.yaml`,可通过启动参数 `--config` 指定配置文件路径。
## 1. 配置文件概述
#### 2. 配置文件格式
- 配置文件为yaml格式,支持注释,命名为xxx.yaml
- **默认路径**`./etc/ppanel.yaml`
- **自定义路径**:通过启动参数 `--config` 指定配置文件路径
- **格式**:YAML 格式,支持注释,文件名需以 `.yaml` 结尾。
## 2. 配置文件结构
以下是配置文件示例,包含默认值和说明:
```yaml
# 配置文件示例
Host: # 服务监听地址,默认: 0.0.0.0
Port: # 服务监听端口,默认: 8080
Debug: # 是否开启调试模式,开启后无法使用后台日志功能, 默认: false
JwtAuth: # JWT认证配置
AccessSecret: # 访问令牌密钥, 默认: 随机生成
AccessExpire: # 访问令牌过期时间,单位秒, 默认: 604800
Logger: # 日志配置
FilePath: # 日志文件路径, 默认: ./ppanel.log
MaxSize: # 日志文件最大大小,单位MB, 默认: 50
MaxBackup: # 日志文件最大备份数, 默认: 3
MaxAge: # 日志文件最大保存时间,单位天, 默认: 30
Compress: # 是否压缩日志文件, 默认: true
Level: # 日志级别, 默认: info, 可选: debug, info, warn, error, panic, panic, fatal
MySQL:
Addr: # MySQL地址, 必填
Username: # MySQL用户名, 必填
Password: # MySQL密码, 必填
Dbname: # MySQL数据库名, 必填
Config: # Mysql配置默认值 charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai
MaxIdleConns: # 最大空闲连接数, 默认: 10
MaxOpenConns: # 最大打开连接数, 默认: 100
LogMode: # 日志级别, 默认: info, 可选: debug, error, warn, info
LogZap: # 是否使用zap日志记录sql, 默认: true
SlowThreshold: # 慢查询阈值,单位毫秒, 默认: 1000
Redis:
Host: # Redis地址, 默认:localhost:6379
Pass: # Redis密码, 默认: ""
DB: # Redis数据库, 默认: 0
Administer:
Email: # 后台登录邮箱, 默认: admin@ppanel.dev
Password: # 后台登录密码, 默认: password
# PPanel 配置文件
Host: "0.0.0.0" # 服务监听地址
Port: 8080 # 服务监听端口
Debug: false # 是否开启调试模式(禁用后台日志)
JwtAuth: # JWT 认证配置
AccessSecret: "" # 访问令牌密钥(为空时随机生成
AccessExpire: 604800 # 访问令牌过期时间(秒)
Logger: # 日志配置
ServiceName: "" # 日志服务标识名称
Mode: "console" # 日志输出模式(console、file、volume
Encoding: "json" # 日志格式(json、plain
TimeFormat: "2006-01-02T15:04:05.000Z07:00" # 自定义时间格式
Path: "logs" # 日志文件目录
Level: "info" # 日志级别(info、error、severe
Compress: false # 是否压缩日志文件
KeepDays: 7 # 日志保留天数
StackCooldownMillis: 100 # 堆栈日志冷却时间(毫秒)
MaxBackups: 3 # 最大日志备份数
MaxSize: 50 # 最大日志文件大小(MB
Rotation: "daily" # 日志轮转策略(daily、size
MySQL: # MySQL 数据库配置
Addr: "" # MySQL 地址(必填)
Username: "" # MySQL 用户名(必填)
Password: "" # MySQL 密码(必填)
Dbname: "" # MySQL 数据库名(必填)
Config: "charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai" # MySQL 连接参数
MaxIdleConns: 10 # 最大空闲连接数
MaxOpenConns: 100 # 最大打开连接数
LogMode: "info" # 日志级别(debug、error、warn、info
LogZap: true # 是否使用 Zap 记录 SQL 日志
SlowThreshold: 1000 # 慢查询阈值(毫秒)
Redis: # Redis 配置
Host: "localhost:6379" # Redis 地址
Pass: "" # Redis 密码
DB: 0 # Redis 数据库索引
Administer: # 管理员登录配置
Email: "admin@ppanel.dev" # 管理员登录邮箱
Password: "password" # 管理员登录密码
```
#### 3. 配置文件说明
## 3. 配置说明
- `Host`: 服务监听地址,默认: **0.0.0.0**
- `Port`: 服务监听端口,默认: **8080**
- `Debug`: 是否开启调试模式,开启后无法使用后台日志功能, 默认: **false**
- `JwtAuth`: JWT认证配置
- `AccessSecret`: 访问令牌密钥, 默认: **随机生成**
- `AccessExpire`: 访问令牌过期时间,单位秒, 默认: **604800**
- `Logger`: 日志配置
- `FilePath`: 日志文件路径, 默认: **./ppanel.log**
- `MaxSize`: 日志文件最大大小,单位MB, 默认: **50**
- `MaxBackup`: 日志文件最大备份数, 默认: **3**
- `MaxAge`: 日志文件最大保存时间,单位天, 默认: **30**
- `Compress`: 是否压缩日志文件, 默认: **true**
- `Level`: 日志级别, 默认: **info**, 可选: **debug, info, warn, error, panic, panic, fatal**
- `MySQL`: MySQL配置
- `Addr`: MySQL地址, 必填
- `Username`: MySQL用户名, 必填
- `Password`: MySQL密码, 必填
- `Dbname`: MySQL数据库名, 必填
- `Config`: Mysql配置默认值 charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai
- `MaxIdleConns`: 最大空闲连接数, 默认: **10**
- `MaxOpenConns`: 最大打开连接数, 默认: **100**
- `LogMode`: 日志级别, 默认: **info**, 可选: **debug, error, warn, info**
- `LogZap`: 是否使用zap日志记录sql, 默认: **true**
- `SlowThreshold`: 慢查询阈值,单位毫秒, 默认: **1000**
- `Redis`: Redis配置
- `Host`: Redis地址, 默认: **localhost:6379**
- `Pass`: Redis密码, 默认: **""**
- `DB`: Redis数据库, 默认: **0**
- `Administer`: 后台登录配置
- `Email`: 后台登录邮箱, 默认: **admin@ppanel.dev**
- `Password`: 后台登录密码, 默认: **password**
### 3.1 服务器设置
#### 4. 环境变量
- **`Host`**:服务监听的地址。
- 默认:`0.0.0.0`(监听所有网络接口)。
- **`Port`**:服务监听的端口。
- 默认:`8080`
- **`Debug`**:是否开启调试模式,开启后禁用后台日志功能。
- 默认:`false`
支持的环境变量如下:
### 3.2 JWT 认证 (`JwtAuth`)
| 环境变量 | 配置项 | 示例 |
|--------------|---------|:-------------------------------------------|
| PPANEL_DB | MySQL配置 | root:password@tcp(localhost:3306)/vpnboard |
| PPANEL_REDIS | Redis配置 | redis://localhost:6379" |
- **`AccessSecret`**:访问令牌的密钥。
- 默认:为空时随机生成。
- **`AccessExpire`**:令牌过期时间(秒)。
- 默认:`604800`7天)。
### 3.3 日志配置 (`Logger`)
- **`ServiceName`**:日志的服务标识名称,在 `volume` 模式下用作日志文件名。
- 默认:`""`
- **`Mode`**:日志输出方式。
- 选项:`console`(标准输出/错误输出)、`file`(写入指定目录)、`volume`Docker 卷)。
- 默认:`console`
- **`Encoding`**:日志格式。
- 选项:`json`(结构化 JSON)、`plain`(纯文本,带颜色)。
- 默认:`json`
- **`TimeFormat`**:日志时间格式。
- 默认:`2006-01-02T15:04:05.000Z07:00`
- **`Path`**:日志文件存储目录。
- 默认:`logs`
- **`Level`**:日志过滤级别。
- 选项:`info`(记录所有日志)、`error`(仅错误和严重日志)、`severe`(仅严重日志)。
- 默认:`info`
- **`Compress`**:是否压缩日志文件(仅在 `file` 模式下生效)。
- 默认:`false`
- **`KeepDays`**:日志文件保留天数。
- 默认:`7`
- **`StackCooldownMillis`**:堆栈日志冷却时间(毫秒),防止日志过多。
- 默认:`100`
- **`MaxBackups`**:最大日志备份数量(仅在 `size` 轮转时生效)。
- 默认:`3`
- **`MaxSize`**:日志文件最大大小(MB,仅在 `size` 轮转时生效)。
- 默认:`50`
- **`Rotation`**:日志轮转策略。
- 选项:`daily`(按天轮转)、`size`(按大小轮转)。
- 默认:`daily`
### 3.4 MySQL 数据库 (`MySQL`)
- **`Addr`**MySQL 服务器地址。
- 必填。
- **`Username`**MySQL 用户名。
- 必填。
- **`Password`**MySQL 密码。
- 必填。
- **`Dbname`**MySQL 数据库名。
- 必填。
- **`Config`**MySQL 连接参数。
- 默认:`charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai`
- **`MaxIdleConns`**:最大空闲连接数。
- 默认:`10`
- **`MaxOpenConns`**:最大打开连接数。
- 默认:`100`
- **`LogMode`**SQL 日志级别。
- 选项:`debug``error``warn``info`
- 默认:`info`
- **`LogZap`**:是否使用 Zap 记录 SQL 日志。
- 默认:`true`
- **`SlowThreshold`**:慢查询阈值(毫秒)。
- 默认:`1000`
### 3.5 Redis 配置 (`Redis`)
- **`Host`**Redis 服务器地址。
- 默认:`localhost:6379`
- **`Pass`**Redis 密码。
- 默认:`""`(无密码)。
- **`DB`**Redis 数据库索引。
- 默认:`0`
### 3.6 管理员登录 (`Administer`)
- **`Email`**:管理员登录邮箱。
- 默认:`admin@ppanel.dev`
- **`Password`**:管理员登录密码。
- 默认:`password`
## 4. 环境变量
以下环境变量可用于覆盖配置文件中的设置:
| 环境变量 | 配置项 | 示例值 |
|----------------|----------|----------------------------------------------|
| `PPANEL_DB` | MySQL 配置 | `root:password@tcp(localhost:3306)/vpnboard` |
| `PPANEL_REDIS` | Redis 配置 | `redis://localhost:6379` |
## 5. 最佳实践
- **安全性**:生产环境中避免使用默认的 `Administer` 凭据,更新 `Email``Password` 为安全值。
- **日志**:生产环境中建议使用 `file``volume` 模式持久化日志,将 `Level` 设置为 `error``severe` 以减少日志量。
- **数据库**:确保 `MySQL``Redis` 凭据安全,避免在版本控制中暴露。
- **JWT**:为 `JwtAuth``AccessSecret` 设置强密钥以增强安全性。
如需进一步帮助,请参考 PPanel 官方文档或联系支持团队。
+145 -97
View File
@@ -1,116 +1,164 @@
### Configuration File Instructions
#### Configuration File Path
# PPanel Configuration Guide
The default configuration file path is ./etc/ppanel.yaml. You can specify a custom path using the --config startup parameter.
This document provides a comprehensive guide to the configuration file for the PPanel application. The configuration
file is in YAML format and defines settings for the server, logging, database, Redis, and admin access.
#### Configuration File Format
## 1. Configuration File Overview
The configuration file uses the YAML format, supports comments, and should be named xxx.yaml.
- **Default Path**: `./etc/ppanel.yaml`
- **Custom Path**: Specify a custom path using the `--config` startup parameter.
- **Format**: YAML, supports comments, and must be named with a `.yaml` extension.
## 2. Configuration File Structure
Below is an example of the configuration file with default values and explanations:
```yaml
# Sample Configuration File
Host: # Service listening address, default: 0.0.0.0
Port: # Service listening port, default: 8080
Debug: # Enable debug mode; disables backend logging when enabled, default: false
JwtAuth: # JWT authentication settings
AccessSecret: # Access token secret, default: randomly generated
AccessExpire: # Access token expiration time in seconds, default: 604800
Logger: # Logging configuration
FilePath: # Log file path, default: ./ppanel.log
MaxSize: # Maximum log file size in MB, default: 50
MaxBackup: # Maximum number of log file backups, default: 3
MaxAge: # Maximum log file retention time in days, default: 30
Compress: # Whether to compress log files, default: true
Level: # Logging level, default: info; options: debug, info, warn, error, panic, fatal
MySQL:
Addr: # MySQL address, required
Username: # MySQL username, required
Password: # MySQL password, required
Dbname: # MySQL database name, required
Config: # MySQL configuration, default: charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai
MaxIdleConns: # Maximum idle connections, default: 10
MaxOpenConns: # Maximum open connections, default: 100
LogMode: # Log level, default: info; options: debug, error, warn, info
LogZap: # Whether to use zap for SQL logging, default: true
SlowThreshold: # Slow query threshold in milliseconds, default: 1000
Redis:
Host: # Redis address, default: localhost:6379
Pass: # Redis password, default: ""
DB: # Redis database, default: 0
Administer:
Email: # Admin login email, default: admin@ppanel.dev
Password: # Admin login password, default: password
# PPanel Configuration
Host: "0.0.0.0" # Server listening address
Port: 8080 # Server listening port
Debug: false # Enable debug mode (disables background logging)
JwtAuth: # JWT authentication settings
AccessSecret: "" # Access token secret (randomly generated if empty)
AccessExpire: 604800 # Access token expiration (seconds)
Logger: # Logging configuration
ServiceName: "" # Service name for log identification
Mode: "console" # Log output mode (console, file, volume)
Encoding: "json" # Log format (json, plain)
TimeFormat: "2006-01-02T15:04:05.000Z07:00" # Custom time format
Path: "logs" # Log file directory
Level: "info" # Log level (info, error, severe)
Compress: false # Enable log compression
KeepDays: 7 # Log retention period (days)
StackCooldownMillis: 100 # Stack trace cooldown (milliseconds)
MaxBackups: 3 # Maximum number of log backups
MaxSize: 50 # Maximum log file size (MB)
Rotation: "daily" # Log rotation strategy (daily, size)
MySQL: # MySQL database configuration
Addr: "" # MySQL address (required)
Username: "" # MySQL username (required)
Password: "" # MySQL password (required)
Dbname: "" # MySQL database name (required)
Config: "charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai" # MySQL connection parameters
MaxIdleConns: 10 # Maximum idle connections
MaxOpenConns: 100 # Maximum open connections
LogMode: "info" # Log level (debug, error, warn, info)
LogZap: true # Enable Zap logging for SQL
SlowThreshold: 1000 # Slow query threshold (milliseconds)
Redis: # Redis configuration
Host: "localhost:6379" # Redis address
Pass: "" # Redis password
DB: 0 # Redis database index
Administer: # Admin login configuration
Email: "admin@ppanel.dev" # Admin login email
Password: "password" # Admin login password
```
#### 3.Configuration Descriptions
## 3. Configuration Details
- Host: Service listening address, default: 0.0.0.0
### 3.1 Server Settings
- Port: Service listening port, default: 8080
- Debug: Enable debug mode; disables backend logging when enabled, default: false
- **`Host`**: Address the server listens on.
- Default: `0.0.0.0` (all network interfaces).
- **`Port`**: Port the server listens on.
- Default: `8080`.
- **`Debug`**: Enables debug mode, disabling background logging.
- Default: `false`.
- JwtAuth: JWT authentication settings
### 3.2 JWT Authentication (`JwtAuth`)
- AccessSecret: Access token secret, default: randomly generated
- AccessExpire: Access token expiration time in seconds, default: 604800
- Logger: Logging configuration
- FilePath: Log file path, default: ./ppanel.log
- MaxSize: Maximum log file size in MB, default: 50
- MaxBackup: Maximum number of log file backups, default: 3
- MaxAge: Maximum log file retention time in days, default: 30
- Compress: Whether to compress log files, default: true
- Level: Logging level, default: info; options: debug, info, warn, error, panic, fatal
- MySQL: MySQL configuration
- Addr: MySQL address, required
- Username: MySQL username, required
- **`AccessSecret`**: Secret key for access tokens.
- Default: Randomly generated if not specified.
- **`AccessExpire`**: Token expiration time in seconds.
- Default: `604800` (7 days).
- Password: MySQL password, required
### 3.3 Logging (`Logger`)
- Dbname: MySQL database name, required
- Config: MySQL configuration, default: charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai
- MaxIdleConns: Maximum idle connections, default: 10
- MaxOpenConns: Maximum open connections, default: 100
- LogMode: Log level, default: info; options: debug, error, warn, info
- LogZap: Whether to use zap for SQL logging, default: true
- SlowThreshold: Slow query threshold in milliseconds, default: 1000
- Redis: Redis configuration
- **`ServiceName`**: Identifier for logs, used as the log filename in `volume` mode.
- Default: `""`.
- **`Mode`**: Log output destination.
- Options: `console` (stdout/stderr), `file` (to a directory), `volume` (Docker volume).
- Default: `console`.
- **`Encoding`**: Log format.
- Options: `json` (structured JSON), `plain` (plain text with colors).
- Default: `json`.
- **`TimeFormat`**: Custom time format for logs.
- Default: `2006-01-02T15:04:05.000Z07:00`.
- **`Path`**: Directory for log files.
- Default: `logs`.
- **`Level`**: Log filtering level.
- Options: `info` (all logs), `error` (error and severe), `severe` (severe only).
- Default: `info`.
- **`Compress`**: Enable compression for log files (only in `file` mode).
- Default: `false`.
- **`KeepDays`**: Retention period for log files (in days).
- Default: `7`.
- **`StackCooldownMillis`**: Cooldown for stack trace logging to prevent log flooding.
- Default: `100`.
- **`MaxBackups`**: Maximum number of log backups (for `size` rotation).
- Default: `3`.
- **`MaxSize`**: Maximum log file size in MB (for `size` rotation).
- Default: `50`.
- **`Rotation`**: Log rotation strategy.
- Options: `daily` (rotate daily), `size` (rotate by size).
- Default: `daily`.
- Host: Redis address, default: localhost:6379
- Pass: Redis password, default: ""
- DB: Redis database, default: 0
- Administer: Admin login configuration
### 3.4 MySQL Database (`MySQL`)
- Email: Admin login email, default: admin@ppanel.dev
- **`Addr`**: MySQL server address.
- Required.
- **`Username`**: MySQL username.
- Required.
- **`Password`**: MySQL password.
- Required.
- **`Dbname`**: MySQL database name.
- Required.
- **`Config`**: MySQL connection parameters.
- Default: `charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai`.
- **`MaxIdleConns`**: Maximum idle connections.
- Default: `10`.
- **`MaxOpenConns`**: Maximum open connections.
- Default: `100`.
- **`LogMode`**: SQL logging level.
- Options: `debug`, `error`, `warn`, `info`.
- Default: `info`.
- **`LogZap`**: Enable Zap logging for SQL queries.
- Default: `true`.
- **`SlowThreshold`**: Threshold for slow query logging (in milliseconds).
- Default: `1000`.
- Password: Admin login password, default: password
### 3.5 Redis (`Redis`)
#### 4. Environment Variables
- **`Host`**: Redis server address.
- Default: `localhost:6379`.
- **`Pass`**: Redis password.
- Default: `""` (no password).
- **`DB`**: Redis database index.
- Default: `0`.
Supported environment variables are as follows:
### 3.6 Admin Login (`Administer`)
| Environment Variable | Configuration | Example |
|-----------------------|---------------|:-------------------------------------------|
| PPANEL_DB | MySQL config | root:password@tcp(localhost:3306)/vpnboard |
| PPANEL_REDIS | Redis config | redis://localhost:6379" |
- **`Email`**: Admin login email.
- Default: `admin@ppanel.dev`.
- **`Password`**: Admin login password.
- Default: `password`.
## 4. Environment Variables
The following environment variables can be used to override configuration settings:
| Environment Variable | Configuration Section | Example Value |
|----------------------|-----------------------|----------------------------------------------|
| `PPANEL_DB` | MySQL | `root:password@tcp(localhost:3306)/vpnboard` |
| `PPANEL_REDIS` | Redis | `redis://localhost:6379` |
## 5. Best Practices
- **Security**: Avoid using default `Administer` credentials in production. Update `Email` and `Password` to secure
values.
- **Logging**: Use `file` or `volume` mode for production to persist logs. Adjust `Level` to `error` or `severe` to
reduce log volume.
- **Database**: Ensure `MySQL` and `Redis` credentials are secure and not exposed in version control.
- **JWT**: Specify a strong `AccessSecret` for `JwtAuth` to enhance security.
For further assistance, refer to the official PPanel documentation or contact support.
Binary file not shown.

After

Width:  |  Height:  |  Size: 553 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 KiB

+2 -2
View File
@@ -6,14 +6,14 @@
#### 二进制安装
1.确定系统架构,并下载对应的二进制文件
下载地址:`https://github.com/perfect-panel/ppanel/releases`
下载地址:`https://github.com/perfect-panel/server/releases`
示例说明:系统:Linux amd64,用户:root,当前目录:/root
- 下载二进制文件
```shell
$ wget https://github.com/perfect-panel/ppanel/releases/download/v0.1.0/ppanel-server-linux-amd64.tar.gz
$ wget https://github.com/perfect-panel/server/releases/download/v1.0.0/ppanel-server-linux-amd64.tar.gz
```
- 解压二进制文件
+2 -2
View File
@@ -8,14 +8,14 @@
1. Determine your system architecture and download the corresponding binary file.
Download URL: `https://github.com/perfect-panel/ppanel/releases`
Download URL: `https://github.com/perfect-panel/server/releases`
Example setup: OS: Linux amd64, User: root, Current directory: `/root`
- Download the binary file:
```shell
$ wget https://github.com/perfect-panel/ppanel/releases/download/v0.1.0/ppanel-server-linux-amd64.tar.gz
$ wget https://github.com/perfect-panel/server/releases/download/v1.0.0/ppanel-server-linux-amd64.tar.gz
```
- Extract the binary file: