Adding support for the new min_free parameter, so that nginx will automatically prune files once the minimum free space has been exceeded.

This commit is contained in:
Tim Pilius 2024-05-06 16:19:25 -04:00
parent 8392ba6613
commit fcba4f8056
3 changed files with 4 additions and 2 deletions

View file

@ -11,6 +11,7 @@ ENV GENERICCACHE_VERSION=2 \
WEBUSER=www-data \
CACHE_INDEX_SIZE=500m \
CACHE_DISK_SIZE=1000g \
MIN_FREE_DISK=100g \
CACHE_MAX_AGE=3560d \
CACHE_SLICE_SIZE=1m \
UPSTREAM_DNS="8.8.8.8 8.8.4.4" \

View file

@ -1 +1 @@
proxy_cache_path /data/cache/cache levels=2:2 keys_zone=generic:CACHE_INDEX_SIZE inactive=CACHE_MAX_AGE max_size=CACHE_DISK_SIZE loader_files=1000 loader_sleep=50ms loader_threshold=300ms use_temp_path=off;
proxy_cache_path /data/cache/cache levels=2:2 keys_zone=generic:CACHE_INDEX_SIZE inactive=CACHE_MAX_AGE max_size=CACHE_DISK_SIZE min_free=MIN_FREE_DISK loader_files=1000 loader_sleep=50ms loader_threshold=300ms use_temp_path=off;

View file

@ -13,6 +13,7 @@ echo "worker_processes ${NGINX_WORKER_PROCESSES};" > /etc/nginx/workers.conf
sed -i "s/^user .*/user ${WEBUSER};/" /etc/nginx/nginx.conf
sed -i "s/CACHE_INDEX_SIZE/${CACHE_INDEX_SIZE}/" /etc/nginx/conf.d/20_proxy_cache_path.conf
sed -i "s/CACHE_DISK_SIZE/${CACHE_DISK_SIZE}/" /etc/nginx/conf.d/20_proxy_cache_path.conf
sed -i "s/MIN_FREE_DISK/${MIN_FREE_DISK}/" /etc/nginx/conf.d/20_proxy_cache_path.conf
sed -i "s/CACHE_MAX_AGE/${CACHE_MAX_AGE}/" /etc/nginx/conf.d/20_proxy_cache_path.conf
sed -i "s/CACHE_MAX_AGE/${CACHE_MAX_AGE}/" /etc/nginx/sites-available/cache.conf.d/root/20_cache.conf
sed -i "s/slice 1m;/slice ${CACHE_SLICE_SIZE};/" /etc/nginx/sites-available/cache.conf.d/root/20_cache.conf