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

feat: add ElasticSearch support in tutor-discovery #89

Conversation

Faraz32123
Copy link
Collaborator

@Faraz32123 Faraz32123 self-assigned this Oct 25, 2024
@@ -0,0 +1 @@
- [Feature] Add `ElasticSearch` support in tutor-discovery as tutor core is shifted to `MeiliSearch`. (by @Faraz32123)

Choose a reason for hiding this comment

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

We can link core PR here and maybe tag this as a breaking change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yup, we can do that.

Copy link
Contributor

Choose a reason for hiding this comment

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

No need to wrap Elasticsearch and Meilisearch in backticks (and there is no capital S)

Comment on lines +19 to +26
{% if DISCOVERY_RUN_ELASTICSEARCH and is_docker_rootless() %}
elasticsearch:
ulimits:
memlock:
# Fixes error setting rlimits for ready process in rootless docker
soft: 0 # zero means "unset" in the memlock context
hard: 0
{% endif %}

Choose a reason for hiding this comment

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

why is this needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

these settings are necessary for elasticsearch i think, when we are running docker in rootless mode to avoid memory issues for elasticsearch.

Comment on lines +23 to +27
DISCOVERY_DOCKER_IMAGE_ELASTICSEARCH = "{{ DISCOVERY_DOCKER_IMAGE_ELASTICSEARCH }}"
DISCOVERY_ELASTICSEARCH_HOST = "{{ DISCOVERY_ELASTICSEARCH_HOST }}"
DISCOVERY_ELASTICSEARCH_PORT = "{{ DISCOVERY_ELASTICSEARCH_PORT }}"
DISCOVERY_ELASTICSEARCH_SCHEME = "{{ DISCOVERY_ELASTICSEARCH_SCHEME }}"
DISCOVERY_ELASTICSEARCH_HEAP_SIZE = "{{ DISCOVERY_ELASTICSEARCH_HEAP_SIZE }}"

Choose a reason for hiding this comment

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

Why are these needed now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As we are running elasticsearch container for/from discovery plugin now, these settings will be need in various patches to run elasticsearch same as it was running through tutor.

Choose a reason for hiding this comment

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

But if the patches were expecting the config with DISCOVERY_ prefix, won't those patches need to an update as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah, these settings are already being used in all patches in this PR with DISCOVERY_ prefix.

Comment on lines 22 to 28
ELASTIC_SEARCH_CONFIG = [{
"host": "{{ DISCOVERY_ELASTICSEARCH_HOST }}",
"port": "{{ DISCOVERY_ELASTICSEARCH_PORT }}",
}]
{% if "{{ DISCOVERY_ELASTICSEARCH_SCHEME }}" == "https" %}":
ELASTIC_SEARCH_CONFIG[0]["use_ssl"] = True
{% endif %}

Choose a reason for hiding this comment

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

Why is this config needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think, these settings can be removed as course-discovery doesn't use this and elasticsearch doesn't have such default settings variable, plus it was previously used in edx-devstack.

@Faraz32123 Faraz32123 force-pushed the feat/enable_elastic_search_for_discovery branch 3 times, most recently from e9a9787 to e6fc6e9 Compare October 30, 2024 13:30
@@ -0,0 +1 @@
{% if DISCOVERY_RUN_ELASTICSEARCH %}setowner 1000 /mounts/elasticsearch{% endif %}

Choose a reason for hiding this comment

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

I am seeing stat: can't stat '/mounts/elasticsearch': No such file or directory error in permissions container. Can you verify this, please?

Copy link

@DawoudSheraz DawoudSheraz left a comment

Choose a reason for hiding this comment

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

Tested locally, the ES container is up and update_index is running. There is just one question on /mounts/elasticsearch running into errors in permissions container.

Copy link
Contributor

@regisb regisb left a comment

Choose a reason for hiding this comment

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

Please add some background information to the README, explaining why we need Elasticsearch. Otherwise, this seems good to go. Great job!

@@ -0,0 +1 @@
- [Feature] Add `ElasticSearch` support in tutor-discovery as tutor core is shifted to `MeiliSearch`. (by @Faraz32123)
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to wrap Elasticsearch and Meilisearch in backticks (and there is no capital S)

@Faraz32123 Faraz32123 force-pushed the feat/enable_elastic_search_for_discovery branch from e6fc6e9 to eddda6f Compare November 1, 2024 15:55
- 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.
@Faraz32123 Faraz32123 force-pushed the feat/enable_elastic_search_for_discovery branch from eddda6f to dd0fd6e Compare November 1, 2024 15:57
@Faraz32123
Copy link
Collaborator Author

Tested locally, the ES container is up and update_index is running. There is just one question on /mounts/elasticsearch running into errors in permissions container.

yeah, permission container had the error for /mounts/elasticsearch. I have resolved that now. Thanks for testing it out at your end :)

@DawoudSheraz DawoudSheraz merged commit 913c37d into overhangio:sumac Nov 1, 2024
Faraz32123 added a commit that referenced this pull request Nov 15, 2024
- 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

3 participants