Skip to content

Configuration reference

GoAPTCacher parses YAML at startup. Unknown YAML keys are currently ignored, so spelling mistakes may silently leave a field at its zero value. Compare changes with this reference and inspect startup logs after every restart.

Complete example

yaml
cache_directory: "/var/cache/goaptcacher"
listen_port: 8090
listen_port_secure: 8091
alternative_ports:
  - 3142

domains:
  - "archive.ubuntu.com"
  - "security.ubuntu.com"
  - ".debian.org"

passthrough_domains:
  - "esm.ubuntu.com"

overrides:
  ubuntu_server: "archive.ubuntu.com"
  debian_server: "deb.debian.org"

remap:
  - from: "/legacy/dists/stable/InRelease"
    to: "/debian/dists/stable/InRelease"

https:
  prevent: false
  intercept: false
  cert: "/etc/goaptcacher/intermediate-ca.crt"
  key: "/etc/goaptcacher/intermediate-ca.key"
  password: ""
  certificate_domain: "cache.example.com"
  aia_address: "http://cache.example.com:8090/_goaptcacher/goaptcacher.crt"
  enable_crl: false

index:
  enable: true
  hostnames:
    - "cache.example.com"
  contact: "<a href=\"mailto:infra@example.com\">Infrastructure team</a>"

mdns: false

expiration:
  unused_days: 90

debug:
  enable: false
  allow_remote: false
  log_interval_seconds: 60
  pprof:
    enable: false
    directory: "/var/cache/goaptcacher/pprof"
    interval_seconds: 60
    retain: 48

Do not configure interception key fields unless interception is enabled. Do not copy example domains without confirming the repositories your clients actually use.

Top-level options

KeyTypeDefaultDescription
cache_directorystring./cacheRoot for cached objects, sidecars, statistics, CRL, and default pprof directory. CACHE_DIR overrides it.
listen_portinteger8090Primary HTTP proxy and operations listener.
listen_port_secureinteger8091 when interception startsDirect TLS listener used only with HTTPS interception.
alternative_portsinteger listemptyAdditional HTTP listeners with identical behavior; 3142 is conventional for apt-cacher compatibility.
domainsstring listemptyAllowed hostname suffixes eligible for caching.
passthrough_domainsstring listemptyAllowed hostname suffixes that bypass caching and interception.
mdnsbooleanfalseAnnounce the APT proxy service on the local multicast domain.

If both domain lists are empty, all hosts are accepted but cacheable methods bypass storage. Passthrough wins when a host matches both lists.

index

KeyTypeDefaultDescription
index.enablebooleanfalseDeclares the overview feature enabled and changes startup messaging. Current routes remain available regardless of this value.
index.hostnamesstring listemptyHostnames shown in UI-generated proxy and DNS examples. The first non-empty value is preferred.
index.contactstringemptyTrusted administrator-supplied HTML rendered in the web interface footer.

overrides

KeyTypeDefaultDescription
overrides.ubuntu_serverstringemptyReplacement host, optionally with path prefix, for hosts ending in archive.ubuntu.com. Do not include a scheme.
overrides.debian_serverstringemptyReplacement host, optionally with path prefix, for Debian FTP mirrors and supported deb.debian.org paths. Do not include a scheme.

See Domain and mirror routing for exact host/path behavior and safe cache migration.

remap

remap is a list of objects:

KeyTypeRequiredDescription
remap[].fromstringyesComplete request path to match exactly.
remap[].tostringyesReplacement path.

The current implementation compares r.URL.Path, not hostname or full URL, and does not perform prefix replacement.

https

KeyTypeDefaultDescription
https.preventbooleanfalseReject allowed CONNECT requests with 403.
https.interceptbooleanfalseTerminate client TLS, generate per-host certificates, and run normal cache logic for HTTPS.
https.certstringemptyPEM CA certificate used to sign generated leaf certificates; required for interception.
https.keystringemptyPEM RSA or ECDSA private key matching cert; required for interception.
https.passwordstringemptyPassword for a supported encrypted PEM key.
https.certificate_domainstringemptyFallback certificate domain and basis for automatically derived AIA/CRL URLs.
https.aia_addressstringderived only when certificate_domain is setExplicit AIA URL embedded in generated leaf certificates.
https.enable_crlbooleanfalseGenerate and serve a CRL. Generation requires certificate_domain.

Interception starts both CONNECT interception on HTTP listeners and the direct TLS listener. prevent takes precedence for CONNECT; avoid enabling both settings.

expiration

KeyTypeDefaultDescription
expiration.unused_daysunsigned integer0Delete cached objects whose recorded last use is older than this many days. 0 disables expiration.

The cleanup loop begins five seconds after startup and then runs every 12 hours.

debug

KeyTypeDefaultDescription
debug.enablebooleanfalseEnable periodic runtime logging plus debug JSON and live pprof HTTP routes.
debug.allow_remotebooleanfalsePermit debug HTTP routes from non-loopback source addresses.
debug.log_interval_secondsinteger60 when debug is enabledInterval for runtime/memory log lines.
debug.pprof.enablebooleanfalseWrite periodic heap and goroutine profiles to disk.
debug.pprof.directorystring<cache_directory>/pprof when pprof is enabledProfile output directory.
debug.pprof.interval_secondsinteger60 when pprof is enabledFile capture interval.
debug.pprof.retaininteger0Number of .pprof files to retain; 0 retains all. Two files are created per interval.

All pprof defaults are applied only when both debug and periodic pprof are enabled. Live pprof HTTP handlers require only debug.enable.

Configuration path and overrides

SourcePrecedenceMeaning
--config PATH or -c PATHhighestYAML file path
CONFIGfallbackYAML file path
./config.yamldefaultYAML file path relative to the working directory
CACHE_DIRfield overrideReplaces cache_directory after YAML parsing

The package service sets CONFIG=/etc/goaptcacher/config.yaml and uses /etc/goaptcacher as its working directory. The container works in /config.

Reload behavior

No live reload or signal-based reload is implemented. Restart the process after every change:

bash
sudo systemctl restart goaptcacher
sudo journalctl -u goaptcacher -n 100 --no-pager

Startup fails for unreadable or syntactically invalid YAML and for unusable interception key material. Other invalid combinations may fail only when a listener or feature starts, so test changes before rollout.

Released under the MIT License.