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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- [Bugfix] Add meilisearch as a dependency on lms-job to avoid meilisearch init job crashing when the platform is stopped. (by @Danyal-Faheem)
2 changes: 1 addition & 1 deletion tutor/templates/local/docker-compose.jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.


cms-job:
image: {{ DOCKER_IMAGE_OPENEDX }}
Expand Down
Loading