-
Notifications
You must be signed in to change notification settings - Fork 6
Amits 2u/dos 5996 meilisearch #280
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
base: master
Are you sure you want to change the base?
Changes from all commits
0e6f581
9cdb6b9
a14ddd1
70f61f4
815a147
3bea7ca
4a23cfd
ef187ea
c3b3a9d
10c754b
9068f59
708ea2f
7908350
1fdc66b
d8ba338
80dc57a
d723048
8dfefe3
bfba9de
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -217,6 +217,9 @@ EDX_PLATFORM_REVISION: master | |||
| ELASTIC_SEARCH_CONFIG: | ||||
| - host: edx.devstack.elasticsearch710 | ||||
| port: 9200 | ||||
| MEILI_SEARCH_CONFIG: | ||||
| - host: edx.devstack.meilisearch184 | ||||
| port: 7700 | ||||
| use_ssl: false | ||||
|
||||
| use_ssl: false |
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,13 @@ | ||||||||||||||||
| # docker build -f docker/build/meilisearch-devstack/Dockerfile . -t edxops/meilisearch:devstack | ||||||||||||||||
|
|
||||||||||||||||
| FROM getmeili/meilisearch:v1.11.0 | ||||||||||||||||
|
Comment on lines
+1
to
+3
|
||||||||||||||||
| # docker build -f docker/build/meilisearch-devstack/Dockerfile . -t edxops/meilisearch:devstack | |
| FROM getmeili/meilisearch:v1.11.0 | |
| # docker build -f docker/build/meilisearch-devstack/Dockerfile . --build-arg MEILISEARCH_VERSION=1.11.0 -t edxops/meilisearch:devstack | |
| ARG MEILISEARCH_VERSION=1.11.0 | |
| FROM getmeili/meilisearch:v${MEILISEARCH_VERSION} |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,14 @@ | ||||||
| FROM edxops/xenial-common:latest | ||||||
| LABEL maintainer="edxops" | ||||||
|
|
||||||
| # Copy ansible roles/playbooks into container | ||||||
| ADD . /edx/app/edx_ansible/edx_ansible | ||||||
| WORKDIR /edx/app/edx_ansible/edx_ansible/docker/plays | ||||||
|
|
||||||
| # Run ansible playbook for Meilisearch (you need meilisearch.yml role defined) | ||||||
| RUN /edx/app/edx_ansible/venvs/edx_ansible/bin/ansible-playbook meilisearch.yml -c local \ | ||||||
| -i '127.0.0.1,' | ||||||
|
|
||||||
| WORKDIR /etc/meilisearch | ||||||
| CMD service meilisearch start && sleep 5 && tail -f /edx/var/log/meilisearch/meilisearch.log | ||||||
| EXPOSE 7700 7701 | ||||||
|
||||||
| EXPOSE 7700 7701 | |
| EXPOSE 7700 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - hosts: all | ||
| become: True | ||
| roles: | ||
| - common | ||
| - meilisearch |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,4 +42,4 @@ | |
| state: present | ||
| wait_timeout: 60 | ||
| become: False | ||
| when: elb_pre_post | ||
| when: elb_pre_post | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| - hosts: all | ||
| become: true | ||
| vars: | ||
| # By default take instances in and out of the elb(s) they | ||
| # are attached to | ||
| # To skip elb operations use "-e elb_pre_post=false" | ||
| elb_pre_post: true | ||
| # Number of instances to operate on at a time | ||
| serial_count: 1 | ||
| CLUSTER_NAME: "commoncluster" | ||
| MEILI_VERSION: "v1.11.0" # change to desired version | ||
| MEILI_PORT: 7700 | ||
| serial: "{{ serial_count }}" | ||
| pre_tasks: | ||
| - action: ec2_metadata_facts | ||
| when: elb_pre_post | ||
| - debug: | ||
| var: ansible_ec2_instance_id | ||
| when: elb_pre_post | ||
| - name: Instance De-register | ||
| local_action: ec2_elb | ||
| args: | ||
| instance_id: "{{ ansible_ec2_instance_id }}" | ||
| region: us-east-1 | ||
| state: absent | ||
| wait_timeout: 60 | ||
| become: false | ||
| when: elb_pre_post | ||
|
|
||
| roles: | ||
| - common | ||
| - role: aws | ||
| when: COMMON_ENABLE_AWS_ROLE | ||
| - meilisearch # add the roles for meilisearch | ||
|
|
||
| post_tasks: | ||
| - debug: | ||
| var: ansible_ec2_instance_id | ||
| when: elb_pre_post | ||
| - name: Register instance in the elb | ||
| local_action: ec2_elb | ||
| args: | ||
| instance_id: "{{ ansible_ec2_instance_id }}" | ||
| ec2_elbs: "{{ ec2_elbs }}" | ||
| region: us-east-1 | ||
| state: present | ||
| wait_timeout: 60 | ||
| become: false | ||
| when: elb_pre_post |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -240,4 +240,4 @@ | |
| tags: | ||
| - "install" | ||
| - "install:configuration" | ||
| - "logrotate" | ||
| - "logrotate" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -170,6 +170,15 @@ EDXAPP_ELASTIC_SEARCH_CONFIG: | |
| port: "{{ EDXAPP_SEARCH_PORT }}" | ||
| use_ssl: "{{ EDXAPP_SEARCH_USE_SSL }}" | ||
|
|
||
| # list of dictionaries of the format | ||
| # { 'url': 'http://hostname:port', 'api_key': 'masterKey' } | ||
| # https://github.com/meilisearch/meilisearch-python | ||
| EDXAPP_MEILI_SEARCH_CONFIG: | ||
| - host: "{{ EDXAPP_SEARCH_HOST }}" | ||
| port: "{{ EDXAPP_SEARCH_PORT }}" | ||
| use_ssl: "{{ EDXAPP_SEARCH_USE_SSL }}" | ||
| api_key: "{{ EDXAPP_SEARCH_API_KEY }}" | ||
|
Comment on lines
+177
to
+180
|
||
|
|
||
| EDXAPP_SETTINGS: '{{ COMMON_EDXAPP_SETTINGS }}' | ||
|
|
||
| EDXAPP_LMS_ENV: 'lms.envs.{{ EDXAPP_SETTINGS }}' | ||
|
|
@@ -1582,6 +1591,7 @@ generic_env_config: &edxapp_generic_env | |
| user: '{{ edxapp_sandbox_user }}' | ||
| AFFILIATE_COOKIE_NAME: "{{ EDXAPP_AFFILIATE_COOKIE_NAME }}" | ||
| ELASTIC_SEARCH_CONFIG: "{{ EDXAPP_ELASTIC_SEARCH_CONFIG }}" | ||
| MEILI_SEARCH_CONFIG: "{{ EDXAPP_MEILI_SEARCH_CONFIG }}" | ||
| PLATFORM_TWITTER_ACCOUNT: "{{ EDXAPP_PLATFORM_TWITTER_ACCOUNT }}" | ||
| PLATFORM_FACEBOOK_ACCOUNT: "{{ EDXAPP_PLATFORM_FACEBOOK_ACCOUNT }}" | ||
| HELP_TOKENS_BOOKS: "{{ EDXAPP_HELP_TOKENS_BOOKS }}" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| --- | ||
| meilisearch_app_dir: "{{ COMMON_APP_DIR }}/meilisearch" | ||
| meilisearch_data_dir: "{{ COMMON_DATA_DIR }}/meilisearch" | ||
| meilisearch_log_dir: "{{ COMMON_LOG_DIR }}/meilisearch" | ||
| meilisearch_cfg_dir: "{{ COMMON_CFG_DIR }}/meilisearch" | ||
|
|
||
| # Meilisearch doesn’t come from apt repo (like Elasticsearch), | ||
| # we fetch the binary directly from GitHub releases. | ||
| meilisearch_download_url: "https://github.com/meilisearch/meilisearch/releases/download/{{ meilisearch_version }}/meilisearch-linux-amd64" | ||
|
|
||
| meilisearch_user: "meilisearch" | ||
| meilisearch_group: "meilisearch" | ||
|
|
||
| # Defaults for a single server installation. | ||
| MEILISEARCH_CLUSTER_MEMBERS: [] # Not typically needed, but kept for parity | ||
| MEILISEARCH_ENV: "development" | ||
| # Service management | ||
| MEILISEARCH_START_TIMEOUT: "300" | ||
| # Version of Meilisearch to install | ||
| meilisearch_version: "v1.11.0" | ||
|
|
||
| # Network and security settings | ||
| meilisearch_host: "0.0.0.0" | ||
| meilisearch_port: 7700 | ||
| MEILISEARCH_URL: "http://{{ meilisearch_host }}:{{ meilisearch_port }}" | ||
| MEILISEARCH_PUBLIC_URL: "http://{{ meilisearch_host }}:{{ meilisearch_port }}" | ||
|
|
||
| # These are placeholders – actual secrets come from sandbox repo | ||
| MEILISEARCH_MASTER_KEY: "{{ lookup('env', 'MEILISEARCH_MASTER_KEY') | default('changeme', true) }}" | ||
| MEILISEARCH_API_KEY: "{{ lookup('env', 'MEILISEARCH_API_KEY') | default('changeme', true) }}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| --- | ||
| dependencies: | ||
| - common |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| --- | ||
| # meilisearch | ||
| # | ||
| # Dependencies: | ||
| # | ||
| # * common | ||
| # | ||
| # Example play: | ||
| # | ||
| # This role installs and configures the Meilisearch service. | ||
| # It can be used for single-server installs (default). | ||
| # | ||
|
|
||
| - name: create meilisearch group | ||
| group: | ||
| name: "{{ meilisearch_group }}" | ||
| state: present | ||
| tags: | ||
| - install | ||
| - install:base | ||
|
|
||
| - name: create meilisearch user | ||
| user: | ||
| name: "{{ meilisearch_user }}" | ||
| group: "{{ meilisearch_group }}" | ||
| shell: /usr/sbin/nologin | ||
| system: yes | ||
| create_home: no | ||
| tags: | ||
| - install | ||
| - install:base | ||
| - name: create directories | ||
| file: | ||
| path: "{{ item }}" | ||
| state: directory | ||
| owner: "{{ meilisearch_user }}" | ||
| group: "{{ meilisearch_group }}" | ||
| mode: 0755 | ||
| loop: | ||
| - "{{ meilisearch_data_dir }}" | ||
| - "{{ meilisearch_log_dir }}" | ||
| - "{{ meilisearch_cfg_dir }}" | ||
| - "{{ meilisearch_app_dir }}" | ||
| tags: | ||
| - install | ||
| - install:base | ||
|
|
||
| - name: download meilisearch binary | ||
| get_url: | ||
| url: "{{ meilisearch_download_url }}" | ||
| dest: "{{ meilisearch_app_dir }}/meilisearch-linux-amd64" | ||
| mode: '0755' | ||
| register: meilisearch_download | ||
| tags: | ||
| - install | ||
| - install:base | ||
|
|
||
| - name: rename meilisearch binary to meilisearch | ||
| command: mv "{{ meilisearch_app_dir }}/meilisearch-linux-amd64" "{{ meilisearch_app_dir }}/meilisearch" | ||
| args: | ||
| creates: "{{ meilisearch_app_dir }}/meilisearch" | ||
| when: meilisearch_download.changed | ||
| tags: | ||
| - install | ||
| - install:base | ||
|
|
||
| - name: drop the meilisearch config (env file) | ||
| template: | ||
| src: edx/etc/meilisearch/meilisearch.yml.j2 | ||
| dest: "{{ meilisearch_cfg_dir }}/meilisearch" | ||
| mode: 0644 | ||
| tags: | ||
| - install | ||
| - install:configuration | ||
|
|
||
| - name: drop the meilisearch systemd service config | ||
| template: | ||
| src: lib/systemd/system/meilisearch.service.j2 | ||
| dest: "/lib/systemd/system/meilisearch.service" | ||
| mode: 0644 | ||
| tags: | ||
| - install | ||
| - install:configuration | ||
|
|
||
| - name: Ensure meilisearch is enabled and started | ||
| service: | ||
| name: meilisearch | ||
| state: started | ||
| enabled: yes | ||
| tags: | ||
| - manage | ||
| - manage:start | ||
|
|
||
| - name: Restart meilisearch when binary is updated | ||
| service: | ||
| name: meilisearch | ||
| state: restarted | ||
| enabled: yes | ||
| when: meilisearch_download.changed | ||
| tags: | ||
| - manage | ||
| - manage:restart | ||
| - install |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,60 @@ | ||||||
| # {{ ansible_managed }} | ||||||
|
|
||||||
| # ======================== Meilisearch Configuration ========================= | ||||||
| # | ||||||
| # NOTE: Meilisearch comes with safe defaults for most settings. | ||||||
| # Only override what you need for your deployment. | ||||||
| # See official docs: | ||||||
| # https://www.meilisearch.com/docs/learn/configuration/instance_options | ||||||
| # | ||||||
| # This template generates a .env file that Meilisearch will load at startup. | ||||||
|
||||||
| # This template generates a .env file that Meilisearch will load at startup. | |
| # This template generates a 'meilisearch' file that Meilisearch will load at startup. |
Copilot
AI
Nov 17, 2025
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 variable MEILI_HTTP_PORT is set here but the systemd service file uses {{ meilisearch_port }} directly in the ExecStart command. This creates an inconsistency - the port should be consistently sourced from either the environment variable or the Ansible variable, not both. Consider using the environment file variable in the service or removing this environment variable declaration.
| MEILI_HTTP_PORT={{ meilisearch_port | default("7700") }} |
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
MEILI_SEARCH_CONFIGis defined as a list with a single dictionary entry (similar toELASTIC_SEARCH_CONFIG), but it includes ause_sslproperty at line 246 that belongs toELASTIC_SEARCH_CONFIG, notMEILI_SEARCH_CONFIG. The indentation showsuse_ssl: falseis underELASTIC_SEARCH_CONFIG. However, based on the structure,MEILI_SEARCH_CONFIGshould have its own properties includinguse_sslandapi_key. Please verify the YAML structure is correctly indented.