惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Hacker News
The Hacker News
B
Blog RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
宝玉的分享
宝玉的分享
L
LangChain Blog
Google DeepMind News
Google DeepMind News
酷 壳 – CoolShell
酷 壳 – CoolShell
F
Full Disclosure
T
The Blog of Author Tim Ferriss
月光博客
月光博客
有赞技术团队
有赞技术团队
Last Week in AI
Last Week in AI
aimingoo的专栏
aimingoo的专栏
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Stack Overflow Blog
Stack Overflow Blog
WordPress大学
WordPress大学
MongoDB | Blog
MongoDB | Blog
小众软件
小众软件
博客园 - Franky
B
Blog
博客园_首页
C
CERT Recently Published Vulnerability Notes
Hugging Face - Blog
Hugging Face - Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
K
Kaspersky official blog
I
Intezer
P
Proofpoint News Feed
博客园 - 叶小钗
S
Schneier on Security
P
Privacy & Cybersecurity Law Blog
Recorded Future
Recorded Future
NISL@THU
NISL@THU
A
Arctic Wolf
Know Your Adversary
Know Your Adversary
C
Cyber Attacks, Cyber Crime and Cyber Security
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The Register - Security
The Register - Security
C
Cisco Blogs
大猫的无限游戏
大猫的无限游戏
S
Secure Thoughts
T
The Exploit Database - CXSecurity.com
Forbes - Security
Forbes - Security
Project Zero
Project Zero
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Cisco Talos Blog
Cisco Talos Blog
D
Docker
Blog — PlanetScale
Blog — PlanetScale
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
人人都是产品经理
人人都是产品经理

Dejavu's Blog

