-
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
fix: add meilisearch as a dependency on lms-job #1184
fix: add meilisearch as a dependency on lms-job #1184
Conversation
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 }} |
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 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?
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.
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.
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.
ES did not have an explicit init job if I remember correctly.
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.