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

fix: add meilisearch as a dependency on lms-job #1184

Merged
merged 2 commits into from
Jan 7, 2025

Conversation

Danyal-Faheem
Copy link
Contributor

Running the Meilisearch init job when the platform is stopped would crash as the meilisearch container wouldn't be running and the endpoint could not be hit.

We add a dependency in the lms-job on meilisearch as the meilisearch init job is run inside the lms container.

Running the Meilisearch init job when the platform is stopped would crash as the meilisearch container wouldn't be running and the endpoint could not be hit.

We add a dependency in the lms-job on meilisearch as the meilisearch init job is run inside the lms container.
@@ -29,7 +29,7 @@ services:
{%- for mount in iter_mounts(MOUNTS, "openedx", "lms-job") %}
- {{ mount }}
{%- endfor %}
depends_on: {{ [("mysql", RUN_MYSQL), ("mongodb", RUN_MONGODB)]|list_if }}
depends_on: {{ [("mysql", RUN_MYSQL), ("mongodb", RUN_MONGODB), ("meilisearch", RUN_MEILISEARCH)]|list_if }}
Copy link
Contributor

Choose a reason for hiding this comment

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

I find it weird that we never caught this issue when we were running elasticsearch. What's the error stacktrace? And can you please add a changelog entry?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The error only occurs when running the meilisearch init job as we are trying to connect to the container. We didn't see this with elasticsearch as there was never an init job for elasticsearch.

Here's the stacktrace:

Traceback (most recent call last):
  File "/openedx/venv/lib/python3.11/site-packages/meilisearch/_httprequests.py", line 50, in send_request
    request = http_method(
              ^^^^^^^^^^^^
  File "/openedx/venv/lib/python3.11/site-packages/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/openedx/venv/lib/python3.11/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/openedx/venv/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/openedx/venv/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/openedx/venv/lib/python3.11/site-packages/requests/adapters.py", line 700, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='meilisearch', port=7700): Max retries exceeded with url: /keys/10bfc5f7-963d-4fc5-bfaa-3c30889c3278 (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0xffffadd62650>: Failed to resolve 'meilisearch' ([Errno -2] Name or service not known)"))

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<string>", line 5, in <module>
  File "/openedx/venv/lib/python3.11/site-packages/meilisearch/client.py", line 306, in get_key
    key = self.http.get(f"{self.config.paths.keys}/{key_or_uid}")
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/openedx/venv/lib/python3.11/site-packages/meilisearch/_httprequests.py", line 76, in get
    return self.send_request(requests.get, path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/openedx/venv/lib/python3.11/site-packages/meilisearch/_httprequests.py", line 73, in send_request
    raise MeilisearchCommunicationError(str(err)) from err
meilisearch.errors.MeilisearchCommunicationError: MeilisearchCommunicationError, HTTPConnectionPool(host='meilisearch', port=7700): Max retries exceeded with url: /keys/10bfc5f7-963d-4fc5-bfaa-3c30889c3278 (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0xffffadd62650>: Failed to resolve 'meilisearch' ([Errno -2] Name or service not known)"))

I've added the changelog entry.

Copy link
Contributor

Choose a reason for hiding this comment

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

ES did not have an explicit init job if I remember correctly.

@DawoudSheraz DawoudSheraz requested a review from regisb January 7, 2025 09:08
@regisb regisb merged commit 9841287 into overhangio:release Jan 7, 2025
2 checks passed
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