添加配置文件管理和完整文档系统
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

12
debian/p2pool.service vendored
View File

@@ -8,17 +8,7 @@ Type=simple
User=p2pool
Group=p2pool
WorkingDirectory=/var/lib/p2pool
ExecStart=/opt/p2pool/p2pool \
--host 127.0.0.1 \
--rpc-port 18081 \
--zmq-port 18083 \
--wallet YOUR_MONERO_WALLET_ADDRESS \
--merge-mine tari://TARI_NODE_IP:18102 TARI_WALLET_ADDRESS \
--p2p 0.0.0.0:37889 \
--data-api /var/lib/p2pool/data-api \
--local-api \
--log-file /var/log/p2pool/p2pool.log \
--loglevel 3
ExecStart=/opt/p2pool/p2pool --params-file /var/lib/p2pool/params.conf
Restart=on-failure
RestartSec=10s
StandardOutput=journal

57
debian/postinst vendored
View File

@@ -17,6 +17,44 @@ mkdir -p /var/lib/p2pool
chown p2pool:p2pool /var/lib/p2pool
chmod 750 /var/lib/p2pool
# Create example params.conf if it doesn't exist
if [ ! -f /var/lib/p2pool/params.conf ]; then
cat > /var/lib/p2pool/params.conf << 'EOF'
# P2Pool Configuration File
# Edit this file with your settings and restart the service
# Monero node connection
host = 127.0.0.1
rpc-port = 18081
zmq-port = 18083
# Your Monero wallet address (REQUIRED)
wallet = YOUR_MONERO_WALLET_ADDRESS
# P2P settings
p2p = 0.0.0.0:37889
# API settings
data-api = /var/lib/p2pool/data-api
local-api = true
# Logging
log-file = /var/log/p2pool/p2pool.log
loglevel = 3
# Mining mode (uncomment to enable mini sidechain)
# mini = true
# Merge mining (optional - uncomment to enable Tari merge mining)
# merge-mine = tari://TARI_NODE_IP:18102 TARI_WALLET_ADDRESS
# Stratum server (for miners to connect)
# stratum = 0.0.0.0:3333
EOF
chown p2pool:p2pool /var/lib/p2pool/params.conf
chmod 640 /var/lib/p2pool/params.conf
fi
# Create log directory
mkdir -p /var/log/p2pool
chown p2pool:p2pool /var/log/p2pool
@@ -34,13 +72,12 @@ fi
echo ""
echo "✅ P2Pool installed successfully!"
echo ""
echo "📋 Before starting P2Pool, you MUST:"
echo "📋 Before starting P2Pool, you MUST configure your settings:"
echo ""
echo "1. Edit the systemd service file to set your Monero wallet address:"
echo " sudo systemctl edit --full p2pool.service"
echo "1. Edit the configuration file:"
echo " sudo nano /var/lib/p2pool/params.conf"
echo ""
echo " Replace 'YOUR_MONERO_WALLET_ADDRESS' with your actual Monero wallet address"
echo " and configure --host and --rpc-port to point to your Monero node"
echo " Set your Monero wallet address and adjust other settings as needed."
echo ""
echo "2. Start P2Pool:"
echo " sudo systemctl enable p2pool.service"
@@ -50,9 +87,13 @@ echo "3. Check status:"
echo " sudo systemctl status p2pool.service"
echo " sudo journalctl -u p2pool -f"
echo ""
echo "Data directory: /var/lib/p2pool"
echo "Log directory: /var/log/p2pool"
echo "Binary: /opt/p2pool/p2pool"
echo "📁 Important paths:"
echo " Config file: /var/lib/p2pool/params.conf"
echo " Data directory: /var/lib/p2pool"
echo " Log directory: /var/log/p2pool"
echo " Binary: /opt/p2pool/p2pool"
echo ""
echo "💡 Tip: Your params.conf will NOT be overwritten during package upgrades."
echo ""
echo "For help:"
echo " /opt/p2pool/p2pool --help"