diff --git a/web/README.md b/web/README.md index 9a8cbbf..7d8d991 100644 --- a/web/README.md +++ b/web/README.md @@ -78,6 +78,9 @@ change them unless you know what you want. you must specify any social login provider in `INSTALLED_APPS` instead. See [settings.py][1] for implementation details. +- `DISKCACHE_PATH` and `DISKCACHE_SIZE`: Django Diskcache location path and + size respectively. Defaults are `/opt/mailman-web-data/diskcache` and 1G. + [1]: https://github.com/maxking/docker-mailman/blob/master/web/mailman-web/settings.py Running diff --git a/web/docker-entrypoint.sh b/web/docker-entrypoint.sh index e2cd561..a02691c 100755 --- a/web/docker-entrypoint.sh +++ b/web/docker-entrypoint.sh @@ -158,4 +158,6 @@ fi # directory for it. Also chown the logs directory to write the files. chown mailman:mailman /opt/mailman-web-data -R +[[ -v DISKCACHE_PATH ]] && chown mailman:mailman "${DISKCACHE_PATH}" -R + exec $@ diff --git a/web/mailman-web/settings.py b/web/mailman-web/settings.py index 8c3aba6..84afc49 100644 --- a/web/mailman-web/settings.py +++ b/web/mailman-web/settings.py @@ -391,12 +391,15 @@ Q_CLUSTER = { POSTORIUS_TEMPLATE_BASE_URL = os.environ.get('POSTORIUS_TEMPLATE_BASE_URL', 'http://mailman-web:8000') +DISKCACHE_PATH = os.environ.get('DISKCACHE_PATH', '/opt/mailman-web-data/diskcache') +DISKCACHE_SIZE = os.environ.get('DISKCACHE_SIZE', 2 ** 30) # 1 gigabyte + CACHES = { 'default': { 'BACKEND': 'diskcache.DjangoCache', - 'LOCATION': '/opt/mailman-web-data/diskcache', + 'LOCATION': DISKCACHE_PATH, 'OPTIONS': { - 'size_limit': 2 ** 30 # 1 gigabyte + 'size_limit': DISKCACHE_SIZE, }, }, }