1
0

feat(forgejo-runner): restructure forgejo-runner app and add english documentation

- rename `forgejo-runner-dind` app directory to `forgejo-runner` to consolidate versions
- delete old standalone `forgejo-runner-dind` app files (README.md, data.yml, logo.png)
- move existing `12.6.2-dind` version files under the new unified `forgejo-runner` app
- update configuration for both DooD and DinD deployment modes within the unified app
- add new `README_en.md` file with english documentation
- update main `README.md` with improved product introduction and clearer version comparison
- add `PRIVILEGED` mode configuration option to data.yml
- update docker-compose files for both versions with refined environment variable usage and labels
- standardize service names and container naming conventions
This commit is contained in:
pooneyy
2026-01-27 03:07:16 +08:00
parent c1c361eda0
commit dff3669784
13 changed files with 111 additions and 215 deletions

View File

@@ -0,0 +1,85 @@
additionalProperties:
formFields:
- default: "false"
edit: true
envKey: PRIVILEGED
labelEn: "Privilege Mode: Manually enabled for permission issues"
labelZh: "特权模式: 遇到权限问题时手动启用"
label:
en: Privilege Mode
zh: 特权模式
description:
en: Manually enabled for permission issues
zh: 遇到权限问题时手动启用
required: false
type: select
values:
- label: "启用 Enabled"
value: "true"
- label: "禁用 Disabled"
value: "false"
- default: http://1.2.3.4:3000
edit: true
envKey: FORGEJO_INSTANCE_URL
labelEn: Forgejo Instance
labelZh: Forgejo 实例
required: true
rule: paramExtUrl
type: text
label:
en: Forgejo Instance
ja: Forgejo インスタンス
ms: Instans Forgejo
pt-br: Instância Forgejo
ru: Экземпляр Forgejo
ko: Forgejo 인스턴스
zh-Hant: Forgejo 實例
zh: Forgejo 实例
- default: '<registration_token>'
edit: true
envKey: RUNNER_REGISTRATION_TOKEN
labelEn: Registration Token
labelZh: 注册令牌
required: true
type: text
label:
en: Registration Token
ja: 登録トークン
ms: Token Pendaftaran
pt-br: Token de Registro
ru: Токен регистрации
ko: 등록 토큰
zh-Hant: 註冊令牌
zh: 注册令牌
- default: '<runner_name>'
edit: true
envKey: RUNNER_NAME
labelEn: Runner Name
labelZh: 运行器名称
required: true
type: text
label:
en: Runner Name
ja: ランナー名
ms: Nama Pelari
pt-br: Nome do Runner
ru: Имя бегуна
ko: 러너 이름
zh-Hant: 執行器名稱
zh: 运行器名称
- default: '<runner_labels>'
edit: true
envKey: RUNNER_LABELS
labelEn: Runner Labels
labelZh: 运行器标签
required: true
type: text
label:
en: Runner Labels
ja: ランナータグ
ms: Label Pelari
pt-br: Rótulos do Runner
ru: Метки бегуна
ko: 러너 레이블
zh-Hant: 執行器標籤
zh: 运行器标签

View File

@@ -0,0 +1,43 @@
services:
forgejo-runner:
image: code.forgejo.org/forgejo/runner:12.6.2
container_name: ${CONTAINER_NAME}
depends_on:
dind:
condition: service_started
links:
- dind
restart: always
user: 1000:1000
command: /data/scripts/register.sh
volumes:
- ./data/runner-data:/data
- ./scripts/register.sh:/data/scripts/register.sh:ro
environment:
- DOCKER_HOST=tcp://dind:2375
- FORGEJO_INSTANCE_URL=${FORGEJO_INSTANCE_URL}
- RUNNER_REGISTRATION_TOKEN=${RUNNER_REGISTRATION_TOKEN}
- RUNNER_NAME=${RUNNER_NAME}
- RUNNER_LABELS=${RUNNER_LABELS}
networks:
- 1panel-network
labels:
createdBy: Apps
dind:
image: docker:29.1.5-dind
container_name: ${CONTAINER_NAME}-dind
privileged: ${PRIVILEGED}
restart: unless-stopped
command: ['dockerd', '-H', 'tcp://0.0.0.0:2375', '--tls=false']
environment:
DOCKER_TLS_CERTDIR: ""
volumes:
- ./data/dind-data:/var/lib/docker
- ./data/daemon.json:/etc/docker/daemon.json:ro
networks:
- 1panel-network
labels:
createdBy: Apps
networks:
1panel-network:
external: true

View File

