8 Commits
Author SHA1 Message Date
wangdefaandClaude Opus 4.8 893e0dc74d 更新 p2pool 到 4.17.1
Build and Release / release (push) Successful in 38s
Build and Release / build-and-test (amd64) (push) Successful in 4m33s
Build and Release / build-and-test (arm64) (push) Successful in 22m28s
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 20:33:10 +08:00
wangdefa 34aa4f8c74 更新 p2pool 到 4.17
Build and Release / release (push) Successful in 38s
Build and Release / build-and-test (amd64) (push) Successful in 24s
Build and Release / build-and-test (arm64) (push) Successful in 14m31s
2026-06-22 18:17:03 +08:00
wangdefaandClaude Opus 4.8 1f92188b59 更新版本号至 4.16,补合并挖矿 TLS 配置说明
Build and Release / build-and-test (arm64) (push) Successful in 24s
Build and Release / build-and-test (amd64) (push) Successful in 27s
Build and Release / release (push) Successful in 11s
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-14 09:55:52 +08:00
wangdefaandClaude Opus 4.8 1ecf2ca151 启用 WITH_GRPC=ON 支持 Tari 合并挖矿
Build and Release / release (push) Successful in 11s
Build and Release / build-and-test (amd64) (push) Successful in 3m54s
Build and Release / build-and-test (arm64) (push) Successful in 20m46s
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-11 09:52:39 +08:00
wangdefaandClaude Opus 4.8 b98a915df3 修复 CI:ldd 纯静态校验被 pipefail 误杀
Build and Release / build-and-test (arm64) (push) Successful in 20s
Build and Release / build-and-test (amd64) (push) Successful in 21s
Build and Release / release (push) Successful in 4s
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 15:06:44 +08:00
wangdefaandClaude Opus 4.8 3b024fdc10 重构为 musl 纯静态打包,配置迁 /etc,对齐三项目
Build and Release / release (push) Has been skipped
Build and Release / build-and-test (amd64) (push) Failing after 3m8s
Build and Release / build-and-test (arm64) (push) Failing after 7m31s
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 14:55:12 +08:00
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
15 changed files with 355 additions and 467 deletions
+45 -17
View File
@@ -9,7 +9,7 @@ on:
env:
DOCKER_BUILDKIT: "1"
PRODUCT_NAME: "p2pool"
PACKAGE_VERSION: "v4.14"
PACKAGE_VERSION: "4.17.1"
BUILDX_NO_DEFAULT_ATTESTATIONS: "1"
jobs:
@@ -18,7 +18,6 @@ jobs:
strategy:
matrix:
arch: [amd64, arm64]
distro: [ubuntu, alpine]
steps:
- uses: actions/checkout@v4
@@ -35,11 +34,10 @@ jobs:
- name: Build binaries
run: |
P2POOL_VERSION=${PACKAGE_VERSION}
PLATFORM="linux/${{ matrix.arch }}"
P2POOL_VERSION="v${PACKAGE_VERSION}" # 上游 p2pool git tag 带 v 前缀,需补回
echo "🏗️ Building ${PLATFORM} on native ${{ matrix.arch }} runner"
echo "📦 Distribution: ${{ matrix.distro }}"
echo "🏗️ Building ${PLATFORM} on native ${{ matrix.arch }} runner (musl 纯静态)"
# 设置 BuildKit 优化参数
export BUILDKIT_PROGRESS=plain
@@ -48,7 +46,7 @@ jobs:
--platform ${PLATFORM} \
--build-arg P2POOL_VERSION=${P2POOL_VERSION} \
--output type=local,dest=./output \
-f docker/Dockerfile.${{ matrix.distro }} .
-f docker/Dockerfile .
- name: Package and test
run: |
@@ -59,24 +57,30 @@ jobs:
exit 1
fi
TARGZ="${PRODUCT_NAME}-${{ matrix.arch }}-${{ matrix.distro }}-${PACKAGE_VERSION}.tar.gz"
TARGZ="${PRODUCT_NAME}-${{ matrix.arch }}-linux-static-${PACKAGE_VERSION}.tar.gz"
tar -czf "${TARGZ}" -C "$DIR" .
echo "📦 Created package: ${TARGZ}"
ls -lh "${TARGZ}"
# 快速验证
# 快速验证--help 冒烟 + ldd 纯静态校验(musl 静态可在 glibc runner 直接跑)
mkdir -p test && tar -xzf "${TARGZ}" -C test
test/p2pool --help 2>/dev/null || echo "⚠️ Help displayed"
test/p2pool --help >/dev/null 2>&1 && echo "✅ --help OK" || echo "⚠️ --help 退出非0"
# ldd 对纯静态二进制返回 exit 1,须先捕获输出再判定(run 块是 bash -e -o pipefail,直接管道会被误杀)
LDD_OUT=$(ldd test/p2pool 2>&1 || true)
if echo "$LDD_OUT" | grep -qE 'statically linked|not a dynamic executable'; then
echo "✅ fully-static(无动态依赖,跨发行版)"
else
echo "⚠️ 非纯静态:"; echo "$LDD_OUT"; exit 1
fi
rm -rf test
- name: Build Debian package
if: matrix.distro == 'ubuntu'
run: |
# 安装 dpkg-deb(如果需要)
sudo apt-get update && sudo apt-get install -y dpkg-dev
TARGZ="${PRODUCT_NAME}-${{ matrix.arch }}-${{ matrix.distro }}-${PACKAGE_VERSION}.tar.gz"
TARGZ="${PRODUCT_NAME}-${{ matrix.arch }}-linux-static-${PACKAGE_VERSION}.tar.gz"
echo "📦 Building Debian package for ${{ matrix.arch }}..."
chmod +x debian/build-deb.sh
@@ -86,7 +90,7 @@ jobs:
- uses: https://github.com/ChristopherHX/gitea-upload-artifact@v4
with:
name: binaries-${{ matrix.arch }}-${{ matrix.distro }}
name: binaries-${{ matrix.arch }}
path: |
*.tar.gz
*.deb
@@ -114,12 +118,13 @@ jobs:
REGISTRY=$(echo "${{ gitea.server_url }}" | sed 's|https\?://||')
OWNER="${{ gitea.repository_owner }}"
REPO_NAME=$(echo "${{ gitea.repository }}" | cut -d'/' -f2)
VERSION="${TAG#v}" # 包版本:去掉 git tag 的 v 前缀(registry 路径/下载名/Release 标题统一用纯数字)
echo "📦 上传包到 Generic Package Registry..."
echo " Registry: ${REGISTRY}"
echo " Owner: ${OWNER}"
echo " Package: ${PRODUCT_NAME}"
echo " Version: ${TAG}"
echo " Version: ${VERSION}"
# 上传所有 tar.gz 包到 Generic Package Registry
for file in *.tar.gz; do
@@ -128,7 +133,7 @@ jobs:
curl -fsSL -X PUT \
-H "Authorization: token ${TOKEN}" \
--upload-file "$file" \
"https://${REGISTRY}/api/packages/${OWNER}/generic/${PRODUCT_NAME}/${TAG}/$file" || {
"https://${REGISTRY}/api/packages/${OWNER}/generic/${PRODUCT_NAME}/${VERSION}/$file" || {
echo "❌ 上传失败: $file"
exit 1
}
@@ -151,12 +156,35 @@ jobs:
}
done
# 生成 Release JSON payload
# 生成 Release 描述
echo ""
echo "📝 生成 Release..."
export REGISTRY OWNER TAG
RELEASE_DATA=$(python3 -c 'import json,glob,os;r=os.environ["REGISTRY"];o=os.environ["OWNER"];p=os.environ["PRODUCT_NAME"];t=os.environ["TAG"];b=["## Release "+t,"","### 📥 下载方式","","#### 方式 1: 直接下载(推荐)","","点击下面 **Assets** 部分的文件名直接下载。","","#### 方式 2: Generic Package Registry",""]+[f"- [`{f}`](https://{r}/api/packages/{o}/generic/{p}/{t}/{f})" for f in sorted(glob.glob("*.tar.gz"))]+["","#### 方式 3: Debian Repository","","```bash","# Download GPG key",f"sudo curl https://{r}/api/packages/{o}/debian/repository.key -o /etc/apt/keyrings/gitea-{o}.asc","","# Add repository",f"echo \"deb [signed-by=/etc/apt/keyrings/gitea-{o}.asc] https://{r}/api/packages/{o}/debian stable main\" | sudo tee -a /etc/apt/sources.list.d/{o}.list","","# Update and install","sudo apt-get update",f"sudo apt-get install {p}","```"];print(json.dumps({"tag_name":t,"name":f"Release {t}","body":"\n".join(b),"draft":False,"prerelease":False}))')
# 拼接 tar.gz 下载链接
ASSETS=$(for f in *.tar.gz; do
[ -f "$f" ] || continue
echo "- [\`$f\`](https://${REGISTRY}/api/packages/${OWNER}/generic/${PRODUCT_NAME}/${VERSION}/$f)"
done)
BODY=$(cat <<EOF
## Release ${VERSION}
### 📥 Debian/Ubuntu 安装
\`\`\`bash
sudo curl https://${REGISTRY}/api/packages/${OWNER}/debian/repository.key -o /etc/apt/keyrings/gitea-${OWNER}.asc
echo "deb [signed-by=/etc/apt/keyrings/gitea-${OWNER}.asc] https://${REGISTRY}/api/packages/${OWNER}/debian stable main" | sudo tee /etc/apt/sources.list.d/${OWNER}.list
sudo apt-get update && sudo apt-get install ${PRODUCT_NAME}
\`\`\`
### 📦 tar.gz 下载
${ASSETS}
EOF
)
RELEASE_DATA=$(jq -n --arg tag "$TAG" --arg ver "$VERSION" --arg body "$BODY" \
'{tag_name: $tag, name: "Release \($ver)", body: $body, draft: false, prerelease: false}')
# 创建 Release
echo ""
+2 -6
View File
@@ -2,10 +2,6 @@
.idea/
.vscode/
.claude/
docs/
example/
llmdoc/
CLAUDE.md
.codex/
+62
View File
@@ -0,0 +1,62 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## 仓库性质
本仓库**只包含构建与打包基础设施**,不含 p2pool 源码。源码在编译时从上游克隆(见 [docker/Dockerfile](docker/Dockerfile)):
- 源码仓库:`github.com/SChernykh/p2pool.git`**p2pool 官方仓库**,非换名)
- 发布仓库:Gitea `gitea.bcde.io``wangdefa/p2pool` 的 Generic / Debian 包仓库
p2pool 是 Monero 去中心化矿池的 sidechain 节点。本项目对上游唯一的定制是 **`-DWITH_MERGE_MINING_DONATION=OFF`**(禁用合并挖矿捐赠),不改源码。
> **与同目录 `gitea-xxxig` / `gitea-xxxig-proxy` / `gitea-mond` 的关系**:四者共享同一套 CI / build-deb / debian 打包骨架,且均为 **musl fully-static** 构建。差异:xxxig 系是 XMRig 换名仓库源码;mond 克隆 Monero 官方靠 init.sh 现场换名;p2pool 直接构建官方源码、不换名,版本号纯数字(`4.17.1`,上游 git tag 带 v、构建时补回)。
## 整体架构:单二进制
编译产出单个可执行文件 `p2pool`:连接 monerod(本地,或经 `--rpc-ssl` 连外部 SSL 节点)、维护 P2Pool sidechain、提供 stratum 给矿工。配置模板 [conf/params.conf.example](conf/params.conf.example)。
## 构建与发布流程(CI
[.gitea/workflows/ci.yaml](.gitea/workflows/ci.yaml) 是 Gitea Actions 流水线:
1. **build-and-test**(矩阵 `arch=[amd64,arm64]`,跑在对应架构原生 runner):用 `docker buildx` 按 [docker/Dockerfile](docker/Dockerfile) 原生编译 → 打成 tar.gz → 解包冒烟(`p2pool --help` + `ldd` 纯静态校验)→ 调 `debian/build-deb.sh` 打 .deb → 上传 artifact。
2. **release**(仅 tag 触发):下载 artifact,上传 tar.gz 到 Generic Package Registry、上传 .deb 到 Debian Registrystable/main),并用 python3 生成描述创建 Gitea Release。
关键点:
- **musl fully-staticAlpine 构建,勿改回 glibc**:上游 p2pool **官方 release 二进制即用此法**(见上游 `.github/workflows/c-cpp.yml` 的 Alpine static job)。[docker/Dockerfile](docker/Dockerfile) 在 `alpine:3.21` 下自编 external 静态库(curl/libuv/libzmq+ 静态 grpc 栈(含 boringssl`WITH_GRPC=ON` 支持 Tari 合并挖矿),再 `-DSTATIC_BINARY=ON` 全静态。产物 `ldd` = `not a dynamic executable`、零外部依赖,**glibc/musl 任意发行版直接运行**(实测 musl 产物在 Debian 13 上正常 `--help`)。
- **为何用 musl 而非 glibc**musl 的 `getaddrinfo` 自带实现,全静态也能解析 DNS;glibc 静态会因 NSS 运行时 `dlopen` 失败。与 `gitea-xxxig`/`gitea-xxxig-proxy`/`gitea-mond` 一致。曾用的 `Dockerfile.ubuntu`glibc 动态)与 `Dockerfile.alpine`(动态链 system 库)均已删除。
- **依赖处理(关键,勿乱改)**
- external 依赖**子模块自带源码**,逐个编静态(`BUILD_SHARED_LIBS=OFF` 等)。拉 8 个常规子模块 + grpc 及其 **6 个必需 third_party**`abseil-cpp`/`boringssl-with-bazel`/`cares`/`protobuf`/`re2`/`zlib`);其余 9 个 grpc 子模块(benchmark/googletest/envoy/googleapis/xds 等测试或 xDS 依赖,已 `GRPC_NO_XDS`**跳过**省体积/时间。
- **WITH_GRPC=ON(支持 Tari 合并挖矿,勿改回 OFF)**:上游 CMake 默认即 ON(官方 alpine static job 为省体积改 OFF,本项目恢复 ON)。ON 时 `cmake/grpc.cmake``add_subdirectory(external/src/grpc)` 自动静态编译 grpc/protobuf/abseil/re2/cares,并 `add_subdirectory(external/src/Tari)` 编 checked-in 的 Tari proto`.pb.cc`,不需运行时 protoc),链接 `Tari_gRPC grpc grpc++ libprotobuf`。这样 `tari://` 主机走 `MergeMiningClientTari`gRPC)而非 `MergeMiningClientJSON_RPC`JSON-RPC,与 Tari 不兼容、报 `empty response`)。代价:二进制 ~5MB→~15MB(`-Wl,-s --gc-sections` 剔除未用 grpc/xDS 代码后远小于全量)、构建 +约 15min/arch。曾为省体积误用 `WITH_GRPC=OFF` 致无法与 Tari 合并挖矿,**已改回 ON,勿回退**。
- **boringssl 来源**`WITH_GRPC=ON` 时由 grpc 子模块(`third_party/boringssl-with-bazel`)提供,grpc.cmake 走此分支、**不再** `add_subdirectory(cmake/ssl)`(那是 `elseif (WITH_TLS)` 分支);p2pool 主体 TLS 与下方 curl 共用这一份 boringssl。
- **curl 用 boringssl TLS(保留 rpc-ssl,勿改回 no-SSL**:完整照搬官方 `c-cpp.yml` 的 curl flags——`P2POOL_BORINGSSL=ON`(上游给 curl 的独立 boringssl 后端补丁,与 `CURL_ENABLE_SSL=OFF` 共存、不走 curl 标准 SSL 路径)+ 一整套 `CURL_DISABLE_*`(尤其 `SRP`/`AWS`/`*_AUTH`)。后者跳过会引用 `OpenSSL::SSL` imported target 的 `curl_openssl_check_exists` 符号检测(新版 cmake 在 `try_compile` 阶段校验该 target 必失败,**少一个 disable 都会触发**)。curl 与 p2pool 主体共用同一 boringssl`json_rpc_request``CURLOPT_SSL_CTX_FUNCTION` 才能接管证书指纹校验——**`--rpc-ssl`/`--rpc-ssl-fingerprint` 连外部 SSL monerod 的能力得以保留**(已实测连真实 SSL 节点用 `--rpc-ssl` 拿到链上高度)。曾误用 no-SSL curl 会断此能力,勿回退。
- **版本号约定**:包版本硬编码在 ci.yaml 的 `PACKAGE_VERSION: "4.17.1"`(**纯数字、无 v**,符合 Debian 版本规范)。**关键分界**:上游 p2pool git tag 带 `v`,故 build job 用 `P2POOL_VERSION="v${PACKAGE_VERSION}"` 补回 v 传给 Dockerfile `git checkout`tar.gz / deb / registry 路径 / Release 标题等包版本一律直接用 `${PACKAGE_VERSION}`release job 用 `VERSION="${TAG#v}"` 归一(tag 带不带 v 都兼容,唯 Release 的 `tag_name` 用 git tag 原值)。CI 触发条件 `tags: ['*']`,发版改 `PACKAGE_VERSION` 并打对应 tag(纯数字,如 `4.17.1`)。
- 架构映射:Dockerfile 内 `arm64→ARCH_ID=aarch64``amd64→ARCH_ID=x86_64`(传给 p2pool cmake,控制 RandomX 优化)。
- tar.gz 下载 URL 形如 `https://gitea.bcde.io/api/packages/wangdefa/generic/p2pool/{version}/p2pool-{arch}-linux-static-{version}.tar.gz`version 为纯数字)。
## 本地常用命令
```bash
# 本地编译某架构的二进制(输出到 ./output/linux_<arch>/p2pool
docker buildx build --platform linux/amd64 \
--build-arg P2POOL_VERSION=v4.17.1 \
--output type=local,dest=./output \
-f docker/Dockerfile .
# 校验纯静态(应输出 "not a dynamic executable"
ldd output/linux_amd64/p2pool
# 用已有 tar.gz 打 .deb 包(第三个参数是 tar.gz
./debian/build-deb.sh amd64 4.17.1 p2pool-amd64-linux-static-4.17.1.tar.gz
```
无单元测试;CI 唯一冒烟是解包后跑 `p2pool --help`musl 纯静态可在 glibc runner 直接运行),并用 `ldd` 校验为纯静态。
## Debian 包布局与服务
- 二进制装到 `/opt/p2pool/p2pool`systemd 服务 [debian/p2pool.service](debian/p2pool.service),维护脚本 `debian/{postinst,prerm,postrm}`
- **配置流转(单一数据源,对齐 gitea-mond**`conf/params.conf.example` 是唯一配置源 → build-deb.sh 复制进包内 `/opt/p2pool/params.conf` → postinst 首次安装时 `cp``/etc/p2pool/params.conf`(**升级不覆盖**用户已有配置;旧版本位于 `/var/lib/p2pool/params.conf` 时 postinst 自动迁移到 `/etc/p2pool/`)。service 的 `ExecStart``--params-file /etc/p2pool/params.conf`。**改默认配置改 conf/params.conf.example 一处即可**(不要再在 postinst 内联 heredoc)。
- 数据目录 `/var/lib/p2pool/data-api`、日志目录 `/var/log/p2pool`,均归 `p2pool` 系统用户。postinst 创建 `p2pool` 系统用户/组,**服务不自动启用/启动**(首次需用户配置钱包地址),升级时若服务原为 enabled 则重启加载新二进制。
- control.template **无 `Depends` 字段**(纯静态,连 libc6/libuv1/libzmq5/libcurl4 都不需要)。
-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
```
+64 -105
View File
@@ -1,132 +1,91 @@
# P2Pool Docker 构建基础设施
# P2Pool
[![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg)]()
[![License](https://img.shields.io/badge/license-MIT-blue.svg)]()
P2Pool 是 [SChernykh/p2pool](https://github.com/SChernykh/p2pool) 的定制打包——Monero 去中心化矿池的 sidechain 节点。对上游唯一定制是**禁用合并挖矿捐赠**(`-DWITH_MERGE_MINING_DONATION=OFF`),不改源码。
为 [p2pool](https://github.com/SChernykh/p2pool) 提供的自动化 Docker 构建和打包系统
**本仓库只包含构建与打包基础设施**,不含 p2pool 源码:二进制在 CI 中从上游官方仓库 `github.com/SChernykh/p2pool` 编译,再打包分发到 [gitea.bcde.io](https://gitea.bcde.io) 的 Generic / Debian 包仓库
## 📋 项目简介
## 产物
这是一个专业的构建基础设施项目,用于自动化构建、打包和分发 p2pool(Monero 去中心化矿池)的多架构二进制文件和 Debian 软件包。
每次构建产出单个可执行文件(musl 纯静态,自带 boringssl/libuv/libzmq + 内置 gRPC,无外部动态库依赖,任意 Linux 发行版可跑):
**关键特性**
- 🏗️ 多架构支持(amd64、arm64
- 📦 多发行版构建(Alpine、Ubuntu
- 🤖 全自动 CI/CD 流程
- 🔒 禁用合并挖矿捐赠
- 📊 原生架构构建(无 QEMU
| 二进制 | 作用 |
|---|---|
| `p2pool` | P2Pool sidechain 节点:连接 monerod、维护 sidechain、向矿工提供 stratum;支持与 Tari 合并挖矿 |
## 🚀 快速开始
支持架构 `amd64` / `arm64`musl 纯静态,任意 Linux 发行版(Debian/Ubuntu/Alpine/CentOS 等)开箱即跑。静态构建仍保留 `--rpc-ssl`(连外部 SSL monerod 节点)与内置 gRPC`--merge-mine tari://...` 与 Tari 合并挖矿)。
### Debian/Ubuntu(推荐)
## 安装
### APTDebian / Ubuntu
```bash
# 下载 GPG 密钥
sudo curl https://gitea.bcde.io/api/packages/wangdefa/debian/repository.key -o /etc/apt/keyrings/gitea-wangdefa.asc
# 添加仓库
echo "deb [signed-by=/etc/apt/keyrings/gitea-wangdefa.asc] https://gitea.bcde.io/api/packages/wangdefa/debian stable main" | sudo tee -a /etc/apt/sources.list.d/wangdefa.list
# 更新并安装
sudo apt-get update
sudo apt-get install p2pool
echo "deb [signed-by=/etc/apt/keyrings/gitea-wangdefa.asc] https://gitea.bcde.io/api/packages/wangdefa/debian stable main" | sudo tee /etc/apt/sources.list.d/wangdefa.list
sudo apt-get update && sudo apt-get install p2pool
```
修改配置:
安装布局:
| | 路径 |
|---|---|
| 二进制 | `/opt/p2pool/p2pool` |
| 默认配置 | `/opt/p2pool/params.conf`postinst 复制到 `/etc/p2pool/params.conf` |
| 数据 | `/var/lib/p2pool/data-api` |
| 日志 | `/var/log/p2pool/` |
| 服务 | `p2pool.service` |
> 安装后服务**不会自动启动**(须先填钱包地址)。编辑 `/etc/p2pool/params.conf` 设置 Monero 钱包地址,再启用:
>
> ```bash
> sudo systemctl enable --now p2pool
> ```
### tar.gz(通用:Alpine / Ubuntu / Debian
从 Generic Package Registry 下载对应架构的 tar.gz,解压即用(单二进制):
```bash
# 设置你的 Monero 钱包地址
sudo nano /var/lib/p2pool/params.conf
# 启动服务
sudo systemctl enable --now p2pool.service
curl -fSL -o p2pool.tar.gz \
https://gitea.bcde.io/api/packages/wangdefa/generic/p2pool/4.17.1/p2pool-amd64-linux-static-4.17.1.tar.gz
tar -xzf p2pool.tar.gz
./p2pool --params-file params.conf # 配置模板见仓库 conf/params.conf.example
```
详细配置说明请查看:[README-params.md](README-params.md)
## 构建与发布
### 本地构建
CI 定义于 [.gitea/workflows/ci.yaml](.gitea/workflows/ci.yaml)
- **push 到 `main`/`develop`**:矩阵 `arch=[amd64,arm64]`,在原生 runner 上用 Dockermusl 纯静态)编译为 tar.gz 并打 `.deb`
- **打 tag**:产物上传到 Generic / Debian 包仓库并创建 Release。
本地构建:
```bash
# Alpine 构建(推荐,体积更小
docker buildx build --pull \
--platform linux/amd64 \
--build-arg P2POOL_VERSION=v4.14 \
# 编译某架构二进制(输出到 ./output/linux_<arch>/p2pool
docker buildx build --platform linux/amd64 \
--build-arg P2POOL_VERSION=v4.17.1 \
--output type=local,dest=./output \
-f docker/Dockerfile.alpine .
-f docker/Dockerfile .
# Ubuntu 构建
docker buildx build --pull \
--platform linux/amd64 \
--build-arg P2POOL_VERSION=v4.14 \
--output type=local,dest=./output \
-f docker/Dockerfile.ubuntu .
# 校验纯静态(应输出 "not a dynamic executable"
ldd output/linux_amd64/p2pool
# 用产物 tar.gz 打 .deb
./debian/build-deb.sh amd64 4.17.1 p2pool-amd64-linux-static-4.17.1.tar.gz
```
## 📚 文档
## 版本号约定
完整的项目文档位于 [llmdoc/](llmdoc/) 目录:
- **上游源码 git tag** 带 `v`(如 `v4.17.1`),CI 用 `P2POOL_VERSION=v${PACKAGE_VERSION}` 检出。
- **包版本**tar.gz / deb / registry 路径)一律用数字(如 `4.17.1`),符合 Debian 版本规范。
- **[项目概述](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)** - 安装和配置
发版只需改 ci.yaml 的 `PACKAGE_VERSION`
## 🏗️ 构建系统
## 目录结构
### 支持的架构和平台
| 架构 | Alpine | Ubuntu | Debian 包 |
|------|--------|--------|-----------|
| amd64 | ✅ | ✅ | ✅ |
| arm64 | ✅ | ✅ | ✅ |
### 构建产物
- **二进制包** (`tar.gz`) - 适用于所有 Linux 发行版
- **Debian 包** (`.deb`) - 适用于 Debian/Ubuntu 系统
## 🔧 配置管理
本项目使用配置文件管理 P2Pool 设置,提供以下优势:
-**升级安全** - 配置文件在包升级时不会被覆盖
-**集中管理** - 所有设置在一个位置
-**易于维护** - 支持注释和版本控制
配置文件模板:[params.conf.example](params.conf.example)
## 📦 发布流程
项目使用 Gitea Actions 实现自动化 CI/CD
1. **代码推送** → 触发构建(main/develop 分支)
2. **创建标签** → 触发完整发布流程
3. **自动构建** → 4 种组合(2 架构 × 2 发行版)
4. **自动发布** → 上传到包注册中心
5. **创建 Release** → 附带下载链接和说明
## 🔐 安全性
- ✅ 禁用上游合并挖矿捐赠
- ✅ 使用专用用户运行服务
- ✅ Systemd 安全加固
- ✅ 最小权限原则
- ✅ 安全的文件权限设置
## 📄 许可证
本项目为上游 [p2pool](https://github.com/SChernykh/p2pool) 提供构建基础设施。
上游项目许可证:GPL-3.0
## 🔗 相关链接
- **上游项目**: [SChernykh/p2pool](https://github.com/SChernykh/p2pool)
- **Monero**: [getmonero.org](https://www.getmonero.org/)
- **项目文档**: [llmdoc/index.md](llmdoc/index.md)
---
**注意**: 本仓库不包含 p2pool 源代码,仅提供构建和打包基础设施。
```
.gitea/workflows/ CI 流水线
docker/ Dockerfile(musl 纯静态,从上游官方源码编译)
debian/ .deb 打包:control 模板、维护脚本、systemd 服务
conf/ params.conf.example 默认配置模板
```
@@ -1,6 +1,6 @@
# P2Pool Configuration File Example
# Copy this file to /var/lib/p2pool/params.conf and edit as needed
# Compatible with: p2pool v4.14+
# Copy this file to /etc/p2pool/params.conf and edit as needed
# Compatible with: p2pool v4.17+
# =============================================================================
# Monero Node Connection (REQUIRED)
@@ -38,8 +38,8 @@ p2p = 0.0.0.0:37889
# 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.
# Accepted values: none (default), v2
# p2p-proxy-protocol = none
# Leave commented to disable; uncomment to enable.
# p2p-proxy-protocol = true
# =============================================================================
# API Settings
@@ -78,15 +78,19 @@ local-api = true
# allows senders to append TLV vectors, increasing addr_len beyond the
# base 12 / 36 bytes).
#
# Accepted values: none (default), v2
# stratum-proxy-protocol = none
# Leave commented to disable; uncomment to enable.
# stratum-proxy-protocol = true
# =============================================================================
# Merge Mining (Optional)
# =============================================================================
# Enable Tari merge mining
# Tari merge mining (this build includes gRPC, so tari:// is supported)
# Format: tari://<tari_node_ip>:<port> <tari_wallet_address>
# merge-mine = tari://127.0.0.1:18142 YOUR_TARI_WALLET_ADDRESS
#
# Generic JSON-RPC merge mining (other merge-mineable chains).
# v4.16+: TLS supported — prefix the host with https:// (default port 443).
# merge-mine = https://aux-node.example.com YOUR_AUX_WALLET_ADDRESS
# =============================================================================
# Logging
@@ -97,10 +101,19 @@ log-file = /var/log/p2pool/p2pool.log
# Log level (0 = none, 1 = fatal, 2 = error, 3 = warn, 4 = info, 5 = debug, 6 = trace)
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)
# =============================================================================
# in-peers = 10
# Maximum incoming localhost P2P connections (v4.17+)
# in-peers-localhost = 10
# out-peers = 10
# =============================================================================
@@ -109,12 +122,26 @@ loglevel = 3
# SOCKS5 proxy for outgoing connections
# socks5 = 127.0.0.1:9050
# SOCKS5 proxy type (v4.14+)
# 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 whether it is a plain proxy or Tor (default)
# plain treat as a standard SOCKS5 proxy (no Tor-specific behavior)
# tor treat as a Tor SOCKS5 proxy (enables onion routing optimizations,
# e.g. .onion peer resolution, correct onion connection counters)
# 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
# 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
+6 -2
View File
@@ -4,7 +4,7 @@ set -e
# 参数检查
if [ $# -ne 3 ]; then
echo "Usage: $0 <ARCH> <VERSION> <TARGZ_FILE>"
echo "Example: $0 amd64 v4.14 p2pool-amd64-ubuntu-v4.14.tar.gz"
echo "Example: $0 amd64 4.17.1 p2pool-amd64-linux-static-4.17.1.tar.gz"
exit 1
fi
@@ -45,12 +45,15 @@ PKG_DIR="${BUILD_DIR}/${PKG_NAME}_${DEB_VERSION}_${DEB_ARCH}"
mkdir -p "${PKG_DIR}/DEBIAN"
mkdir -p "${PKG_DIR}/opt/p2pool"
mkdir -p "${PKG_DIR}/lib/systemd/system"
mkdir -p "${PKG_DIR}/etc/p2pool"
# 解压二进制文件
echo "📂 Extracting binaries..."
tar -xzf "${TARGZ_FILE}" -C "${PKG_DIR}/opt/p2pool"
# 打入默认配置(conf/params.conf.example 为唯一配置源,postinst 据此生成 /etc/p2pool/params.conf
echo "📄 Bundling default config..."
cp conf/params.conf.example "${PKG_DIR}/opt/p2pool/params.conf"
# 生成 control 文件
echo "📝 Generating control file..."
sed -e "s/{{VERSION}}/${DEB_VERSION}/" \
@@ -72,6 +75,7 @@ cp debian/p2pool.service "${PKG_DIR}/lib/systemd/system/"
# 设置权限
chmod 755 "${PKG_DIR}/opt/p2pool/p2pool"
chmod 644 "${PKG_DIR}/opt/p2pool/params.conf"
chmod 644 "${PKG_DIR}/lib/systemd/system/p2pool.service"
# 构建 deb 包
-1
View File
@@ -3,7 +3,6 @@ Version: {{VERSION}}
Section: net
Priority: optional
Architecture: {{ARCH}}
Depends: libc6, libuv1, libzmq5, libcurl4
Maintainer: P2Pool Team <noreply@example.com>
Homepage: https://github.com/SChernykh/p2pool
Description: Decentralized pool for Monero mining
+1 -1
View File
@@ -8,7 +8,7 @@ Type=simple
User=p2pool
Group=p2pool
WorkingDirectory=/var/lib/p2pool
ExecStart=/opt/p2pool/p2pool --params-file /var/lib/p2pool/params.conf
ExecStart=/opt/p2pool/p2pool --params-file /etc/p2pool/params.conf
Restart=on-failure
RestartSec=10s
StandardOutput=journal
+39 -84
View File
@@ -12,78 +12,48 @@ if ! getent passwd p2pool >/dev/null; then
--gecos "P2Pool Service" p2pool
fi
# Create data directory
mkdir -p /var/lib/p2pool/data-api
chown -R p2pool:p2pool /var/lib/p2pool
chmod -R 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 << 'CONF'
# 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
# Use SSL for RPC connection
# rpc-ssl = true
# RPC credentials (if applicable)
# rpc-login = username:password
# 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:18142 TARI_WALLET_ADDRESS
# Stratum server (for miners to connect)
# stratum = 0.0.0.0:3333
CONF
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
chmod 750 /var/log/p2pool
# Set binary permissions
chown root:root /opt/p2pool/p2pool
# Create data directory(非递归设权限,避免升级时遍历庞大数据目录)
mkdir -p /var/lib/p2pool/data-api
chown p2pool:p2pool /var/lib/p2pool /var/lib/p2pool/data-api
chmod 750 /var/lib/p2pool /var/lib/p2pool/data-api
# Create config directory
mkdir -p /etc/p2pool
# 兼容旧版本:配置文件曾位于 /var/lib/p2pool/params.conf,迁移到 /etc/p2pool/params.conf
if [ ! -f /etc/p2pool/params.conf ] && [ -f /var/lib/p2pool/params.conf ]; then
echo "Migrating existing config from /var/lib/p2pool to /etc/p2pool..."
cp /var/lib/p2pool/params.conf /etc/p2pool/params.conf
fi
# 首次安装:从包内默认配置生成(源:conf/params.conf.example)。升级不覆盖已有配置
if [ ! -f /etc/p2pool/params.conf ]; then
cp /opt/p2pool/params.conf /etc/p2pool/params.conf
fi
chown p2pool:p2pool /etc/p2pool/params.conf
chmod 640 /etc/p2pool/params.conf
# Set permissions/opt 目录与二进制 755,数据文件 644(对齐 xxxig / xxxig-proxy / mond
chown -R root:root /opt/p2pool
find /opt/p2pool -type d -exec chmod 755 {} +
find /opt/p2pool -type f -exec chmod 644 {} +
chmod 755 /opt/p2pool/p2pool
# Reload systemd and handle service restart on upgrade
# Reload systemd
if [ -d /run/systemd/system ]; then
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
# 升级时重启正在运行的服务以加载新二进制;try-restart 不会启动未运行的服务,
# 故首次安装仍保持"不自动启动"语义
systemctl try-restart p2pool.service 2>/dev/null || true
# 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
@@ -91,31 +61,16 @@ fi
echo ""
echo "✅ P2Pool installed successfully!"
echo ""
echo "📋 Before starting P2Pool, you MUST configure your settings:"
echo ""
echo "1. Edit the configuration file:"
echo " sudo nano /var/lib/p2pool/params.conf"
echo ""
echo " Set your Monero wallet address and adjust other settings as needed."
echo ""
echo "2. Start P2Pool:"
echo " sudo systemctl enable p2pool.service"
echo " sudo systemctl start p2pool.service"
echo ""
echo "3. Check status:"
echo " sudo systemctl status p2pool.service"
echo " sudo journalctl -u p2pool -f"
echo ""
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 " Config file: /etc/p2pool/params.conf"
echo " Data directory: /var/lib/p2pool/data-api"
echo " Log directory: /var/log/p2pool"
echo " Binaries: /opt/p2pool/p2pool"
echo " Systemd services: p2pool.service"
echo ""
echo "💡 Tip: Your params.conf will NOT be overwritten during package upgrades."
echo ""
echo "For help:"
echo " /opt/p2pool/p2pool --help"
echo "💡 Tip: Your config files will NOT be overwritten during package upgrades."
echo " Before starting, set your Monero wallet in /etc/p2pool/params.conf, then:"
echo " sudo systemctl enable --now p2pool.service"
echo ""
exit 0
+2 -1
View File
@@ -12,9 +12,10 @@ case "$1" in
delgroup --quiet p2pool || true
fi
# Remove data directories (only on purge)
# Remove data/config directories (only on purge)
rm -rf /var/lib/p2pool
rm -rf /var/log/p2pool
rm -rf /etc/p2pool
;;
remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+17 -32
View File
@@ -1,33 +1,18 @@
case "$1" in
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
#!/bin/sh
set -e
exit 0
# 仅在卸载(remove)时停用服务;升级(upgrade)时保持运行,
# 由 postinst 的 try-restart 重启以加载新二进制
if [ "$1" = "remove" ] && [ -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
+77
View File
@@ -0,0 +1,77 @@
# p2pool musl 纯静态构建(external 静态库参照上游官方 c-cpp.yml 的 Alpine static 流程)
# Alpine + 自编 external 静态库(curl/libuv/libzmq) + 静态 grpc 栈(WITH_GRPC=ONTari 合并挖矿) + -DSTATIC_BINARY=ON
# 产物 fully-staticldd: not a dynamic executable),glibc/musl 任意发行版直接运行。
# 为何 muslmusl getaddrinfo 自包含,全静态可跨发行版;glibc 静态会因 NSS dlopen 失败。
FROM alpine:3.21 AS build
ARG P2POOL_VERSION
ARG TARGETARCH
RUN apk add --no-cache git cmake gcc g++ make linux-headers perl
RUN git clone https://github.com/SChernykh/p2pool /src/p2pool
WORKDIR /src/p2pool
# 拉 8 个常规子模块 + grpc 及其 6 个必需 third_party(abseil/boringssl/cares/protobuf/re2/zlib)。
# WITH_GRPC=ON 需完整 grpc 栈静态编译以支持 Tari 合并挖矿;其余 9 个 grpc 子模块
# (benchmark/googletest/envoy/googleapis/xds 等测试或 xDS 依赖,已 GRPC_NO_XDS) 跳过省体积/时间。
RUN git checkout ${P2POOL_VERSION} && \
git submodule update --init --recursive \
external/src/RandomX external/src/rapidjson external/src/cppzmq \
external/src/libuv external/src/libzmq external/src/robin-hood-hashing \
external/src/curl external/src/miniupnp && \
git submodule update --init external/src/grpc && \
git -C external/src/grpc submodule update --init --recursive \
third_party/abseil-cpp third_party/boringssl-with-bazel \
third_party/cares/cares third_party/protobuf third_party/re2 third_party/zlib
# external libcurlHTTP + p2pool boringssl 集成(保留 rpc-ssl 连 HTTPS monerod)。
# 完整照搬官方 c-cpp.yml 的 curl flagsP2POOL_BORINGSSL=ON 是上游给 curl 打的独立
# boringssl TLS 后端补丁(不走 curl 标准 CURL_ENABLE_SSL 路径,故二者共存且仍支持 --rpc-ssl)。
# 一整套 CURL_DISABLE_*(尤其 SRP/AWS/*_AUTH) 用于跳过会引用 OpenSSL::SSL imported target 的
# curl_openssl_check_exists 符号检测——新版 cmake 在 try_compile 阶段校验该 target 必失败,少一个都会触发。
RUN cd external/src/curl && cmake . -DCMAKE_BUILD_TYPE=Release \
-DCURL_DROP_UNUSED=ON -DCURL_DISABLE_TYPECHECK=ON \
-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG=ON -DCURL_DISABLE_SHA512_256=ON \
-DPICKY_COMPILER=OFF -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF \
-DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF \
-DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON \
-DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF \
-DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF \
-DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON \
-DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON \
-DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON \
-DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON \
-DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON \
-DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF \
-DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF \
-DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF \
-DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON \
-DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON \
-DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON \
-DCURL_DISABLE_NEGOTIATE_AUTH=ON \
-DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include && \
make -j"$(nproc)"
# external libuv 静态
RUN cd external/src/libuv && mkdir build && cd build && \
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF && \
make -j"$(nproc)"
# external libzmq 静态
RUN cd external/src/libzmq && mkdir build && cd build && \
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF \
-DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF && \
make -j"$(nproc)"
# p2pool 主体:纯静态(STATIC_BINARY) + 启用 grpc(Tari 合并挖矿) + 禁合并挖矿捐赠(gitea-p2pool 定制)
RUN if [ "$TARGETARCH" = "arm64" ]; then ARCH_ID=aarch64; else ARCH_ID=x86_64; fi && \
mkdir build && cd build && \
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DSTATIC_BINARY=ON -DWITH_GRPC=ON -DWITH_MERGE_MINING_DONATION=OFF \
-DARCH_ID="$ARCH_ID" \
-DCMAKE_C_FLAGS='-Wl,-s -Wl,--gc-sections' \
-DCMAKE_CXX_FLAGS='-Wl,-s -Wl,--gc-sections' && \
make -j"$(nproc)" p2pool && cp p2pool /p2pool
FROM scratch
ARG TARGETARCH
COPY --from=build /p2pool /linux_${TARGETARCH}/p2pool
-46
View File
@@ -1,46 +0,0 @@
FROM alpine:3.21 AS base
ARG TARGETARCH
RUN apk update && apk add --no-cache \
git \
cmake \
gcc \
g++ \
make \
linux-headers \
libuv-dev \
zeromq-dev \
curl-dev
FROM base AS build
ARG P2POOL_VERSION
ARG TARGETARCH
ARG BUILDPLATFORM
ARG TARGETPLATFORM
RUN git clone --recursive https://github.com/SChernykh/p2pool /src/p2pool
WORKDIR /src/p2pool
RUN git checkout ${P2POOL_VERSION}
# Determine parallel jobs based on cross-compilation and architecture
RUN mkdir build && cd build && \
if [ "$BUILDPLATFORM" != "$TARGETPLATFORM" ]; then \
MAKE_JOBS="-j2"; \
elif [ "$TARGETARCH" = "amd64" ]; then \
MAKE_JOBS="-j$(($(nproc) / 2))"; \
else \
MAKE_JOBS="-j$(nproc)"; \
fi && \
echo "Building with parallel jobs: $MAKE_JOBS (arch: $TARGETARCH, cross-compile: $([ "$BUILDPLATFORM" != "$TARGETPLATFORM" ] && echo yes || echo no))" && \
cmake .. -DCMAKE_BUILD_TYPE=Release -DWITH_MERGE_MINING_DONATION=OFF && \
make $MAKE_JOBS
FROM scratch
ARG TARGETARCH
COPY --from=build /src/p2pool/build/p2pool /linux_${TARGETARCH}/p2pool
-46
View File
@@ -1,46 +0,0 @@
FROM ubuntu:24.04 AS base
ARG TARGETARCH
RUN apt-get update && apt-get install -y \
git \
cmake \
gcc \
g++ \
make \
libuv1-dev \
libzmq3-dev \
libcurl4-openssl-dev \
&& rm -rf /var/lib/apt/lists/*
FROM base AS build
ARG P2POOL_VERSION
ARG TARGETARCH
ARG BUILDPLATFORM
ARG TARGETPLATFORM
RUN git clone --recursive https://github.com/SChernykh/p2pool /src/p2pool
WORKDIR /src/p2pool
RUN git checkout ${P2POOL_VERSION}
# Determine parallel jobs based on cross-compilation and architecture
RUN mkdir build && cd build && \
if [ "$BUILDPLATFORM" != "$TARGETPLATFORM" ]; then \
MAKE_JOBS="-j2"; \
elif [ "$TARGETARCH" = "amd64" ]; then \
MAKE_JOBS="-j$(($(nproc) / 2))"; \
else \
MAKE_JOBS="-j$(nproc)"; \
fi && \
echo "Building with parallel jobs: $MAKE_JOBS (arch: $TARGETARCH, cross-compile: $([ "$BUILDPLATFORM" != "$TARGETPLATFORM" ] && echo yes || echo no))" && \
cmake .. -DCMAKE_BUILD_TYPE=Release -DWITH_MERGE_MINING_DONATION=OFF && \
make $MAKE_JOBS
FROM scratch
ARG TARGETARCH
COPY --from=build /src/p2pool/build/p2pool /linux_${TARGETARCH}/p2pool