Debian Repository Manager for multi-distribution package management
Project description
Debian Repository Manager (debrepomanager)
A system for managing multiple Debian-like repositories with support for multiple distributions, architectures, and package collections, featuring atomic updates and GitHub Actions integration.
Features
- ๐ Atomic updates via aptly snapshots
- ๐ Multi-codename: bookworm, noble, trixie, jammy, etc.
- ๐๏ธ Multi-architecture: amd64, arm64, riscv64
- ๐ฆ Multi-component: various package collections
- ๐ GPG signing for all repositories
- ๐งน Retention policies: automatic cleanup of old versions
- ๐ค GitHub Actions: CI/CD pipeline integration
- ๐ Verification: repository consistency checks
- ๐ Dual format: old and new APT URL formats support
- ๐ Release lifecycle: integrated
release add/removecommands (v0.4.0) - ๐ Environment isolation: stable/beta/test with
--environment(v0.4.0) - โ๏ธ Dynamic nginx: auto-updated configuration (v0.3.7)
Architecture
Built on top of aptly with:
- Multi-root isolation (separate aptly root per codename)
- Snapshots for atomic operations
- Python CLI for easy management
- GitHub Actions for automation
See ARCHITECTURE.md for detailed description.
Requirements
Server
- aptly >= 1.5.0
- gpg (GnuPG) >= 2.2
- Python >= 3.11
- rsync (for GitHub Actions)
- SSH server (for GitHub Actions)
Development
- Python >= 3.11 (tested on 3.11, 3.12, 3.13)
- pip
- virtualenv (recommended)
- Docker (for integration tests)
Installation
From PyPI
pip install debrepomanager
From source
git clone https://github.com/jethome-iot/repomanager.git
cd repomanager
pip install -e .
For development
git clone https://github.com/jethome-iot/repomanager.git
cd repomanager
# Create virtual environment
python3 -m venv venv
source venv/bin/activate
# Install dependencies
pip install -e ".[dev]"
# Run tests
pytest
Quick Start
# Add new release
debrepomanager release add bookworm
# Add packages with environment isolation
debrepomanager add --environment stable --codename bookworm --package-dir /path/to/packages/
# Or traditional way
debrepomanager add --codename bookworm --component jethome-tools --package-dir /path/to/packages/
# List repositories
debrepomanager list
# Remove old release
debrepomanager release remove bullseye --backup --confirm
See also: QUICK_START.md for 5-minute getting started guide.
Configuration
Auto-Detection (Recommended)
debrepomanager automatically finds configuration files:
# No --config needed! Searches standard locations:
# 1. /etc/debrepomanager/config.yaml
# 2. ~/.debrepomanager/config.yaml
# 3. ./config.yaml
debrepomanager list
debrepomanager create-repo --codename bookworm --component jethome-tools
Configuration Priority
Priority (low โ high):
/etc/debrepomanager/config.yaml- System-wide~/.debrepomanager/config.yaml- User-level./config.yaml- Local directory--config path- Explicit overrideREPOMANAGER_*env vars - Highest priority
Minimal Configuration
Create ~/.debrepomanager/config.yaml:
gpg:
key_id: "YOUR_GPG_KEY_ID"
aptly:
root_base: "/srv/aptly"
publish_base: "/srv/repo/public"
repositories:
architectures: [amd64, arm64, riscv64]
Note: Codenames and components are created dynamically - no need to list them!
Environment Variables
export REPOMANAGER_APTLY_ROOT_BASE=/custom/path
export REPOMANAGER_GPG_KEY_ID=TESTKEY123
debrepomanager list
See docs/CONFIG.md and config.yaml.example for all options.
Usage
Release Management (v0.4.0+)
Add New Release
# Add new release with default components
debrepomanager release add trixie
# Add with custom components
debrepomanager release add oracular \
--components jethome-tools \
--components jethome-desktop
Remove Old Release
# Remove with backup (safe)
debrepomanager release remove bullseye --backup --confirm
# Remove without backup
debrepomanager release remove jammy --no-backup --force --confirm
Environment Isolation (v0.4.0+)
Upload to Different Environments
# Stable (production)
debrepomanager add --environment stable \
--codename bookworm \
--package-dir /path/to/packages/
# Beta (testing)
debrepomanager add --environment beta \
--codename bookworm \
--package-dir /path/to/packages/
# Test (development)
debrepomanager add --environment test \
--codename bookworm \
--package-dir /path/to/packages/
Environment URLs:
- Stable:
http://repo.site.com/ - Beta:
http://repo.site.com/beta/ - Test:
http://repo.site.com/test/
Legacy Scripts (Deprecated in v0.4.0)
โ ๏ธ The following scripts are deprecated and will be removed in v0.5.0:
scripts/repoaddโ Usedebrepomanager add --environmentscripts/add-release.shโ Usedebrepomanager release addscripts/remove-release.shโ Usedebrepomanager release remove
See MIGRATION.md for migration guide.
Symlink Management
Check and fix symlinks for dual format APT support:
# Check all symlinks
debrepomanager fix-symlinks --check-only
# Fix all symlinks
debrepomanager fix-symlinks
# Fix specific codename
debrepomanager fix-symlinks --codename trixie
Create repository
debrepomanager create-repo --codename bookworm --component jethome-tools
Add packages
# Add specific packages
debrepomanager add --codename bookworm --component jethome-tools \
--packages package1.deb package2.deb
# Add all packages from directory
debrepomanager add --codename bookworm --component jethome-tools \
--package-dir /path/to/packages/
List repositories and packages
# List all repositories
debrepomanager list
# List repositories for specific codename
debrepomanager list --codename bookworm
# List packages in repository
debrepomanager list --codename bookworm --component jethome-tools
Delete repository
# With confirmation
debrepomanager delete-repo --codename bookworm --component old-component --confirm
# Quick delete (for scripts)
debrepomanager delete-repo --codename bookworm --component old-component --yes
Retention and cleanup
# Check what would be removed (dry-run)
debrepomanager cleanup --codename bookworm --component jethome-tools
# Apply cleanup
debrepomanager cleanup --codename bookworm --component jethome-tools --apply
Client Configuration
Supported APT URL Formats (v0.3.7+)
Both old and new formats work simultaneously:
# New format (recommended)
deb http://repo.site.com/bookworm jethome-tools main
# Old format (backward compatibility via nginx)
deb http://repo.site.com bookworm jethome-tools
Requirements for old format: Nginx rewrite rules (see NGINX_OLD_FORMAT.md)
Debian Bookworm
# Import GPG key
wget -qO - http://repo.site.com/pubkey.gpg | \
sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/jethome.gpg
# Add repository (new format - recommended)
echo "deb http://repo.site.com/bookworm jethome-tools main" | \
sudo tee /etc/apt/sources.list.d/jethome.list
# Or old format (if nginx configured)
echo "deb http://repo.site.com bookworm jethome-tools" | \
sudo tee /etc/apt/sources.list.d/jethome.list
# Update
sudo apt update
# Install packages
sudo apt install your-package
Ubuntu Noble
# Import GPG key
wget -qO - http://repo.site.com/pubkey.gpg | \
sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/jethome.gpg
# Add repository
echo "deb http://repo.site.com/noble jethome-tools main" | \
sudo tee /etc/apt/sources.list.d/jethome.list
# Update
sudo apt update
Dual Format Support
The system supports both old and new APT URL formats simultaneously:
Old format (backward compatibility):
deb http://repo.site.com bookworm jethome-tools
New format (recommended):
deb http://repo.site.com/bookworm jethome-tools main
Both formats work simultaneously via symlinks. See DUAL_FORMAT.md for technical details.
Repository URL Structure
Repositories are accessible via:
http://repo.site.com/{codename}/{component}
Examples:
http://repo.site.com/bookworm/jethome-tools
http://repo.site.com/noble/jethome-armbian
http://repo.site.com/trixie/jethome-bookworm
Development
Project Structure
debrepomanager/
โโโ debrepomanager/ # Main package
โ โโโ __init__.py
โ โโโ cli.py # CLI interface
โ โโโ aptly.py # Aptly wrapper
โ โโโ config.py # Configuration management
โ โโโ gpg.py # GPG operations
โ โโโ utils.py # Utilities
โโโ tests/ # Tests
โโโ docs/ # Documentation
โโโ .github/workflows/ # GitHub Actions
โโโ config.yaml.example # Configuration example
Running Tests
# All tests
pytest
# With coverage
pytest --cov=debrepomanager --cov-report=html
# Specific module
pytest tests/test_config.py
# Verbose
pytest -v
Code Quality
Project uses:
- Black for formatting (spaces, not tabs)
- flake8 for linting
- mypy for type checking
# Format
black debrepomanager/
# Lint
flake8 debrepomanager/
# Type check
mypy debrepomanager/
Documentation
Quick Reference
- ๐ Quick Start - Get started in 5 minutes
- ๐ Command Cheat Sheet - Command reference
- ๐ Common Workflows - Typical scenarios
- ๐ Migration Guide - Upgrade from v0.3.x to v0.4.0
For Users
- Deployment Guide - Complete deployment instructions
- APT Configuration - Client setup for all systems
- Release Lifecycle - Managing releases
For Administrators
- Configuration Reference - Detailed config options
- Nginx Configuration - Old format APT support
- Multi-Environment Setup - stable/beta/test environments
- Dual Format Support - Old and new URL formats
For Developers
- Architecture - Architecture decisions
- Development Guide - Developer workflow
- GPG Key Rotation - Zero-downtime key rotation
- Changelog - Version history
Troubleshooting
GPG signing fails
# Check key availability
gpg --list-secret-keys
# Check gpg-agent
gpg-connect-agent 'keyinfo --list' /bye
# Restart gpg-agent
gpgconf --kill gpg-agent
gpg-connect-agent /bye
Aptly errors
# Check repository status
debrepomanager list
# Check snapshots (via aptly directly)
aptly -config /srv/aptly/bookworm/aptly.conf snapshot list
# Check published repositories
aptly -config /srv/aptly/bookworm/aptly.conf publish list
Permission issues
# Check permissions
ls -la /srv/aptly/
ls -la /srv/repo/public/
# Fix permissions
chown -R repomanager:repomanager /srv/aptly/
chown -R www-data:repomanager /srv/repo/public/
chmod -R g+w /srv/aptly/ /srv/repo/public/
GitHub Actions Integration
For CI/CD workflows, configure GitHub Secrets:
SSH_PRIVATE_KEY: SSH key for server accessSSH_HOST: Server address (e.g., repo.site.com)SSH_USER: SSH user (e.g., repomanager)GPG_PRIVATE_KEY: GPG private key (base64 encoded)GPG_PASSPHRASE: GPG key passwordGPG_KEY_ID: GPG key ID
See Quick Start Guide for GitHub Actions examples.
License
MIT License - see LICENSE
Authors
JetHome Team
Contributing
Pull requests are welcome! Please make sure to:
- Add tests for new functionality
- Update documentation
- Follow code style (black, flake8)
- Ensure all tests pass
Links
- Documentation: docs/
- PyPI: https://pypi.org/project/debrepomanager/
- Issues: https://github.com/jethome-iot/repomanager/issues
- Discussions: https://github.com/jethome-iot/repomanager/discussions
Project Status
- Version: 0.4.0
- Status: Production Ready
- Tests: 300+ tests, 80%+ coverage
- Python: 3.11, 3.12, 3.13 supported
What's New in v0.4.0
- โ
Release management commands:
debrepomanager release add/remove - โ
Environment isolation:
--environment stable/beta/test - โ Auto-component generation: from directory name
- โ ๏ธ Deprecated: bash scripts (use Python CLI instead)
- ๐ Enhanced documentation: CHEATSHEET, WORKFLOWS, MIGRATION guides
Made with โค๏ธ by JetHome Team
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file debrepomanager-0.4.0.tar.gz.
File metadata
- Download URL: debrepomanager-0.4.0.tar.gz
- Upload date:
- Size: 233.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02164d09fd6774b39af80cb21d6f9c48dfd5dfc1fad5037b5657b63bb333fcb7
|
|
| MD5 |
04743d5ea738d8fa3e3b8d1ac5e0a5a6
|
|
| BLAKE2b-256 |
c47454f197c6f0f1ebac1802cb401914186ab260f7d6fd6e8652267f46d9bacc
|
File details
Details for the file debrepomanager-0.4.0-py3-none-any.whl.
File metadata
- Download URL: debrepomanager-0.4.0-py3-none-any.whl
- Upload date:
- Size: 125.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d760c4e4cde496a17d2a87e34c38d93676cd9b671603bb0baff22870803f58e5
|
|
| MD5 |
8fa376a12ea7dc52d951e82414577e5a
|
|
| BLAKE2b-256 |
fc71b1752afaf7edf2cd761e7bb84776d0a540ac2347c57959b851d15b3a0a76
|