Files
computer-playbook/compose/package-cache-frontend/upstreams.conf
T
kevinveenbirkenbachandClaude Opus 4.7 eb45f0ffaf feat(cache): inner-build override + TTL env-var + SPOT docs
Extend the local cache stack with three independent capabilities:

1. Inner-`dockerd` build coverage for HTTP-only package mirrors.
   `roles/sys-svc-compose/files/compose.py` (the runner's `compose`
   wrapper) auto-generates a transient `compose.cache.override.yml`
   per app when `INFINITO_PACKAGE_CACHE_FRONTEND_IP` is exported. The
   override pins `build.extra_hosts` for `deb.debian.org`,
   `archive.ubuntu.com`, and `security.ubuntu.com` to the frontend.
   `pull.py` now delegates to the wrapper so build/pull operations see
   the same `-f` set the wrapper auto-detects. nginx in the frontend
   gains a port-80 listener with path rewrites for those hostnames,
   and `package.sh` registers two new Nexus proxies
   (`apt-debian-security`, `apt-ubuntu-security`) for the security
   suites whose upstream URL prefix differs from the main archive.

   Alpine is intentionally excluded from the inner-build extra_hosts:
   3.18+ defaults to HTTPS, and inner-`dockerd` build containers do
   not import the frontend CA. Routing apk through the frontend would
   trip TLS verification.

2. General cache freshness env-var. `scripts/meta/env/cache/package.sh`
   exports `INFINITO_PACKAGE_CACHE_MAX_AGE_MIN` (default `129600`,
   i.e. 90 days). The bootstrap helper consumes it for every Nexus
   proxy's `contentMaxAge`, `metadataMaxAge`, and
   `negativeCache.timeToLive`, replacing the previous 1440-minute
   literal. Lower the value when chasing fast-moving upstreams.

3. SPOT cache documentation at `docs/contributing/environment/cache.md`.
   `compose.yml.md`, `variables.md`, the per-service READMEs, and
   `requirements/012-...` now link to it instead of restating the
   stack's behaviour. Net documentation lines drop substantially while
   the cache page becomes the single user-facing reference.

Also: code-comment cleanup per `docs/contributing/documentation.md`
guidelines across all touched .py / .sh / .yml files. Multi-paragraph
docstrings, banner separators, and restate-the-obvious comments are
removed; one-line WHY comments remain where the rationale is not
already visible in the code.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-30 01:08:41 +02:00

152 lines
3.9 KiB
Plaintext

proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Accept-Encoding "";
proxy_buffering on;
proxy_request_buffering off;
proxy_read_timeout 300s;
proxy_connect_timeout 30s;
# Docker embedded DNS, pinned to bypass image-specific resolv.conf order.
resolver 127.0.0.11 ipv6=off valid=30s;
server {
listen 80;
server_name deb.debian.org;
location /debian/ {
rewrite ^/debian/(.*)$ /repository/apt-debian/$1 break;
proxy_pass http://package-cache:8081;
}
location /debian-security/ {
rewrite ^/debian-security/(.*)$ /repository/apt-debian-security/$1 break;
proxy_pass http://package-cache:8081;
}
}
server {
listen 80;
server_name archive.ubuntu.com;
location /ubuntu/ {
rewrite ^/ubuntu/(.*)$ /repository/apt-ubuntu/$1 break;
proxy_pass http://package-cache:8081;
}
}
server {
listen 80;
server_name security.ubuntu.com;
location /ubuntu/ {
rewrite ^/ubuntu/(.*)$ /repository/apt-ubuntu-security/$1 break;
proxy_pass http://package-cache:8081;
}
}
server {
listen 80;
server_name dl-cdn.alpinelinux.org;
location /alpine/ {
rewrite ^/alpine/(.*)$ /repository/raw-alpine/$1 break;
proxy_pass http://package-cache:8081;
}
}
server {
listen 443 ssl;
server_name pypi.org;
ssl_certificate /etc/nginx/certs/pypi.org.crt;
ssl_certificate_key /etc/nginx/certs/pypi.org.key;
location / {
proxy_pass http://package-cache:8081/repository/pypi-proxy/;
}
}
server {
listen 443 ssl;
server_name files.pythonhosted.org;
ssl_certificate /etc/nginx/certs/files.pythonhosted.org.crt;
ssl_certificate_key /etc/nginx/certs/files.pythonhosted.org.key;
location / {
proxy_pass http://package-cache:8081/repository/pypi-proxy/;
}
}
server {
listen 443 ssl;
server_name registry.npmjs.org;
ssl_certificate /etc/nginx/certs/registry.npmjs.org.crt;
ssl_certificate_key /etc/nginx/certs/registry.npmjs.org.key;
location / {
proxy_pass http://package-cache:8081/repository/npm-proxy/;
}
}
server {
listen 443 ssl;
server_name rubygems.org;
ssl_certificate /etc/nginx/certs/rubygems.org.crt;
ssl_certificate_key /etc/nginx/certs/rubygems.org.key;
location / {
proxy_pass http://package-cache:8081/repository/gem-proxy/;
}
}
server {
listen 443 ssl;
server_name index.rubygems.org;
ssl_certificate /etc/nginx/certs/index.rubygems.org.crt;
ssl_certificate_key /etc/nginx/certs/index.rubygems.org.key;
location / {
proxy_pass http://package-cache:8081/repository/gem-proxy/;
}
}
server {
listen 443 ssl;
server_name repo.packagist.org;
ssl_certificate /etc/nginx/certs/repo.packagist.org.crt;
ssl_certificate_key /etc/nginx/certs/repo.packagist.org.key;
location / {
proxy_pass http://package-cache:8081/repository/raw-packagist/;
}
}
server {
listen 443 ssl;
server_name proxy.golang.org;
ssl_certificate /etc/nginx/certs/proxy.golang.org.crt;
ssl_certificate_key /etc/nginx/certs/proxy.golang.org.key;
location / {
proxy_pass http://package-cache:8081/repository/go-proxy/;
}
}
server {
listen 443 ssl;
server_name dl-cdn.alpinelinux.org;
ssl_certificate /etc/nginx/certs/dl-cdn.alpinelinux.org.crt;
ssl_certificate_key /etc/nginx/certs/dl-cdn.alpinelinux.org.key;
location / {
proxy_pass http://package-cache:8081/repository/raw-alpine/;
}
}
server {
listen 443 ssl;
server_name raw.githubusercontent.com;
ssl_certificate /etc/nginx/certs/raw.githubusercontent.com.crt;
ssl_certificate_key /etc/nginx/certs/raw.githubusercontent.com.key;
location / {
proxy_pass http://package-cache:8081/repository/raw-githubusercontent/;
}
}
server {
listen 443 ssl;
server_name codeload.github.com;
ssl_certificate /etc/nginx/certs/codeload.github.com.crt;
ssl_certificate_key /etc/nginx/certs/codeload.github.com.key;
location / {
proxy_pass http://package-cache:8081/repository/raw-codeload-github/;
}
}