diff --git a/Dockerfile b/Dockerfile index be99eee..f12f3a1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ LABEL maintainer="LanCache.Net Team " ENV GENERICCACHE_VERSION=2 \ CACHE_MODE=monolithic \ WEBUSER=www-data \ - CACHE_MEM_SIZE=500m \ + CACHE_INDEX_SIZE=500m \ CACHE_DISK_SIZE=1000000m \ CACHE_MAX_AGE=3560d \ CACHE_SLICE_SIZE=1m \ diff --git a/overlay/etc/nginx/conf.d/20_proxy_cache_path.conf b/overlay/etc/nginx/conf.d/20_proxy_cache_path.conf index 8b43a8f..d66bdfa 100644 --- a/overlay/etc/nginx/conf.d/20_proxy_cache_path.conf +++ b/overlay/etc/nginx/conf.d/20_proxy_cache_path.conf @@ -1 +1 @@ -proxy_cache_path /data/cache/cache levels=2:2 keys_zone=generic:CACHE_MEM_SIZE inactive=200d 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=200d max_size=CACHE_DISK_SIZE loader_files=1000 loader_sleep=50ms loader_threshold=300ms use_temp_path=off; diff --git a/overlay/hooks/entrypoint-pre.d/00_deprecation.sh b/overlay/hooks/entrypoint-pre.d/00_deprecation.sh index 7ec1347..0587cfa 100644 --- a/overlay/hooks/entrypoint-pre.d/00_deprecation.sh +++ b/overlay/hooks/entrypoint-pre.d/00_deprecation.sh @@ -7,3 +7,9 @@ if [[ ! -z "${CACHE_DOMAIN_REPO}" ]]; then fi +if [[ ! -z "${CACHE_INDEX_SIZE}" ]]; then + echo " *** CACHE_MEM_SIZE has been deprecated in place of CACHE_INDEX_SIZE" + echo " *** Using CACHE_MEM_SIZE as the value" + echo " *** Please update your configuration at your earliest convenience" + CACHE_INDEX_SIZE=$CACHE_MEM_SIZE +fi \ No newline at end of file diff --git a/overlay/hooks/entrypoint-pre.d/10_setup.sh b/overlay/hooks/entrypoint-pre.d/10_setup.sh index 4b112e5..404ca6a 100644 --- a/overlay/hooks/entrypoint-pre.d/10_setup.sh +++ b/overlay/hooks/entrypoint-pre.d/10_setup.sh @@ -1,12 +1,17 @@ #!/bin/sh set -e +# Handle CACHE_MEM_SIZE deprecation +if [[ ! -z "${CACHE_MEM_SIZE}" ]]; then + CACHE_INDEX_SIZE=${CACHE_MEM_SIZE} +fi + # Preprocess UPSTREAM_DNS to allow for multiple resolvers using the same syntax as lancache-dns UPSTREAM_DNS="$(echo -n "${UPSTREAM_DNS}" | sed 's/[;]/ /g')" echo "worker_processes ${NGINX_WORKER_PROCESSES};" > /etc/nginx/workers.conf sed -i "s/^user .*/user ${WEBUSER};/" /etc/nginx/nginx.conf -sed -i "s/CACHE_MEM_SIZE/${CACHE_MEM_SIZE}/" /etc/nginx/conf.d/20_proxy_cache_path.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/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