7 Commits

Author SHA1 Message Date
wangdefa b222b802bf feat: 更新版本号至 v4.15.1,调整相关文档和构建脚本示例
Build and Release / build-and-test (arm64, alpine) (push) Successful in -56s
Build and Release / build-and-test (amd64, alpine) (push) Successful in -2m41s
Build and Release / build-and-test (arm64, ubuntu) (push) Successful in -38s
Build and Release / build-and-test (amd64, ubuntu) (push) Successful in -2m30s
Build and Release / release (push) Successful in -2m2s
2026-05-11 18:22:10 +08:00
wangdefa 2599d203bb feat: 更新版本号至 v4.15,调整相关文档和示例配置
Build and Release / build-and-test (arm64, alpine) (push) Successful in -52s
Build and Release / build-and-test (amd64, alpine) (push) Successful in -2m30s
Build and Release / build-and-test (amd64, ubuntu) (push) Successful in -1m46s
Build and Release / build-and-test (arm64, ubuntu) (push) Successful in 43s
Build and Release / release (push) Successful in -1m47s
2026-05-01 21:15:40 +08:00
wangdefa e4f8a390bb feat: 更新版本号至 v4.14,调整相关文档和配置示例
Build and Release / build-and-test (amd64, alpine) (push) Successful in 8m40s
Build and Release / build-and-test (amd64, ubuntu) (push) Successful in -1m7s
Build and Release / build-and-test (arm64, alpine) (push) Successful in 5m48s
Build and Release / build-and-test (arm64, ubuntu) (push) Successful in -11s
Build and Release / release (push) Successful in -36s
2026-03-02 09:56:13 +08:00
wangdefa 676984ba8e feat: 更新 .gitignore 文件
Build and Release / build-and-test (arm64, alpine) (push) Successful in 6s
Build and Release / build-and-test (amd64, alpine) (push) Successful in -39s
Build and Release / build-and-test (arm64, ubuntu) (push) Successful in 17s
Build and Release / build-and-test (amd64, ubuntu) (push) Successful in -19s
Build and Release / release (push) Has been skipped
2026-01-24 09:16:38 +08:00
wangdefa 961b2d3702 chore: 删除过时的文档文件以清理项目结构 2026-01-24 09:15:25 +08:00
wangdefa 8f7cca95fe feat: 添加内存锁定资源限制以支持 RandomX 大页内存优化
Build and Release / build-and-test (arm64, alpine) (push) Successful in 9s
Build and Release / build-and-test (amd64, alpine) (push) Successful in -38s
Build and Release / build-and-test (arm64, ubuntu) (push) Successful in 18s
Build and Release / build-and-test (amd64, ubuntu) (push) Successful in -24s
Build and Release / release (push) Has been skipped
2026-01-23 11:36:52 +08:00
wangdefa 8f0463687e fix: 修复 apt 升级后服务需要手动重新启用的问题
- 修改 prerm 脚本,升级时只停止服务不禁用
- 修改 postinst 脚本,升级后自动重启已启用的服务
- 首次安装仍保持手动启用服务的行为
2026-01-23 11:35:32 +08:00
19 changed files with 132 additions and 838 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ on:
env: env:
DOCKER_BUILDKIT: "1" DOCKER_BUILDKIT: "1"
PRODUCT_NAME: "p2pool" PRODUCT_NAME: "p2pool"
PACKAGE_VERSION: "v4.13" PACKAGE_VERSION: "v4.15.1"
BUILDX_NO_DEFAULT_ATTESTATIONS: "1" BUILDX_NO_DEFAULT_ATTESTATIONS: "1"
jobs: jobs:
+6 -1
View File
@@ -1,6 +1,11 @@
.DS_Store
.idea/ .idea/
.vscode/ .vscode/
.claude/ .claude/
CLAUDE.md .codex/
docs/ docs/
example/ example/
CLAUDE.md
-113
View File
@@ -1,113 +0,0 @@
# 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
```
+2 -32
View File
@@ -42,36 +42,24 @@ sudo nano /var/lib/p2pool/params.conf
sudo systemctl enable --now p2pool.service sudo systemctl enable --now p2pool.service
``` ```
详细配置说明请查看:[README-params.md](README-params.md)
### 本地构建 ### 本地构建
```bash ```bash
# Alpine 构建(推荐,体积更小) # Alpine 构建(推荐,体积更小)
docker buildx build --pull \ docker buildx build --pull \
--platform linux/amd64 \ --platform linux/amd64 \
--build-arg P2POOL_VERSION=v4.13 \ --build-arg P2POOL_VERSION=v4.15.1 \
--output type=local,dest=./output \ --output type=local,dest=./output \
-f docker/Dockerfile.alpine . -f docker/Dockerfile.alpine .
# Ubuntu 构建 # Ubuntu 构建
docker buildx build --pull \ docker buildx build --pull \
--platform linux/amd64 \ --platform linux/amd64 \
--build-arg P2POOL_VERSION=v4.13 \ --build-arg P2POOL_VERSION=v4.15.1 \
--output type=local,dest=./output \ --output type=local,dest=./output \
-f docker/Dockerfile.ubuntu . -f docker/Dockerfile.ubuntu .
``` ```
## 📚 文档
完整的项目文档位于 [llmdoc/](llmdoc/) 目录:
- **[项目概述](llmdoc/overview/project-overview.md)** - 了解项目目的和架构
- **[CI/CD 架构](llmdoc/architecture/cicd-architecture.md)** - 自动化构建流程
- **[Docker 架构](llmdoc/architecture/docker-architecture.md)** - 多阶段构建系统
- **[本地构建指南](llmdoc/guides/local-build.md)** - 开发者构建指南
- **[Debian 包指南](llmdoc/guides/debian-package.md)** - 安装和配置
## 🏗️ 构建系统 ## 🏗️ 构建系统
### 支持的架构和平台 ### 支持的架构和平台
@@ -88,25 +76,8 @@ docker buildx build --pull \
## 🔧 配置管理 ## 🔧 配置管理
本项目使用配置文件管理 P2Pool 设置,提供以下优势:
-**升级安全** - 配置文件在包升级时不会被覆盖
-**集中管理** - 所有设置在一个位置
-**易于维护** - 支持注释和版本控制
配置文件模板:[params.conf.example](params.conf.example) 配置文件模板:[params.conf.example](params.conf.example)
## 📦 发布流程
项目使用 Gitea Actions 实现自动化 CI/CD
1. **代码推送** → 触发构建(main/develop 分支)
2. **创建标签** → 触发完整发布流程
3. **自动构建** → 4 种组合(2 架构 × 2 发行版)
4. **自动发布** → 上传到包注册中心
5. **创建 Release** → 附带下载链接和说明
## 🔐 安全性 ## 🔐 安全性
- ✅ 禁用上游合并挖矿捐赠 - ✅ 禁用上游合并挖矿捐赠
@@ -125,7 +96,6 @@ docker buildx build --pull \
- **上游项目**: [SChernykh/p2pool](https://github.com/SChernykh/p2pool) - **上游项目**: [SChernykh/p2pool](https://github.com/SChernykh/p2pool)
- **Monero**: [getmonero.org](https://www.getmonero.org/) - **Monero**: [getmonero.org](https://www.getmonero.org/)
- **项目文档**: [llmdoc/index.md](llmdoc/index.md)
--- ---
+1 -1
View File
@@ -4,7 +4,7 @@ set -e
# 参数检查 # 参数检查
if [ $# -ne 3 ]; then if [ $# -ne 3 ]; then
echo "Usage: $0 <ARCH> <VERSION> <TARGZ_FILE>" echo "Usage: $0 <ARCH> <VERSION> <TARGZ_FILE>"
echo "Example: $0 amd64 v4.12 p2pool-amd64-ubuntu-v4.12.tar.gz" echo "Example: $0 amd64 v4.15.1 p2pool-amd64-ubuntu-v4.15.1.tar.gz"
exit 1 exit 1
fi fi
+4
View File
@@ -15,6 +15,10 @@ StandardOutput=journal
StandardError=journal StandardError=journal
SyslogIdentifier=p2pool SyslogIdentifier=p2pool
# Resource limits
LimitMEMLOCK=infinity
AmbientCapabilities=CAP_IPC_LOCK
# Security hardening # Security hardening
NoNewPrivileges=true NoNewPrivileges=true
PrivateTmp=true PrivateTmp=true
+26 -7
View File
@@ -13,13 +13,13 @@ if ! getent passwd p2pool >/dev/null; then
fi fi
# Create data directory # Create data directory
mkdir -p /var/lib/p2pool mkdir -p /var/lib/p2pool/data-api
chown p2pool:p2pool /var/lib/p2pool chown -R p2pool:p2pool /var/lib/p2pool
chmod 750 /var/lib/p2pool chmod -R 750 /var/lib/p2pool
# Create example params.conf if it doesn't exist # Create example params.conf if it doesn't exist
if [ ! -f /var/lib/p2pool/params.conf ]; then if [ ! -f /var/lib/p2pool/params.conf ]; then
cat > /var/lib/p2pool/params.conf << 'EOF' cat > /var/lib/p2pool/params.conf << 'CONF'
# P2Pool Configuration File # P2Pool Configuration File
# Edit this file with your settings and restart the service # Edit this file with your settings and restart the service
@@ -28,6 +28,12 @@ host = 127.0.0.1
rpc-port = 18081 rpc-port = 18081
zmq-port = 18083 zmq-port = 18083
# Use SSL for RPC connection
# rpc-ssl = true
# RPC credentials (if applicable)
# rpc-login = username:password
# Your Monero wallet address (REQUIRED) # Your Monero wallet address (REQUIRED)
wallet = YOUR_MONERO_WALLET_ADDRESS wallet = YOUR_MONERO_WALLET_ADDRESS
@@ -46,11 +52,11 @@ loglevel = 3
# mini = true # mini = true
# Merge mining (optional - uncomment to enable Tari merge mining) # Merge mining (optional - uncomment to enable Tari merge mining)
# merge-mine = tari://TARI_NODE_IP:18102 TARI_WALLET_ADDRESS # merge-mine = tari://TARI_NODE_IP:18142 TARI_WALLET_ADDRESS
# Stratum server (for miners to connect) # Stratum server (for miners to connect)
# stratum = 0.0.0.0:3333 # stratum = 0.0.0.0:3333
EOF CONF
chown p2pool:p2pool /var/lib/p2pool/params.conf chown p2pool:p2pool /var/lib/p2pool/params.conf
chmod 640 /var/lib/p2pool/params.conf chmod 640 /var/lib/p2pool/params.conf
fi fi
@@ -64,9 +70,22 @@ chmod 750 /var/log/p2pool
chown root:root /opt/p2pool/p2pool chown root:root /opt/p2pool/p2pool
chmod 755 /opt/p2pool/p2pool chmod 755 /opt/p2pool/p2pool
# Reload systemd # Reload systemd and handle service restart on upgrade
if [ -d /run/systemd/system ]; then if [ -d /run/systemd/system ]; then
systemctl daemon-reload systemctl daemon-reload
# On upgrade: restart service if it was enabled
if [ "$1" = "configure" ] && [ -n "$2" ]; then
# $2 is the previously installed version (only set on upgrade)
if systemctl is-enabled --quiet p2pool.service 2>/dev/null; then
echo "Restarting p2pool service after upgrade..."
systemctl start p2pool.service || true
fi
fi
# Note: On fresh install, service is NOT auto-enabled or auto-started
# Users should manually enable the service:
# systemctl enable p2pool.service
# systemctl start p2pool.service
fi fi
echo "" echo ""
+32 -16
View File
@@ -1,17 +1,33 @@
#!/bin/sh case "$1" in
set -e upgrade)
# Stop service only during upgrade, keep enabled state
if [ -d /run/systemd/system ]; then
if systemctl is-active --quiet p2pool.service; then
echo "Stopping p2pool service for upgrade..."
systemctl stop p2pool.service
fi
fi
;;
remove|deconfigure)
# Stop and disable service during removal
if [ -d /run/systemd/system ]; then
if systemctl is-active --quiet p2pool.service; then
echo "Stopping p2pool service..."
systemctl stop p2pool.service
fi
if systemctl is-enabled --quiet p2pool.service 2>/dev/null; then
echo "Disabling p2pool service..."
systemctl disable p2pool.service
fi
fi
;;
failed-upgrade)
# Do nothing on failed upgrade
;;
*)
echo "prerm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# Stop and disable service if running exit 0
if [ -d /run/systemd/system ]; then
if systemctl is-active --quiet p2pool.service; then
echo "Stopping p2pool service..."
systemctl stop p2pool.service
fi
if systemctl is-enabled --quiet p2pool.service 2>/dev/null; then
echo "Disabling p2pool service..."
systemctl disable p2pool.service
fi
fi
exit 0
-83
View File
@@ -1,83 +0,0 @@
# CI/CD 架构
## 流水线概述
P2Pool 构建系统使用 Gitea Actions 实现自动化构建、测试和发布流程。
## 构建矩阵
### 架构支持
- amd64
- arm64
### 发行版本
- Ubuntu
- Alpine Linux
### 构建组合
- 总计 4 种构建变体:
1. amd64 + Ubuntu
2. amd64 + Alpine
3. arm64 + Ubuntu
4. arm64 + Alpine
## 流水线触发条件
### 自动触发
- 推送到 `main``develop` 分支
- 创建 Git 标签(发布版本)
## 流水线阶段
### 构建与测试阶段
```yaml
jobs:
build-and-test:
strategy:
matrix:
arch: [amd64, arm64]
distro: [ubuntu, alpine]
# 使用原生架构的 runner
runs-on: >-
${{
matrix.arch == 'amd64' && 'ubuntu-latest-amd64' ||
'ubuntu-latest-arm64'
}}
```
### 关键步骤
1. 设置 Docker Buildx
2. 构建二进制文件
3. 打包为 tar.gz
4. 对于 Ubuntu:创建 Debian 包
5. 上传构建产物
### 发布阶段
- 下载所有构建产物
- 上传到 Gitea 通用包仓库
- 上传 Debian 包
- 创建发布版本
- 附加下载链接
## 性能特点
### 原生架构构建
- 比 QEMU 跨架构编译快 3-10 倍
- 构建稳定性高
- 需要专用的 amd64 和 arm64 runner
### 编译并行度
- amd64:使用一半 CPU 核心
- arm64:使用全部 CPU 核心
- 跨架构编译:限制为 2 个并行作业
## 关键配置文件
- [.gitea/workflows/ci.yaml](../../.gitea/workflows/ci.yaml):主要 CI/CD 配置
## 安全与性能平衡
- 限制并行编译作业数
- 使用原生架构 runner
- 避免使用 QEMU 虚拟化
-45
View File
@@ -1,45 +0,0 @@
# Debian 打包架构
## 1. 身份
- **目的**:为 p2pool 构建跨架构的 Debian 软件包
- **关键功能**:多架构支持、自动化构建和发布
## 2. 核心组件
关键文件:
- `.gitea/workflows/ci.yaml`CI/CD 流程
- `debian/build-deb.sh`Debian 打包脚本
- `debian/control`:软件包元数据
- `debian/postinst`:安装后脚本
- `debian/postrm`:卸载后脚本
## 3. 构建流程
1. **架构选择**
- `amd64`: 64位 x86 架构
- `arm64`: ARM 64位架构
2. **发行版目标**
- `stable`:统一的稳定发行版仓库
3. **Package Registry**
- Generic Package Registry:存储 `.tar.gz`
- Debian Package Registry:存储 `.deb`
## 4. 配置管理
- 配置文件:`/var/lib/p2pool/params.conf`
- 安全原则:
- 配置与二进制包分离
- 升级时保留用户配置
- 最小权限原则
## 5. 发布策略
- 自动化版本发布
- 标签触发(`refs/tags/*`
- 多渠道发布:
1. Generic Package Registry
2. Debian Package Registry
3. GitHub/Gitea Releases
@@ -1,93 +0,0 @@
# Docker 构建架构
## 多阶段构建策略
P2Pool 的 Docker 构建使用多阶段构建,确保最终镜像轻量且安全。
### 构建阶段概览
```
┌─────────────────────────────────────────────────┐
│ 阶段 1:基础镜像 (Alpine 3.21 / Ubuntu 24.04) │
│ - 安装构建依赖: │
│ git, cmake, gcc, g++, make │
│ libuv-dev, libzmq-dev, libcurl-dev │
└─────────────────┬───────────────────────────────┘
┌─────────────────▼───────────────────────────────┐
│ 阶段 2:构建 │
│ 1. 从 GitHub 克隆 p2pool(使用 --recursive
│ 2. 检出指定的 P2POOL_VERSION 标签 │
│ 3. CMake 配置: │
│ - 发布构建 │
│ - 禁用合并挖矿捐赠 │
│ 4. 使用 make 编译: │
│ - 交叉编译:-j2 │
│ - amd64-j$(nproc / 2) │
│ - arm64-j$(nproc) │
└─────────────────┬───────────────────────────────┘
┌─────────────────▼───────────────────────────────┐
│ 阶段 3:提取 (scratch 镜像) │
│ - 将二进制文件复制到 /linux_${TARGETARCH}/ │
│ - 启用 Docker buildx 本地文件提取 │
└──────────────────────────────────────────────────┘
```
## 关键构建参数
### 版本控制
- `P2POOL_VERSION`:指定上游 p2pool 版本
- 使用 `--build-arg` 传递版本
### 编译配置
- `-DWITH_MERGE_MINING_DONATION=OFF`:禁用合并挖矿捐赠
- 不同架构的编译并行度控制
## 镜像变体
### Alpine 镜像 (推荐)
- 基于 Alpine Linux
- 镜像体积小
- 安全性高
- 文件:`docker/Dockerfile.alpine`
### Ubuntu 镜像
- 基于 Ubuntu LTS
- 更广泛的系统兼容性
- 文件:`docker/Dockerfile.ubuntu`
## 构建命令示例
```bash
# Alpine 构建(推荐)
docker buildx build --pull \
--platform linux/amd64 \
--build-arg P2POOL_VERSION=v4.9.1 \
--output type=local,dest=./output \
-f docker/Dockerfile.alpine .
# 多架构构建
docker buildx build --pull \
--platform linux/amd64,linux/arm64 \
--build-arg P2POOL_VERSION=v4.9.1 \
--output type=local,dest=./output \
-f docker/Dockerfile.alpine .
```
## 性能优化策略
### 并行度控制
- amd64`$(nproc) / 2`(减少资源竞争)
- arm64`$(nproc)`(充分利用资源)
### 缓存优化
- 使用多阶段构建减少最终镜像大小
- 利用 Docker 构建缓存
## 注意事项
- 需要 Docker Buildx 支持
- 构建需要互联网连接
- 克隆上游仓库需要 `--recursive` 参数
- 编译过程禁用合并挖矿捐赠功能
-135
View File
@@ -1,135 +0,0 @@
# Debian 包安装与配置指南
## 安装步骤
### 添加 Gitea 包仓库
```bash
# 导入 Gitea 仓库密钥
sudo curl https://GITEA_URL/api/packages/OWNER/debian/repository.key \
-o /etc/apt/keyrings/gitea-OWNER.asc
# 添加仓库源(以 Debian 12 为例)
echo "deb [signed-by=/etc/apt/keyrings/gitea-OWNER.asc] \
https://GITEA_URL/api/packages/OWNER/debian stable main" | \
sudo tee /etc/apt/sources.list.d/OWNER.list
# 更新包列表并安装
sudo apt-get update
sudo apt-get install p2pool
```
## 配置 P2Pool
### 编辑配置文件
P2Pool 使用配置文件 `/var/lib/p2pool/params.conf` 来管理所有设置。安装后会自动创建示例配置文件。
```bash
# 编辑配置文件
sudo nano /var/lib/p2pool/params.conf
```
配置文件示例:
```conf
# P2Pool Configuration File
# 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
# Stratum server (for miners to connect)
# stratum = 0.0.0.0:3333
```
### 关键配置参数
- `host`Monero 节点的 IP 地址
- `rpc-port`Monero 节点的 RPC 端口
- `zmq-port`Monero 节点的 ZMQ 端口
- `wallet`**必需** - 您的 Monero 钱包地址
- `mini`:启用 mini 侧链(适合算力较小的矿工)
- `stratum`:Stratum 服务器地址,供矿机连接
- `loglevel`:日志级别(0-63 为默认值)
### 配置文件的优势
-**版本升级安全**`params.conf``apt upgrade` 时不会被覆盖
-**易于管理**:所有配置集中在一个文件中
-**支持注释**:可以添加说明和注释
-**无需修改 systemd**:避免编辑系统服务文件
## 启动和管理服务
```bash
# 启用服务,设置开机自启
sudo systemctl enable p2pool.service
# 启动服务
sudo systemctl start p2pool.service
# 查看服务状态
sudo systemctl status p2pool.service
# 查看实时日志
sudo journalctl -u p2pool -f
```
## 目录结构
- `/opt/p2pool/p2pool`P2Pool 二进制文件
- `/var/lib/p2pool/`:数据目录
- `/var/log/p2pool/`:日志目录
## 安全建议
- 使用专用钱包地址
- 限制 Stratum 端口的网络访问
- 定期更新 p2pool 版本
## 故障排查
### 常见错误
- RPC 端口配置不正确
- 钱包地址无效
- 网络连接问题
### 检查日志
```bash
# 查看完整日志
sudo cat /var/log/p2pool/p2pool.log
# 查看最近错误
sudo journalctl -u p2pool -n 50 --no-pager
```
## 版本管理
```bash
# 查看当前版本
/opt/p2pool/p2pool --version
# 检查可用更新
sudo apt-get update
sudo apt-cache policy p2pool
```
-88
View File
@@ -1,88 +0,0 @@
# 本地构建指南
## 准备工作
### 系统依赖
- Docker
- Docker Buildx
- Git
### 安装 Docker Buildx
```bash
# 启用 QEMU(支持多平台构建)
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
# 创建 buildx builder
docker buildx create --use --name p2pool_builder --driver docker-container
docker buildx inspect --bootstrap
```
## 构建二进制包
### Alpine 构建(推荐)
```bash
# 构建单一架构
docker buildx build --pull \
--platform linux/amd64 \
--build-arg P2POOL_VERSION=v4.9.1 \
--output type=local,dest=./output \
-f docker/Dockerfile.alpine .
# 多架构构建
docker buildx build --pull \
--platform linux/amd64,linux/arm64 \
--build-arg P2POOL_VERSION=v4.9.1 \
--output type=local,dest=./output \
-f docker/Dockerfile.alpine .
```
### Ubuntu 构建
```bash
docker buildx build --pull \
--platform linux/amd64 \
--build-arg P2POOL_VERSION=v4.9.1 \
--output type=local,dest=./output \
-f docker/Dockerfile.ubuntu .
```
## 构建 Debian 包
```bash
# 打包二进制文件
TARGZ="p2pool-amd64-ubuntu-v4.12.tar.gz"
tar -czf "${TARGZ}" -C ./output/linux_amd64 .
# 生成 Debian 包
./debian/build-deb.sh amd64 v4.12 "${TARGZ}"
```
## 常见问题排查
### 调整编译并行度
修改 Dockerfile 中的 `MAKE_JOBS` 变量:
```dockerfile
# 使用全部 CPU 核心(amd64
elif [ "$TARGETARCH" = "amd64" ]; then \
MAKE_JOBS="-j$(nproc)";
# 或使用固定作业数
elif [ "$TARGETARCH" = "amd64" ]; then \
MAKE_JOBS="-j4";
```
### 网络和依赖问题
- 确保 Docker 可以访问互联网
- 检查 Git 子模块是否正确初始化
- 验证 CMake 和编译器版本兼容性
## 性能提示
- 使用 SSD 提高构建速度
- 保持 Docker 镜像和依赖更新
- 对于大型项目,考虑使用构建缓存
-13
View File
@@ -1,13 +0,0 @@
# p2pool 文档系统
## 概述 (Overview)
- [CI 工作流程](/llmdoc/overview/ci-workflow.md)
## 指南 (Guides)
- [Debian 包安装](/llmdoc/guides/debian-package.md)
## 架构 (Architecture)
- [Debian 打包架构](/llmdoc/architecture/debian-packaging.md)
## 参考 (Reference)
(暂无)
-24
View File
@@ -1,24 +0,0 @@
# CI 工作流程概述
## 1. 身份
- **目的**:自动化构建、测试和发布 p2pool 软件包
- **关键功能**:支持多架构、多发行版的软件包构建和发布
## 2. 高层描述
CI 工作流程通过 Gitea 工作流实现自动化构建和发布:
- 支持架构:`amd64``arm64`
- 支持发行版:`ubuntu``alpine`
- 发布目标:
1. Generic Package Registry
2. Debian Package Registry (stable)
3. GitHub/Gitea Releases
## 3. 关键文件
- `.gitea/workflows/ci.yaml`:主要工作流配置
- `debian/build-deb.sh`Debian 打包脚本
- `docker/Dockerfile.ubuntu`Ubuntu 构建镜像
- `docker/Dockerfile.alpine`Alpine 构建镜像
-45
View File
@@ -1,45 +0,0 @@
# 项目概述:P2Pool Docker 构建基础设施
## 项目背景
P2Pool 是一个去中心化的 Monero 矿池,本项目旨在提供一个标准化、可靠的构建和打包基础设施。
## 主要目标
1. 自动化构建 p2pool 二进制包
2. 支持多架构(amd64, arm64
3. 生成 Debian 和通用包
4. 禁用合并挖矿捐赠功能
## 构建输出
- **二进制包**
- amd64 架构
- arm64 架构
- **包格式**
- tar.gz 压缩包
- Debian 包(.deb
- **构建基础镜像**
- Alpine Linux (推荐)
- Ubuntu LTS
## 关键特性
- 使用 Docker 多阶段构建
- 通过 Gitea Actions 自动化 CI/CD
- 支持版本化构建
- 原生架构构建,性能优化
- 自动包发布到 Gitea 包仓库
## 版本管理
- 直接从 [SChernykh/p2pool](https://github.com/SChernykh/p2pool) 上游仓库构建
- 通过 `P2POOL_VERSION` 环境变量控制构建版本
- 使用 Git 标签管理版本发布
## 使用限制
- 不包含 p2pool 源代码
- 构建时需要互联网连接
- 依赖 Docker Buildx
- 需要配置钱包地址才能运行服务
-59
View File
@@ -1,59 +0,0 @@
# 编码规范
## Shell 脚本规范
### 基本原则
- 使用 `#!/bin/sh` 作为脚本头
- 遵循 POSIX shell 标准
- 避免使用 Bash 特定语法
### 缩进与格式
- 使用 4 个空格缩进
- 每个代码块使用一致的缩进
- 长行使用 `\` 换行
### 变量使用
- 使用双引号包裹变量:`"$VARIABLE"`
- 避免未定义变量
- 使用 `${VARIABLE:-default}` 设置默认值
### 示例
```sh
#!/bin/sh
set -eu
# 变量定义
P2POOL_VERSION="${1:-v4.9.1}"
OUTPUT_DIR="${2:-./output}"
# 函数定义
build_p2pool() {
local arch="$1"
local distro="$2"
docker buildx build --pull \
--platform "linux/${arch}" \
--build-arg "P2POOL_VERSION=${P2POOL_VERSION}" \
--output "type=local,dest=${OUTPUT_DIR}" \
-f "docker/Dockerfile.${distro}" .
}
# 主逻辑
main() {
build_p2pool "amd64" "alpine"
}
main "$@"
```
## Docker 文件规范
- 遵循多阶段构建
- 尽量减少镜像层数
- 使用多架构构建
- 避免在构建过程中下载可变内容
## Git 提交规范
- 使用清晰、简洁的提交信息
- 提交信息应描述**为什么**做这个改动
- 使用动词开头:添加(Add)、修复(Fix)、优化(Improve)等
-79
View File
@@ -1,79 +0,0 @@
# Git 协作规范
## 分支管理
### 主分支
- `main`: 稳定版本
- `develop`: 开发分支
### 开发流程
1.`develop` 创建功能分支
2. 功能分支命名规范:
- `feature/` 前缀表示新功能
- `bugfix/` 前缀表示 bug 修复
- `docs/` 前缀表示文档更新
### 示例分支创建
```bash
# 从 develop 创建功能分支
git checkout develop
git pull origin develop
git checkout -b feature/add-architecture-docs
```
## 提交规范
### 提交信息格式
```
<类型>: <简要描述>
[可选的详细说明]
[关联的 issue 或 PR]
```
### 类型定义
- `feat`: 新功能
- `fix`: 修复 bug
- `docs`: 文档更新
- `style`: 代码风格调整
- `refactor`: 重构
- `test`: 测试相关
- `build`: 构建系统或外部依赖变更
- `ci`: CI 配置变更
### 提交示例
```bash
docs: 添加 p2pool 构建文档系统
- 创建 llmdoc 目录结构
- 添加项目概述文档
- 编写编码和 Git 规范文档
关联 Issue: #123
```
## 代码审查
### 合并请求(PR)规范
- 所有 PR 必须从功能分支提交到 `develop`
- PR 标题应简洁描述变更
- PR 描述必须包含:
1. 变更的目的
2. 具体实现
3. 测试方法
- 至少需要一个审查者批准
## 版本标签
### 版本命名
- 使用语义化版本 (Semantic Versioning)
- 格式:`vMAJOR.MINOR.PATCH`
- 示例:`v4.12.0`
### 发布流程
```bash
# 创建版本标签
git tag v4.12.0
git push origin v4.12.0
```
+60 -3
View File
@@ -1,5 +1,6 @@
# P2Pool Configuration File Example # P2Pool Configuration File Example
# Copy this file to /var/lib/p2pool/params.conf and edit as needed # Copy this file to /var/lib/p2pool/params.conf and edit as needed
# Compatible with: p2pool v4.15+
# ============================================================================= # =============================================================================
# Monero Node Connection (REQUIRED) # Monero Node Connection (REQUIRED)
@@ -11,6 +12,7 @@ host = 127.0.0.1
rpc-port = 18081 rpc-port = 18081
# Monero ZMQ port (required for optimal performance) # Monero ZMQ port (required for optimal performance)
# v4.14+: ZMQ connections now support IPv6 addresses
zmq-port = 18083 zmq-port = 18083
# ============================================================================= # =============================================================================
@@ -29,6 +31,16 @@ p2p = 0.0.0.0:37889
# Add known peer nodes (optional) # Add known peer nodes (optional)
# addpeers = node1.p2pool.io:37889,node2.p2pool.io:37889 # addpeers = node1.p2pool.io:37889,node2.p2pool.io:37889
# HAProxy PROXY Protocol v2 for P2P connections (v4.14+)
# Enable ONLY if p2pool's P2P port is behind a proxy that sends PROXY Protocol
# v2 headers (e.g. HAProxy with "send-proxy-v2" directive).
# When enabled, the real client IP is extracted from the PROXY header and used
# for peer management, ban checks and logging — instead of the proxy's IP.
# P2P traffic is typically low-volume and usually does NOT need load balancing;
# leave commented out unless you have a specific reason to proxy P2P.
# Leave commented to disable; uncomment to enable.
# p2p-proxy-protocol = true
# ============================================================================= # =============================================================================
# API Settings # API Settings
# ============================================================================= # =============================================================================
@@ -50,15 +62,30 @@ local-api = true
# ============================================================================= # =============================================================================
# Enable stratum server for miners to connect # Enable stratum server for miners to connect
# Format: <bind_ip>:<port> # Format: <bind_ip>:<port>
# Uncomment and configure if you want to connect mining software
# stratum = 0.0.0.0:3333 # stratum = 0.0.0.0:3333
# HAProxy PROXY Protocol v2 for Stratum connections (v4.14+)
# Enable ONLY if p2pool's Stratum port is behind a proxy that sends PROXY
# Protocol v2 headers (e.g. HAProxy with "send-proxy-v2" directive).
# When enabled, miners' real IP addresses are correctly extracted and shown
# in the `workers` command output, and per-IP ban/rate-limiting works properly.
# This is an open standard also supported by nginx, Traefik, AWS ELB, etc.;
# it is NOT tied to HAProxy specifically.
#
# ⚠️ TLV extensions (send-proxy-v2-ssl, send-proxy-v2-ssl-cn,
# unique-id-format, crc32c) are silently ignored — only the address block
# is read. Do NOT use exact addr_len checks in custom builds (spec §2.2
# allows senders to append TLV vectors, increasing addr_len beyond the
# base 12 / 36 bytes).
#
# Leave commented to disable; uncomment to enable.
# stratum-proxy-protocol = true
# ============================================================================= # =============================================================================
# Merge Mining (Optional) # Merge Mining (Optional)
# ============================================================================= # =============================================================================
# Enable Tari merge mining # Enable Tari merge mining
# Format: tari://<tari_node_ip>:<port> <tari_wallet_address> # Format: tari://<tari_node_ip>:<port> <tari_wallet_address>
# Uncomment and configure if you want to merge mine Tari
# merge-mine = tari://127.0.0.1:18142 YOUR_TARI_WALLET_ADDRESS # merge-mine = tari://127.0.0.1:18142 YOUR_TARI_WALLET_ADDRESS
# ============================================================================= # =============================================================================
@@ -70,10 +97,16 @@ log-file = /var/log/p2pool/p2pool.log
# Log level (0 = none, 1 = fatal, 2 = error, 3 = warn, 4 = info, 5 = debug, 6 = trace) # Log level (0 = none, 1 = fatal, 2 = error, 3 = warn, 4 = info, 5 = debug, 6 = trace)
loglevel = 3 loglevel = 3
# Disable logging destinations (v4.15+)
# Leave commented unless you want to disable logging output.
# disable-log is equivalent to no-console-log + no-log-file and saves ~8 MB RAM.
# no-console-log = true
# no-log-file = true
# disable-log = true
# ============================================================================= # =============================================================================
# Performance Tuning (Advanced) # Performance Tuning (Advanced)
# ============================================================================= # =============================================================================
# Number of light cache blocks to keep in RAM
# in-peers = 10 # in-peers = 10
# out-peers = 10 # out-peers = 10
@@ -82,3 +115,27 @@ loglevel = 3
# ============================================================================= # =============================================================================
# SOCKS5 proxy for outgoing connections # SOCKS5 proxy for outgoing connections
# socks5 = 127.0.0.1:9050 # socks5 = 127.0.0.1:9050
# SOCKS5 proxy type (v4.14+, i2p value added in v4.15)
# Controls how p2pool treats the SOCKS5 proxy configured above.
# Accepted values:
# auto - auto-detect by port number (9050 = Tor, 4447 = I2P; default)
# plain - treat as a standard SOCKS5 proxy (no Tor/I2P-specific behavior)
# tor - treat as a Tor SOCKS5 proxy (enables .onion peer handling)
# i2p - treat as an I2P SOCKS5 proxy (enables .b32.i2p peer handling)
# Only meaningful when `socks5` is set; ignored otherwise.
# socks5-proxy-type = auto
# I2P support (v4.15+)
# Requires an I2P SOCKS proxy, usually 127.0.0.1:4447 with i2pd.
# Recommended for I2P-only P2P to avoid clearnet/DNS/UPnP leaks:
# socks5 = 127.0.0.1:4447
# socks5-proxy-type = i2p
# no-dns = true
# no-upnp = true
# no-clearnet-p2p = true
#
# Broadcast your I2P hidden service .b32.i2p address to peers.
# This address is linked to shares mined by your wallet; use a dedicated
# I2P address for mining.
# i2p-address = YOUR_I2P_ADDRESS.b32.i2p