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

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

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

184
README.md Normal file
View File

@@ -0,0 +1,184 @@
# P2Pool Docker 构建基础设施
[![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg)]()
[![License](https://img.shields.io/badge/license-MIT-blue.svg)]()
为 [p2pool](https://github.com/SChernykh/p2pool) 提供的自动化 Docker 构建和打包系统。
## 📋 项目简介
这是一个专业的构建基础设施项目,用于自动化构建、打包和分发 p2poolMonero 去中心化矿池)的多架构二进制文件和 Debian 软件包。
**关键特性**
- 🏗️ 多架构支持amd64、arm64
- 📦 多发行版构建Alpine、Ubuntu
- 🤖 全自动 CI/CD 流程
- 🔒 禁用合并挖矿捐赠
- 📊 原生架构构建(无 QEMU
## 🚀 快速开始
### 使用 Debian 包安装(推荐)
```bash
# 1. 添加包仓库
sudo curl https://GITEA_URL/api/packages/OWNER/debian/repository.key \
-o /etc/apt/keyrings/gitea-OWNER.asc
echo "deb [signed-by=/etc/apt/keyrings/gitea-OWNER.asc] \
https://GITEA_URL/api/packages/OWNER/debian bookworm main" | \
sudo tee /etc/apt/sources.list.d/OWNER.list
# 2. 安装 P2Pool
sudo apt-get update
sudo apt-get install p2pool
# 3. 配置
sudo nano /var/lib/p2pool/params.conf
# 设置你的 Monero 钱包地址
# 4. 启动服务
sudo systemctl enable --now p2pool.service
```
详细配置说明请查看:[README-params.md](README-params.md)
### 本地构建
```bash
# Alpine 构建(推荐,体积更小)
docker buildx build --pull \
--platform linux/amd64 \
--build-arg P2POOL_VERSION=v4.13 \
--output type=local,dest=./output \
-f docker/Dockerfile.alpine .
# Ubuntu 构建
docker buildx build --pull \
--platform linux/amd64 \
--build-arg P2POOL_VERSION=v4.13 \
--output type=local,dest=./output \
-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)** - 安装和配置
## 🏗️ 构建系统
### 支持的架构和平台
| 架构 | Alpine | Ubuntu | Debian 包 |
|------|--------|--------|-----------|
| amd64 | ✅ | ✅ | ✅ |
| arm64 | ✅ | ✅ | ✅ |
### 构建产物
- **二进制包** (`tar.gz`) - 适用于所有 Linux 发行版
- **Debian 包** (`.deb`) - 适用于 Debian/Ubuntu 系统
- **多发行版支持** - Debian 12 (bookworm)、Debian 13 (trixie)
## 🔧 配置管理
本项目使用配置文件管理 P2Pool 设置,提供以下优势:
-**升级安全** - 配置文件在包升级时不会被覆盖
-**集中管理** - 所有设置在一个位置
-**易于维护** - 支持注释和版本控制
配置文件模板:[params.conf.example](params.conf.example)
## 📦 发布流程
项目使用 Gitea Actions 实现自动化 CI/CD
1. **代码推送** → 触发构建main/develop 分支)
2. **创建标签** → 触发完整发布流程
3. **自动构建** → 4 种组合2 架构 × 2 发行版)
4. **自动发布** → 上传到包注册中心
5. **创建 Release** → 附带下载链接和说明
## 🛠️ 技术栈
- **构建工具**: Docker, Docker Buildx
- **编译工具**: CMake, GCC, G++
- **依赖库**: libuv, libzmq, libcurl
- **CI/CD**: Gitea Actions
- **包管理**: dpkg, apt
## 📖 开发指南
### 更新 p2pool 版本
```bash
# 1. 编辑 CI 配置
vim .gitea/workflows/ci.yaml
# 更新 PACKAGE_VERSION 变量
# 2. 本地测试构建
docker buildx build \
--build-arg P2POOL_VERSION=vX.Y.Z \
--output type=local,dest=./output \
-f docker/Dockerfile.alpine .
# 3. 创建版本标签
git tag vX.Y.Z
git push origin vX.Y.Z
```
### 编码规范
项目遵循以下规范:
- **Shell 脚本**: 使用 `set -e`,严格参数验证
- **Dockerfile**: 多阶段构建,优化缓存利用
- **CI/CD**: 使用构建矩阵,原生架构运行器
详见:[编码规范](llmdoc/reference/coding-conventions.md) | [Git 规范](llmdoc/reference/git-conventions.md)
## 🔐 安全性
- ✅ 禁用上游合并挖矿捐赠
- ✅ 使用专用用户运行服务
- ✅ Systemd 安全加固
- ✅ 最小权限原则
- ✅ 安全的文件权限设置
## 🤝 贡献
欢迎提交 Issue 和 Pull Request
在提交 PR 前,请确保:
1. 代码符合项目编码规范
2. 更新相关文档
3. 测试所有受影响的构建配置
## 📄 许可证
本项目为上游 [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)
## 💬 支持
- 📖 查看 [文档](llmdoc/index.md)
- 🐛 提交 [Issue](../../issues)
- 💡 参考 [配置指南](README-params.md)
---
**注意**: 本仓库不包含 p2pool 源代码,仅提供构建和打包基础设施。