Apt Cache
01README
Install and operate Apt-Cacher NG on a Linux host over SSH and point apt clients at it: one managed server fragment plus per-distribution mirror backends, client proxy configuration with conflict detection and rollback, hit/miss and byte statistics, and removal. One model type serves any host: the SSH target and inputs arrive per call, and state is keyed by the target.
02Behaviors
@randybias/apt-cachev2026.10.17.1apt_cache.ts
fn install_server()
Install apt-cacher-ng non-interactively with the HTTP-tunnel debconf prompt answered no. Idempotent: an already-installed package is adopted and its version read. Returns the host and version.
fn render_server()
READ-ONLY. Render the managed server fragment and backend files with their SHA-256 and persist the render. Deterministic; no host is contacted.
fn apply_server()
Write the managed fragment and backend files, restart apt-cacher-ng only when they changed, and verify the service, the listen socket and an HTTP fetch. Idempotent: identical bytes mean no write and no restart.
fn remove_server()
DESTRUCTIVE. Stop and disable apt-cacher-ng, remove the managed fragment and backend files, and remove the package (purge only with purge_cache_ack, which also deletes the cache directory). Re-running on a host with nothing installed is a clean no-op.
fn get()
READ-ONLY. Report service state, listen sockets, a config digest, cache size and filesystem free space, and persist the observation.
fn sync()
READ-ONLY. Re-render the managed fragment, compare it with the live file, flag a PassThroughPattern the model did not render, and persist the observation.
fn stats()
READ-ONLY. Read the apt-cacher request log over SSH for hit/miss counts and bytes over a window, plus cache size and free space, and persist the observation. Matches the maintenance page's log analysis without invoking Count Data; fails closed on an unrecognised log.
fn configure_client()
Write the managed apt snippet on a client, verify it with apt-config dump and optionally apt-get update, and persist the client state. Refuses a conflicting proxy file without override_existing_ack and a policy that disagrees with a recorded server for the proxy host.
fn client_get()
READ-ONLY. Report the effective Acquire::*::Proxy values on a client, whether the managed snippet is the one in force, and any conflicting file, and persist the observation.
fn unconfigure_client()
Remove the managed apt snippet and auto-detect script and verify apt no longer uses the managed proxy. Re-running when nothing is present is a clean no-op.
Resources
server(infinite)— Recorded Apt-Cacher NG server state for one host
client(infinite)— Recorded apt proxy client state for one host
observation(7d)— Last read-only observation for one host
render(7d)— Last rendered server configuration for one input set
03Stats
A
93 / 100
Downloads
2
Archive size
139.2 KB
- Has README or module doc2/2earned
- README has a code example1/1earned
- README is substantive1/1earned
- Most symbols documented1/1earned
- No slow types (deprecated)1/1earned
- Dependencies pass trust audit2/2earned
- Has description1/1earned
- Platform support declared (or universal)2/2earned
- License1/2partial
no SPDX license declared
- Verified public repository2/2earned
deno-command1 accepted
Spawns a subprocess with Deno.Command().
- models/_lib/ssh.ts:505 — no reason given
05Platforms
06Labels