添加配置文件管理和完整文档系统
All checks were successful
Build and Release / build-and-test (arm64, alpine) (push) Successful in 30s
Build and Release / build-and-test (amd64, alpine) (push) Successful in 42s
Build and Release / build-and-test (arm64, ubuntu) (push) Successful in 41s
Build and Release / build-and-test (amd64, ubuntu) (push) Successful in 54s
Build and Release / release (push) Has been skipped

- 重构配置方式:使用 params.conf 替代命令行参数
- postinst 自动创建配置文件,升级时保护用户配置
- 初始化 llmdoc 文档系统(概述、架构、指南、参考)
- 创建 README.md 和配置指南
- 提供完整的配置模板示例

配置文件优势:升级安全、集中管理、易于维护
This commit is contained in:
2025-12-19 09:20:33 +08:00
parent 1bafc36670
commit 9ff0daa938
14 changed files with 1083 additions and 19 deletions

113
README-params.md Normal file
View File

@@ -0,0 +1,113 @@
# P2Pool Configuration File Guide
## Overview
P2Pool uses a configuration file (`params.conf`) to manage all runtime settings. This approach provides several advantages over command-line parameters:
- **Upgrade Safety**: Configuration is preserved during package upgrades
- **Centralized Management**: All settings in one location
- **Documentation**: In-file comments explain each option
- **Maintainability**: Easy to review and modify settings
## Configuration File Locations
### Debian Package Installation
```
/var/lib/p2pool/params.conf
```
### Manual Installation
```
./params.conf (in the working directory)
```
## Basic Configuration Example
```conf
# Minimum required configuration
host = 127.0.0.1
rpc-port = 18081
zmq-port = 18083
wallet = 4xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```
## Advanced Configuration
See [params.conf.example](params.conf.example) for a comprehensive configuration template with all available options.
## Configuration Best Practices
1. **Always backup** your `params.conf` before making changes
2. **Test changes** by running P2Pool manually before updating the systemd service
3. **Use comments** to document your customizations
4. **Keep sensitive data secure**: The config file contains your wallet address
## Switching from Command-Line to Configuration File
If you're currently using command-line parameters, you can convert them to a configuration file:
```bash
# Old way (command-line)
p2pool --host 127.0.0.1 --rpc-port 18081 --wallet YOUR_WALLET
# New way (configuration file)
p2pool --params-file params.conf
```
## Testing Your Configuration
```bash
# Test configuration before starting the service
sudo -u p2pool /opt/p2pool/p2pool --params-file /var/lib/p2pool/params.conf
# If everything looks good, start the service
sudo systemctl start p2pool.service
```
## Troubleshooting
### Configuration Not Loading
1. Check file permissions:
```bash
ls -l /var/lib/p2pool/params.conf
# Should be readable by p2pool user
```
2. Verify file syntax:
```bash
# No equal signs in comments
# Use "key = value" format
# One setting per line
```
3. Check systemd service logs:
```bash
sudo journalctl -u p2pool -n 50
```
### Common Mistakes
- ❌ Missing wallet address
- ❌ Incorrect Monero node connection settings
- ❌ Syntax errors (missing `=`, extra spaces)
- ❌ Commented-out required settings
## Migration from Older Versions
If you're upgrading from a version that used systemd service file configuration:
1. Copy your settings from the old service file
2. Convert them to `params.conf` format
3. Update the service file to use `--params-file`
4. Restart the service
Example migration:
```bash
# Old (in systemd service)
ExecStart=/opt/p2pool/p2pool --host 127.0.0.1 --wallet XXXXX
# New (in params.conf)
host = 127.0.0.1
wallet = XXXXX
```