Closed thraxil closed 3 years ago
@OmarIthawi yeah, I wasn't positive how that should work. I think if we need a different key for lms/cms, we should do that in lms/envs/production.py
and cms/envs/production.py
in the edx-platform
code. Eg, we currently have: https://github.com/appsembler/edx-platform/blob/main/cms/envs/production.py#L212-L216
# if 'staticfiles' in CACHES:
# CACHES['staticfiles']['KEY_PREFIX'] = EDX_PLATFORM_REVISION
I think what we want is to put that back in but with a change like:
if 'staticfiles' in CACHES:
CACHES['staticfiles']['KEY_PREFIX'] = CACHES['staticfiles']['KEY_PREFIX'] + "_cms"
And maybe leave the lms one as it is. That way, cms and lms have independent caches, but are otherwise consistent and sharing across servers.
@OmarIthawi yeah, I wasn't positive how that should work. I think if we need a different key for lms/cms, we should do that in
lms/envs/production.py
andcms/envs/production.py
in theedx-platform
code. Eg, we currently have: https://github.com/appsembler/edx-platform/blob/main/cms/envs/production.py#L212-L216# if 'staticfiles' in CACHES: # CACHES['staticfiles']['KEY_PREFIX'] = EDX_PLATFORM_REVISION
I think what we want is to put that back in but with a change like:
if 'staticfiles' in CACHES: CACHES['staticfiles']['KEY_PREFIX'] = CACHES['staticfiles']['KEY_PREFIX'] + "_cms"
And maybe leave the lms one as it is. That way, cms and lms have independent caches, but are otherwise consistent and sharing across servers.
That definitely works! Thanks Anders!
https://github.com/appsembler/edx-platform/pull/920 will be required before merging this.
With the hostname+random number approach, every edxapp server gets a different KEY_PREFIX. Eg, juniper prod currently has:
/edx/etc/lms.yml
on edxapp0 and edxapp1:/edx/etc/studio.yml
on edxapp0 and edxapp1:etc. That means that they are not sharing the cache. So each server has to do the URL generation/lookup for itself the first time it gets the first request for a given static file.
Instead, we should be using the same
KEY_PREFIX
on all the servers, except we want to be very careful that it changes on each deploy so the cache is forced to update when staticfiles may have changed.To do that, https://github.com/appsembler/tahoe_deploy/pull/42 passes in the Cloud Build
BUILD_ID
variable asEDXAPP_APPSEMBLER_BUILD_ID
. That should fit our requirement of being unique per deploy but consistent across servers.