feat(aiometadata): add optional poster reverse-proxy cache#111
Open
IbbyLabs wants to merge 1 commit into
Open
Conversation
2b59448 to
7a5e0b4
Compare
Add an opt-in poster-cache nginx service to the aiometadata stack that
caches poster images on disk, so repeated requests skip upstream latency
and (with cache warming) serve posters instantly. Serves /health, /stats
and /purge; disk cache lives under ${DOCKER_DATA_DIR}/poster-cache.
It sits behind Authelia with page-specific protection: the /purge and /stats
admin endpoints require two_factor, while image fetches bypass auth so Stremio
can load posters.
- poster-cache service on its own `poster-cache` profile; router carries the
authelia@docker middleware
- poster-cache-nginx.conf, poster-cache-stats.sh and poster-cache-purge-handler.sh
sidecars; the two scripts are committed executable for the nc/stats entrypoint
- Authelia: TEMPLATE_POSTER_CACHE_HOSTNAME in apps/authelia/compose.yaml plus
access_control rules in config/configuration.yml (two_factor on ^/purge$ and
^/stats$, bypass otherwise)
- POSTER_CACHE_HOSTNAME added to root .env and the cloudflare-ddns DOMAINS list
- commented opt-in POSTER_* vars in apps/aiometadata/.env (POSTER_PROXY_PREFIX_URL,
POSTER_WARMUP_URL, POSTER_WARMUP_DELAY_MS, POSTER_WARMUP_CONCURRENCY)
7a5e0b4 to
1fa57d8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the optional poster reverse-proxy cache from AIOMetadata (upstream docs) to the existing
aiometadataapp. Annginx:alpinesidecar caches poster images on disk so repeated requests skip upstream latency; with AIOMetadata's cache warming, posters are served straight from disk. It exposes/health,/stats(cache size + image count) and/purge.Everything lives inside
apps/aiometadata/(part of the same service) and is fully opt-in. It is wired through Authelia with page-specific protection — the same approach the template already uses for Stremio addon hosts:poster-cacheservice on its ownposter-cacheprofile; its Traefik router carries theauthelia@dockermiddleware.apps/authelia/compose.yaml+config/configuration.yml):/purgeand/statsrequire two_factor, every other path (image fetches,/health) is bypass so Stremio can load posters without a login.POSTER_CACHE_HOSTNAMEadded to the root.envand to thecloudflare-ddnsDOMAINSlist.poster-cache-nginx.conf,poster-cache-stats.sh,poster-cache-purge-handler.sh(the two scripts are committed executable — the entrypoint runs them via/stats.sh &andnc -lk -p 9888 -e /purge-handler.sh).POSTER_*addon vars are added commented-out inapps/aiometadata/.env; behaviour is unchanged unless the user opts in.Enabling it
poster-cachetoCOMPOSE_PROFILESin the root.env.POSTER_*vars inapps/aiometadata/.env.docker compose up -d— DDNS publishesposter-cache.${DOMAIN}; Traefik + Authelia pick up the new host automatically.Test plan
Validated locally on a fresh first deploy (wiped data dir):
poster-cache service (
docker compose --profile poster-cache up -d)GET /health→200 okX-Cache-Status: MISS, 2ndHIT, identical 1.46 MB payload; cache persists to${DOCKER_DATA_DIR}/poster-cache(levels=1:2, owned bynginx)/https:/host/…resolves to the same cache entry as/https://host/…GET /stats→ valid JSON, correct byte accounting;GET /purge→ success (exercises thenc -ehandler) and clears the cacheAuthelia integration (full
requiredstack up)requireddeploymentsposter-cache.${DOMAIN}:/purge→ 302 (2FA),/stats→ 302 (2FA),/health→ 200,/https://image…→ 200,/purgexx→ 200 (confirms^/purge$is exact-anchored, so only the real admin endpoints are protected)Config
docker compose configparses underrequired,aiometadata,cloudflare-ddnsandposter-cacheprofiles;poster-cacheis gated toposter-cache/allonlyMore details can be found here
Summary by CodeRabbit
POSTER_CACHE_HOSTNAMEand documented poster reverse-proxy cache routing/warm-up options.allprofile.