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

Create separate KOLIBRI_HOME for Endless Key #119

Closed
wants to merge 6 commits into from
Closed

Conversation

jprvita
Copy link
Contributor

@jprvita jprvita commented Sep 6, 2023

We want to be able to ship different content and configuration for
Kolibri and the Endless Key app. This commit adds support for installing
the content and configuration for each app to separate locations, so
they can be used side-by-side.

#117

We want to be able to ship different content and configuration for
Kolibri and the Endless Key app. This commit adds support for installing
the content and configuration for each app to separate locations, so
they can be used side-by-side.

#117
The Endless Key app needs a different set of plugins than traditional
Kolibri.

#117
When downloading Kolibri channels to our cache server, also include
Endless Key channels.

#117
@jprvita jprvita marked this pull request as ready for review September 15, 2023 22:34
@jprvita jprvita linked an issue Sep 15, 2023 that may be closed by this pull request
Partially revert "Create separate KOLIBRI_HOME for Endless Key"

This reverts the changes to hooks/image/62-kolibri-automatic-provision
from commit 35694c0.
Copy link
Contributor

@dylanmccall dylanmccall left a comment

Choose a reason for hiding this comment

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

I have some thoughts here, but I'm not sure how urgently we want to address them.

The one thing I definitely think we should change is we don't need these changes for the image/62-kolibri-automatic-provision hook to support Endless Key. That stuff just happens on its own with the current version of the Endless Key app, and I don't think we'll have images needing it to behave differently.

config/defaults.ini Outdated Show resolved Hide resolved
hooks/image/62-kolibri-automatic-provision Outdated Show resolved Hide resolved
Comment on lines +107 to +109
# FIXME: enabling kolibri-explore-plugin fails because we are using a
# kolibri version that is too old.
#"kolibri_explore_plugin"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is fine. It means Kolibri will need to execute some of extra database migrations on first run, but shouldn't be a problem.

One issue we are going to crash into here is that the Explore plugin provides its own applyexternaltags management command. We use that when importing content from our content collection files, and it's necessary so the Explore plugin knows how to populate the different sections in the Discovery page. Without those tags, the Discovery page is pretty bare.

I think that is going to be a bit of a puzzle to sort out, so I don't know if we want to do it here, but we'll want to do this all a bit differently in the near future. The good news is, I don't think we will need to put a Kolibri database in the image at all any more, so this issue about the Explore plugin and the old Kolibri version will probably be moot. All we need is to fetch the content files, put them somewhere (as in kolibri manage exportcontent), add a JSON file describing what that content is (the exportcontent command generates a content manifest file), and get the app to populate its database (with the correct content in the database and marked available) based on that file.

For Kolibri, that JSON file would be exactly what the exportcontent command generates. For Endless Key, we'd copy our own JSON files from endless-key-collections. Those ones include the information we need about external content tags.

Copy link
Member

Choose a reason for hiding this comment

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

It's certainly a lot simpler to put the content directly in the Kolibri homedir rather than putting it somewhere else on disk and then coming up with a procedure to import it and then maybe delete the massive duplicated data.

When I was previously thinking about this, my understanding was that the content pack would still be picked at runtime. Then the explore plugin would very quickly run through the content downloader since all the content is already available. The last step would to apply the tags per the chosen content pack would still run.

Copy link
Member

Choose a reason for hiding this comment

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

Another way to handle the whole mismatched versions thing is to just figure out the ones the flatpak has:

$ flatpak_site_packages=$(ls -d /var/lib/flatpak/app/org.endlessos.Key/current/active/files/lib/python*/site-packages)
$ PYTHONPATH="$flatpak_site_packages" pip list --format json > flatpak-packages.json 
$ jq -r '.[] | select(.name == "kolibri") | .version' flatpak-packages.json 
0.16.0b5
$ jq -r '.[] | select(.name == "kolibri-explore-plugin") | .version' flatpak-packages.json 
6.47.0

Although for kolibri itself it would currently be awkward because we're install the betas directly from github releases instead of PyPI.

# Preloaded content or the Endless Key app
# The Endless Key app can be pre-loaded with content from the Kolibri channels
# listed in this setting.
install_channels =
Copy link
Contributor

@dylanmccall dylanmccall Sep 18, 2023

Choose a reason for hiding this comment

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

Is it intentional for the moment that we're going to do the old content nodes listed right in the image configuration? Another option here is we could add an install_content_collections option which lists names of collection files from endless-key-collections. The good news about those is Kolibri's importcontent management command already knows how to read them. The bad news is it would involve a whole new hook (and probably a Python script because that management command is a smidge limited at the moment).

Copy link
Member

@dbnicholson dbnicholson left a comment

Choose a reason for hiding this comment

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

Looks like this is getting closer, but I think it's going to need a bit more work.

hooks/image/60-kolibri-content Show resolved Hide resolved
Comment on lines +107 to +109
# FIXME: enabling kolibri-explore-plugin fails because we are using a
# kolibri version that is too old.
#"kolibri_explore_plugin"
Copy link
Member

Choose a reason for hiding this comment

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

Another way to handle the whole mismatched versions thing is to just figure out the ones the flatpak has:

$ flatpak_site_packages=$(ls -d /var/lib/flatpak/app/org.endlessos.Key/current/active/files/lib/python*/site-packages)
$ PYTHONPATH="$flatpak_site_packages" pip list --format json > flatpak-packages.json 
$ jq -r '.[] | select(.name == "kolibri") | .version' flatpak-packages.json 
0.16.0b5
$ jq -r '.[] | select(.name == "kolibri-explore-plugin") | .version' flatpak-packages.json 
6.47.0

Although for kolibri itself it would currently be awkward because we're install the betas directly from github releases instead of PyPI.


PLUGIN_LOCATION=`pip3 show kolibri-explore-plugin | grep Location | awk '{ print $2 }'`
APPS_LOCATION="${PLUGIN_LOCATION}/kolibri_explore_plugin"
COLLECTIONS_LOCATION="${PLUGIN_LOCATION}/kolibri_explore_plugin/static/collections/"
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need to do this. These bundles are only needed at runtime and aren't required if you're just running importchannel/importcontent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But don't we need to put them in place, so they can be found at runtime? Or do they already come with the Flatpak?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense.. I was confused by your earlier comment, but I guess things were not as well defined at that point.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry about that. I was totally wrong on what's needed here. In fact, the whole #117 issue could probably go away since we don't really need to create the homedir at all. What's actually needed is just preseeding content. Let's just keep going, but we may want to retitle the issue.

@jprvita jprvita closed this Sep 26, 2023
@jprvita jprvita deleted the ek-home-dir branch October 2, 2023 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow building an Endless Key home directory
3 participants