甲骨文 ARM 实例部署 Gemma 4 模型 Headscale + Tailscale 组建虚拟专用网 在 Linux 上使用 Yubikey OpenPGP 应用 BuyVM VPS 块存储挂载教程 Alpine Linux 服务器配置指南 Alpine Linux 安装 Cloudflared Docker 多容器共享中心数据库 安装 Komari 服务器监控工具 Scaleway VPS 安装 Debian Linux Debian 13 下部署 AsmBB 论坛 使用 Kopia 自动化备份服务器数据 给 Docker 启用 IPv6 支持 Netcup 服务器安装自定义 ISO 镜像 烽火 HG5582A 光猫开启桥接模式 Docker 自托管 Shlink 短链服务 部署 Obsidian LiveSync 实时同步服务指南 我的 2025 年不完全回顾 Linux 下 Intel 核显驱动配置与硬件加速 Fedora Linux 安装配置记录 2025 年优雅地自托管 RSS 服务 Woodpecker CI 和 Gitea 实现 Hugo 自动部署 在 Blinko 中使用 Ollama 作为 AI 供应商 Docker 部署 Gitea/Forgejo Plausible CE 启用城市级地理位置识别 Blinko 开源 AI 知识库 Docker 部署指南 Netcup 免税账号注册及购买服务器全记录 Docker 自托管 Cloudreve Pro 私有网盘服务 GiffGaff SIM 卡使用体验和注意事项 简体中文互联网在变得糟糕吗? 如何低成本申请 S/MIME 证书用于个人邮件服务 迁移到 NameCrane Mail 域名邮箱套件服务 香烟与咖啡 在 Windows 中使用 Yubikey 的 OpenPGP 应用 Windows 11 IoT LTSC 养老指南 巧用浏览器生成 HAR 文件批量下载所需网页资源 聊聊静态网站的评论系统 在 Hugo 站点中优雅地展示实况照片 使用 snac 部署一个简洁优雅的 ActivityPub 实例 当 25 岁来临的时候 断网的这两年 从 Bitwarden/Vaultwarden 到 KeePassXC 也许是 Android 上最好的本地播放器 - 椒盐音乐 2023 半年小结 写一个好玩的 Hugo 货币汇率转换短代码 写一个 Hugo 短代码将不同类别的总字数统计转换为书名显示 海信 Touch Lite 墨水屏音乐阅读器的简单体验 从 Debian 11(bullseye) 无感升级到 Debian 12(bookworm) 使用 GitHub Actions 自动提交 URL 到 IndexNow 批量重写 Git 历史提交记录 使用 cgit 托管小小的也很可爱的 Git 服务器 在 Debian 上使用 stagit 和 Nginx 的简单 Git 服务器 托管简单 Git 服务器的一些尝试 使用 stagit 自托管纯静态 Git 存储库 使用 Docker 快速部署单人 Fediverse 实例 我是如何建立自己的个人博客的? 简单、隐私友好的谷歌分析替代品,Plausible 自托管部署指南 服务器使用 Cloudflare CDN 的最佳实践 甲骨文服务器分配并启用 IPv6 地址 Git 版本控制学习笔记(二) Cloudflare WAF 防护策略简易指南 Mastodon 服务器批量导入自定义表情 低成本自托管 Mastodon 实例简明指南 自托管服务指南──有了服务器可以做什么? 使用 Miniflux + RSSHub 打造个人 RSS 阅读器 构建支持多种 CPU 架构的 Docker 镜像 一个可自托管的静态短链接应用 别了,二〇二二! Duplicacy CLI 进阶使用指南 Duplicacy CLI 备份工具的基本使用 初探 Cloudflare 零信任 - 通过 Docker 部署 Bitwarden 密码管理器 Yubikey 转运日志及上手指南 初探 Cloudflare 零信任 — 通过 Cloudflare Tunnel 搭建 SSH 聊天室 初探 Cloudflare 零信任 - 通过 Cloudflare Tunnel 访问服务 某科学的 PGP 算号指南 2022 年的 MacBook Air M1 使用体验及应用推荐 使用 Vercel 和 Supabase 自托管 Cusdis 评论系统 为什么你的搜索引擎不好用? 个人在 Windows 上常用软件清单 macOS 基础开发环境设置指南 在 macOS 上使用 Canokey 的 OpenPGP 应用 提取 Windows UWP 应用商店的安装包以供离线安装 Git 版本控制学习笔记(一) 使用 Notion 管理 GitHub Star 项目 使用 Vercel 免费部署 Giscus 评论系统 将博客评论从 Utterances 无缝迁移到 Giscus Canokey 签名和认证应用指南 Canokey 的基本使用指南 Canokey Pigeon 揽件日志及简单开箱 关于 Google Play 保护机制和 DRM 安全等级的那些事 记录一次捡垃圾装机 GitHub 使用 GPG 密钥提交签名认证 使用 Scoop 管理 Windows 下的软件和开发环境 Windows Terminal+PowerShell 7 打造 Windows 下最好用的终端 一个好用的 Telegram 文件批量上传/下载工具 Clash for Windows 优雅地使用 TUN 模式接管系统流量 全平台搭建 Hexo 静态博客指南 尝试将 Manjaro 作为主力操作系统使用 Hexo 进行 SEO 优化的基本指南 使用本地代理给 Git 和 NPM 加速 使用 flowerss 部署 Telegram RSS 订阅机器人
Gitea/Forgejo 集成 Woodpecker CI/CD
Dejavu Moe · 2025-12-02 · via Dejavu's Blog

前情提要 Docker 部署 Gitea/Forgejo 个人代码托管服务

选择集成服务

Gitea/Forgejo 除了轻量还拥有强大的 CI/CD 集成支持,我暂时了解的选择项:

  • Gitea Actions: 基于 nektos/act 的分叉,称作 act runner ,是官方的默认推荐。与 GitHub Actions 高度兼容,但不适合我的实际需求;
  • Drone CI: 被商业收购后,开源版几乎停滞且充满混乱,不建议使用;
  • Woodpecker CI: Drone CI 的 OSS Fork,社区活跃,简单易用。

