4 Commits
Author SHA1 Message Date
wangdefa 882c073111 更新 p2pool 到 4.18.1
CI / validate (push) Successful in 5s
CI / build (amd64) (push) Successful in 3m24s
CI / build (arm64) (push) Successful in 9m51s
Release / build (amd64) (push) Successful in 3m18s
Release / build (arm64) (push) Successful in 9m58s
Release / release (push) Successful in 43s
2026-09-23 09:09:53 +08:00
wangdefa 3e7ec0c654 更新 CI/CD 流水线,拆分为独立的构建和发布流程,添加版本控制,更新至 4.18
CI / validate (push) Successful in 6s
CI / build (amd64) (push) Successful in 4m11s
CI / build (arm64) (push) Successful in 22m29s
Release / build (amd64) (push) Successful in 4m23s
Release / build (arm64) (push) Successful in 22m17s
Release / release (push) Successful in 37s
2026-08-07 09:01:45 +08:00
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
9 changed files with 289 additions and 257 deletions
-236
View File
@@ -1,236 +0,0 @@
# .gitea/workflows/ci.yaml
name: Build and Release
on:
push:
branches: [main, develop]
tags: ['*']
env:
DOCKER_BUILDKIT: "1"
PRODUCT_NAME: "p2pool"
PACKAGE_VERSION: "4.16"
BUILDX_NO_DEFAULT_ATTESTATIONS: "1"
jobs:
build-and-test:
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest-amd64' || 'ubuntu-latest-arm64' }}
strategy:
matrix:
arch: [amd64, arm64]
steps:
- uses: actions/checkout@v4
- name: Setup Docker Buildx
run: |
# 创建 buildx builder(原生构建不需要 QEMU)
docker buildx create --use --name native-builder \
--driver docker-container \
--driver-opt network=host \
--driver-opt env.BUILDKIT_STEP_LOG_MAX_SIZE=50000000 \
--driver-opt env.BUILDKIT_STEP_LOG_MAX_SPEED=10000000 \
|| true
docker buildx inspect --bootstrap
- name: Build binaries
run: |
PLATFORM="linux/${{ matrix.arch }}"
P2POOL_VERSION="v${PACKAGE_VERSION}" # 上游 p2pool git tag 带 v 前缀,需补回
echo "🏗️ Building ${PLATFORM} on native ${{ matrix.arch }} runner (musl 纯静态)"
# 设置 BuildKit 优化参数
export BUILDKIT_PROGRESS=plain
docker buildx build --pull \
--platform ${PLATFORM} \
--build-arg P2POOL_VERSION=${P2POOL_VERSION} \
--output type=local,dest=./output \
-f docker/Dockerfile .
- name: Package and test
run: |
DIR="./output/linux_${{ matrix.arch }}"
if [ ! -d "$DIR" ]; then
echo "❌ 构建输出目录不存在: $DIR"
exit 1
fi
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 >/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
run: |
# 安装 dpkg-deb(如果需要)
sudo apt-get update && sudo apt-get install -y dpkg-dev
TARGZ="${PRODUCT_NAME}-${{ matrix.arch }}-linux-static-${PACKAGE_VERSION}.tar.gz"
echo "📦 Building Debian package for ${{ matrix.arch }}..."
chmod +x debian/build-deb.sh
./debian/build-deb.sh ${{ matrix.arch }} ${PACKAGE_VERSION} "${TARGZ}"
ls -lh *.deb
- uses: https://github.com/ChristopherHX/gitea-upload-artifact@v4
with:
name: binaries-${{ matrix.arch }}
path: |
*.tar.gz
*.deb
retention-days: 1
release:
runs-on: ubuntu-latest-amd64
needs: build-and-test
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: https://github.com/ChristopherHX/gitea-download-artifact@v4
with:
pattern: binaries-*
path: ./packages
merge-multiple: true
- name: Upload packages and create release
env:
TOKEN: ${{ secrets.BUILD_TOKEN }}
TAG: ${{ github.ref_name }}
run: |
cd packages
# 提取仓库信息(移除 https:// 前缀和仓库路径)
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: ${VERSION}"
# 上传所有 tar.gz 包到 Generic Package Registry
for file in *.tar.gz; do
[ ! -f "$file" ] && continue
echo " ⬆️ $file"
curl -fsSL -X PUT \
-H "Authorization: token ${TOKEN}" \
--upload-file "$file" \
"https://${REGISTRY}/api/packages/${OWNER}/generic/${PRODUCT_NAME}/${VERSION}/$file" || {
echo "❌ 上传失败: $file"
exit 1
}
done
# 上传 Debian 包到 Debian Package Registry (通用稳定版)
echo ""
echo "📦 上传 Debian 包到 Debian Package Registry..."
for file in *.deb; do
[ ! -f "$file" ] && continue
# 上传到 stable (通用稳定版)
echo " ⬆️ $file → stable"
curl -fsSL -X PUT \
-H "Authorization: token ${TOKEN}" \
--upload-file "$file" \
"https://${REGISTRY}/api/packages/${OWNER}/debian/pool/stable/main/upload" || {
echo "❌ Debian 包上传失败: $file (stable)"
exit 1
}
done
# 生成 Release 描述
echo ""
echo "📝 生成 Release..."
# 拼接 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 ""
echo "🎉 创建 Release..."
RESPONSE=$(curl -fsSL -w "\n%{http_code}" -X POST \
-H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/json" \
"https://${REGISTRY}/api/v1/repos/${{ gitea.repository }}/releases" \
-d "${RELEASE_DATA}")
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
RESPONSE_BODY=$(echo "$RESPONSE" | head -n-1)
if [ "$HTTP_CODE" = "201" ]; then
echo "✅ Release 创建成功"
RELEASE_ID=$(echo "$RESPONSE_BODY" | grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2)
echo " Release ID: ${RELEASE_ID}"
elif [ "$HTTP_CODE" = "409" ]; then
echo "⚠️ Release 已存在,获取现有 Release ID..."
RELEASE_ID=$(curl -fsSL \
-H "Authorization: token ${TOKEN}" \
"https://${REGISTRY}/api/v1/repos/${{ gitea.repository }}/releases/tags/${TAG}" | \
grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2)
echo " Release ID: ${RELEASE_ID}"
else
echo "❌ 创建 Release 失败 (HTTP ${HTTP_CODE})"
echo "$RESPONSE_BODY"
exit 1
fi
# 上传文件作为 Release 附件
echo ""
echo "📎 上传文件作为 Release 附件..."
for file in *.tar.gz *.deb; do
[ ! -f "$file" ] && continue
echo " ⬆️ $file"
# 使用 multipart/form-data 上传附件
curl -fsSL -X POST \
-H "Authorization: token ${TOKEN}" \
-F "attachment=@${file}" \
"https://${REGISTRY}/api/v1/repos/${{ gitea.repository }}/releases/${RELEASE_ID}/assets?name=${file}" || {
echo " ⚠️ 附件上传失败: $file(可能已存在)"
}
done
echo ""
echo "✅ Release 创建完成!"
echo "🔗 访问: https://${REGISTRY}/${{ gitea.repository }}/releases/tag/${TAG}"
+84
View File
@@ -0,0 +1,84 @@
name: CI
# 分支推送只做校验和原生构建;tag 发布由 release.yml 独立处理。
on:
push:
branches: ["**"]
env:
DOCKER_BUILDKIT: "1"
BUILDX_NO_DEFAULT_ATTESTATIONS: "1"
BUILDKIT_PROGRESS: plain
jobs:
validate:
runs-on: ubuntu-latest-amd64
steps:
- uses: actions/checkout@v4
- name: 校验版本、配置和脚本语法
run: |
VERSION=$(tr -d '\r\n' < VERSION)
[[ "${VERSION}" =~ ^[0-9]+\.[0-9]+(\.[0-9]+)?$ ]]
test -s conf/params.conf.example
bash -n debian/build-deb.sh
sh -n debian/postinst debian/prerm debian/postrm
build:
needs: validate
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest-amd64' || 'ubuntu-latest-arm64' }}
strategy:
fail-fast: false
matrix:
arch: [amd64, arm64]
steps:
- uses: actions/checkout@v4
- name: 准备原生 Buildx
run: |
BUILDER=$(docker buildx create --use \
--driver docker-container \
--driver-opt network=host \
--driver-opt env.BUILDKIT_STEP_LOG_MAX_SIZE=50000000 \
--driver-opt env.BUILDKIT_STEP_LOG_MAX_SPEED=10000000)
echo "BUILDER=${BUILDER}" >> "$GITHUB_ENV"
docker buildx inspect --bootstrap
- name: 构建 ${{ matrix.arch }} 二进制
run: |
VERSION=$(tr -d '\r\n' < VERSION)
docker buildx build --pull \
--platform "linux/${{ matrix.arch }}" \
--build-arg "P2POOL_VERSION=v${VERSION}" \
--output type=local,dest=./output \
-f docker/Dockerfile .
- name: 冒烟测试
run: |
DIR="./output/linux_${{ matrix.arch }}"
test -x "${DIR}/p2pool"
"${DIR}/p2pool" --version
"${DIR}/p2pool" --help >/dev/null
"${DIR}/p2pool" --test
LDD_OUT=$(ldd "${DIR}/p2pool" 2>&1 || true)
grep -qE 'statically linked|not a dynamic executable' <<<"${LDD_OUT}"
- name: 验证 Debian 打包
run: |
VERSION=$(tr -d '\r\n' < VERSION)
TARGZ="p2pool-${{ matrix.arch }}-linux-static-${VERSION}.tar.gz"
tar -czf "${TARGZ}" -C "./output/linux_${{ matrix.arch }}" .
if ! command -v dpkg-deb >/dev/null; then
sudo apt-get update
sudo apt-get install -y dpkg-dev
fi
./debian/build-deb.sh "${{ matrix.arch }}" "${VERSION}" "${TARGZ}"
DEB="p2pool_${VERSION}_${{ matrix.arch }}.deb"
CONTENTS=$(dpkg-deb --contents "${DEB}")
grep -Fq 'opt/p2pool/p2pool' <<<"${CONTENTS}"
grep -Fq 'opt/p2pool/params.conf' <<<"${CONTENTS}"
grep -Fq 'lib/systemd/system/p2pool.service' <<<"${CONTENTS}"
- name: 清理 Buildx
if: always()
run: docker buildx rm "${BUILDER}" || true
+170
View File
@@ -0,0 +1,170 @@
name: Release
on:
push:
tags: ["*"]
env:
DOCKER_BUILDKIT: "1"
BUILDX_NO_DEFAULT_ATTESTATIONS: "1"
BUILDKIT_PROGRESS: plain
PRODUCT_NAME: p2pool
jobs:
build:
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest-amd64' || 'ubuntu-latest-arm64' }}
strategy:
fail-fast: false
matrix:
arch: [amd64, arm64]
steps:
- uses: actions/checkout@v4
- name: 校验 tag 与源码版本
env:
TAG: ${{ gitea.ref_name }}
run: |
VERSION=$(tr -d '\r\n' < VERSION)
TAG_VERSION="${TAG#v}"
[[ "${TAG_VERSION}" =~ ^[0-9]+\.[0-9]+(\.[0-9]+)?$ ]]
[ "${TAG_VERSION}" = "${VERSION}" ] || {
echo "tag ${TAG_VERSION} 与 VERSION ${VERSION} 不一致"
exit 1
}
echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
- name: 准备原生 Buildx
run: |
BUILDER=$(docker buildx create --use \
--driver docker-container \
--driver-opt network=host \
--driver-opt env.BUILDKIT_STEP_LOG_MAX_SIZE=50000000 \
--driver-opt env.BUILDKIT_STEP_LOG_MAX_SPEED=10000000)
echo "BUILDER=${BUILDER}" >> "$GITHUB_ENV"
docker buildx inspect --bootstrap
- name: 构建 ${{ matrix.arch }} 二进制
run: |
docker buildx build --pull \
--platform "linux/${{ matrix.arch }}" \
--build-arg "P2POOL_VERSION=v${VERSION}" \
--output type=local,dest=./output \
-f docker/Dockerfile .
- name: 打包并冒烟测试
run: |
DIR="./output/linux_${{ matrix.arch }}"
TARGZ="${PRODUCT_NAME}-${{ matrix.arch }}-linux-static-${VERSION}.tar.gz"
test -x "${DIR}/p2pool"
tar -czf "${TARGZ}" -C "${DIR}" .
TEST_DIR=$(mktemp -d)
trap 'rm -rf "${TEST_DIR}"' EXIT
tar -xzf "${TARGZ}" -C "${TEST_DIR}"
"${TEST_DIR}/p2pool" --version
"${TEST_DIR}/p2pool" --help >/dev/null
"${TEST_DIR}/p2pool" --test
LDD_OUT=$(ldd "${TEST_DIR}/p2pool" 2>&1 || true)
grep -qE 'statically linked|not a dynamic executable' <<<"${LDD_OUT}"
- name: 构建 Debian 包
run: |
if ! command -v dpkg-deb >/dev/null; then
sudo apt-get update
sudo apt-get install -y dpkg-dev
fi
TARGZ="${PRODUCT_NAME}-${{ matrix.arch }}-linux-static-${VERSION}.tar.gz"
./debian/build-deb.sh "${{ matrix.arch }}" "${VERSION}" "${TARGZ}"
DEB="${PRODUCT_NAME}_${VERSION}_${{ matrix.arch }}.deb"
CONTENTS=$(dpkg-deb --contents "${DEB}")
grep -Fq 'opt/p2pool/p2pool' <<<"${CONTENTS}"
grep -Fq 'opt/p2pool/params.conf' <<<"${CONTENTS}"
grep -Fq 'lib/systemd/system/p2pool.service' <<<"${CONTENTS}"
- uses: https://github.com/ChristopherHX/gitea-upload-artifact@v4
with:
name: packages-${{ matrix.arch }}
path: |
*.tar.gz
*.deb
if-no-files-found: error
retention-days: 1
- name: 清理 Buildx
if: always()
run: docker buildx rm "${BUILDER}" || true
release:
needs: build
runs-on: ubuntu-latest-amd64
steps:
- uses: actions/checkout@v4
- uses: https://github.com/ChristopherHX/gitea-download-artifact@v4
with:
pattern: packages-*
path: ./packages
merge-multiple: true
- name: 校验发布文件并生成校验和
env:
TAG: ${{ gitea.ref_name }}
run: |
VERSION=$(tr -d '\r\n' < VERSION)
TAG_VERSION="${TAG#v}"
[ "${TAG_VERSION}" = "${VERSION}" ]
for arch in amd64 arm64; do
test -f "packages/${PRODUCT_NAME}-${arch}-linux-static-${VERSION}.tar.gz"
test -f "packages/${PRODUCT_NAME}_${VERSION}_${arch}.deb"
done
(cd packages && sha256sum *.tar.gz *.deb > SHA256SUMS)
REGISTRY=$(echo "${{ gitea.server_url }}" | sed 's|https\?://||')
echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
echo "REGISTRY=${REGISTRY}" >> "$GITHUB_ENV"
- name: 上传 Generic 和 Debian 软件包
env:
TOKEN: ${{ secrets.BUILD_TOKEN }}
run: |
OWNER="${{ gitea.repository_owner }}"
for file in packages/*.tar.gz; do
name=$(basename "${file}")
curl -fsSL -X PUT \
-H "Authorization: token ${TOKEN}" \
--upload-file "${file}" \
"https://${REGISTRY}/api/packages/${OWNER}/generic/${PRODUCT_NAME}/${VERSION}/${name}"
done
for file in packages/*.deb; do
curl -fsSL -X PUT \
-H "Authorization: token ${TOKEN}" \
--upload-file "${file}" \
"https://${REGISTRY}/api/packages/${OWNER}/debian/pool/stable/main/upload"
done
- name: 生成 Release 描述
run: |
cat > release-notes.md <<EOF
## Release ${VERSION}
上游版本:[P2Pool v${VERSION}](https://github.com/SChernykh/p2pool/releases/tag/v${VERSION})
### Debian/Ubuntu 安装
\`\`\`bash
sudo curl https://${REGISTRY}/api/packages/${{ gitea.repository_owner }}/debian/repository.key -o /etc/apt/keyrings/gitea-${{ gitea.repository_owner }}.asc
echo "deb [signed-by=/etc/apt/keyrings/gitea-${{ gitea.repository_owner }}.asc] https://${REGISTRY}/api/packages/${{ gitea.repository_owner }}/debian stable main" | sudo tee /etc/apt/sources.list.d/${{ gitea.repository_owner }}.list
sudo apt-get update && sudo apt-get install p2pool
\`\`\`
发布附件包含 amd64、arm64 的 tar.gz、Debian 包和 SHA256SUMS。
EOF
- name: 创建或更新 Release 并上传附件
uses: https://gitea.com/actions/gitea-release-action@v1
with:
token: ${{ secrets.BUILD_TOKEN }}
name: Release ${{ gitea.ref_name }}
body_path: release-notes.md
files: |
packages/*.tar.gz
packages/*.deb
packages/SHA256SUMS
+7 -1
View File
@@ -4,4 +4,10 @@
.vscode/ .vscode/
.claude/ .claude/
.codex/ .codex/
# 构建产物
*.deb
*.tar.gz
output/
packages/
+9 -9
View File
@@ -11,7 +11,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
p2pool 是 Monero 去中心化矿池的 sidechain 节点。本项目对上游唯一的定制是 **`-DWITH_MERGE_MINING_DONATION=OFF`**(禁用合并挖矿捐赠),不改源码。 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.16`,上游 git tag 带 v、构建时补回)。 > **与同目录 `gitea-xxxig` / `gitea-xxxig-proxy` / `gitea-mond` 的关系**:四者共享同一套 CI / build-deb / debian 打包骨架,且均为 **musl fully-static** 构建。差异:xxxig 系是 XMRig 换名仓库源码;mond 克隆 Monero 官方靠 init.sh 现场换名;p2pool 直接构建官方源码、不换名,版本号纯数字(`4.18.1`,上游 git tag 带 v、构建时补回)。
## 整体架构:单二进制 ## 整体架构:单二进制
@@ -19,20 +19,20 @@ p2pool 是 Monero 去中心化矿池的 sidechain 节点。本项目对上游唯
## 构建与发布流程(CI) ## 构建与发布流程(CI)
[.gitea/workflows/ci.yaml](.gitea/workflows/ci.yaml) 是 Gitea Actions 流水线: 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。 1. [.gitea/workflows/ci.yml](.gitea/workflows/ci.yml) 仅由分支推送触发:先检查版本、配置与 shell 语法,再用 amd64、arm64 原生 runner 并行编译,执行严格冒烟测试并验证 DEB 包内容;不上传 artifact。
2. **release**(仅 tag 触发):下载 artifact,上传 tar.gz 到 Generic Package Registry、上传 .deb 到 Debian Registry(stable/main),并用 python3 生成描述创建 Gitea Release。 2. [.gitea/workflows/release.yml](.gitea/workflows/release.yml) 仅由 tag 推送触发:校验 tag 与 [VERSION](VERSION) 一致,双架构原生构建 → tar.gz → DEB → artifact 汇总 → SHA256SUMS → Generic/Debian Registry → Gitea Release。
关键点: 关键点:
- **musl fully-static(Alpine 构建,勿改回 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 fully-static(Alpine 构建,勿改回 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 库)均已删除。 - **为何用 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`)**跳过**省体积/时间。 - 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,勿回退**。 - **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,勿回退**。上游 v4.18.1 换用新 Tari 数据格式,合并挖矿需 Tari 节点 v6.0.0+。
- **boringssl 来源**:`WITH_GRPC=ON` 时由 grpc 子模块(`third_party/boringssl-with-bazel`)提供,grpc.cmake 走此分支、**不再** `add_subdirectory(cmake/ssl)`(那是 `elseif (WITH_TLS)` 分支);p2pool 主体 TLS 与下方 curl 共用这一份 boringssl。 - **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 会断此能力,勿回退。 - **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.16"`(**纯数字、无 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.16`)。 - **版本号约定**:根目录 [VERSION](VERSION) 是唯一版本来源,内容为纯数字、无 `v`(当前 `4.18.1`,兼容两段或三段版本号)。上游 p2pool git tag 带 `v`,构建时补回后传给 Dockerfile;tar.gz、DEB 和 Registry 路径使用纯数字版本。发布 tag 可带或不带 `v`,归一后必须与 VERSION 完全一致。
- 架构映射:Dockerfile 内 `arm64→ARCH_ID=aarch64`、`amd64→ARCH_ID=x86_64`(传给 p2pool cmake,控制 RandomX 优化)。 - 架构映射: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 为纯数字)。 - tar.gz 下载 URL 形如 `https://gitea.bcde.io/api/packages/wangdefa/generic/p2pool/{version}/p2pool-{arch}-linux-static-{version}.tar.gz`(version 为纯数字)。
@@ -41,7 +41,7 @@ p2pool 是 Monero 去中心化矿池的 sidechain 节点。本项目对上游唯
```bash ```bash
# 本地编译某架构的二进制(输出到 ./output/linux_<arch>/p2pool) # 本地编译某架构的二进制(输出到 ./output/linux_<arch>/p2pool)
docker buildx build --platform linux/amd64 \ docker buildx build --platform linux/amd64 \
--build-arg P2POOL_VERSION=v4.16 \ --build-arg P2POOL_VERSION="v$(cat VERSION)" \
--output type=local,dest=./output \ --output type=local,dest=./output \
-f docker/Dockerfile . -f docker/Dockerfile .
@@ -49,10 +49,10 @@ docker buildx build --platform linux/amd64 \
ldd output/linux_amd64/p2pool ldd output/linux_amd64/p2pool
# 用已有 tar.gz 打 .deb 包(第三个参数是 tar.gz) # 用已有 tar.gz 打 .deb 包(第三个参数是 tar.gz)
./debian/build-deb.sh amd64 4.16 p2pool-amd64-linux-static-4.16.tar.gz ./debian/build-deb.sh amd64 4.18.1 p2pool-amd64-linux-static-4.18.1.tar.gz
``` ```
无单元测试;CI 唯一冒烟是解包后跑 `p2pool --help`(musl 纯静态可在 glibc runner 直接运行),并用 `ldd` 校验为纯静态。 CI 对二进制执行 `p2pool --version`、`p2pool --help` 和内置 `p2pool --test`,用 `ldd` 校验为纯静态,并检查 DEB 内的二进制、默认配置和 systemd 服务。
## Debian 包布局与服务 ## Debian 包布局与服务
+13 -9
View File
@@ -14,6 +14,8 @@ P2Pool 是 [SChernykh/p2pool](https://github.com/SChernykh/p2pool) 的定制打
支持架构 `amd64` / `arm64`;musl 纯静态,任意 Linux 发行版(Debian/Ubuntu/Alpine/CentOS 等)开箱即跑。静态构建仍保留 `--rpc-ssl`(连外部 SSL monerod 节点)与内置 gRPC(`--merge-mine tari://...` 与 Tari 合并挖矿)。 支持架构 `amd64` / `arm64`;musl 纯静态,任意 Linux 发行版(Debian/Ubuntu/Alpine/CentOS 等)开箱即跑。静态构建仍保留 `--rpc-ssl`(连外部 SSL monerod 节点)与内置 gRPC(`--merge-mine tari://...` 与 Tari 合并挖矿)。
P2Pool v4.18.1 要求连接 **Monero daemon v0.18.5.1 或更高版本**;与 Tari 合并挖矿要求 **Tari 节点 v6.0.0 或更高版本**(v4.18.1 换用新的 Tari 数据格式)。
## 安装 ## 安装
### APT(Debian / Ubuntu) ### APT(Debian / Ubuntu)
@@ -46,24 +48,24 @@ sudo apt-get update && sudo apt-get install p2pool
```bash ```bash
curl -fSL -o p2pool.tar.gz \ curl -fSL -o p2pool.tar.gz \
https://gitea.bcde.io/api/packages/wangdefa/generic/p2pool/4.16/p2pool-amd64-linux-static-4.16.tar.gz https://gitea.bcde.io/api/packages/wangdefa/generic/p2pool/4.18.1/p2pool-amd64-linux-static-4.18.1.tar.gz
tar -xzf p2pool.tar.gz tar -xzf p2pool.tar.gz
./p2pool --params-file params.conf # 配置模板见仓库 conf/params.conf.example ./p2pool --params-file params.conf # 配置模板见仓库 conf/params.conf.example
``` ```
## 构建与发布 ## 构建与发布
CI 定义于 [.gitea/workflows/ci.yaml](.gitea/workflows/ci.yaml): Gitea Actions 分为两条流水线:
- **push 到 `main`/`develop`**:矩阵 `arch=[amd64,arm64]`,在原生 runner 上用 Docker(musl 纯静态)编译为 tar.gz 并打 `.deb`。 - [.gitea/workflows/ci.yml](.gitea/workflows/ci.yml):分支推送时检查版本、配置和 shell 语法,并在 amd64、arm64 原生 runner 上编译、运行内置测试和验证 DEB 包内容。
- **打 tag**:产物上传到 Generic / Debian 包仓库并创建 Release。 - [.gitea/workflows/release.yml](.gitea/workflows/release.yml):tag 推送时构建 tar.gz 和 DEB,生成 `SHA256SUMS`,上传包仓库并创建或更新 Release。
本地构建: 本地构建:
```bash ```bash
# 编译某架构二进制(输出到 ./output/linux_<arch>/p2pool) # 编译某架构二进制(输出到 ./output/linux_<arch>/p2pool)
docker buildx build --platform linux/amd64 \ docker buildx build --platform linux/amd64 \
--build-arg P2POOL_VERSION=v4.16 \ --build-arg P2POOL_VERSION="v$(cat VERSION)" \
--output type=local,dest=./output \ --output type=local,dest=./output \
-f docker/Dockerfile . -f docker/Dockerfile .
@@ -71,15 +73,17 @@ docker buildx build --platform linux/amd64 \
ldd output/linux_amd64/p2pool ldd output/linux_amd64/p2pool
# 用产物 tar.gz 打 .deb # 用产物 tar.gz 打 .deb
./debian/build-deb.sh amd64 4.16 p2pool-amd64-linux-static-4.16.tar.gz ./debian/build-deb.sh amd64 4.18.1 p2pool-amd64-linux-static-4.18.1.tar.gz
``` ```
## 版本号约定 ## 版本号约定
- **上游源码 git tag** 带 `v`(如 `v4.16`),CI 用 `P2POOL_VERSION=v${PACKAGE_VERSION}` 检出。 - 根目录 [VERSION](VERSION) 是唯一版本来源,使用不带 `v` 的版本号。
- **包版本**(tar.gz / deb / registry 路径)一律用数字(如 `4.16`),符合 Debian 版本规范。 - **上游源码 git tag** 带 `v`(如 `v4.18.1`),CI 构建时自动补回。
- **包版本**(tar.gz / deb / registry 路径)一律用数字(如 `4.18.1`),符合 Debian 版本规范。
- 发布 tag 可写成 `4.18.1` 或 `v4.18.1`,去掉 `v` 后必须与 VERSION 一致。
发版只需改 ci.yaml 的 `PACKAGE_VERSION`。 发版时先更新 VERSION 并提交,再创建同版本 tag。
## 目录结构 ## 目录结构
+1
View File
@@ -0,0 +1 @@
4.18.1
+4 -1
View File
@@ -1,6 +1,6 @@
# P2Pool Configuration File Example # P2Pool Configuration File Example
# Copy this file to /etc/p2pool/params.conf and edit as needed # Copy this file to /etc/p2pool/params.conf and edit as needed
# Compatible with: p2pool v4.16+ # Compatible with: p2pool v4.17+
# ============================================================================= # =============================================================================
# Monero Node Connection (REQUIRED) # Monero Node Connection (REQUIRED)
@@ -85,6 +85,7 @@ local-api = true
# Merge Mining (Optional) # Merge Mining (Optional)
# ============================================================================= # =============================================================================
# Tari merge mining (this build includes gRPC, so tari:// is supported) # Tari merge mining (this build includes gRPC, so tari:// is supported)
# v4.18.1+: requires Tari node v6.0.0 or newer (new Tari merge mining data format).
# Format: tari://<tari_node_ip>:<port> <tari_wallet_address> # Format: tari://<tari_node_ip>:<port> <tari_wallet_address>
# merge-mine = tari://127.0.0.1:18142 YOUR_TARI_WALLET_ADDRESS # merge-mine = tari://127.0.0.1:18142 YOUR_TARI_WALLET_ADDRESS
# #
@@ -112,6 +113,8 @@ loglevel = 3
# Performance Tuning (Advanced) # Performance Tuning (Advanced)
# ============================================================================= # =============================================================================
# in-peers = 10 # in-peers = 10
# Maximum incoming localhost P2P connections (v4.17+)
# in-peers-localhost = 10
# out-peers = 10 # out-peers = 10
# ============================================================================= # =============================================================================
+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 4.16 p2pool-amd64-linux-static-4.16.tar.gz" echo "Example: $0 amd64 4.18.1 p2pool-amd64-linux-static-4.18.1.tar.gz"
exit 1 exit 1
fi fi