@@ -0,0 +1,47 @@
#!/bin/bash
set -e
mkdir -p data
cd data
## ----------------------------
## Runner 数据目录及权限设置
## ----------------------------
mkdir -p runner-data
touch runner-data/.runner
touch runner-data/config.yml
mkdir -p runner-data/.cache
# 设置权限为 forgejo-runner 镜像中默认用户UID 1000
chown -R 1000:1000 runner-data
chmod 775 runner-data/.runner
chmod 775 runner-data/.cache
chmod g+s runner-data/.runner
chmod g+s runner-data/.cache
## ----------------------------
## Docker-in-Docker 数据目录
## ----------------------------
mkdir -p dind-data
## ----------------------------
## daemon.json 镜像加速配置
## ----------------------------
if [ -f /etc/docker/daemon.json ]; then
cp /etc/docker/daemon.json ./daemon.json
else
cat > ./daemon.json <<EOF
{
"registry-mirrors": [
"https://docker.1panel.live",
"https://docker.1ms.run"
]
}
EOF
fi
cd ..
chmod +x ./scripts/register.sh

View File

@@ -0,0 +1,24 @@
#!/bin/sh
set -e
# 等待 dockerd 可用
echo "⏳ Waiting for Docker daemon on dind..."
until curl -s http://dind:2375/_ping | grep -q "OK"; do
sleep 1
done
echo "✅ Docker daemon is ready."
cd /data
if [ ! -s .runner ]; then
echo ">>> Registering runner..."
forgejo-runner register --no-interactive \
--instance "$FORGEJO_INSTANCE_URL" \
--token "$RUNNER_REGISTRATION_TOKEN" \
--name "$RUNNER_NAME" \
--labels "$RUNNER_LABELS"
forgejo-runner generate-config > config.yml
fi
echo ">>> Starting daemon..."
exec forgejo-runner --config config.yml daemon

View File

@@ -1,5 +1,23 @@
additionalProperties:
formFields:
- default: "false"
edit: true
envKey: PRIVILEGED
labelEn: "Privilege Mode: Manually enabled for permission issues"
labelZh: "特权模式: 遇到权限问题时手动启用"
label:
en: Privilege Mode
zh: 特权模式
description:
en: Manually enabled for permission issues
zh: 遇到权限问题时手动启用
required: false
type: select
values:
- label: "启用 Enabled"
value: "true"
- label: "禁用 Disabled"
value: "false"
- default: http://1.2.3.4:3000
edit: true
envKey: FORGEJO_INSTANCE_URL
@@ -21,7 +39,7 @@ additionalProperties:
edit: true
envKey: RUNNER_REGISTRATION_TOKEN
labelEn: Registration Token
labelZh: Registration Token
labelZh: 注册令牌
required: true
type: text
label:
@@ -37,7 +55,7 @@ additionalProperties:
edit: true
envKey: RUNNER_NAME
labelEn: Runner Name
labelZh: Runner Name
labelZh: 运行器名称
required: true
type: text
label:
@@ -53,7 +71,7 @@ additionalProperties:
edit: true
envKey: RUNNER_LABELS
labelEn: Runner Labels
labelZh: Runner Labels
labelZh: 运行器标签
required: true
type: text
label:

View File

@@ -1,16 +1,17 @@
services:
forgejo_runner:
forgejo-runner:
image: code.forgejo.org/forgejo/runner:12.6.2
container_name: ${CONTAINER_NAME:-forgejo-runner}
container_name: ${CONTAINER_NAME}
privileged: ${PRIVILEGED}
restart: always
user: root
command: "/data/scripts/register.sh"
command: /data/scripts/register.sh
volumes:
- ./data:/data
- ./scripts/register.sh:/data/scripts/register.sh:ro
- /var/run/docker.sock:/var/run/docker.sock # 使用宿主机 Docker
- /var/run/docker.sock:/var/run/docker.sock
environment:
- DOCKER_HOST=unix:///var/run/docker.sock # 指定宿主机 socket
- DOCKER_HOST=unix:///var/run/docker.sock
- FORGEJO_INSTANCE_URL=${FORGEJO_INSTANCE_URL}
- RUNNER_REGISTRATION_TOKEN=${RUNNER_REGISTRATION_TOKEN}
- RUNNER_NAME=${RUNNER_NAME}
@@ -18,8 +19,7 @@ services:
networks:
- 1panel-network
labels:
createdBy: "Apps"
createdBy: Apps
networks:
1panel-network:
external: true

View File

