Merge pull request 'pkg-cache: host package cache opt-in (default OFF) + origin fallback health check' (#68) from feat/pkgcache-host-optin into trunk
Cloud Apache Container / plan (push) Successful in 4s
Cloud Apache Container / Shell-Checks (push) Failing after 1m47s
Cloud Apache Container / Build-Shared-OLS (push) Successful in 3m2s
Cloud Apache Container / Build-LiteSpeed-Images (82) (push) Successful in 5m50s
Cloud Apache Container / Build-LSPHP-Images (82) (push) Successful in 6m2s
Cloud Apache Container / Build-Shared-httpd (push) Successful in 6m0s
Cloud Apache Container / Build-LiteSpeed-Images (83) (push) Successful in 5m27s
Cloud Apache Container / Build-LiteSpeed-Images (84) (push) Successful in 5m14s
Cloud Apache Container / Build-LiteSpeed-Images (85) (push) Successful in 5m59s
Cloud Apache Container / Build-LSPHP-Images (83) (push) Successful in 6m29s
Cloud Apache Container / Build-LSPHP-Images (84) (push) Successful in 6m25s
Cloud Apache Container / Build-LSPHP-Images (85) (push) Successful in 6m31s
Cloud Apache Container / Build-FPM-Images (82) (push) Successful in 17m55s
Cloud Apache Container / Build-and-Push (82) (push) Successful in 19m15s
Cloud Apache Container / Build-and-Push (83) (push) Successful in 16m18s
Cloud Apache Container / Build-FPM-Images (83) (push) Successful in 16m7s
Cloud Apache Container / Build-FPM-Images (84) (push) Successful in 10m16s
Cloud Apache Container / Build-FPM-Images (85) (push) Successful in 9m45s
Cloud Apache Container / Build-and-Push (84) (push) Successful in 14m43s
Cloud Apache Container / Build-and-Push (85) (push) Successful in 14m34s
Cloud Apache Container / Build-FPM-Images (86) (push) Successful in 9m55s
Cloud Apache Container / Build-and-Push (86) (push) Successful in 11m57s
Cloud Apache Container / plan (push) Successful in 4s
Cloud Apache Container / Shell-Checks (push) Failing after 1m47s
Cloud Apache Container / Build-Shared-OLS (push) Successful in 3m2s
Cloud Apache Container / Build-LiteSpeed-Images (82) (push) Successful in 5m50s
Cloud Apache Container / Build-LSPHP-Images (82) (push) Successful in 6m2s
Cloud Apache Container / Build-Shared-httpd (push) Successful in 6m0s
Cloud Apache Container / Build-LiteSpeed-Images (83) (push) Successful in 5m27s
Cloud Apache Container / Build-LiteSpeed-Images (84) (push) Successful in 5m14s
Cloud Apache Container / Build-LiteSpeed-Images (85) (push) Successful in 5m59s
Cloud Apache Container / Build-LSPHP-Images (83) (push) Successful in 6m29s
Cloud Apache Container / Build-LSPHP-Images (84) (push) Successful in 6m25s
Cloud Apache Container / Build-LSPHP-Images (85) (push) Successful in 6m31s
Cloud Apache Container / Build-FPM-Images (82) (push) Successful in 17m55s
Cloud Apache Container / Build-and-Push (82) (push) Successful in 19m15s
Cloud Apache Container / Build-and-Push (83) (push) Successful in 16m18s
Cloud Apache Container / Build-FPM-Images (83) (push) Successful in 16m7s
Cloud Apache Container / Build-FPM-Images (84) (push) Successful in 10m16s
Cloud Apache Container / Build-FPM-Images (85) (push) Successful in 9m45s
Cloud Apache Container / Build-and-Push (84) (push) Successful in 14m43s
Cloud Apache Container / Build-and-Push (85) (push) Successful in 14m34s
Cloud Apache Container / Build-FPM-Images (86) (push) Successful in 9m55s
Cloud Apache Container / Build-and-Push (86) (push) Successful in 11m57s
This commit was merged in pull request #68.
This commit is contained in:
commit
4c988758cc
5 files changed
+397
-34
No files matched your search
+37
-12
@@ -217,17 +217,45 @@ Applied to every job here (Build-and-Push, FPM, Shared-httpd, Shared-OLS, LiteSp
|
||||
The script is canonical here (`.gitea/scripts/resolve-base-image.sh`); other repos
|
||||
carry byte-identical copies.
|
||||
|
||||
## WHP hosts (`scripts/host/pkgcache-host-repos.sh`)
|
||||
## WHP hosts (`scripts/host/pkgcache-host-repos.sh`) — opt-in, default OFF
|
||||
|
||||
`pkgcache-host-repos.sh apply https://192.168.1.40` does the following:
|
||||
- backs up every `/etc/yum.repos.d/*.repo` to `/root/pkgcache-repo-backup-<UTC>/`;
|
||||
- installs the name-constrained CA as a system anchor;
|
||||
- rewrites the AlmaLinux, EPEL and Remi sections to `baseurl=<cache>/... <origin>/...`;
|
||||
- comments out mirrorlist/metalink in those sections;
|
||||
- sets `gpgcheck=1`, plus `repo_gpgcheck=1` for AlmaLinux and Remi.
|
||||
The package cache is **not** part of the stock WHP setup. A host uses the
|
||||
distro repos unless its server setting turns the cache on. The setting is
|
||||
`/etc/pkgcache-host.conf` (template: `scripts/host/conf.example`):
|
||||
|
||||
`revert [DIR]` restores byte-identical files (verified on AL9 and AL10) and
|
||||
removes the anchor. `status` shows the current state.
|
||||
```
|
||||
PKGCACHE_ENABLED=0 # 1 = use the cache; absent file = off
|
||||
PKGCACHE_URL=https://<cache host>
|
||||
PKGCACHE_CA=/path/to/ca.crt # default: pkg-cache-ca.crt next to the script
|
||||
```
|
||||
|
||||
No cache host name is built into the tool or the defaults.
|
||||
|
||||
- `pkgcache-host-repos.sh sync` makes the host match the setting: ON runs `apply` and installs the health timer, OFF runs `revert` and removes it.
|
||||
- `apply [URL]` (URL defaults to `PKGCACHE_URL`; without a URL it refuses while the setting is OFF):
|
||||
- backs up every `/etc/yum.repos.d/*.repo` to `/root/pkgcache-repo-backup-<UTC>/`;
|
||||
- installs the CA as a system anchor;
|
||||
- rewrites the AlmaLinux, EPEL and Remi sections to `baseurl=<cache>/... <origin>/...`;
|
||||
- comments out mirrorlist/metalink in those sections;
|
||||
- sets `gpgcheck=1`, plus `repo_gpgcheck=1` for AlmaLinux and Remi;
|
||||
- installs and enables `pkgcache-host-health.timer`.
|
||||
- `revert [DIR]` restores byte-identical files (verified on AL9 and AL10), removes the anchor and the timer, and works from either mode below.
|
||||
- `status` shows the setting, the **mode** (`cache-first`, `origin-only`, `off`), the timer and the health counters.
|
||||
|
||||
**Health check** (`pkgcache-host-health.sh`, timer every 5 min, only while ON). It fetches
|
||||
`repodata/repomd.xml` and `repomd.xml.asc` of a managed repo through the cache (5 s connect, 10 s total;
|
||||
HTTP 200, non-empty, a real PGP signature). The `.asc` is what broke on 2026-11-26.
|
||||
- 2 failures in a row: the managed lines become origin-only. The cache-first line stays above as `#pkgcache-cachefirst baseurl=...`, so the change is exactly reversible.
|
||||
- 3 successes in a row: cache-first again.
|
||||
- If the origin fails the same probe, the host or the internet is down, not the cache: nothing is counted.
|
||||
- Only lines of the exact managed shape are touched. Each file is rewritten to a temp file in the same directory and `rename(2)`d under a lock, so a running dnf sees the old or the new file, never half of one.
|
||||
- Transitions are logged to the journal (`journalctl -t pkgcache-host-health`).
|
||||
|
||||
**Hosts already configured by the old tool** (before the setting existed) keep working: their
|
||||
repos are already cache-first with the origin as 2nd URL. They have no health timer and no
|
||||
`/etc/pkgcache-host.conf`, so `sync` treats them as OFF and would revert them. To keep them
|
||||
on the cache, write the config with `PKGCACHE_ENABLED=1` first. To take them off, run `revert`.
|
||||
**Before the first `sync` on the canary (192.168.1.148, which must keep using the cache)**, write `/etc/pkgcache-host.conf` there with `PKGCACHE_ENABLED=1`, `PKGCACHE_URL=https://192.168.1.40` and `PKGCACHE_CA=<path to ca.crt>`. A `sync` without that file reverts it to the stock repos.
|
||||
|
||||
**Why not "cache first, mirrorlist as fallback":** measured on AL10, with
|
||||
mirrorlist/metalink left in place dnf **ignores `baseurl` completely** (0 cache
|
||||
@@ -244,9 +272,6 @@ requests). The origin as second baseurl is the fallback dnf really performs.
|
||||
| cache **down** (nginx stopped): makecache --refresh / download | rc=0 **16 s** / rc=0 24 s, served by origin |
|
||||
| cache **silently dropped** (iptables DROP): makecache --refresh / download | rc=0 **225 s** / rc=0 59 s (dnf's 30 s connect timeout per attempt) |
|
||||
|
||||
**Datacenter hosts** (whp01, whp02, sdbees, TrueSelfCA) cannot reach
|
||||
192.168.1.40 and are **not configured**. That needs CT130 on NetBird (see the
|
||||
report: setup key / route pending).
|
||||
|
||||
## Operating the cache (CT130)
|
||||
|
||||
|
||||
Reference in new issue
Block a user