Overview
The copr-frontend is the main web interface for the Copr build system. It is a Flask-based application that provides:- Web UI for managing build projects and submissions
- RESTful APIs (v1, v2, and v3) for programmatic access
- User authentication via OpenID, FAS, and OIDC
- Build monitoring and status tracking
- Repository configuration generation
Key Technologies
Key Technologies
- Framework: Flask (Python 3)
- Database: PostgreSQL with SQLAlchemy ORM
- Caching: Redis with Flask-Caching
- Search: Whooshee for full-text search
- Authentication: Flask-OpenID, OIDC (Authlib)
- Session: Flask-Session with Redis backend
Directory Structure
Key Modules and Responsibilities
Core Application (coprs/)
Core Application (coprs/)
Application Initialization (__init__.py)
Sets up the Flask application with all necessary extensions:Models (models.py)
Defines database models:- Copr: Project/repository definition
- Build: Build task representation
- Package: Source package metadata
- CoprChroot: Enabled build targets (fedora-39-x86_64, etc.)
- User: User accounts and permissions
- Action: Backend actions (createrepo, delete, etc.)
Views (views/)
Route handlers organized by namespace:coprs_ns/: Web UI for projects and buildsapiv3_ns/: REST API v3 endpointsadmin_ns/: Administrative interfacebackend_ns/: Backend communication endpointsstatus_ns/: Build queue and status pages
Logic (logic/)
Business logic separated from view layer:coprs_logic.py: Project operationsbuilds_logic.py: Build submission and managementactions_logic.py: Backend action generationpackages_logic.py: Package management
Database Models
Database Models
Configuration
Main Configuration File
Main Configuration File
API Endpoints
Web UI Features
User Dashboard
- Projects overview
- Recent builds
- Build statistics
- Repository instructions
Project Management
- Create/edit/delete projects
- Configure build chroots
- Manage external repositories
- Set build options (timeouts, network access, etc.)
- Package webhooks integration
Build Management
- Submit builds from various sources:
- Direct SRPM URLs
- Git repositories (with Tito, Make, Mock SCM)
- PyPI packages
- RubyGems
- DistGit
- Monitor build progress
- View build logs (live and archived)
- Rebuild packages
- Delete builds
Repository Configuration
- Generate
.repofiles - GPG key distribution
- Enable/disable chroots
- Repository metadata
Cron Jobs
Scheduled Tasks
Scheduled Tasks
Database Migrations
Using Alembic
Using Alembic
Frontend uses Alembic for schema migrations:
Development Commands
Logging
Log Locations
Log Locations
- Main log:
/var/log/copr-frontend/frontend.log - Access log:
/var/log/httpd/copr_access_log - Error log:
/var/log/httpd/copr_error_log
/etc/logrotate.d/copr-frontendDependencies
Core Python Packages
python3-flask- Web frameworkpython3-sqlalchemy- ORMpython3-flask-sqlalchemy- Flask-SQLAlchemy integrationpython3-flask-restx- REST API with Swaggerpython3-wtforms- Form handling and validationpython3-flask-wtf- Flask-WTForms integrationpython3-flask-whooshee- Full-text searchpython3-redis- Redis clientpython3-requests- HTTP librarypython3-copr-common- Shared Copr utilities
Authentication
python3-authlib- OIDC supportpython3-python-ldap- LDAP authentication
Optional
python3-fedmsg- Fedora messaging (legacy)python3-copr-messaging- Fedora messaging (modern)