mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 02:54:26 +00:00
The ubuntu CI image build (job 103277644636) hung on Canonical's archive: apt fetched 26 MB at 417 kB/s, then 61.6 kB in 29 s, then sat on the package download until the job was cancelled after 23 minutes, while download.docker.com delivered 42.8 MB in under a second on the same runner. Locally archive.ubuntu.com and security.ubuntu.com took 20-26 s to the first byte against 2 s for a university mirror. INFINITO_APT_UBUNTU_MIRRORS in default.env is now the one list of Ubuntu mirrors, in failover order: de.archive.ubuntu.com, ftp.fau.de, ftp.halifax.rwth-aachen.de, archive.ubuntu.com. - Image builds: the Dockerfile sources the list alongside the install scripts and runs scripts/install/apt-mirrors.sh first. In an image with ubuntu.sources it points both stanzas at apt's mirror+file method, priorities in list order, and sets Acquire::http::Timeout to 10 s, so apt moves on from a mirror that fails or goes silent; other distros are untouched. In ubuntu:latest apt-get update took 8 s against 110 s on the stock sources, a dead first mirror was left behind within 25 s against 62 s on apt's defaults, and the swarm node packages (80 debs) came in 17 s. The Dockerfile's own RUN lines ran clean on ubuntu, debian, fedora and arch. - Package cache: package.sh proxies the first entry as the primary Ubuntu repos and the second as their fallback. Nexus revalidates metadata on every request here (metadataMaxAge 0), which costs a full download from a mirror without an ETag; both de.archive and ftp.fau.de send one, and the 15 MB universe index now comes back from the cache in 0.02 s. - tests/external/repository/test_apt_ubuntu_mirrors.py keeps the list honest: the first mirror must answer InRelease within 5 s (median of three) or the test names a faster later one, no mirror's -updates may lag the freshest by more than 24 h, and every entry must be the primary archive, a Canonical country alias or an enabled official mirror in Launchpad's registry. It caught the first draft of the list: mirrors.edge.kernel.org is not an official Ubuntu mirror. After pulling, an existing checkout needs `make dotenv-force`: plain `make dotenv` re-reads the old .env through BASH_ENV and keeps its values. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
16 lines
596 B
Bash
Executable File
16 lines
596 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
sources="/etc/apt/sources.list.d/ubuntu.sources"
|
|
if [[ ! -f "${sources}" ]]; then
|
|
exit 0
|
|
fi
|
|
|
|
: "${INFINITO_APT_UBUNTU_MIRRORS:?INFINITO_APT_UBUNTU_MIRRORS must be set}"
|
|
read -r -a mirrors <<<"${INFINITO_APT_UBUNTU_MIRRORS}"
|
|
|
|
mirrorlist="/etc/apt/ubuntu.mirrorlist"
|
|
printf '%s\n' "${mirrors[@]}" | awk '{ printf "%s\tpriority:%d\n", $0, NR }' >"${mirrorlist}"
|
|
printf 'Acquire::http::Timeout "10";\n' >/etc/apt/apt.conf.d/80infinito-mirrors
|
|
sed -i -E "s#^URIs: http://(archive|security)\.ubuntu\.com/ubuntu/?\$#URIs: mirror+file:${mirrorlist}#" "${sources}"
|