Woodpecker
Overview
Woodpecker CI is a lightweight, cloud-native continuous integration and deployment system built on Docker. This document covers the deployment and configuration of Woodpecker CI using Docker Compose with Traefik as a reverse proxy.
Service Details
Component | Value |
---|---|
URL | https://ci.trymondo.com |
Server Image | woodpeckerci/woodpecker-server:v3.5.2 |
Agent Image | woodpeckerci/woodpecker-agent:v3.5.2 |
Database | PostgreSQL 17 |
Services | woodpecker-server, woodpecker-agent, woodpecker-db |
Networks | woodpecker-net, traefik-net |
Authentication | GitHub OAuth |
Architecture
The deployment consists of three main components:
- Woodpecker Server: The core service that manages the UI, API, and orchestrates CI jobs
- Woodpecker Agent: Executes CI jobs in containers
- PostgreSQL Database: Stores all Woodpecker CI data
Prerequisites
- Docker Engine (24.0+)
- Docker Compose v2
- Traefik reverse proxy configured and running
- External networks:
woodpecker-net
andtraefik-net
- GitHub OAuth application
- DNS configured for
ci.trymondo.com
Configuration Preparation
GitHub OAuth Setup
- Create a GitHub OAuth application at https://github.com/settings/applications/new
- Set the callback URL to
https://ci.trymondo.com/login
- Note the Client ID and Client Secret for your
.env
file
Environment Variables
Create a .env
file with the following variables:
Deployment Configuration
Docker Compose File
Network Configuration
Before deployment, ensure the required networks exist:
Deployment Instructions
-
Create the deployment directory:
-
Create the
docker-compose.yml
and.env
files: -
Deploy the service:
-
Verify all services are running:
Traefik Integration Details
The Woodpecker server is configured with the following Traefik settings:
- Host Rule:
ci.trymondo.com
- Entrypoints: websecure (HTTPS on port 443), web (HTTP on port 80 with redirect to HTTPS)
- TLS: Enabled with production certificate resolver
- Backend Port: 8000 (Woodpecker Web UI)
- Middleware: HTTP to HTTPS redirect for enhanced security
Pipeline Configuration
Basic .woodpecker.yml Example
Create a .woodpecker.yml
file in the root of your GitHub repository:
Secrets Management
To add secrets to your Woodpecker CI projects:
- Navigate to your repository in the Woodpecker UI
- Go to Settings > Secrets
- Add required secrets (e.g.,
docker_username
,docker_password
)
Scaling and Performance
Additional Agents
To scale out CI capacity, you can add more agents:
Resource Constraints
For improved stability, consider adding resource constraints:
Maintenance
Backup Strategy
Back up Woodpecker CI regularly:
-
Database backup:
-
Volume backup using Restic/Backrest:
woodpecker-server-data
(contains server state)woodpecker-db-data
(contains database files)
Updates
To update Woodpecker CI:
-
Update the image tags in
docker-compose.yml
-
Apply the update:
-
Check logs for any issues:
Troubleshooting
Server Startup Issues
If the server fails to start:
-
Check environment variables:
-
Verify database connection:
Agent Connection Problems
If agents can’t connect to the server:
-
Check agent logs:
-
Verify agent secret is consistent between server and agent
-
Check network connectivity between containers:
GitHub Integration Issues
If GitHub integration is not working:
-
Verify OAuth callback URL is correctly set to
https://ci.trymondo.com/login
-
Check GitHub client ID and secret in environment variables
-
Examine server logs for OAuth-related errors:
Security Considerations
- Agent Secret: Use a strong, randomly generated secret for agent authentication
- Admin Access: Limit admin access to specific GitHub usernames
- Docker Socket: The agent has access to the Docker socket, which grants significant privileges
- HTTPS: Enforce HTTPS-only access through Traefik
- Network Isolation: Use separate networks for communication between services
Additional Resources
- Official Woodpecker CI Documentation
- Woodpecker CI GitHub Repository
- Traefik Documentation
- PostgreSQL Documentation