Переглянути джерело

apt-mirror2 migration complete

Denys Bashkatov 3 тижнів тому
батько
коміт
b8517de178
4 змінених файлів з 78 додано та 12 видалено
  1. 5 1
      Dockerfile
  2. 30 5
      data/conf/apt-mirror/mirror.list
  3. 19 3
      scripts/mirror-sync.sh
  4. 24 3
      setup.sh

+ 5 - 1
Dockerfile

@@ -13,10 +13,14 @@ RUN apt-get update && apt-get install -y \
     npm \
     xz-utils \
     net-tools \
+    bzip2 \
+    gzip \
+    unzip \
+    ca-certificates \
     && rm -rf /var/lib/apt/lists/*
 
 # Install apt-mirror from PyPI (using --break-system-packages for Ubuntu 24.04)
-RUN pip3 install --break-system-packages apt-mirror
+RUN pip3 install --break-system-packages apt-mirror uvloop
 
 # Create necessary directories
 RUN mkdir -p /var/spool/apt-mirror \

+ 30 - 5
data/conf/apt-mirror/mirror.list

@@ -1,5 +1,5 @@
-# apt-mirror configuration for mirror.root
-# Generated on неділя, 29 червня 2025 18:34:37 +0300
+# apt-mirror2 configuration for mirror.root
+# Generated on понеділок, 14 липня 2025 10:35:31 +0300
 
 # Set base_path to the directory where you want to store the mirror
 set base_path    /var/spool/apt-mirror
@@ -26,23 +26,48 @@ set postmirror_script $var_path/postmirror.sh
 set run_postmirror 0
 
 # Set nthreads to the number of threads to use
-set nthreads     2
+set nthreads     4
 
 # Set _tilde to 1 to download tilde files
 set _tilde 0
 
-# Ubuntu 24.04 (Noble Numbat) repositories
+# Set timeout for downloads (in seconds)
+set _timeout 300
+
+# Set retry count for failed downloads
+set _retry 3
+
+set release_files_retries 15
+
+# Set download speed limit (in bytes per second, 0 = unlimited)
+set _limit_rate 0
+
+# Set user agent for downloads
+set _user_agent "apt-mirror2/14"
+
+# Set number of connections per host
+set _max_connections 10
+
+ignore_errors
+
+# Ubuntu 24.04 (Noble Numbat) repositories - AMD64 architecture
 deb http://archive.ubuntu.com/ubuntu noble main restricted universe multiverse
 deb http://archive.ubuntu.com/ubuntu noble-updates main restricted universe multiverse
 deb http://archive.ubuntu.com/ubuntu noble-security main restricted universe multiverse
 deb http://archive.ubuntu.com/ubuntu noble-backports main restricted universe multiverse
 
-# Debian 12 (Bookworm) repositories
+# Debian 12 (Bookworm) repositories - AMD64 and ARM64 architectures
 deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
 deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
 deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
 deb http://deb.debian.org/debian bookworm-backports main contrib non-free non-free-firmware
 
+# Debian ARM64 repositories (additional packages)
+deb-arm64 http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
+deb-arm64 http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
+deb-arm64 http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
+deb-arm64 http://deb.debian.org/debian bookworm-backports main contrib non-free non-free-firmware
+
 # Clean up old packages
 clean http://archive.ubuntu.com/ubuntu
 clean http://deb.debian.org/debian

+ 19 - 3
scripts/mirror-sync.sh

@@ -52,8 +52,12 @@ do_sync() {
     # Create lock file
     create_lock
     
-    # Run apt-mirror2 using Python version
-    if apt-mirror "$MIRROR_CONFIG" 2>&1 | tee -a "$MIRROR_LOG"; then
+    # Set environment variables for better performance
+    export PYTHONUNBUFFERED=1
+    export PYTHONIOENCODING=utf-8
+    
+    # Run apt-mirror2 using Python version with timeout
+    if timeout 7200 apt-mirror "$MIRROR_CONFIG" 2>&1 | tee -a "$MIRROR_LOG"; then
         log "Sync completed successfully"
         
         # Update symlink to ensure web server sees latest data
@@ -64,8 +68,20 @@ do_sync() {
         
         # Update last sync timestamp
         date > /var/spool/apt-mirror/last-sync.txt
+        
+        # Log sync completion statistics
+        log "Sync completed at $(date)"
+        if [ -d "/var/spool/apt-mirror/mirror" ]; then
+            local total_size=$(du -sh /var/spool/apt-mirror/mirror 2>/dev/null | cut -f1)
+            log "Total mirror size: $total_size"
+        fi
     else
-        log "ERROR: Sync failed"
+        local exit_code=$?
+        if [ $exit_code -eq 124 ]; then
+            log "ERROR: Sync timed out after 2 hours"
+        else
+            log "ERROR: Sync failed with exit code $exit_code"
+        fi
         remove_lock
         return 1
     fi

+ 24 - 3
setup.sh

@@ -241,23 +241,44 @@ set postmirror_script \$var_path/postmirror.sh
 set run_postmirror 0
 
 # Set nthreads to the number of threads to use
-set nthreads     20
+set nthreads     10
 
 # Set _tilde to 1 to download tilde files
 set _tilde 0
 
-# Ubuntu 24.04 (Noble Numbat) repositories
+# Set timeout for downloads (in seconds)
+set _timeout 300
+
+# Set retry count for failed downloads
+set _retry 3
+
+# Set download speed limit (in bytes per second, 0 = unlimited)
+set _limit_rate 0
+
+# Set user agent for downloads
+set _user_agent "apt-mirror2/14"
+
+# Set number of connections per host
+set _max_connections 10
+
+# Ubuntu 24.04 (Noble Numbat) repositories - AMD64 architecture
 deb http://archive.ubuntu.com/ubuntu noble main restricted universe multiverse
 deb http://archive.ubuntu.com/ubuntu noble-updates main restricted universe multiverse
 deb http://archive.ubuntu.com/ubuntu noble-security main restricted universe multiverse
 deb http://archive.ubuntu.com/ubuntu noble-backports main restricted universe multiverse
 
-# Debian 12 (Bookworm) repositories
+# Debian 12 (Bookworm) repositories - AMD64 and ARM64 architectures
 deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
 deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
 deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
 deb http://deb.debian.org/debian bookworm-backports main contrib non-free non-free-firmware
 
+# Debian ARM64 repositories (additional packages)
+deb-arm64 http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
+deb-arm64 http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
+deb-arm64 http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
+deb-arm64 http://deb.debian.org/debian bookworm-backports main contrib non-free non-free-firmware
+
 # Clean up old packages
 clean http://archive.ubuntu.com/ubuntu
 clean http://deb.debian.org/debian