Overview
The copr-backend is the build orchestration service that:- Communicates with Frontend to fetch build tasks
- Manages builder machine allocation via Resalloc
- Dispatches builds to builders and monitors execution
- Handles repository generation with
createrepo_c - Signs packages with GPG keys
- Processes actions (createrepo, delete, fork, etc.)
- Publishes build results and logs
Key Technologies
Key Technologies
- Language: Python 3
- Builder Management: Resalloc server
- Repository Generation: createrepo_c, prunerepo
- Package Signing: obs-signd, rpm-sign
- Messaging: Fedora Messaging (AMQP)
- Task Queue: Redis
- Configuration Management: Ansible (for builder provisioning)
Architecture
Directory Structure
Core Components
Build Dispatcher
Build Dispatcher
Build Dispatcher (daemons/build.py)
Manages the build worker pool:- Fetch pending build tasks from Frontend
- Enforce worker limits (total, per-arch, per-owner)
- Spawn background workers for builds
- Monitor worker health
- Handle worker failures and timeouts
Build Worker
Build Worker
Build Worker (background_worker_build.py)
Executes individual build tasks:- Request builder from Resalloc
- SSH to builder and execute
copr-rpmbuild - Monitor build progress (live log streaming)
- Download build artifacts (RPMs, logs)
- Sign packages (via copr-keygen)
- Update repository metadata
- Notify frontend of completion
- Release builder back to pool
Action Dispatcher
Action Dispatcher
Action Dispatcher (daemons/action.py)
Handles administrative tasks:createrepo: Generate/update repository metadatadelete_build: Remove build artifactsdelete_project: Remove entire projectfork: Copy project to new locationrename: Rename projectrawhide_to_release: Branch rawhide to new releasedelete_copr_dir: Remove CoprDir (PR builds, etc.)
Repository Management
Repository Management
Repository Generation (createrepo.py)
Uses createrepo_c for efficient repository metadata generation:- Incremental updates with
--update - Module metadata support
- Comps groups integration
- Appstream metadata generation
- Batched createrepo (multiple builds at once)
Configuration
/etc/copr/copr-be.conf
/etc/copr/copr-be.conf
Systemd Services
Service Management
Service Management
Resalloc Integration
Builder Allocation
Builder Allocation
Cron Jobs
Maintenance Scripts
Useful Commands
Useful Commands
Storage Backends
Filesystem vs Pulp
Filesystem vs Pulp
Logging
Log Files
Log Files
- Build dispatcher:
/var/log/copr-backend/backend.log - Action dispatcher:
/var/log/copr-backend/backend.log - Job workers:
/var/log/copr-backend/worker-{N}.log - Prunerepo:
/var/log/copr-backend/prune_old.log
/etc/logrotate.d/copr-backendDependencies
Core Packages
python3-copr-common- Shared Copr utilitiespython3-resalloc- Resalloc clientpython3-requests- HTTP clientpython3-daemon- Daemonizationpython3-setproctitle- Process title managementpython3-redis- Redis clientpython3-boto3- AWS S3 support
External Tools
createrepo_c- Repository metadata generationprunerepo- Repository pruningobs-signd- Package signing daemonansible- Builder provisioningrsync- File synchronizationopenssh-clients- SSH communication