Skip to content

feat: shared ES option for discovery service

Matjaz Gregoric requested to merge mtyaka/SE-5941-course-discover-es-prefix into main

Description

This adds support for shared Elastic Search for the Discovery service by prefixing its ES indexes. It also adds configuration for the Discovery service to be able to connect to the shared ES instance.

Supporting information

I had to change the way connections to the shared ES instance work because I couldn't find any way to patch the discovery Job to add the ES volume with the CA certificate to the job container with kustomize. Passing the CA cert in directly and passing a ssl_context to the ES connection configuration helped work around the problem. I used the same approach with LMS/CMS for consistency.

Testing instructions

First create a new instance that uses shared ES by adding the following configuration to your instance's config.yml:

GROVE_ENABLE_SHARED_ELASTICSEARCH: true
ELASTICSEARCH_HOST: set-via-environment
ELASTICSEARCH_HTTP_AUTH: set-via-environment
ELASTICSEARCH_INDEX_PREFIX: set-via-environment
ELASTICSEARCH_CA_CERT_PEM: set-via-environment

Make sure that the tutor-discovery plugin is enabled by adding it to requirements.txt and to the PLUGINS list in config.yml.

Alternatively you can use the existing "mtyaka" instance in the grove-stage-digitalocean cluster.

With your test instance set up:

  1. Log into the LMS and verify that creating a new post on forums works, and that you can find it using the search function.
  2. Log into the CMS and verify that the "Reindex course" button works.
  3. Log into the discovery pod and run this management command: ./manage.py update_index --disable-change-limit
  4. Verify that the above command runs successfully and that all index names it prints are prefixed with a unique prefix.

Dependencies

Checklist

If any of the items below is not applicable, do not remove them, but put a check in it.

  • Git commit history is clean
  • Git commits are following conventional-commit practices
  • Unit tests are added/updated
  • Documentation is added/updated
Edited by Matjaz Gregoric

Merge request reports