@@ -1,66 +1,22 @@
# Forgejo Actions Runner
## 产品介绍
**Forgejo Actions Runner** 是 Forgejo 的官方运行器组件,用于执行 CI/CD 工作流中的各类任务。它与 Forgejo Actions 系统集成,支持本地或远程运行任务,帮助用户构建自动化 DevOps 流程
Forgejo Runner 是一个守护进程,用于连接到 Forgejo 实例并运行持续集成 (CI) 作业。该项目是 Forgejo 生态系统的一部分,旨在为 Forgejo 用户提供类似 GitHub Actions 的自动化工作流能力。其核心价值在于为自托管的 Forgejo 实例提供原生的 CI/CD 功能,目标用户是需要自动化构建、测试和部署流程的开发团队和组织,特别是在需要自托管解决方案的场景中
适合希望**完全自托管** CI/CD 流水线的个人或组织部署使用。
## 主要功能
## ✨ 特性
- **持续集成作业执行**: 作为守护进程连接到 Forgejo 实例,自动拉取并执行工作流中定义的 CI/CD 任务,支持开发者实现自动化构建、测试和部署流程。
- 与 Forgejo Actions 完全集成
- 支持自定义容器或直接在主机运行
- 多 Runner 支持并行执行
- 支持 amd64 / arm64 等架构
- 简单易用,部署轻量
- **多架构支持**: 目前正式支持在基于 Linux 内核的操作系统上运行,涵盖 `amd64``arm64` 架构,并提供二进制文件和容器镜像,同时正在积极开发对其他架构 (如 s390x、powerpc64le、riscv64 和 Windows) 的支持。
## ⚙️ 快速开始Docker 部署)
- **与 Forgejo 深度集成**: 作为 Forgejo 的原生 Actions 运行器,能够无缝集成到 Forgejo 的工作流系统中,用户可以通过 Forgejo 界面配置和管理自动化任务。
### 1. 启动 Forgejo 主服务(略)
## 配置和使用说明
确保 Forgejo 主程序已部署并启用了 Actions 功能
### 2. 运行 Action Runner 容器
```bash
docker run -d --name forgejo-runner \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /opt/runner:/data \
codeberg.org/forgejo/runner:latest
```
### 3. 初始化注册
首次运行后,进入容器进行注册:
```bash
docker exec -it forgejo-runner forgejo-runner register
```
你需要提供:
- **Forgejo 实例 URL**(例如 `https://git.example.com`
- **Runner Token**(从仓库或组织设置中获取)
- **运行模式**Docker / shell 等)
- **标签**(可选,便于任务调度)
## 🔄 自动启动示例Docker Compose
```yaml
version: '3'
services:
forgejo-runner:
image: codeberg.org/forgejo/runner:latest
container_name: forgejo-runner
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./runner-data:/data
restart: unless-stopped
```
## 📘 文档与资源
- 项目主页https://forgejo.org/docs/latest/admin/actions/
- 源码仓库https://code.forgejo.org/forgejo/runner
## 🧑‍🤝‍🧑 关于 Forgejo Runner
Forgejo Runner 是社区主导的 CI 执行器,致力于提供安全、可控、可扩展的构建环境。它是 Forgejo 构建完整 DevOps 生态的重要组成部分。
- **选择版本**: 现提供两种版本,常规版本 (下称 DooD 版本) 与 DinD 版本
- DooD 版权限更高,与宿主机共享 docker 环境遇到需要在工作流中使用容器的情况DooD 版本可以在宿主机管理 Runner 中的容器;
- DinD 版安全性更强docker 环境与宿主机完全独立,基本没有越权;
- 当 DinD 版本下运行某些 action 权限不足时,请先尝试启用特权模式,若仍报错,再尝试使用 DooD 版。
- **Forgejo 实例 URL**: (例如 `https://git.example.com`)
- **注册令牌**: 从 Create new runner 按钮中获取,仅用于 Runner 实例,需要区别于个人访问令牌 (PAT)
- **运行器名称**: 区分不同 Runner 实例的唯一标识符,同一命名空间 (仓库或组织) 下不允许重复
- **运行器标签**: 用于标记 Runner 实例,工作流中可以根据标签选择 Runner 执行任务,同一个标签可以绑定多个 Runner 实例

View File

