Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renamed cache_mem_size to cache_index_size #103

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ MAINTAINER LanCache.Net Team <[email protected]>
ENV GENERICCACHE_VERSION=2 \
WEBUSER=www-data \
CACHE_MODE=generic \
CACHE_MEM_SIZE=500m \
CACHE_INDEX_SIZE=500m \
CACHE_DISK_SIZE=1000000m \
CACHE_MAX_AGE=3560d \
CACHE_SLICE_SIZE=1m \
Expand Down
2 changes: 1 addition & 1 deletion overlay/etc/nginx/conf.d/20_proxy_cache_path.conf
Original file line number Diff line number Diff line change
@@ -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;
Crabbey marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 8 additions & 1 deletion overlay/hooks/entrypoint-pre.d/10_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ set -e
# Preprocess UPSTREAM_DNS to allow for multiple resolvers using the same syntax as lancache-dns
UPSTREAM_DNS="$(echo -n "${UPSTREAM_DNS}" | sed 's/[;]/ /g')"

if [ ! -z ${CACHE_MEM_SIZE} ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per monolithic this should be done in a deprecation file so all the checks happen in the same place (I'd perhaps suggest 00_generic_deprecation.sh to avoid naming clashes)

https://github.com/lancachenet/monolithic/blob/master/overlay/hooks/entrypoint-pre.d/00_deprecation.sh

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment it can probably just warning rather than error, then EXPORT CACHE_INDEX_SIZE up to the controlling shell?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure you can export a variable from one script to the parent shell - unless this is a magic bit of supervisord functionality?
Could move the warning out to a separate script, and leave the action in place?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kinda forgot about this!

I think the best option with fresh eyes is to do the transfer here so it can be used in the script, and then put the warning message into deprecation.sh but without the abort so it will stilll continue for the moment.

We would also need to update the website and docker-compose (I don't think we have PR's waiting for those do we?

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

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/generic.conf.d/root/20_cache.conf
sed -i "s/slice 1m;/slice ${CACHE_SLICE_SIZE};/" /etc/nginx/sites-available/generic.conf.d/root/20_cache.conf
Expand Down