-
Notifications
You must be signed in to change notification settings - Fork 446
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
feat: replace Elasticsearch by Meilisearch #1141
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.
@regisb This is looking great -- just a couple of minor issues when I used this in my tutor dev env, along with these open PRs:
- feat: add Meilisearch-compatible search engine openedx/edx-search#162
- [sumac] feat: migrate from Ruby to forum v2 Python app tutor-forum#48
- feat: enable meilisearch in the Authoring MFE if enabled via tutor tutor-mfe#228 -- minor change required to MFE_CONFIG
Am deploying a sandbox to test the k8s setup, will report back with any issues there.
./manage.py cms reindex_studio --experimental | ||
./manage.py cms reindex_course --active |
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.
Should gate these too (though not sure about which variable to use to do this?)
./manage.py cms reindex_studio --experimental | |
./manage.py cms reindex_course --active | |
{% if ACTIVATE_MEILISEARCH %} | |
./manage.py cms reindex_studio --experimental | |
./manage.py cms reindex_course --active | |
{% endif %} |
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.
No, I don't think that's right. We assume that meilisearch is running, somewhere. Even if RUN_MEILISEARCH is false, it just means that meilisearch is running on a remote host. So we still need to run the migration commands.
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.
Oh yes, you're correct!
There's an issue with reindex_course --setup
referencing elasticsearch directly (openedx/edx-platform#35743), but that's not Tutor's problem :)
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.
I suggest we run ./manage.py lms shell -c "import search.meilisearch; search.meilisearch.create_indexes()"
in init/lms.sh. What do you think?
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.
Also keep in mind that until we resolve openedx/modular-learning#235 (which is in progress), we should avoid running ./manage.py cms reindex_studio --experimental
on any instances with thousands of courses or more.
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.
As for re-indexing courses, I haven't looked into it but it does sound like we're doing it more than is necessary.
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.
Is there a function that would only create and configure the indexes (without deleting them first), such that we could call this function at every launch? Pretty much like a ./manage.py migrate
command.
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 doesn't exist yet, but we could add that. A --create-only
flag would be trivial.
The edge case is when upgrading to a newer commit/release and the index parameters have changed; in that case, we need to replace the index and the new index will be empty unless we also re-index all the content. This could be done asynchronously though; it also doesn't replace the existing index until the reindexing is complete, so there's no downtime.
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.
I think we do need a lightweight, idempotent index creation command that works in just all cases. This can take different forms: a single python function, a management command, or a set of migrations. If we can get this in Sumac then that's great, if not then we should probably think about it for later releases.
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.
I added a proposal to openedx/modular-learning#235 for a new --init
flag that will achieve this.
39ab257
to
2cbe2f2
Compare
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.
👍 once comments 1 & 2 are addressed.
I tested this by deploying and testing a k8s sandbox configured with openedx/edx-platform#35689 . The sandbox demonstrates a functional meilisearch deployment, with published course content search indexed for students, and draft content for courses + libraries v2 indexed in Authoring MFE for Content Authors. Note that this deployment required fixes from overhangio/tutor-mfe#231 + openedx/edx-platform#35743.
However, I'm unable to create new posts using tutor-forum@v2 (overhangio/tutor-forum#48), so I wasn't able to test this with the new edx-search Meilisearch engine. Happy to leave the sandbox running to test updated versions of tutor-forum@v2 and https://github.com/edly-io/edx-platform.git@edly/forumv.
- I tested this using the sandbox configured by DO NOT MERGE -- testing Meilisearch in tutor core openedx/edx-platform#35689
- I read through the code
-
I checked for accessibility issuesN/A -
Includes documentation-- upgrade documentation will be done as part of a separate PR. -
User-facing strings are extracted for translationN/A
3b5ab26
to
9a99611
Compare
9a99611
to
7e8570b
Compare
Again, thanks for the quick and thorough review Jill. Meilisearch is not supposed to work with forum v2 just yet, this would be pending some work on my side. I'd like to complete this PR before I move on to the integration of meilisearch in forum v2. |
7e8570b
to
032e632
Compare
With this change, we get rid of Elasticsearch across all of Tutor. Instead, we run Meilisearch, which is much more lightweight in terms of memory usage. Obviously, this is a (very) breaking change. Indexing commands will be run during init, such that search should work as before. After the edx-search PR is merged and the dependency is upgraded in edx-platform, we should remove the manual `RUN pip install ...` command.
c996f3b
to
ebc39e3
Compare
- As Tutor and Open edX have shifted to Meilisearch, and course-discovery still depends on Elasticsearch, running the Elasticsearch container with tutor-discovery will facilitate smoother operation for the course-discovery service. - It's related PR from tutor: overhangio/tutor#1141.
- As Tutor and Open edX have shifted to Meilisearch, and course-discovery still depends on Elasticsearch, running the Elasticsearch container with tutor-discovery will facilitate smoother operation for the course-discovery service. - It's related PR from tutor: overhangio/tutor#1141.
- As Tutor and Open edX have shifted to Meilisearch, and course-discovery still depends on Elasticsearch, running the Elasticsearch container with tutor-discovery will facilitate smoother operation for the course-discovery service. - It's related PR from tutor: overhangio/tutor#1141. Co-authored-by: Muhammad Faraz Maqsood <[email protected]>
- As Tutor and Open edX have shifted to Meilisearch, and course-discovery still depends on Elasticsearch, running the Elasticsearch container with tutor-discovery will facilitate smoother operation for the course-discovery service. - It's related PR from tutor: overhangio/tutor#1141. Co-authored-by: Muhammad Faraz Maqsood <[email protected]>
- As Tutor and Open edX have shifted to Meilisearch, and course-discovery still depends on Elasticsearch, running the Elasticsearch container with tutor-discovery will facilitate smoother operation for the course-discovery service. - It's related PR from tutor: overhangio/tutor#1141. Co-authored-by: Muhammad Faraz Maqsood <[email protected]>
With this change, we get rid of Elasticsearch across all of Tutor. Instead, we run Meilisearch, which is much more lightweight in terms of memory usage. Obviously, this is a (very) breaking change. Indexing commands will be run during init, such that search should work as before.
After the edx-search PR is merged and the dependency is upgraded in edx-platform, we should remove the manual
RUN pip install ...
command.