What is this article about?

Woodpecker is a server application which provides automated testing and build functionality for Continuous Integration (CI) of software. Woodpecker is a fork of the Drone CI from back in 2019 when Drone was open source. After that Drone went in a different direction where in the meantime essential parts of the Drone software (e.g. Drone runners) are not available with a FOSS compliant license any more. So in simple words Woodpecker is the open source alternative to Drone.io.

This article will show how to install and configure the woodpecker docker containers and how to configure Codeberg (or any other Gitea based site) to automatically use these containers for CI.

Before Woodpecker Version 0.14.0 the server needed user cridentials (username & password) to connect to Codeberg. Since Version 0.14.0 an OAuth2 authentication method is used. This article addresses Version 0.14.0 and higher.

Prerequisites

Create OAuth2 application

Prepare woodpecker containers

Let’s create a folder and within a docker-compose.yml like the following …

version: '3'

services:
  drone-server:
    image: woodpeckerci/woodpecker-server:v0.14.0
    networks:
      - woodpecker
      - web
    volumes:
      - /var/lib/drone:/var/lib/drone/
    environment:
      - DRONE_OPEN=true
      - DRONE_HOST={your woodpecker domain including "https"}
      - DRONE_GITEA=true
      - DRONE_GITEA_URL=https://codeberg.org
      - DRONE_GITEA_CLIENT={OAuth2 Client ID}
      - DRONE_GITEA_SECRET={OAuth2 Client Secret}
      - DRONE_SECRET={Random key for the communication to the agent}

    labels:
      - "traefik.docker.network=web"
      - "traefik.enable=true"
      - "traefik.http.routers.woodpecker.rule=Host(`{your woodpecker domain}`)"
      - "traefik.http.routers.woodpecker.entrypoints=https"
      - "traefik.http.routers.woodpecker.tls=true"
      - "traefik.http.routers.woodpecker.tls.certresolver=letsencrypt"
      - "traefik.http.services.woodpecker.loadbalancer.server.port=8000"
      - "traefik.http.services.woodpecker.loadbalancer.server.scheme=http"
  drone-agent:
    image: woodpeckerci/woodpecker-agent:v0.14.0
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    depends_on:
      - drone-server
    networks:
      - woodpecker
    environment:
      - DRONE_SERVER=drone-server:9000
      - DRONE_SECRET={Random key for the communication to the agent - same as above}
      - DRONE_MAX_PROCS=1

networks:
  web:
    external: true
  woodpecker:

Replace {your woodpecker domain} with your domain name. The format shall be “https://woodpecker.example.com

The random key could be any string or you create one …

openssl rand -hex 32 

The database with login infos and build results goes into “/var/lib/drone” in this example. Of course your are free to change it, use a docker volume or store it within the container (which will be replaced once you recreate your container).

That’s it … next start the container

docker-compose up 

Connect woodpecker with Codeberg

Finished

Woodpecker is now set up. You can adapt the Woodpecker settings as needed and it will change the webhooks in Codeberg in the background.