@@ -0,0 +1,20 @@
## Introduction
Forgejo Runner is a daemon process used to connect to a Forgejo instance and run continuous integration (CI) jobs. This project is part of the Forgejo ecosystem and aims to provide Forgejo users with automation workflow capabilities similar to GitHub Actions. Its core value lies in offering native CI/CD functionality for self-hosted Forgejo instances. The target users are development teams and organizations that require automated build, test, and deployment processes, especially in scenarios where self-hosted solutions are needed.
## Features
- **Continuous Integration Job Execution**: Connects to a Forgejo instance as a daemon process, automatically pulls and executes CI/CD tasks defined in workflows, enabling developers to automate build, test, and deployment processes.
- **Multi-Architecture Support**: Officially supports running on Linux kernel-based operating systems, covering `amd64` and `arm64` architectures. Provides binary files and container images. Active development is underway for support of other architectures (such as s390x, powerpc64le, riscv64) and Windows.
- **Deep Integration with Forgejo**: As a native Actions runner for Forgejo, it seamlessly integrates into Forgejo's workflow system, allowing users to configure and manage automated tasks via the Forgejo interface.
## Configuration and Usage Instructions
- **Choose a Version**: Two versions are currently available: the regular version (referred to as the DooD version) and the DinD version.
- The DooD version has higher privileges and shares the Docker environment with the host machine. When workflows require container usage, the DooD version can manage containers within the Runner on the host machine.
- The DinD version offers stronger security, with a Docker environment completely isolated from the host machine, minimizing privilege escalation risks.
- If certain actions encounter insufficient permissions under the DinD version, first try enabling privileged mode. If errors persist, consider switching to the DooD version.
- **Forgejo Instance URL**: (e.g., `https://git.example.com`)
- **Registration Token**: Obtained from the "Create new runner" button. This token is used exclusively for the Runner instance and should differ from a Personal Access Token (PAT).
- **Runner Name**: A unique identifier to distinguish different Runner instances. Duplicate names are not allowed within the same namespace (repository or organization).
- **Runner Labels**: Used to tag Runner instances. Workflows can select a Runner based on labels to execute tasks. The same label can be assigned to multiple Runner instances.

View File

@@ -1,31 +1,30 @@
name: Forgejo Runner
name: Forgejo Actions Runner
tags:
- DevOps
title: Forgejo Actions 的 Runner
description: Forgejo Actions 的 Runner
title: Forgejo Runner 是连接 Forgejo 实例并运行持续集成作业的守护进程
description: Forgejo Runner 是连接 Forgejo 实例并运行持续集成作业的守护进程
additionalProperties:
key: forgejo-runner
name: Forgejo Runner
name: Forgejo Actions Runner
tags:
- DevOps
shortDescZh: Forgejo Actions 的 Runner
shortDescEn: A runner for Forgejo based on Forgejo fork of act
shortDescZh: Forgejo Runner 是连接 Forgejo 实例并运行持续集成作业的守护进程
shortDescEn: Forgejo Runner is a daemon process that connects to a Forgejo instance and runs continuous integration jobs
description:
en: A runner for Forgejo based on Forgejo fork of act
ja: act の Forgejo フォークに基づいた Forgejo 用ランナー
ms: Penjalank untuk Forgejo berdasarkan fork Forgejo dari act
pt-br: Um runner para Forgejo baseado no fork do Forgejo do act
ru: Раннер для Forgejo на основе форка Forgejo от act
ko: act의 Forgejo 포크를 기반으로 한 Forgejo용 러너
zh-Hant: 基於 Forgejo fork 的 act 的 Forgejo 執行器
zh: 基于 Forgejo fork 的 act 的 Forgejo 运行器
en: Forgejo Runner is a daemon process that connects to a Forgejo instance and runs continuous integration jobs
zh: Forgejo Runner 是连接 Forgejo 实例并运行持续集成作业的守护进程
zh-Hant: Forgejo Runner 是連接 Forgejo 實例並執行持續整合作業的守護行程
ja: Forgejo Runner は、Forgejo インスタンスに接続し、継続的インテグレーションジョブを実行するデーモンプロセスです
ms: Forgejo Runner ialah proses daemon yang menyambung ke contoh Forgejo dan menjalankan kerja integrasi berterusan
pt-br: Forgejo Runner é um processo daemon que se conecta a uma instância do Forgejo e executa trabalhos de integração contínua
ru: Forgejo Runner — это процесс-демон, который подключается к экземпляру Forgejo и запускает задания непрерывной интеграции
ko: Forgejo Runner는 Forgejo 인스턴스에 연결하여 지속적 통합 작업을 실행하는 데몬 프로세스입니다
type: tool
crossVersionUpdate: true
limit: 0
recommend: 0
website: https://forgejo.org/docs/latest/admin/actions/
website: https://forgejo.org
github: https://code.forgejo.org/forgejo/runner
document: https://forgejo.org/docs/latest/admin/actions/
document: https://forgejo.org/docs/latest/admin/actions
architectures:
- amd64
- arm64

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB