-
Notifications
You must be signed in to change notification settings - Fork 739
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
CONTENT_FALLBACK_DIRS option along with cherrypy/devserver support. #6865
CONTENT_FALLBACK_DIRS option along with cherrypy/devserver support. #6865
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validation can be improved - one flag about potential impact on performance.
conf.OPTIONS["Deployment"]["URL_PATH_PREFIX"] | ||
).lstrip("/") | ||
content_dirs = [paths.get_content_dir_path()] + paths.get_content_fallback_paths() | ||
dispatcher = MultiStaticDispatcher(content_dirs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case where the fallback paths are not used, how much overhead does the multistatic dispatcher add compared to how cherrypy normally handles static files?
One way to be conservative about this would be to only use the MultiStaticDispatcher in the case where there are fallback content paths.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's still using the same cherrypy static handlers. The additional code that's executed per file request is:
https://github.com/learningequality/kolibri/pull/6865/files/78ae3149620cc3e98743ca87968e6557529b95c0#diff-601cde52caf17fa9d77c64ca9e73e927R239-R248
In the case of no fallback content paths, this loop will only be executed once, but it does do an extra os.path.exists
call in there, which wouldn't be needed in the "single handler" case. Actually, the simplest way to "handle" that might be to just short-circuit the find_handler
method if there's only one candidate handler anyway.
Should we target this to the |
I took this for a spin locally and the fallback paths are working for me with a fallback path on an external hard drive. The main issue was that even with smaller channels, scanforcontent took a couple minutes to run on a fairly fast machine. @jamalex For cases where we know in advance what content will be in the fallback dir(s), can we extend the preseeded Kolibri trick to run scanforcontent so it can scan in the channels and load them into the Kolibri db beforehand? (I'm assuming the scanforcontent time hit is mostly due to a need to import things from the channel db into a Kolibri installation db?) |
The "click to log in" and password-free changes for Android will be going in If Otherwise we can merge here and have the MrPau team do an integration test pass. In either case, we'll need Gherkin stories for these changes in order for them to test it eventually. |
I appear to have gotten this working, along with porting the preseeded Kolibri stuff to Mac so I can test Kolibri while keeping all the big channels on my external drive. :) Have to say that just loading right into a Kolibri with plenty of content after initial setup is a nice experience. |
For |
We could, in principle. Except I can't imagine too many scenarios where we would know specifically what content would be there at install time. Except for full OS images, and in that case the simplest would be to start Kolibri, stop Kolibri, and then deprovision (with data left in place).
It's hard to say. That's likely to be a decent portion of it (and if the external drive is non-SSD and/or over slower USB, then that could be a bottleneck for the DB reads). The other part would be annotation, if you have a lot of new content available in the fallback dirs. But for that, it shouldn't be much slower than if the content were on your primary disk/content path. Could you time the stages based on log outputs when you run |
Opened a tech debt issue here: |
22a465e
to
dabc4a1
Compare
Codecov Report
|
App support
Summary
For Flatpak-based preloading of Endless content, as well as future SD card-based static content distribution for Android, this PR adds a
CONTENT_FALLBACK_DIRS
option that allows for additional search paths to be specified beyond the standard, primaryCONTENT_DIR
.Content is only downloaded to the primary content location, but a file is found in one of the fallback directories instead, that path will be used by the server, and the file will be considered available.
CONTENT_FALLBACK_DIRS
is a semicolon-separated list of paths. Those paths should each contain subfolders called "storage" and "databases", in the same form as the<KOLIBRI_HOME>/content
directory (or otherCONTENT_DIR
path).Reviewer guidance
Run Kolibri with the environment variable
CONTENT_FALLBACK_DIRS
set to a path (or semi-colon-delimited list of paths) containing Kolibri content. Note that you then need to runkolibri manage scanforcontent
to pick up any new content.Note: will not currently work properly with kolibri-server or behind any of our standard nginx proxy configs, as those have the /static prefix hardcoded to a single lookup path.
TODO
get_channel_ids_for_content_database_dir
and references to it)Contributor Checklist
PR process:
Testing:
Reviewer Checklist
yarn
andpip
)