三者都能与 Gitea 轻松集成,最终我选择了 Woodpecker CI。

基本概念

Woodpecker CI 基本服务组成为 serveragent 及可选的 autoscaler,前两者是必需的,工作流程如下:

                        ┌──────────────────────┐
                        │   Code Hosting /     │   <-- webhooks, events
                        │   Forge (e.g. Gitea) │      push / pr / commit
                        └─────────┬────────────┘
                                  │ HTTP / Webhook
                        ┌──────────────────────┐
                        │   Woodpecker Server  │
                        │    API / Web UI      │
                        │    orchestration     │
                        └─────────┬────────────┘
                                  │ gRPC (queue / job dispatch)
         ┌────────────┬──────────────┼──────────────┬────────────┐
         │            │                             │            │
         ▼            ▼                             ▼            ▼
┌────────────────┐ ┌────────────────┐        ┌────────────────┐ (more agents …)
│ Woodpecker     │ │ Woodpecker     │        │ Woodpecker     │
│ Agent (Docker) │ │ Agent (Docker) │  …     │ Agent (K8s /   │
│                │ │                │        │ Docker / local)└────────────────┘ └────────────────┘        └────────────────┘
         │                 │                          │
         │ Executes        │ Executes                 │ Executes
         │ pipeline steps  │ pipeline steps           │ pipeline steps
(build / test / │ (build / test /          │ (build / test / 
         │  deploy etc.)   │  deploy etc.)            │  deploy etc.) 
         ▼                 ▼                          ▼
   build logs / status  build logs / status      build logs / status
         └──────────────┬──────────────┬──────────────┘
                        │  Results / statuses sent back to Server
                Server updates Web UI, sends status back to Forge

(Optional) ─────────────────────────────────────────────────────────────
(monitors queue / load)
      ┌────────────────────────────┐
      │ Woodpecker Autoscaler      │
      └────────────┬───────────────┘
                   │   dynamically spin up / down VM(s) / Agent host(s)
           New Agent(s)       <-- connect via gRPC to Server

注册 OAuth2 应用

在 Gitea 实例注册 OAuth2 应用,获取 Client IDClient Secret 备用

create-oauth2-app.webp

部署

更新 Docker 模板

在 Gitea 的 Compose 模板里,加入服务片段。对于单人实例,建议使用 SQLite 数据库,看起来就像这样:

services:
  gitea:
    image: docker.gitea.com/gitea:1.25.2-rootless
    container_name: gitea
    restart: unless-stopped
    user: "1000"
    volumes:
      - ./data:/var/lib/gitea
      - ./config:/etc/gitea
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "127.0.0.1:33033:3000"
      - "127.0.0.1:11211:2222"
    networks:
      - gitea

  woodpecker-server:
    image: woodpeckerci/woodpecker-server:v3
    container_name: woodpecker-server
    restart: unless-stopped
    depends_on:
      gitea:
        condition: service_healthy
    ports:
      - '127.0.0.1:18000:8000'
    networks:
      - gitea
    volumes:
      - ./woodpecker/server/data:/var/lib/woodpecker/
    environment:
      - WOODPECKER_OPEN=false # disable registration
      - WOODPECKER_ADMIN=${WOODPECKER_ADMIN}
      - WOODPECKER_HOST=${WOODPECKER_HOST}
      - WOODPECKER_AGENT_SECRET=${WOODPECKER_AGENT_SECRET}
      - WOODPECKER_DISABLE_VERSION_CHECK=false
      - WOODPECKER_GITEA=true
      - WOODPECKER_GITEA_URL=${WOODPECKER_GITEA_URL}
      - WOODPECKER_GITEA_SKIP_VERIFY=false
      - WOODPECKER_GITEA_CLIENT=${WOODPECKER_GITEA_CLIENT}
      - WOODPECKER_GITEA_SECRET=${WOODPECKER_GITEA_SECRET}
  woodpecker-agent:
    image: woodpeckerci/woodpecker-agent:v3
    container_name: woodpecker-agent
    restart: unless-stopped
    depends_on:
      woodpecker-server:
        condition: service_healthy
    networks:
      - gitea
    volumes:
      - ./woodpecker/agent/config:/etc/woodpecker
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - WOODPECKER_SERVER=woodpecker-server:9000
      - WOODPECKER_AGENT_SECRET=${WOODPECKER_AGENT_SECRET}
      - WOODPECKER_MAX_WORKFLOWS=2

