deb-mock/dev_notes/apt_cache_integration.md
robojerk 20947d240e
Some checks failed
Build and Publish Debian Package / build-deb (push) Failing after 2s
Build Deb-Mock Package / build (push) Successful in 53s
Test Deb-Mock Build / test (push) Successful in 53s
add APT cache server integration documentation
2025-08-04 00:59:52 +00:00

3.3 KiB

APT Cache Server Integration

This document describes the integration of your APT cache server (http://192.168.1.79:3142) with the Deb-Mock CI/CD workflows.

Overview

The CI/CD workflows now use your APT cache server to speed up package installations and reduce bandwidth usage during builds.

Configuration

APT Cache Server Setup

Your APT cache server is configured at:

  • URL: http://192.168.1.79:3142
  • Type: apt-cacher-ng (based on the /acng-report.html endpoint)
  • Status: Available and accessible

CI/CD Integration

The APT cache is configured in all CI/CD workflows:

- name: Install build dependencies
  run: |
    # Configure APT to use your cache server
    echo 'Acquire::http::Proxy "http://192.168.1.79:3142";' | sudo tee /etc/apt/apt.conf.d/99proxy
    echo 'Acquire::https::Proxy "http://192.168.1.79:3142";' | sudo tee -a /etc/apt/apt.conf.d/99proxy
    
    sudo apt update
    sudo apt install -y build-essential devscripts debhelper dh-python python3-all python3-setuptools
    sudo apt install -y sbuild schroot debootstrap

Workflows Using APT Cache

  1. build-deb.yml: Package building workflow
  2. test.yml: Testing workflow
  3. build.yml: Basic build workflow

Benefits

1. Speed Improvements

  • Faster package downloads during CI/CD runs
  • Reduced build times for subsequent runs
  • Cached packages don't need to be downloaded again

2. Bandwidth Savings

  • Reduces external bandwidth usage
  • Local caching of frequently used packages
  • Efficient for multiple builds

3. Reliability

  • Reduces dependency on external package mirrors
  • Faster recovery from network issues
  • Consistent package availability

Monitoring

Cache Server Status

You can monitor your cache server at:

CI/CD Logs

The CI/CD logs will show:

  • APT cache configuration messages
  • Package download speeds
  • Cache hit/miss statistics (if available)

Troubleshooting

Common Issues

  1. Cache Server Unavailable

    • CI/CD will fall back to direct downloads
    • Builds will still succeed but may be slower
  2. Cache Misses

    • New packages will be downloaded and cached
    • Subsequent builds will benefit from caching
  3. Configuration Errors

    • APT will ignore invalid proxy settings
    • Builds will continue with direct downloads

Debug Commands

# Test cache server connectivity
curl -I http://192.168.1.79:3142/acng-report.html

# Check APT proxy configuration
cat /etc/apt/apt.conf.d/99proxy

# Test package download through cache
sudo apt update

Future Enhancements

Potential Improvements

  1. Cache Statistics Integration

    • Display cache hit rates in CI/CD logs
    • Monitor cache effectiveness
  2. Fallback Configuration

    • Automatic fallback to direct downloads
    • Health checks for cache server
  3. Cache Warming

    • Pre-download common packages
    • Optimize cache for Deb-Mock builds

References