|
1 |
| -Meilisearch for Open edX (Tutor Plugin) |
| 1 | +Typesense for Open edX (Tutor Plugin) |
2 | 2 | =======================================
|
3 | 3 |
|
4 |
| -This is a plugin for `Tutor <https://docs.tutor.edly.io>`_ 18 (Open edX "Redwood" release) that provides Meilisearch to the platform, so it can be used as a search engine to power content search. |
5 |
| - |
6 |
| -⭐️ This plugin isn't needed with Tutor 19+ (Open edX Sumac+), as `Meilisearch functionality is now built in <https://github.com/overhangio/tutor/pull/1141>`_. ⭐️ |
| 4 | +This is a plugin for `Tutor <https://docs.tutor.edly.io>`_ 20 (Open edX "Teak" release) that provides Typesense to the platform, so it can be used as a search engine to power content search. |
7 | 5 |
|
8 | 6 | Installation
|
9 | 7 | ------------
|
10 | 8 |
|
11 | 9 | Currently, you need to clone this repo from GitHub then install it into your tutor virtual environment with::
|
12 | 10 |
|
13 |
| - pip install -e ./tutor-contrib-meilisearch |
| 11 | + pip install -e ./tutor-contrib-typesense |
14 | 12 |
|
15 | 13 | Then, to enable this plugin, run::
|
16 | 14 |
|
17 |
| - tutor plugins enable meilisearch |
| 15 | + tutor plugins enable typesense |
18 | 16 |
|
19 | 17 | If you have an already running platform, initialize this plugin with a command like the following::
|
20 | 18 |
|
21 |
| - tutor [local|dev|k8s] do init --limit=meilisearch |
| 19 | + tutor [local|dev|k8s] do init --limit=typesense |
22 | 20 |
|
23 | 21 | Or use ``tutor [local|dev|k8s] launch -I`` to re-launch the platform (takes much longer).
|
24 | 22 |
|
25 | 23 | Configuration
|
26 | 24 | -------------
|
27 | 25 |
|
28 |
| -- ``MEILISEARCH_INDEX_PREFIX`` (default: ``"tutor_"``) |
29 |
| -- ``MEILISEARCH_PUBLIC_HOST`` (default: ``"meilisearch.{{ LMS_HOST }}"``) |
30 |
| -- ``MEILISEARCH_DOCKER_IMAGE`` (default: ``"docker.io/getmeili/meilisearch:v1.8``) |
31 |
| -- ``MEILISEARCH_MASTER_KEY`` The master key. Only required to generate the API key (default: auto-generated). |
32 |
| -- ``MEILISEARCH_API_KEY`` The API key (or tenant key) to use for this Open edX instance (default: auto-generated using the master key). |
| 26 | +- ``TYPESENSE_COLLECTION_PREFIX`` (default: ``"tutor_"``) |
| 27 | +- ``TYPESENSE_PUBLIC_HOST`` (default: ``"typesense.{{ LMS_HOST }}"``) |
| 28 | +- ``TYPESENSE_DOCKER_IMAGE`` (default: ``"docker.io/typesense/typesense:29.0"``) |
| 29 | +- ``TYPESENSE_BOOTSTRAP_API_KEY`` The initial admin API key to use when bootstrapping the Typesense server and to generate an api key for Open edX (default: auto-generated). |
| 30 | +- ``TYPESENSE_API_KEY`` The API key used by Open edX (default: auto-generated). |
33 | 31 |
|
34 | 32 | These values can be modified with ``tutor config save --set PARAM_NAME=VALUE`` commands.
|
35 | 33 |
|
| 34 | +Limitations |
| 35 | +----------- |
| 36 | + |
| 37 | +It's not recommended to run high availability (clustered) Typesense on Kubernetes. See `typesense/typesense#465 <https://github.com/typesense/typesense/issues/465>` and `typesense/typesense#2049 <https://github.com/typesense/typesense/issues/2049>` for more information. |
| 38 | + |
| 39 | +This plugin does not support deploying a clustered Typesense server. |
| 40 | + |
36 | 41 | Upgrading
|
37 | 42 | ---------
|
38 |
| -If you upgrade this plugin or change the ``MEILISEARCH_DOCKER_IMAGE`` setting, you may get a new version of Meilisearch. |
39 |
| -In that case, the ``meilisearch`` Docker service will fail to start because the index format is from an older version. |
40 |
| -For large instances, you can follow the `Meilisearch update procedure <https://www.meilisearch.com/docs/learn/update_and_migration/updating#updating-a-self-hosted-meilisearch-instance>`_ |
41 |
| -(basically, dump the index contents to a file, upgrade it, then restore from the data dump file). For development and |
42 |
| -smaller installations, the easier way is to follow this procedure:: |
| 43 | +If you upgrade this plugin or change the ``TYPESENSE_DOCKER_IMAGE`` setting, you may get a new version of Typesense. |
| 44 | +According to `Typesense docs on updating <https://typesense.org/docs/guide/updating-typesense.html#typesense-self-hosted>`_, |
| 45 | +this upgrade happens automatically, and no manual actions are required. |
43 | 46 |
|
44 |
| - tutor [local|dev] stop meilisearch |
45 |
| - cd "$(tutor config printroot)/data/meilisearch" |
46 |
| - mv data.ms "data.ms.$(date +%Y-%m-%d)" |
47 |
| - tutor config save |
48 |
| - tutor [local|dev] start -d meilisearch |
49 |
| - tutor [local|dev] do init --limit=meilisearch |
| 47 | +DNS records |
| 48 | +----------- |
50 | 49 |
|
51 |
| -TODO |
52 |
| ----- |
| 50 | +For production use, it is assumed that the ``TYPESENSE_PUBLIC_HOST`` DNS record points to your server. |
53 | 51 |
|
54 |
| -Currently, this plugin always deploys a new instance of Meilisearch. It should be modified to support using an existing external instance if desired. |
| 52 | +In development mode, Typesense is available at http://typesense.local.openedx.io:8108. |
55 | 53 |
|
56 |
| -DNS records |
| 54 | +Troubleshooting |
| 55 | +--------------- |
| 56 | + |
| 57 | +TBD |
| 58 | + |
| 59 | +Development |
57 | 60 | -----------
|
58 | 61 |
|
59 |
| -For production use, it is assumed that the ``MEILISEARCH_PUBLIC_HOST`` DNS record points to your server. |
| 62 | +Set up a python virtual environment, then you can install dependencies and run the tests like: |
60 | 63 |
|
61 |
| -In development mode, Meilisearch is available at http://meilisearch.local.edly.io:7700. |
| 64 | + make install |
| 65 | + make test |
62 | 66 |
|
63 |
| -Web UI |
64 |
| ------- |
| 67 | +After making some changes, you can run the auto formatter over the code for consistency: |
65 | 68 |
|
66 |
| -The Meilisearch web UI can be accessed at http(s)://<MEILISEARCH_PUBLIC_HOST>. For development, this is usually http://meilisearch.local.edly.io:7700/ |
| 69 | + make format |
67 | 70 |
|
68 |
| -An API key for accessing the UI can be obtained with:: |
69 | 71 |
|
70 |
| - tutor config printvalue MEILISEARCH_API_KEY |
| 72 | +Open edX integration |
| 73 | +-------------------- |
71 | 74 |
|
72 |
| -Troubleshooting |
73 |
| ---------------- |
| 75 | +This plugin provides the following settings to Open edX components for integration: |
74 | 76 |
|
75 |
| -TBD |
| 77 | +- (common) ``TYPESENSE_ENABLED: bool = True`` - whether the Typesense backend is enabled |
| 78 | +- (common) ``TYPESENSE_COLLECTION_PREFIX: str = "the_configured_collection_prefix"`` - a prefix that the backend should use for all collections (the API key is scoped to this prefix) |
| 79 | +- (cms, lms) ``TYPESENSE_URL: str = "http://typesense:8108"`` - the internal url for accessing the Typesense API |
| 80 | +- (cms, lms) ``TYPESENSE_PUBLIC_URL: str = "http://(depends on TYPESENSE_PUBLIC_HOST)"`` - the public url to the Typesense API (for user searches on the frontend) |
| 81 | +- (cms, lms) ``TYPESENSE_API_KEY: str = "the api key"`` - an api key for the Open edX backend to make updates to Typesense collections |
| 82 | +- (lms) ``MFE_CONFIG["TYPESENSE_ENABLED"]: bool = True`` - for MFE's to know when to use Typesense logic |
76 | 83 |
|
77 | 84 | License
|
78 | 85 | -------
|
79 | 86 |
|
80 |
| -This work is licensed under the terms of the `GNU Affero General Public License (AGPL) <https://github.com/open-craft/tutor-contrib-meilisearch/blob/master/LICENSE.txt>`_. |
| 87 | +This work is licensed under the terms of the `GNU Affero General Public License (AGPL) <https://github.com/open-craft/tutor-contrib-typesense/blob/master/LICENSE.txt>`_. |
0 commit comments