networks:
  gitea:

准备 Docker 绑定卷

提前建立 Woodpecker 所需数据持久化目录

mkdir -p ./woodpecker/{server/data,agent/config}

设置用户组权限

sudo chown -R 1000:1000 ./woodpecker
sudo chmod -R 755 ./woodpecker

配置环境变量

  • WOODPECKER_ADMIN 对应 Gitea 实例上允许授权的用户名

  • WOODPECKER_GITEA_URL 填写 Gitea 实例 URL,如 https://git.your.domain

  • WOODPECKER_GITEA_CLIENT 是 Gitea OAuth2 应用的 Client ID

  • WOODPECKER_GITEA_SECRET 是 Gitea OAuth2 应用的 Client Secret

  • WOODPECKER_AGENT_SECRET 随机值机密,使用 openssl rand -base64 32 生成

Gitea WebHook 配置

编辑 ./data/app.ini ,设置 Gitea 允许的 WebHook 网络主机

[webhook]
ALLOWED_HOST_LIST=external,loopback

启动服务

模板和环境变量准备好后,启动服务

sudo docker compose up -d

Nginx 反向代理

下面是 Woodpecker 的 Nginx 反向代理配置示例,如果图方便和安全,更推荐使用 Cloudflare Tunnel 访问服务

server {
    listen 80;
    listen [::]:80;
    server_name woodpecker.your.domain;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    http2 on;
    server_name woodpecker.your.domain;

    ssl_certificate /path/to/cert/wild.via.moe.pem;
    ssl_certificate_key /path/to/cert/wild.via.moe.key;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ecdh_curve X25519:P-256:P-384;
    ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-CHACHA20-POLY1305:ECDHE+AES128:RSA+AES128:ECDHE+AES256:RSA+AES256';
    ssl_prefer_server_ciphers off;
    ssl_session_timeout 1d;
    ssl_session_cache shared:MozSSL:10m;

    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
    access_log /var/log/nginx/woodpecker.your.domain.access.log;
    error_log /var/log/nginx/woodpecker.your.domain.error.log;

    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header X-XSS-Protection "1; mode=block" always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header Referrer-Policy "no-referrer-when-downgrade" always;
    add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'" always;

    location / {
        proxy_pass http://127.0.0.1:18000;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-For $realip_remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_http_version 1.1;
        proxy_redirect off;
        proxy_buffering off;
        chunked_transfer_encoding off;
    }
}

将域名解析到服务器 IP,重载 Nginx 配置

sudo nginx -t
sudo nginx -s reload

授权访问

访问 Woodpecker 域名,进入 Gitea 应用授权页面

oauth.webp

授权成功,会进入 Woodpecker 管理台

woodpecker.webp

测试

最后,简单测试下 CI 是否正常工作。在存储库添加 CI 脚本 .woodpecker/ci-test.yaml

when:
  - event: push
    branch: main

steps:
  - name: node-build
    image: node:20-alpine
    commands:
      - echo "Running Node.js test..."
      - node -e 'console.log("Hello, world! from Node.js")'
      - echo "CI test success! Dejavu Moe says hello to you"

Woodpecker 添加这个存储库后,回到 Gitea 存储库任意提交一次。

ci-test.webp

在 Gitea 也可以看到它正常工作

finish.webp

一切完成!

参考资料: